#clojure log - Mar 19 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:00 ddellacosta: noprompt: okay

0:01 noprompt: sorry to keep you waiting. So yeah, one of things I think would be useful would be to have a lookup function or functions for routes

0:07 $seen seangrove

0:07 lazybot: seangrove was last seen quitting 4 hours and 50 minutes ago.

0:08 ddellacosta: hmm, how do I send messages to folks?

0:08 amalloy: $help mail

0:08 lazybot: amalloy: Send somebody a message. Takes a nickname and a message to send. Will alert the person with a notice.

0:08 ddellacosta: amalloy: thanks

0:09 noprompt: ddellacosta: i think by having IRouteValue and adding the "raw" route as a third element in the vector is good enough for now w/o breaking the current API

0:10 ddellacosta: noprompt: okay, gotcha--so, basically, leave the locate-route modifications roughly as is, but move the route-spec fn to its own IRouteValue protocol? Seems reasonable

0:29 noprompt: wondering what I should call the function that returns the actual route value...I have "route-spec" now, but maybe something like "get-original" or "original-route" or..."route-value?"

0:29 noprompt: ddellacosta: right.

0:29 ddellacosta: noprompt: the one inside the IRouteValue protocol I mean

0:30 noprompt: (defprotocol IRouteValue (route-value [route] "Return the original route value"))

0:32 ddellacosta: basically, i'm trying to make sure we avoid adding too much functionality at one.

0:32 ddellacosta: if that's enough to help you solve your problem while not assuming too much i think that's good.

0:33 ddellacosta: by creating a separate protocol and returning the "raw" route it's a win for now and the future.

0:33 ddellacosta: noprompt: absolutely, and I definitely am on the same page with that--my goal with this is to "disturb" the codebase as little as possible.

0:33 noprompt: alright, will make those modifications and push

0:33 noprompt: ddellacosta: lol did you see the shit i pushed yesterday?!

0:33 ddellacosta: noprompt: no, which? Will check it out

0:33 noprompt: ddellacosta: i added like 100 lines just so we could serialize/deserialize vectors/maps etc. for query strings.

0:34 lol, it doesn't break anything and no one will notice but it's there.

0:34 dissipate: noprompt, what is there?

0:35 ddellacosta: noprompt: oh, yeah, I did see that now that you mentioned it. Nice stuff. :-)

0:35 dissipate: ^

0:36 noprompt: ddellacosta: somehow we've ended up in this space where query params turns out to be useful.

0:37 ddellacosta: noprompt: you know, it's interesting how the use-cases shift when you are doing client-side routing actually. Although maybe you weren't being tongue-in-cheek...

0:38 noprompt: ddellacosta: it's a weird nasty place.

0:38 ddellacosta: noprompt: hahaha

0:38 noprompt: the client sucks. but it's getting better all the time.

0:38 ddellacosta: noprompt: "the client..." web clients in general?

0:39 noprompt: ddellacosta: i just meant the front end. it's a mixed bag.

0:39 ddellacosta: noprompt: definitely agreed on both counts if that's what you mean.

0:39 noprompt: yeah. Absolutely. But having done this since around 1998 I can say definitively we are both better off and worse off, depending on how you look at it.

0:40 noprompt: ddellacosta: considering that we might've had a chance at scheme i really don't know.

0:40 ddellacosta: noprompt: there are things you can do now that were inconceivable ten years ago. And the compatibility story has gotten a *lot* better, all my complaints about IE aside. However, the amount of complexity involved is astounding, when you take web development as a whole.

0:41 noprompt: you mean, as opposed to what JS turned out to be?

0:41 noprompt: ddellacosta: well, legend has it, that javascript was supposed to be a scheme like language but netscape changed it at the last minute.

0:42 dissipate: noprompt, and we have been stuck with it ever since. :(

0:42 noprompt: you know, because java.

0:42 danielszmulewicz: Has Datomic memory requirements changed? I'm trying to upgrade to the latest version (0.9.4609), but I get an out of memory error. I have 1GB of memory on my VPS where datomic (0.8.something) worked flawlessly.

0:42 ddellacosta: noprompt: right, I remember that B. Eich was big into scheme, wasn't he...and Self?

0:42 noprompt: well, good thing he was able to include at least some parts of it, conceptually

0:43 dissipate: ddellacosta, yes, and a guy named Douglas Crockford tried to convince us that there are actually 'good' parts of javascript

0:43 ddellacosta: dissipate: well, when you have to use a language, there have to be ways to cope

0:43 noprompt: ddellacosta: from what i've read. i've never met the man though. he could be a serial rapist serving time in prison and a robotic stunt double programmed to speak/write/tweet on his behalf is filling his role as a human until his release.

0:44 dissipate: yeah but he gave us the term "dog balls" (function () {}()) <-- dog balls

0:44 dissipate: ddellacosta, and there in lies the problem. javascript should have never existed. it should all be byte code, and no i am not talking about the JVM

0:45 ddellacosta: hahaha

0:45 you guys

0:45 noprompt: dissipate: yes and it would have been "cool" if money never existed to create classes and social problems but hey, what can you do?

0:45 dissipate: noprompt, that's hawt. :O

0:46 noprompt: lol

0:46 dissipate: noprompt, well, i suppose the USSR tried that. but even they still had money.

0:47 noprompt: ddellacosta: i've only been programming for around 4.5 years so i can't speak to the horrors prior to my arrival on the scene.

0:47 css is pretty horrible i'll say that.

0:47 ddellacosta: noprompt: I remember Netscape 4

0:47 noprompt: and DHTML

0:47 noprompt: I barely escaped with my life

0:47 noprompt: i remember it too, but probably not the way others did.

0:48 dissipate: noprompt, the horrors continue

0:49 * ddellacosta sobs from a Netscape/IE4 flashback

0:50 noprompt: ddellacosta: one day i'm gonna have enough money saved up to go to japan. :-/

0:51 ddellacosta: noprompt: well, if I'm here you can crash at my place. :-)

0:51 noprompt: ddellacosta: i *really* wanna shop for vinyl therer. ;_; it's too much on ebay.

0:51 ddellacosta: noprompt: oh, seriously, the Japanese are nuts about that stuff

0:51 noprompt: like in an awesome/scaryw ay

0:51 noprompt: ddellacosta: those guys sell me a record for like 20 bux in yen and then it get's here with a price tag in yen for half the price.

0:51 ddellacosta: *scary way

0:52 noprompt: ddellacosta: there's so much good 60s/70s pop from japan.

0:52 <3 it

0:52 dissipate: how is the clojure scene in japan?

0:53 noprompt: i only open iterm to spawn another instance of emacs

0:59 ddellacosta: dissipate: not much of one

1:00 dissipate: ddellacosta, well, i guess japan has bigger problems than programming languages. their entire race is pretty much dying out.

1:00 jph-: dissipate, slow population growth, not dying out

1:00 * jph- <3 japan

1:01 dissipate: jph-, slow as in negative?

1:01 noprompt: "race" lol

1:01 jph-: dissipate, im not sure what the latest figures are, but it could be in negatives atm

1:01 dissipate: jph-, it is indeed negative

1:02 ddellacosta: noprompt: I'm a bit confused as to how to do this, as the only place I can get ahold of the original route is in compile-route

1:25 jph-: im looking at some clojure 1.4.0 code

1:25 and i see (defn somefunc [_] ...)

1:26 what does _ mean? or has that been superceded since 1.4?

1:28 SegFaultAX: jph-: If that's exactly what was written, it's probably just a placeholder for the arg list.

1:29 Or rather, the parameter list.

1:29 jph-: so like

1:29 (defn f [& args] ...) equivalent?

1:29 this is the exact line: (defn get-iso [c _] (:iso-code c))

1:30 SegFaultAX: No. [& args] is variadic (it collects all unbound args into a single list)

1:30 jph-: i've not encountered _ before so i'm not sure how it's used

1:30 SegFaultAX: So [a b c & rest] binds the first three arguments to parameters a b and c, then everything after that to args.

1:31 _ isn't meaningful in any way, it's universally used as the "I don't care about this value" name.

1:31 jph-: oh

1:31 got it

1:31 devnull of parameteres

1:32 SegFaultAX: If you saw a function whose parameter list was literally [_], that makes no sense at all.

1:32 jph-: yep

1:32 itd be (fn [] ...)

1:32 SegFaultAX: Right. And the fn would be side-effecting.

1:33 jph-: just not sure what has changed between clojure 1.4 and 1.5

1:33 whether stuff i've looked at is deprecated or not

1:56 amalloy: SegFaultAX: why would a function whose parameter list is [_] make no sense?

1:56 it's perfectly reasonable to write something like (defn always-3 [_] 3) for passing to map

1:56 like, of course you can use constantly, but defining a named function is fine too

1:56 SegFaultAX: Maybe if constantly didn't exist.

1:57 Well ok, it makes sense in a very limited context I suppose.

2:00 amalloy: Are you saying it's common to have functions that take a single argument which is never actually used?

2:00 amalloy: no, i would expect it to be more common to use constantly. but to say that it doesn't make sense at all? that's very different from uncommon

2:02 SegFaultAX: I mean a nullary function that is purely side-effecting is fairly common. But a unary function that never references its argument?

2:06 xuser: I have seen (let [x (fn) _ (println x) x (some other fn)]...

2:07 SegFaultAX: Well that's strange, why put it in the let at all? Let forms have implicit do-blocks.

2:07 Oh rebinding it, yea.

2:16 amalloy: SegFaultAX: it's a unary function because it's being passed to something else that expects a unary function

2:16 you wouldn't define it that way if you never passed it around

2:17 xuser: amalloy: how long have you being doing clojure?

2:17 amalloy: for like...4 years?

2:17 ish

2:19 xuser: old school ;)

3:09 seangrove: ,(let [x (atom {}) y (atom {})] (swap! x assoc :y y))

3:09 clojurebot: {:y #<Atom@118712b: {}>}

3:09 seangrove: ,(let [x (atom {}) y (atom {})] (swap! x assoc :y y) (swap! y assoc :x x)

3:09 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

3:09 seangrove: ,(let [x (atom {}) y (atom {})] (swap! x assoc :y y) (swap! y assoc :x x))

3:09 clojurebot: {:x #<Atom@135371: {:y #<Atom@cb3966: {:x #<Atom@135371: {:y #<Atom@cb3966: {:x #<Atom@135371: #>}>}>}>}>}

3:10 seangrove: I feel like I pulled a hiredman

3:10 petehunt: what did i just see

3:11 my emoticons are confusing me :P sec

3:11 seangrove: Heh, x => y => x => y...

3:12 also...

3:12 petehunt: so it worked

3:12 or are they pointing to the wrong versions of x and y

3:12 seangrove: ,(let [a [(atom nil)]] (reset! (first a) a))

3:12 petehunt: or am i not making any sense

3:12 clojurebot: [#<Atom@45d316: [#<Atom@45d316: [#<Atom@45d316: [#<Atom@45d316: [#<Atom@45d316: #>]>]>]>]>]

3:13 seangrove: Seems like clojure allows it, it just sensibly stops printing the structure after a bit

3:13 Hadn't really come across this before

3:14 petehunt: seangrove: so how would you model a mutual friendship in an om app

3:14 what would your state atom look like

3:15 seangrove: {:users [{:id :pete :name "Sam"}{:id :aaron :name "Aarom}] :friendships [[:pete :aaron]]} ?

3:16 woops, [[:sam :aaron]]

3:17 petehunt: so you would refer to them by id

3:17 seangrove: Or if I needed fast lookups {:users [{:id :sam :name "Sam" :friends [:aaron]}{:id :aaron :name "Aarom} :friends [:sam] :friendships [[:sam :aaron]]}

3:17 petehunt: got it

3:17 seangrove: Yeah, I think so

3:17 Just guessing off the top of my head though, and it's way past my bedtime

3:18 I'm off, best of luck out there ;)

3:50 sm0ke: when i do a lein with-profiles repl, i get 'nrepl not in classpath' error?

3:50 why is that?

3:51 lein with-profiles myprofile repl

3:59 +myprofile

4:50 borkdude: Is there a way to get all possible keyword paths from a nested map (as in json-like thing), like: {:a {:b "d" :c "f"} :b nil} -> [[:a :b] [:a :c] [:b]] ?

5:11 szymanowski: hello, is there a way to add a keyval to an array-map and be sure that it doesn't become a hash-map?

5:17 mpenet: szymanowski: I don't think so. You can always use a LinkedHashMap instead if that's absolutely necessary

5:18 szymanowski: thank you, i don't know LinkedHashMap, i will look at it

5:18 clgv: szymanowski: no. it will automatically change if a certain threshold is reached

5:19 szymanowski: you can use a sorted-map though if you require a certain order defined by a comparison predicate

5:21 szymanowski: yes i've tried with sorted-map but it doesn't really fit my needs very well, maybe https://github.com/amalloy/ordered

5:21 clgv: szymanowski: ah you want to have insertion order

5:21 szymanowski: yes

5:21 clgv: well then go ahead and use amalloy's lib

5:22 szymanowski: yes it looks nice

5:33 jph-: and the penny drops for defrecord/defprotocol

5:33 this stuff is sweet

5:43 mskoud: Trying to use eval (know its evil) using a ring webserver. When run in the repl it ok and in the correct namespace, but when run through webserver the eval evaluates in the clojure.core namespace. How do i avoid that?

5:47 clgv: mskoud: despite you probably dont want to hear this. you are very likely doing something wrong by using "eval"

5:48 mskoud: you can fix it if you put an "(in-ns 'my.desired.target.ns)" in the code you pass to `eval`

5:48 hyPiRion: yeah, a `(do (in-ns 'my-ns) ~body) should work

5:49 clgv: mskoud: could you please report here when that part of the code backfired at you? ;)

5:50 mskoud: im trying to interpolate a string which can contain sexprs

5:51 clgv: must be a huge advantage compared to templating otherwise I'd use the latter

5:52 rstandy: what libraries do people use to implement authentication in clojure web applications?

5:53 hyPiRion: friend

5:54 jph-: rstandy, im just using noir session

5:55 rstandy: hyperboreean, jph-: thanks

5:55 will check that

5:56 jph-: does noire already manage authentication then?

5:56 noir, I mean

5:56 jph-: if you look at a basic luminus template (lein new luminus blah +site) it does the utmost basics

5:56 rstandy: jph-: ah ok

5:56 jph-: the session stuff is relatively mature

5:57 but it's up to you to do the registration and login verification

5:57 you could drop in various hashing algorithms, or maybe something fancier

5:57 rstandy: jph-: ok, got it

5:58 I would like to use something to extends for implementing authentication over LDAP or via oauth

5:58 clgv: rstandy: I used "friend"

5:58 jph-: i'd start with friend if you need something more full-featured

5:58 rstandy: clgv, hyPiRion: do you use it in production?

5:58 clgv: rstandy: for webform-based authentication it did not need much customization to get it running

5:59 hyPiRion: rstandy: no, not in production.

5:59 Well, unless you mean my private websites-production.

5:59 rstandy: hyperboreean: ok, thanks

5:59 clgv: rstandy: since I am working at a university "use in production" likely does not have the same meaning as for you. but yeah, it is in production

6:00 rstandy: clgv: do you have a certain number of people using it daily?

6:01 clgv: is the login page accessibile from the web? Just to see an real example of friend auth

6:01 clgv: rstandy: since it is no classical website. no. 2-3 people use it when the application is running

6:02 rstandy: clgv: ok, thanks for the info

6:03 oh, nice, there is a friend-demo at herokuapp.com

6:04 will try it

6:04 clgv: yeah right, there are demos for several authentication workflows

6:06 rstandy: clgv: really interesting library, from a very smart guy, I see (cemerick)

6:09 clgv: rstandy: yeah. though some people complained in IRC that it would be to complicated to get started with it. but I do not agree with that

6:20 rstandy: clgv: will definitely take a look at friend (which is also intriguing for its clever name)

6:24 myguidingstar: hi all, is there any way to call a function from project's dev dependencies from a leiningen plugin?

6:25 xsyn: myguidingstar: look at https://github.com/zcaudate/vinyasa

6:26 or you can use the full path

6:26 myguidingstar: let's see

6:26 xsyn: http.async.client/function

6:26 as an example

6:34 mskoud: clgv: works in repl (eval `(do (clojure.core/in-ns 'cms.core) (+ 1 3))) but returns "java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set" when run through ring server.

7:04 honza: does anyone have a post with how to set up piggieback + vim-fireplace with the clojurescript repl?

7:14 clgv: mskoud: (binding [*ns* 'cms.core] ...) could be an alternative

7:15 mskoud: but you see that you are already shooting yourself in the foot, right?

7:16 jph-: how do i case the class of a var? (case (class var) java.math.BigDecimal "yay!" "nope") doesnt seem to work

7:17 clgv: jph-: you cant literally with case

7:17 jph-: what's the right way to do it?

7:18 clgv: jph-: it is the same issue as with static constants

7:18 jph-: i know i can do (instance? ...)

7:18 but that's not case

7:18 clgv: jph-: yeah, (cond (instance? java.math.BigDecimal v) ...)

7:18 jph-: oh yeh i'd forgotten about cond

7:19 clgv: jph-: you could also use the helper macro that was suggested for static constants ( I think that was on the mailing list lately)

7:21 jph-: depending on whether that dispatch happens in a hotspot you might want the case behaviour instead of cond which expands to nested ifs

7:43 mskoud: clgv: yes maybe. trying to make some content able to pull info from some data in the code.

8:28 voldyman: whats the best method of getting xml data from a url?

8:29 jcromartie: depends on a lot of factors

8:29 voldyman: tried slurp but it converts '<' to &lt; etc.

8:29 jcromartie: slurp does not do that

8:29 voldyman: it does for me.

8:29 jcromartie: ,(slurp "http://www.w3schools.com/xml/note.xml")

8:29 clojurebot: #<SecurityException java.lang.SecurityException: denied>

8:30 jcromartie: well anyway

8:30 it doesn't

8:30 voldyman: jcromartie: you are right, only half of the tags are escaped

8:30 jcromartie: can you share the URL to the XML document?

8:31 voldyman: https://itunes.apple.com/us/rss/topsongs/limit=10/explicit=true/xml

8:32 oh fish, solved the problem, i think

8:34 (clojure.data.xml/parse "<a><b>a</b><b>c</b></a>")

8:34 ,(clojure.data.xml/parse "<a><b>a</b><b>c</b></a>")

8:34 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.data.xml>

8:36 voldyman: error in clojure.data.xml/parse https://www.refheap.com/61821

8:41 hyPiRion: ,(require 'clojure.data.xml)

8:41 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/data/xml__init.class or clojure/data/xml.clj on classpath: >

8:50 jstew: I think that clojurebot doesn't like it because it's an external lib

8:51 hyPiRion: yeah

8:51 not bundled with vanilla clojure

10:10 Bronsa: ,(defrecord x [a])

10:10 clojurebot: sandbox.x

10:10 Bronsa: ,(x. 1 nil {:a 2})

10:10 clojurebot: #sandbox.x{:a 1, :a 2}

10:10 Bronsa: voila`

10:11 jcromartie: What do most of y'all use for blogging platforms? Is Tumblr ever a good choice for code-related blogs? I don't see many technical posts there.

10:12 I should probably host it myself :) I have no excuse

10:12 edbond: jcromartie, I vote for github pages

10:12 jcromartie: edbond: yeah, not a bad idea

10:14 rockin'

10:19 jstew: Tumblr would be awesome for a tech related blog. Make animated gifs of nrepl.

11:04 luxbock: I have two protocols that implement largely the same functionality

11:04 at first I wrote them as normal functions for both cases, but then I decided a protocol would simplify things

11:04 but now I'm wondering how I should organize my namespace around this new change

11:05 err. I have just one protocol that is implemented by two different records I should say

11:06 is it standard practice to throw all of that stuff in a separate my-proj.impl.X namespace and then just build an outward facing API from those bits later?

11:07 mpenet: luxbock: it's not unusual yes

11:07 luxbock: alright, guess that's what I'll do then

11:07 glad I found clj-refactor.el

11:17 shep-werk: luxbock: thanks for mentioning that, now I'm going to use it :-)

11:36 jcromartie: let's say I want to do x y and z

11:36 and I want to stop and return the first case where some pred returns a truthy value for any of those

11:36 I say "do" because these are side-effecty functions

11:37 they all return a map of either {:success …} or {:error ...}

11:37 condp?

11:37 no

11:40 dnolen_: (some #(%) [x y z])

11:40 jcromartie: ah ha, yes, and wrap up the side effects in fns

11:40 thanks

11:41 except I really want first filter

11:41 but yes

11:42 I was *about* to write a macro :)

11:42 like, filter-forms

11:45 cemerick: hyPiRion: are you using double-check post-test.check-merge, or an older SNAPSHOT?

11:48 jcromartie: dnolen_: how stupid is this? https://gist.github.com/anonymous/9644556

11:50 dnolen_: jcromartie: I don't really have an opinion, looks fine if that's what you want to do

11:52 jcromartie: though if I think about it not sure why you can't just use `or`

11:52 jcromartie: good call

11:59 dsay: using shoreleave http-rpc for remote call. response is returned.

11:59 perform reset! in callback function on a defined atom but when use atom it doesn’t have new value. what need to do to set var with remote response?

12:01 clgv: I have a seldom event S and very frequent events F that operate on a reference. it seems that the transaction of S never succeed while F events are running. after I stop the F events another event S succeeds. how can I fix that?

12:02 augustl: so, I extracted jdk8 to a folder. How can I make "lein" use it? Tried setting JAVA_HOME to $HOME/local/jdk1.8.0 to no avail.

12:03 clgv: augustl: linux/unix?

12:03 augustl: just found LEIN_JAVA_CMD :)

12:03 clgv: yeah

12:03 clgv: augustl: google for jdk and "update-alternatives"

12:03 augustl: if you want to use it for more then just one try

12:05 shep-werk: clgv: As a Gentoo user, I feel I should be indignant :-)

12:05 rasmusto: gentoo -O3 erryday

12:05 augustl: clgv: I don't want to change my system java :)

12:05 LEIN_JAVA_CMD=$HOME/local/jdk1.8.0/bin/java seems to have worked

12:05 shep-werk: rasmusto: oh, are we going to get in a CFLAGS war? Oh yeah!

12:06 jjl`: anyone got a good example of as-> usage? it's very hard to google for

12:06 rasmusto: shep-werk: those days are over for me, I'm in arch now

12:07 clgv: shep-werk: stop using gentoo to save our planet ;) :P

12:07 shep-werk: rasmusto: well, we are still above the Ubuntu rabble, right? /s

12:07 clgv: Why would I want to turn off my space heater? It's cold here!

12:08 clgv: shep-werk: there are heaters with a better efficiency :P

12:08 shep-werk: my heater has the side effect of producing nice terminal text

12:08 rasmusto: ,(-> 3 inc dec (as-> b [b (- b)]))

12:08 clojurebot: [3 -3]

12:09 rasmusto: jjl`: does that clarify it?

12:09 jjl`: rasmusto: not really

12:09 rasmusto: (doc as->)

12:09 clojurebot: "([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."

12:10 rasmusto: "expr" is what gets passed in with the threading macro

12:10 hyPiRion: cemerick: I'm using 5.6-SNAPSHOT. (5.7-SNAPSHOT weren't out when I tried to compile)

12:10 clgv: jjl`: as-> is most useful when you have different postions where to insert the result of the previous calculation

12:10 rasmusto: name is a name you pick, and forms are expressions that use that named var: [b (- b)] for example

12:10 jcromartie: hmm… don't rely on lazy operations, e.g. map, for fine-grained control over side effects

12:11 jjl`: clgv: *nod* i've just done a macroexpand in repl to try and make sense of it. but i'm not completely sure i get it

12:12 rasmusto: ,(macroexpand `(-> 3 inc dec (as-> b [b (- b)])))

12:12 clojurebot: (let* [sandbox/b (clojure.core/dec (clojure.core/inc 3)) sandbox/b [sandbox/b (clojure.core/- sandbox/b)]] sandbox/b)

12:13 clgv: ,(as-> 10 x (range x) (reduce + x) (/ x 10))

12:13 clojurebot: 9/2

12:13 jjl`: i think i get it

12:13 hyPiRion: (-> a (b c) (d e f) g (h)) is the same as (h (g (d (b a c) e f)))

12:14 cbp: jjl`: http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/

12:15 jjl`: i don't have a problem with -> (which i find very useful)

12:15 cbp: ah sorry then

12:15 jjl`: it's just as-> that i'm struggling with. but i think i've got a grasp

12:16 cemerick: hyPiRion: OK. If you have any troubles with it (aside from the namespace renaming :-/), let me know. Probably going to cut a 0.5.7 release this week.

12:16 (first "real" release)

12:17 rasmusto: jjl`: hyPiRion's example shows what as-> can do by itself, mine was more showing that -> and as-> can work together if you need a named binding partway through the threading macro

12:17 jjl`: er s/hyPiRion/clgv

12:17 hyPiRion: cemerick: will do – no worries

12:18 jjl`: rasmusto: yeah, i think your example solves a problem ive had down the line, where one of the things that needed threading needed threading to another point in the sexp

12:18 naturally i rewrote it as a let and suffered the ugliness

12:18 cbp: jjl`: the point of as-> is to remove nesting -> and ->>. So you can define where the placeholder is instead of depending on first or last position

12:19 jjl`: *nod*

12:21 honza: does anyone have a post with how to set up piggieback + vim-fireplace with the clojurescript repl?

12:30 jcromartie: is there a better way to write this side-effecty loop thing? https://gist.github.com/anonymous/a51f8d487fbdeca53cbe

12:31 bbloom: jcromartie: doseq?

12:31 jcromartie: doseq can't short circuit

12:31 this is pure bikeshedding :)

12:31 bbloom: ah, how about reduced ?

12:31 jcromartie: slash golf

12:31 rasmusto: :while isn't short-circuity?

12:31 bbloom: ,(doc doseq)

12:31 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

12:32 bbloom: (doc for)

12:32 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when te

12:32 jcromartie: hm

12:32 ok

12:32 bbloom: yeah, i think let+while will do what you want

12:32 rasmusto: thanks, i always forget doseq does taht

12:33 jcromartie: no, doseq returns nil

12:33 I want to return the first value for which :error is truthy

12:33 bbloom: jcromartie: use reduced

12:33 jcromartie: without evaluating any more

12:33 chunked seqs are right out

12:33 hm

12:34 bbloom: (reduce (fn [_ task] (let [result (task)] (when (:error result) (reduced result))) nil tasks)

12:34 jcromartie: woah, an escape from reduce?

12:34 bbloom: (doc reduced)

12:34 clojurebot: "([x]); Wraps x in a way such that a reduce will terminate with the value x"

12:34 jcromartie: when did that become a thing?

12:34 bbloom: (doc reduced?)

12:34 clojurebot: "([x]); Returns true if x is the result of a call to reduced"

12:34 bbloom: ,(meta #'reduced)

12:34 clojurebot: {:ns #<Namespace clojure.core>, :name reduced, :arglists ([x]), :column 1, :added "1.5", ...}

12:34 bbloom: 1.5 :-)

12:34 Raynes: jcromartie: Clojure has a changelog. You should poke around in there every once in a while :P

12:34 It's exciting.

12:35 clgv: after the releases is sufficient ;)

12:36 jcromartie: Raynes: yes, thanks

12:36 :| I've just been cruising since 1.2

12:36 cbp: jcromartie: you can use some

12:37 jcromartie: cbp: are you sure some won't chunk?

12:37 yeah, some *looks* safe

12:37 but it's not explicit

12:38 some appears to be the winner :)

12:38 (some #(let [result (%)] (and (:error result) result)) tasks)

12:38 cbp: jcromartie: it uses first & next, no chunked-cons so i dont see why it should

12:39 Raynes: And you can easily find out if it will

12:39 Throw some side effects at it.

12:39 cbp: ,(some #(do (print %) (when (:error %) %)) [1 2 3 {:error 4} 5])

12:39 clojurebot: 123{:error 4}{:error 4}

12:40 jcromartie: but that's not an explicit guarantee, just an implementation detail

12:40 augustl: is there a way to set java-cmd in a leiningen project without hardcoding it into the project.clj?

12:41 cbp: some is supposed to short circuit so i dont see any reason for it to do any more work than it should by chunking

12:41 clgv: augustl: the question contradicts itself

12:41 * cbp shrugs

12:41 technomancy: augustl: might be able to set it in .leinrc

12:41 augustl: technomancy: trying to make leiningen use java 8 extracted to a folder, so I don't have to install it as my system java to play around with it :)

12:42 technomancy: augustl: why not just put it on your $PATH?

12:42 augustl: technomancy: that's all leiningen needs?

12:42 Raynes: jcromartie: If you're concerned about that, you're probably going to need to get Rich to put it in writing that it'll never change, or copy the source of some so that you know it'll never change. :P

12:42 Pate_: any Clojurists from South Africa?

12:42 technomancy: augustl: sure

12:43 augustl: setting PATH worked fine, great :)

12:43 rasmusto: famous last words

12:46 augustl: booyah https://gist.github.com/augustl/9645871

12:46 the beauty of JS, easily accessible right from Clojure ;)

12:49 technomancy: haha

12:49 nice

12:49 sdegutis: Yeah, I was thinking of how they should have named the Java utility to run scripts "java-script".

12:50 augustl: sdegutis: haha, a missed opportunity

12:50 sdegutis: They named it "jrunscript" :/

12:50 austinh: How can I test that a value is a MapEntry in Clojurescript?

12:50 augustl: there's a bin named jjs though :)

12:51 austinh: isa?

12:51 jjl`: 'beauty of js'. sorry, got me giggling

12:52 i'm amused by the idea of running clojurescript on the jvm though

12:52 augustl: will attempt to make it easy to create single page web apps with fb react and render initial page from the server, without much extra work

12:52 and without the need to run a separate node process for that

12:53 jjl`: full circle :) What's the use case?

12:53 tbaldridge: It'll be interesting to see how that whole thing works out in relation to Graal and Truffle. Last I heard the JS Truffle VM is quite a bit faster than nashorn

12:53 jjl`: augustl: oh i don't have a good use case, i'm just amused :)

12:54 austinh: augustl: Thank you.

12:54 jjl`: augustl: i'm daft enough to have tried porting perl to the jvm so amusement from craziness comes easily

12:54 augustl: FUD time.. I remember reading somewhere that v8 is optimized for crashing. After all, if a chrome tab crashes, just reload, no big deal. So comparing that to nashorm might be interesting.

12:55 jjl`: perlj.am would be the domain name for that project

12:55 jjl`: php is certainly optimised for short runtimes (memory leaks etc.) which is actually a valid design decision if you know youre scripts are supposed to execute in a second or so

12:56 i'm pretty sure nashorn is optimised for long runtimes. that's the only way they'll get the full benefit of hotspot

12:56 augustl: yeah, seens like nashorn is oracle saying "we're good at doing dynamic languages now"

12:56 jjl`: actually i think it's their way of saying "yeah, okay, rhino is a bit crap"

12:56 technomancy: augustl: nashorn is "see, invokedynamic isn't just for jruby!"

12:57 augustl: :D

12:57 jjl`: isn't rhino a mozilla project though?

12:57 jjl`: because jython uses it as well? :)

12:57 yes, rhino is mozilla. but it also means there was no great jvm js implementation

12:57 i think they're just hopping on the bandwagon more than anything

12:58 "oh yeah, javascript is cool. we've always thought it. look here! we wrote one!"

12:58 i think it'll get remarkably interesting once clojurescript is self-hosting

12:59 augustl: there's also a node.js implementation for nashorn btw

12:59 which uses libuv, the cool part of node

12:59 jjl`: the other interesting thing is vert.x

13:00 http://vertx.io/

13:00 tbaldridge: And then Truffle just goes off the deep and and says "let's do a tracing JIT on the JVM"

13:00 *deep end

13:00 augustl: https://avatar-js.java.net/

13:00 tbaldridge: http://lafo.ssw.uni-linz.ac.at/papers/2014_CGO_OneVMToRuleThemAll.pdf

13:00 augustl: vertx is a completely separate implementation of the event loop

13:00 avatar is just a wrapper around the very same library that node uses internally

13:01 not sure which is a better idea.. Would make sense to do a node.js implementation on top of vert.x too

13:01 jjl`: that would certainly help get people ported over

13:04 dnolen_: jjl`: nashorn is not optimized for long runtimes, I've been following along since very relevant for Clojure(Script) narrative. They seems very interested start up fast, optimize fast - like the other JS engines.

13:04 jjl`: interesting

13:05 dnolen_: tbaldridge: pretty sure that isn't true w/ respect to Truffle / Nashorn

13:05 tbaldridge: invokeDynamic rewritten for Nashorn far as I know

13:05 jjl`: i think the day is fast approaching that i'll have to give up programming and become a farmer. when every tech stack has javascript

13:06 dnolen_: tbaldridge: and Nashorn is now as fast as SpiderMonkey and w/in shooting distance of JSC/V8

13:06 jjl`: it can't be long until someone writes a build system in javascript designed for building java, that takes the form of a DSL

13:06 hiptobecubic: It's really a shame that javascript is such an abomination

13:07 austinh: augustl: Actually, are you sure about using isa? to test MapEntry in cljs? I can't get it to work.

13:07 augustl: austinh: hmm, not sure what a MapEntry is

13:09 locks: hiptobecubic: ur just jelly

13:15 dnolen_: austinh: there is no concrete MapEntry type in CLJS, just the IMapEntry protocol

13:16 austinh: when seq'ing maps you just a get a seq of vectors, and vectors satisfy IMapEntry

13:16 can test IMapEntry with (satisfies? IMapEntry foo)

13:16 austinh: dnolen_: Thanks!

13:16 tbaldridge: dnolen_: that could be, the talk I was thinking of was both biased (presented by a lead Truffle researcher) and older (~1yo)

13:17 dnolen_: tbaldridge: yeah Nashorn was a dog a year ago

13:25 seangrove: Nashorn definitely seems like ti could open up some very cool possibilities

13:55 jstew: Anyone know if I can run code after a ring response completes? (using compojure).

13:57 I generate some temp files, and want to clean them up.

13:57 technomancy: jstew: middleware can do that

13:59 jstew: technomancy: If I remove the file in middleware, won't it be gone by the time I try to serve it as the response?

13:59 jjl`: you misunderstand middleware

13:59 your function receives the next function in the chain and you call it

13:59 jstew: indeed I may :)

13:59 jjl`: so you can do things both before and after

13:59 amalloy: jstew: are you trying to serve the temp files themselves as the response?

13:59 jstew: amalloy: Correct.

14:00 jjl`: oh, like sendfile() or something?

14:00 which plugin are you using to send it?

14:00 amalloy: so he probably can't (straightforwardly) clean them up in a middleware - ring needs to be able to see the files in order to serve them, after his handler/middleware stack is done

14:00 jjl`: because it could just be a case of ordering your middleware if it's one that will just slurp the file and pass the content back

14:01 amalloy: jjl`: he doesn't need a plugin, really - ring can accept java.io.File as the :body

14:01 and slurping it isn't much good if it's too big to fit in ram

14:01 jstew: That's what I am doing. Serving the file directly and setting content-Disposition in the headers

14:02 jjl`: amalloy: in that case, it's a bigger problem than it first appears :)

14:02 amalloy: jstew: in most (all?) modern operating systems, you can delete a file while you have it open, and handles to it will stay valid

14:02 so you can open an InputStream on the file, then delete it, then pipe that stream to ring

14:02 jstew: Ahh... Yes, that will work. Thank you! Forgot about that.

14:02 amalloy: (ring is happy to accept streams)

14:02 jjl`: this only works of course if you haven't taken a flock()

14:03 amalloy: java probably doesn't even let you

14:03 jjl`: hah

14:03 amalloy: right, it doesn't. since not every OS in the world supports that

14:04 * jjl` bets that it doesn't support VMS paths

14:04 jjl`: this is, incidentally, why perl's core file handling stuff is awful. it *does* support VMS

14:05 `szx: (into [] lazyseq) vs (vec lazyseq)? surprisingly, google didn't have the answer

14:06 amalloy: `szx: amazingly, there's no easy answer. vec seems like it *should* be right, and i'd use it because it's most readable, but i think into/[] is actually a bit faster

14:07 `szx: amalloy: alright, so vec it is till i run into performance issues

14:07 amalloy: `szx: and when you do run into performance issues, there will be better places to fix them :)

14:08 jcromartie: into is definitely faster

14:09 IMHO into is a bit of an underrated gem of the collections interface

14:12 cbp: into is faster because it uses transients

14:13 stuartsierra: austinh, augustl: remember `isa?` compares 2 classes. `instance?` asks if an object is of a particular class.

14:15 amalloy: jcromartie, cbp: into is *usually* faster. it is definitely not the case that it's always faster

14:16 austinh: stuartsierra: Thanks!

14:16 cbp: amalloy: I imagine into gets faster the more items there are

14:17 amalloy: for example, consider (let [a (into-array (range 30))] (vec v))

14:17 vec has optimizations for array inputs

14:17 into has to seq over the array

14:17 cbp: ah

14:18 amalloy: (in the example above is about 10 times faster than into)

14:19 in practice, into will "always" be faster, but it just doesn't really matter

14:19 i suggest using vec, because it's more specialized, and eventually someone will get around to implementing the same transient optimizations for it that work with into, as well as the other vector-specific ones it already has

14:21 technomancy: yeah, imo into makes most sense when you're pouring into something that's not empty

14:22 you use it to pour into {} too, but only because there's nothing like vec for maps for whatever reason

14:23 Bronsa: technomancy: my guess is simply because `map` was already taken

14:23 cbp: ran out of names :-D

14:25 rasmusto: ,array-map

14:25 clojurebot: #<core$array_map clojure.core$array_map@1e9bfd3>

14:26 technomancy: yeah, but you have to apply it

14:26 rasmusto: oh yeah, how is array vs hash map picked?

14:27 jjl`: apply is my usual frustration with ->

14:27 technomancy: jjl`: (partial apply f) =)

14:27 don't actually do that

14:27 jjl`: quite

14:28 come to think of it, i'm not sure why i haven't written a wrapper that switches the arguments

14:28 cbp: rasmusto: I believe the cutoff is around 8 items

14:28 jjl`: that would solve it

14:29 rasmusto: cbp: okay, so nothing to do with the types of keys used or anything

14:29 cbp: rasmusto: no I don't think so

14:33 Averell: Is recur a kludge or motivated by no TCO on the JVM? Or am i paranoid?

14:33 bbloom: ~recur

14:33 clojurebot: Cool story bro.

14:33 bbloom: ~tco

14:33 clojurebot: yes please

14:33 bbloom: lol

14:33 Averell: this has been discussed many times here

14:33 TimMc: Averell: Paranoid? Who's out to get you?

14:33 Averell: any faq?

14:34 by natural suspicion

14:34 my*

14:34 bbloom: Averell: in short, TCO is useful for many problems, but far from critical b/c you can always use a trampoline

14:34 Averell: recur is tail RECURSION optimization, which is different than general TCO

14:35 tbaldridge: Averell: TCO isn't supported on the JVM....so there that, but also recur covers almost everything so I don't see much of a problem

14:35 Averell: yes, but lets say there was, would recur still exist?

14:35 amalloy: technomancy: at one point i did (def ap (partial partial apply)), to make it easier to squeeze apply forms into -> chains

14:36 bbloom: Averell: if the JVM supported proper tail calls, it's likely that clojure would have still needed something like recur, since clojure was simultaneously developed for the CLR, which also doesn't have general TCO

14:36 justin_smith: it's nice to have something that throws an error if not in the tail position

14:36 tbaldridge: probably for backwards compatibility. But also I think recur is really nice since it fails to work if its used in a non tail call position

14:36 amalloy: i don't remember if i ever actually used it, though - it looks knida awkward

14:36 bbloom: Averell: nor does javascript, for the clojurescript backend

14:36 tbaldridge: bbloom: sure it does, just not on x86-64....or x86....one of those, not sure

14:36 bbloom: Averell: so yes, host constraints led to the addition of the "recur" form, but it's still useful in much the same was as static type checking or runtime assertions are useful

14:37 technomancy: Averell: also: most uses of tco in scheme are better served by laziness in clojure

14:37 bbloom: tbaldridge: the CLR *can* do TCO, but doesn't promise it

14:37 amalloy: i imagine if we did have general tail calls we'd have something like (tail f x args), meaning "act like (f x args), but throw an exception if you can't do this without using stack space"

14:38 or rather, don't compile if you can't do this

14:39 bbloom: amalloy: and that's practically exactly what i do in my interpreter: https://github.com/brandonbloom/eclj/blob/03bbe44dfb355930ff341b742b3b74c78325ca5d/src/eclj/core.clj#L583-L586

14:39 augustl: anyone here happen to know how you provide your own classes to a jdk8 nashorn runtime? :)

14:39 bbloom: amalloy: i implement normal recursion with the y-combinator, but i implement recur as an effect that enforces tail position on the continuation

14:40 cbp: hmm, if I have some manner of (zipmap (keys m) (vals m)) I would have to rewrite that for clojure 1.6?

14:41 jcromartie: cbp: why? aren't keys and vals consistent?

14:41 bbloom: tbaldridge: clarifying: the CLR supports explicit tail calls, but the JIT may or may not perform tail call OPTIMIZATION for non-tail calls. the JVM supports neither explicit nor optimized tail calls

14:41 jcromartie: http://dev.clojure.org/jira/browse/CLJ-1302

14:41 this is in 1.6

14:42 bbloom: tbaldridge: or i guess not for "non-tail calls", i mean for implicit tail calls. ie normal calls in tail position

14:42 big difference as far as debuggers are concerned...

14:42 Averell: why is that apparently so much harder than detecting tail position?

14:42 rasmusto: (doc keys)

14:43 clojurebot: "([map]); Returns a sequence of the map's keys."

14:43 cbp: jcromartie: there were some hashing changes and in that ticket Stuart Sierra says you should not rely on it

14:43 bbloom: Averell: reality is more complex than the lambda calculus? :-)

14:43 Averell: i suppose :)

14:43 bbloom: Averell: exception handling, especially finally blocks, for example

14:43 jcromartie: "The absence of this property in the docs is correct. You should not rely on this."

14:43 (other stuart)

14:44 cbp: er

14:44 yes other stuart

14:44 :-P

14:44 bbloom: Averell: the comp sci community genuinely didn't understand the nature of exception handling until the last few years

14:44 jcromartie: but rich hickey says "keys order == vals order == seq order"

14:44 tbaldridge: jcromartie: cbp: "keys order == vals order == seq order"

14:44 jcromartie: i.e. /thread

14:44 cbp: Oh but at the end Rich says that yeah

14:44 amalloy: yeah, i'm amazed to hear that from stuart

14:44 cbp: *joy*

14:44 jcromartie: WHAT AN IDIOT, GOD, PFFFFT

14:45 amalloy: bbloom: does the CS community understand it now?

14:45 stuartsierra: I remember this discussion now. Stuart Holloway was incorrect. The order of keys and vals is the same.

14:46 bbloom: amalloy: much better than they did, that's for sure

14:48 Averell: question answered? happy to provide further references

14:52 dnolen_: Averell: the reason Clojure and ClojureScript don't offer TCO is very simple - it makes interop problematic.

14:53 Averell: no, i'm good. thanks :)

14:53 if you have any links to better understand exception handling, that sounded interesting.

14:55 bbloom: Averell: i gave a talk on algebraic effects on monday night, it should be on youtube later this week. follow @papers_we_love on twitter. some background materials are linked to from here: https://github.com/papers-we-love/papers-we-love/issues/9

14:55 Averell: in short, exceptions are now best understood in terms of delimited continuations

14:56 bore: Hi guys. Just a quick one for a clojure newbie. How do I replace the last character of the String most efficiently?

14:57 do I need to dip into java?

14:57 technomancy: can't you just use lasts?

14:57 last

14:58 maxthoursie: (apply str (butlast some-string))

14:58 wouldn't say it's efficient

14:58 technomancy: oh, misread

14:58 cbp: Is there an alternative to compiling protocol buffers from clojure than lein-protobuf?

14:58 Maybe I should do it manually..

14:59 * cbp shivers

14:59 bbloom: (doc re-replace)

14:59 clojurebot: Cool story bro.

14:59 maxthoursie: bore: (clojure.string/replace "foo" #"o$" "b")

14:59 bbloom: ah, d'oh not re-replace

14:59 bore: yeah what maxthoursie said

15:00 jcromartie: cbp: I'd think your protocol buffers should be a separate project

15:01 cbp: jcromartie: That's a good idea. But separate from the need to compile them

15:02 bore: well what maxthoursie said sounds a bit inefficient and I'll need to call str twice. Once with apply to get string back and then once to add the replacement character

15:02 otherwise makes sense

15:03 maxthoursie: bore: the second one

15:03 justin_smith: matching on #".$" should be fast, strings in the jvm are counted

15:03 maxthoursie: bore: use clojure.string/replace

15:03 bore: So far I have (str (.substring foo 0 (dec (count foo))) bar)

15:04 aha OK that sounds more like it

15:04 thanks a lot

15:05 maxthoursie: bore: if you want it faster i guess you should store it in a mutable way so you can just replace the character directly

15:05 bore: but if you can aviod that -> cleaner code

15:05 strings are the only thing that java got right (wrt immutability)

15:06 bore: no I think copying into byte buffer would make things worse - I do not intend to reuse the base string much

15:06 but thanks for the idea

15:06 I'll go with regex solution

15:06 it strikes a good balance

15:07 maxthoursie: fails on the 'aviod regexes when you can' guildline though :)

15:09 justin_smith: I guess you could use a StringBuilder or something if you wanted to super optimize it

15:10 https://www.refheap.com/61951 .substring is a little faster than the re solution

15:12 https://www.refheap.com/61951 updated to show the def of input

15:13 Averell: is count walking the full string?

15:13 justin_smith: no, strings are counted

15:13 they store their size

15:14 Averell: oh that's what that meant. duh.

15:14 gtrak: count uses seq functions, pretty sure

15:15 so it doesn't matter if strings are counted

15:15 justin_smith: oh, so you want .length

15:15 gtrak: eat the cost of the reflection warning :-)

15:16 justin_smith: the book "clojure high performance programming" claims count is O(1) on counted collections

15:16 gtrak: aha, actually I see a special case for CharSequence

15:16 pyrtsa: gtrak: count delegates to RT/count on the JVM: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L528-L558

15:16 jcromartie: clojure.core/count is optimized for CharSequence

15:16 oh yeah

15:16 gtrak: so count should be fine

15:16 jcromartie: :)

15:17 how many people were just on that file

15:17 gtrak: it's almost as if they thought of that

15:17 justin_smith: gtrak: according to this book, it is O(1) on list, hashmap, arraymap, vector, queue, treemap

15:17 and if I am reading that source right, it agrees

15:18 gtrak: err.. I think it could be wrong for list

15:18 clojurebot: excusez-moi

15:18 gtrak: I remember reading it delegating to the rest, if that's a cons then you've got problems

15:18 but in practice it's probably negligible

15:18 Averell: hehe. so at least it works for very short lists.

15:19 pyrtsa: count is O(n) for lists. Unless there's a tail that implements Counted. Then it's O(n_head).

15:20 gtrak: the class of the head is not a testament to the rest of it

15:20 pyrtsa: :)

15:21 gtrak: But indeed it is when the head is Counted. ;)

15:21 gtrak: err, hmm, actually looks like persistentlist manages the count for every case.

15:21 as long as you start there when you cons you should be fine

15:22 augustl: isn't (defn ^:static -myMethod [] ...) the way to create static methods for a :gen-class ns?

15:22 pyrtsa: Oh, PersistentList does implement Counted. But lazy seqs don't.

15:22 gtrak: conj, rather.. grr

15:23 if you call cons, you break it, if you conj onto a list, you're fine

15:23 pyrtsa: Funnily, the result of (range n) does not implement Counted.

15:24 justin_smith: I guess because lazy things in general do not

15:24 it seems like it would be so trivial though!

15:24 pyrtsa: Yeah, but it could be implemented with an own class.

15:24 justin_smith: also, (nth (range) n) is O(n) though one could naively imagine it being O(1)

15:26 Averell: but nth on a counted thing would be O(1)?

15:27 pyrtsa: nth for Indexed will be O(1) or O(log n) or something like that, I guess.

15:27 Bronsa: Averell: lists are counted, nth is still O(n)

15:29 pyrtsa: Oh, I wasn't quite accurate with that. I meant that Counted doesn't affect nth. Again, the impl is found in RT.java.

15:30 Averell: static public. it's distracting :)

15:42 Man browsing that is kinda cool. although the language suddenly loses some mystique, just seeing it there, how simple stuff is.

15:56 hyPiRion: Most of it is simple

15:57 But when you attempt to answer the question "is this symbol/keyword legal?" by reading the Reader, you're gonna have a bad time

15:59 Averell: hehe. i already have a bad time moving out of simple collections, but still much more approachable than i thought.

16:00 akurilin: Does anybody have a solution to this: I have 2 local libs my project depends on, I'm using "checkouts" folder in development. When building the uberjar though I need to be sure that the git repositories are up to date and that I ran lein install or I might be shipping the uberjar with outdated libs

16:00 gtrak: i don't think checkouts has much to do with artifacts

16:01 unless you're relying on bad AOT behavior

16:01 akurilin: Checkouts lets you not notice that the local .jar repo is not up to date, right? Everything will work just fine until you build and ship

16:01 gtrak: checkouts will add the subdirs to the classpath is my understanding

16:02 akurilin: That's correct.

16:02 lein uberjar uses the repo though.

16:02 gtrak: right.

16:03 you probably want to mvn install the dependency jars, it's worth the trouble.

16:03 akurilin: What does that mean?

16:04 gtrak: 'lein install', just like you said

16:04 you need actual releases and maven artifacts for the deps

16:05 if you don't want to go through the trouble, ie you are the author of those checkouts, why not just add the source to your project's source-paths?

16:05 tbaldridge: pyrtsa: in ClojureScript I think it does

16:05 gtrak: maybe I'm misunderstanding what you mean by 'local libs'...

16:06 tbaldridge: pyrtsa: bleh, stale irc window

16:06 gtrak: is this clojure source in a clojure project that's not released anywhere?

16:06 akurilin: yes it is

16:06 it's just shared across multiple projects

16:06 gtrak: ah, yea. well.. maybe a more convenient way to share it is :source-paths :-)

16:07 akurilin: Admittedly the lein install approach is a pita

16:07 gtrak: like this: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L244

16:07 throw "../my-lib/src" in there

16:07 and don't worry about it

16:08 unless you actually want to start releasing the shared code

16:08 akurilin: Let me try that, that sounds really useful :)

16:08 gtrak: then you can remove it from checkouts, too

16:09 jcromartie: I'm really finding a lot of places where "for" is much more readable than "map"

16:09 fun fact: (if [pred x] …) will allways be true :)

16:10 gtrak: lol yes

16:10 rasmusto: for + :when/:let/:while is a lot nicer than map + filter/take-while/???

16:10 lazybot: rasmusto: Oh, absolutely.

16:11 gtrak: ~for + :when/:let/:while

16:11 clojurebot: Pardon?

16:13 rasmusto: nrepl.el question: why does it not switch modes when I C-c M-j?

16:14 oh, it was something in my config... hm

16:15 justin_smith: rasmusto: using emacs now? woah

16:15 brehaut: is there anything analgous to sql subselect in core.logic ?

16:15 rasmusto: justin_smith: trying it out, vim is giving me pains recently

16:16 justin_smith: more specifically, BLOCKING highlighting of matching parens causing many ms of lag

16:16 justin_smith: weird

16:17 zspencer: Is there a clojure idiomatic way of injecting a dependency?

16:17 rasmusto: Had to start dumping out profiling information, and yeah, thousands of hits to the highlight function

16:17 technomancy: akurilin: I'd recommend setting :target-path to "target/%s" to avoid that problem

16:17 akurilin: your checkout deps should be stripped from the classpath when creating the uberjar, but class files compiled when they were on the classpath could still be included with the default :target-path setting

16:18 akurilin: see the last Q on https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md

16:19 seangrove: Ah, I miss vars sometimes in cljs

16:20 * seangrove sings, "You don't know what you have (with metadata) 'til it's gone..."

16:20 jjl`: you've paid for paradise, put up a parking lot?

16:22 TimMc: jjl`: I can't tell if you're punning, or if that's how you think the lyrics go.

16:25 gtrak: It took me 3 years to hit a problem where metadata was the right solution, but it made a hard thing pretty trivial.

16:26 avoided changing a ton of code around.

16:27 akurilin: technomancy: so you'd not recommend the source-paths approach?

16:27 gtrak: had to validate a data structure, but the information that was needed to do it was no longer there, so it was either attach it via metadata, or pass around an extra argument everywhere or change the structure and everything that uses it.

16:27 akurilin: or is that still cool?

16:27 technomancy: akurilin: checkouts is just a wrapper around source-paths and a few other things to begin with

16:28 akurilin: but yeah, changing source-paths won't actually fix the problem if you have classfiles bleeding over across profile boundaries

16:34 akurilin: technomancy: so to be clear, would I still want to run lein install there on my deps, or are they somehow going to be built for me during lein uberjar

16:34 ?

16:34 gtrak: that looks like a different problem than the one you're trying to avoid

16:34 that's how to avoid AOT in general except when you're making uberjar

16:35 technomancy: akurilin: checkout deps are off the classpath when uberjarring no matter what, so yeah. stuff is going to come out of ~/.m2.

16:36 akurilin: Ok got it, thanks

16:36 technomancy: right, so ensuring what goes into the jar is up-to-date is bigger than just this

16:36 gtrak: technomancy: I just suggested he avoid a project boundary for code-sharing if he's not committed to doing releases.

16:37 technomancy: but you can't get that right if you're leaking across profiles anyway

16:37 gtrak: and mess with sources paths instead

16:37 akurilin: So the idea is that if I use source-paths then I simply can't use profiles correctly?

16:37 gtrak: totally unrelated

16:37 technomancy: akurilin: sorry, to be clear checkouts are only enabled through profiles

16:38 the base profile is what turns checkouts on

16:38 but only the uberjar profile is active when cerating an uberjar

16:38 so you're using profiles whether you're doing it explicitly or not

16:40 akurilin: So the point is that once you add a source-path directive to project.clj, you always have that path on regardless of profile, riht?

16:41 it becomes an extension of the project folder

16:41 gtrak: profiles can do anything, but pretty much

16:42 the uberjar/checkouts stuff is irrelevant, it's a source folder for your project.

16:42 you could write a profile that kills it, but that wouldn't make much sense :-)

16:42 technomancy: oh, sure

16:42 or you could add checkouts to the defproject directly

16:42 akurilin: Well the impression I'm getting is that checkouts is a "magical folder", as in it's ignored when building the uberjar

16:43 as opposed to something you'd add with source-path

16:43 technomancy: :checkout-deps-shares [:source-paths] will make it active during uberjar if that's what you want

16:44 gtrak: checkouts implies you want something with artifacts, I thought.

16:45 technomancy: well if you're using it for something other than "Convenience during development" then you're beyond using it for what it's intended for =)

16:47 anyway, everyone should use profile isolation regardless, and if you also do this :source-paths thing it might also solve different problems

16:47 gtrak: hacking checkouts to give custom behavior on libraries you don't control is probably bad.

16:48 if you control the deps, then you don't need checkouts except for convenience, and maybe it's more convenient to do other things.

16:48 to avoid having to install/deploy that stuff in the first place.

16:49 we had a massive shared library that was shared across 3 products, and the artifact was AOT'd, which meant that they all had to use the same clojure version among other complexities.

16:49 I think we could have avoided some problems by doing it this way.

16:51 technomancy: the simplest thing to do is just not create deployable artifacts on the same machine you do dev on

16:51 gtrak: the fact that clojure AOT tries to AOT the world means you'd get all the dependency classes in the artifact, so we filter those.

16:51 technomancy: poof; no more staleness problems

16:51 gtrak: all to distribute a proprietary shared jar without source in it.

16:52 jjl`: TimMc: it was never one of my favourites. they're probably wrong but i'm willing to accept the more flattering alternative

16:53 gtrak: technomancy: that doesn't solve this problem.

16:53 jjl`: TimMc: ohh, now i look them up it makes a lot more sense

16:53 gtrak: rather, the one we had.

16:55 technomancy: gtrak: ah yeah, well AOTing a library is never going to be pretty

16:55 gtrak: http://dev.clojure.org/jira/browse/CLJ-322

16:56 technomancy: wow, this was once on the list for 1.6??

16:56 lazybot: technomancy: Definitely not.

17:08 hugod: pprint doesn't seem to print metadata, even if *print-meta* is true

17:11 I wonder if fipp does…

17:12 bbloom: hugod: nope, but it should be pretty easy to add

17:12 hugod: take a look at edn.clj

17:13 hugod: bbloom: ok, will have a look

17:16 TimMc: jjl`: :-)

17:18 mikerod: When processing unevaluated Clojure forms with a goal is to fully-qualify all Symbols that are non-local

17:18 with a goal of fully-qualifying**

17:18 is there any good strategy? :)

17:19 stuartsierra: tools.analyzer?

17:19 mikerod: Looks like it becomes quite a trick to detect locally Symbol bindings that the unevaluated code may produce.

17:19 stuartsierra: I haven't looked much at it before. I suppose I should look a bit.

17:21 stuartsierra: Within a macro, you can get the current local symbols from &env I think. You can look up global symbols with `resolve`.

17:21 mikerod: If you just blindly qualify any Symbol that can be qualified in the current *ns*, I think the only issue is it would ignore local shadowing of those Symbols.

17:22 Yeah, &env is an option I explored. I couldn't come up with a reasonable way to use it though when I haven't actually evaluated the binding forms. So there really is no "env" at the time, unless I reproduce it.

17:23 For example, if I have some code like '(let [x 5] (for [y [1 2]] x y z); I want to see '(let [x 5] (for [y [1 2]] x y ns.name/z) returned

17:24 What the code does doesn't matter, it is assumed to be useful later in another context.

17:24 I just want to store it off with qualified Symbols. It is simple I think, if there are no locals shadowing global Symbols.

17:33 I believe that locals only come from let* and letfn* when it comes down to the special forms right?

17:34 Nvm I think I answered myself. I'll keep digging. :P

17:35 justin_smith: mikerod: don't forget fn / (defn) bindings

17:37 mikerod: justin_smith: yep, just thought about them. then I thought, maybe I would have to consider recur and catch as well. I don't know for sure, but they stood out as possibilities.

17:38 justin_smith: loop (recur would bind for either fn or loop)

17:39 mikerod: hmm yeah

17:40 rasmusto: vabC-cC-r for evaling a region? or is there a better way to eval an inner expression in emacs

17:40 (this is an evil-mode hack btw)

17:44 dsrx: rasmusto: if the point is at the end of a sexp C-x C-e will evaluate just that sexp in cider

17:44 rasmusto: (blah (foo bar)|) + C-X C-e ?

17:44 dsrx: yeah

17:45 well, idk if C-X will do anything different than C-x :p

17:45 rasmusto: is there a way to do it from (blah (foo| bar)) ?

17:45 typo :)

17:48 aaron_: hi

17:49 fu86: I want to use enlive to fetch the content from an url which is not html

17:50 enlive-html/get-resource seems the right way, but I don't know how to use it :(

17:50 brehaut: fu86: look at clj-http for general purpose http requests

17:51 from memory enlive-html/get-resource will always try to consume the resourse as html

17:51 fu86: thanks

17:51 i've tried to use an "custom" loader which simply return the content but it does not work

17:52 i will use clj-http for such stuff, thanks

17:57 amalloy: rasmusto: (blah (foo| bar)) there's not really a good way to define how far up you want to go - should it eval (foo bar), or (blah (foo bar)), or the context surrounding that, or...?

17:57 or indeed just foo

17:57 instead, use C-x C-e as-is, and if you want to go up N levels first use paredit-forward-up N times (or with a prefix argument of N)

17:59 i have paredit-{forward,backward}-{down,up} on the C-M-{WESD} keys, although in practice i mostly use backward-up

18:02 rasmusto: amalloy: hm, ok.

18:11 ahh, emacs has cider now

18:11 something must have pulled it in as a dep

18:15 cbp: magnars: ping

18:39 seangrove: dnolen_: Any from the Om instrumentation, I'd like dynamically swap the render method on a component before passing it to om/build* - e.g. to have a preview render method and an actual render method that otherwise uses the same methods for everything else

18:39 dnolen_: Any suggestions on how I'd go about that?

18:44 storme: hello

18:44 anyone use yokogiri before?

18:45 Raynes: I bet devn has.

18:50 storme: I'm trying to make an image scraper with clojure

18:51 would yokogiri be useful for this?

18:51 SegFaultAX: Haha, is that a thing? yokogiri?

18:51 storme: yep lol

18:51 <-- coming from ruby

18:51 SegFaultAX: That's an awesome name.

18:51 storme: so not sure what clojure libs are out there

18:52 SegFaultAX: storme: Are you scraping html?

18:52 storme: yep

18:53 SegFaultAX: enlive can do that. I haven't used yokogiri so I don't know how good it is.

18:53 storme: ah thanks

18:57 rasmusto: "defun" indentation isn't working for me in clojure-mode, is there something I have to set?

19:01 ugh, I had lisp-indent-offset set somewhere :<

19:05 Cr8: I usually use Jsoup for scraping

19:06 It can do css-like selectors, and its types mostly participate in the java collection interfaces, so you can seq over them and such

19:13 devn: storme: oh hello there

19:14 yokogiri is really, really simple. enlive and all of those others things can do scraping, but I got annoyed with how much other stuff they brought to the table that I simply didn't need

19:14 yokogiri is named after yoko harada, who did the JRuby implementation for Nokogiri

19:15 storme: so for an image scraper, would you recommend yokogiri over enlive?

19:15 devn: storme: i mean, you're asking me if i'd recommend it? I wrote it, so yeah! It's great! :)

19:15 it's pretty darn easy

19:15 in fact, let me dig up a snippet for you

19:16 storme: oh haha

19:26 devn: hmph, thanks for asking about it storme -- i just was whipping up an example for you, and found that I'm getting an exception from org.apache.httpclient

19:30 storme: devn working for me

19:34 devn: yeah, i think i just had a blocked outgoing connection for emacs

19:36 SegFaultAX: 1.6 is RC... oh snap.

19:44 devn: storme: https://gist.github.com/devn/9654084

19:45 storme: hopefully that speeds things along for you.

19:45 SegFaultAX: devn: That's slick. Nokogiri is such a useful library, thanks for making a Clojure variant. :)

19:46 devn: yeah dude, no problemo. it's just a wrapper around a couple libs. There's a lot Nokogiri will do that yokogiri won't at the moment

19:47 contributions would be much appreciated

19:47 SegFaultAX: I'm assuming that's the node building side?

19:47 It seems like the query side is pretty fleshed out.

19:47 devn: yeah, i mean, on the other hand

19:47 i think tools like enlive and laser and so on already have that

19:47 SegFaultAX: Yup.

19:48 devn: they all sort of seemed to have more complicated screen scraping stories though IMO

19:48 i just wanted a thingy to query really, so *shrug*

19:48 muhoo: scraping with emlive ia pretty painless

19:48 storme: thanks a lot devn!

19:49 devn: yeah no problem, also, welcome :)

19:50 muhoo: yeah? It was a long time ago, i remember like 3 tutorials were written for it

19:51 which to me was not something i was very interested in, since i just wanted to, as i said above, do some basic screen scraping

19:51 * muhoo shrugs

19:51 muhoo: it worked for me

19:52 devn: like, the fact that tutorials needed to be written to understand how to get a page and find an element was kind of crazy

19:53 muhoo: actually, i take that back i guess. i think i just wanted to use xpath and css out of familiarity

19:54 muhoo: i'd rather not need to find a fn called 'first-child' when i already know how to do that with xpath

19:54 but meh, to each their own. i should give enliven another look

19:57 justin_smith: first-child, not to be confused with firstborn-child - (promise firstborn-child)

20:14 TimMc: justin_smith: It really is too bad promise doesn't take any arguments.

20:17 xeqi: seangrove: have you done any perf check on java8's new js engine for server side rendering?

20:18 seangrove: xeqi: No, dnolen has been battering away on it for the past month though

20:24 justin_smith: TimMc: (let [offering (promise)] (deliver offering firstborn-child))

20:25 arrdem: hahaha

20:26 the gods of pointer arithmetic find your offering pleasing

20:26 your application may run

20:26 for now

20:26 TimMc: :-D

20:26 &(let [p (promise)] (deliver p p))

20:26 lazybot: java.lang.StackOverflowError

20:26 brehaut: wait wat? surely only if its dereffed?

20:27 &(let [p (promise)] (deliver p 1))

20:27 lazybot: ⇒ #<core$promise$reify__6153@3827c3: 1>

20:27 brehaut: oh right

20:28 TimMc: It's just print silliness.

20:28 &(pst)

20:28 lazybot: java.lang.RuntimeException: Unable to resolve symbol: pst in this context

20:28 gfredericks: ,(deftypo Foo [] java.util.Map clojure.lang.IDeref)

20:29 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: deftypo in this context, compiling:(NO_SOURCE_PATH:0:0)>

20:29 gfredericks: ,(deftype Foo [] java.util.Map clojure.lang.IDeref)

20:29 clojurebot: sandbox.Foo

20:29 cbp: lol deftypo

20:29 gfredericks: ,(Foo.)

20:29 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Multiple methods in multimethod 'print-method' match dispatch value: class sandbox.Foo -> interface clojure.lang.IDeref and interface java.util.Map, and neither is preferred>

20:29 TimMc: brehaut: Interestingly, the overflow is in java.util.regex.Pattern$BmpCharProperty.match or so.

20:29 justin_smith: that is an awesome typo

20:29 gfredericks: deftypo is the weirdest feature of clojure

20:29 rasmusto: is that a core.logic thing? deftypeo?

20:29 TimMc: That's from the Intercal side of Clojure's history.

20:29 gfredericks: I did core.logic for a month and now I can't stop putting o's at the end of things

20:30 Bronsa: here's a funny one

20:30 ,(deftype x [a])

20:30 clojurebot: sandbox.x

20:30 Bronsa: ,(x. 1 nil {:a 2})

20:30 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class sandbox.x, compiling:(NO_SOURCE_PATH:0:0)>

20:30 Bronsa: uh

20:30 derp

20:30 ,(defrecord x [a])

20:30 clojurebot: sandbox.x

20:30 Bronsa: ,(x. 1 nil {:a 2})

20:30 clojurebot: #sandbox.x{:a 1, :a 2}

20:31 TimMc: oooo

20:31 arrdem: o0oooooh

20:31 TimMc: Basis and extra attrs?

20:31 Bronsa: yeah

20:31 justin_smith: (leto [wiki "http://dune.wikia.com/wiki/Leto_Atreides_I"] wiki)

20:31 arrdem: justin_smith: har har

20:31 gfredericks: is there a ticket for that one?

20:31 cbp: ,(update-in (x. 1 nil {:a 2}) [:a] inc)

20:31 clojurebot: #sandbox.x{:a 2, :a 2}

20:32 Bronsa: gfredericks: not that I know of.

20:32 gfredericks: I guess it would be pretty low priority

20:32 Bronsa: gfredericks: there's to say that that ctor is an implementation detail

20:32 gfredericks: I didn't even know about it

20:32 Bronsa: __meta + __extmap

20:32 rasmusto: ,((x. 1 nil {:a 2}) :a)

20:32 clojurebot: #<ClassCastException java.lang.ClassCastException: sandbox.x cannot be cast to clojure.lang.IFn>

20:32 rasmusto: ,(get (x. 1 nil {:a 2}) :a)

20:32 clojurebot: 1

20:33 Bronsa: watch this

20:33 gfredericks: fun fact: you can't add metadata to a lazy seq without forcing it

20:33 Bronsa: ,(map->x (x. 1 nil {:a 2}))

20:33 clojurebot: #sandbox.x{:a 1}

20:33 arrdem: Bronsa: this is absurd. thanks for sharing :D

20:33 Bronsa: oh damn

20:33 arrdem: gfredericks: that doesn't make sense...

20:33 Bronsa: that returns #user.x{:a 2} in my repl

20:33 w/e

20:33 rasmusto: probably not a big deal

20:34 gfredericks: arrdem: it makes good sense after digging into the impl for a while

20:34 cbp: ,*clojure-version*

20:34 clojurebot: {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}

20:36 Bronsa: arrdem: I "discovered" this behaviour while investigating for CLJ-1323

20:36 that's a funny one too

20:36 gfredericks: arrdem: basically you don't want two objects holding onto the same thunk

20:36 arrdem: Bronsa: I'm so jelly of the fun you have playing with the core

20:36 gfredericks: cuz that would require a lot more coordination

20:36 arrdem: Bronsa: one day I'll catch up, but not this semester :c

20:37 gfredericks: hum... that makes sense but I'd have to read it myself.

21:02 amalloy: gfredericks: you also can't conj onto a lazy-seq without forcing it, as i recall

21:02 forcing the first element, anyway; of course you don't have to force the whole thing

21:11 hyPiRion: gfredericks: that would just force the first element, right?

21:11 unless that's exactly what amalloy said.

21:12 amalloy: well, i was saying it about conjing; you're saying the same thing about metadata, which is also true

21:12 hyPiRion: Yeah, I was unsure whether you only meant conjing or both

21:26 Steveo_: where can I find the ant colony code that rich refers to in his concurrency talk?

21:27 gfredericks: amalloy: that one is not obvious to me

21:28 ,(let [a (atom false) l (lazy-seq (swap! a not) nil)] [(first (conj l 3)) @a])

21:28 clojurebot: [3 true]

21:28 gfredericks: ,(let [a (atom false) l (lazy-seq (swap! a not) nil)] [(first (cons 3 l)) @a])

21:28 clojurebot: [3 false]

21:28 gfredericks: weeeeird

21:29 cbp: o_O

21:29 amalloy: gfredericks: because cons just creates a Cons object, but conj dispatches to .cons on the collection

21:29 and lazy-seq delegates most of its operations to (.seq this)

21:30 gfredericks: ooh okay

21:30 so the lazy-seq impl is just lazy

21:30 amalloy: yes. it definitely could be better. instead it's lazily not being lazy

21:31 * gfredericks glares at everybody who hasn't laughed yet

21:31 rasmusto: heh

21:31 amalloy: gfredericks: they're laughing lazily. only if you force them will you hear the sound

21:32 * arrdem realizes that he has some idle cycles and precomputes values

21:32 arrdem: haha

21:32 brehaut: gfredericks: no need to be so strict

21:33 gfredericks: by "glaring at" of course I meant "forcing"

21:35 storme: (reduce + (range 16 128))

21:35 ,(reduce + (range 16 128))

21:36 clojurebot: 8008

21:36 storme: ,(/ (reduce + (range 19 173)) 11)

21:36 clojurebot: 1337

21:37 gfredericks: ,(take 5 (for [x (range) y (range x) :let [z (range y x) s (seq (str z))] :when (= s (reverse s))] [y x z]))

21:37 storme: ,(str (/ (reduce + (range 19 173)) 11) (reduce + (range 16 128)))

21:37 clojurebot: "13378008"

21:37 Execution Timed Out

21:37 storme: ,(str (/ (reduce + (range 19 173)) 11) " " (reduce + (range 16 128)))

21:37 clojurebot: "1337 8008"

21:37 gfredericks: ,(take 2 (for [x (range) y (range x) :let [z (range y x) s (seq (str z))] :when (= s (reverse s))] [y x z]))

21:37 clojurebot: Execution Timed Out

21:37 gfredericks: oh whops

21:38 ,(take 5 (for [x (range) y (range x) :let [z (reduce + (range y x)) s (seq (str z))] :when (= s (reverse s))] [y x z]))

21:38 clojurebot: ([0 1 0] [0 2 1] [1 2 1] [0 3 3] [1 3 3])

21:38 gfredericks: ,(take 5 (for [x (range) y (range x) :let [z (reduce + (range y x)) s (seq (str z))] :when (> z 10) :when (= s (reverse s))] [y x z]))

21:38 clojurebot: ([5 7 11] [4 8 22] [3 9 33] [2 10 44] [0 11 55])

21:38 amalloy: gfredericks: what on earth

21:38 gfredericks: storme made me wonder how often (range x y) is a palindrome :P

21:39 ,(take 5 (drop 50 (for [x (range) y (range x) :let [z (reduce + (range y x)) s (seq (str z))] :when (> z 10) :when (= s (reverse s))] [y x z])))

21:39 clojurebot: ([9 34 525] [33 34 33] [0 35 595] [1 35 595] [5 35 585])

21:39 storme: lol gfredericks

21:39 * rasmusto needs to stay on irc late more often

21:39 gfredericks: ,(take 5 (drop 50 (for [x (range) y (range 10 x) :let [z (reduce + (range y x)) s (seq (str z))] :when (> z 10) :when (= s (reverse s))] [y x z])))

21:39 clojurebot: ([31 45 525] [32 45 494] [44 45 44] [12 46 969] [34 46 474])

21:39 amalloy: ah, i see

21:39 gfredericks: ,(reduce + (range 34 46))

21:39 clojurebot: 474

21:40 gfredericks: ,(take 5 (drop 50 (for [x (range) y (range 10 x) :let [z (reduce + (range y x)) s (seq (str z))] :when (> z 1000) :when (= s (reverse s))] [y x z])))

21:40 clojurebot: ([53 102 3773] [80 102 1991] [74 103 2552] [27 104 5005] [16 106 5445])

21:40 gfredericks: ,(take 5 (drop 50 (for [x (range) y (range 10 x) :let [z (reduce + (range y x)) s (seq (str z))] :when (> z 10000) :when (= s (reverse s))] [y x z])))

21:40 clojurebot: ([91 192 14241] [85 194 15151] [26 197 18981] [50 197 18081] [86 197 15651])

21:40 gfredericks: so much math I'm making clojurebot do

21:40 storme: ,(:require [yokogiri.core :as html])

21:40 clojurebot: #<CompilerException java.lang.ClassNotFoundException: yokogiri.core, compiling:(NO_SOURCE_PATH:0:0)>

21:40 storme: is clojurebot open source?

21:41 arrdem: $source

21:41 lazybot: Source not found.

21:41 arrdem: ~source

21:41 gfredericks: $google clojurebot

21:41 lazybot: [hiredman/clojurebot · GitHub] https://github.com/hiredman/clojurebot

21:41 storme: ty

21:41 arrdem: clojurebot: source |is| $google clojurebot

21:42 gfredericks: ,(println "$google clojurebot")

21:42 clojurebot: $google clojurebot\n

21:42 arrdem: gfredericks: bots ignore each-other, remember?

21:42 storme: ,(println "I'm a bot")

21:42 clojurebot: I'm a bot\n

21:42 arrdem: well.. ours do.

21:42 rasmusto: ,(print "$google clojurebot")

21:42 clojurebot: $google clojurebot

21:42 rasmusto: ##(print "$google clojurebot")

21:42 lazybot: ⇒ $google clojurebotnil

21:42 storme: ,(println "$google clojurebot")

21:42 clojurebot: $google clojurebot\n

21:43 storme: ,(println "$google lazybot")

21:43 clojurebot: $google lazybot\n

21:43 arrdem: storme: what did I say about the bots ignoring each other...

21:43 storme: ah, missed that arrdem

22:26 amalloy: lazybot ignores clojurebot

22:26 but not vice versa, as i recall

22:26 &(symbol ",1")

22:26 lazybot: ⇒ ,1

22:27 amalloy: oh, right. he prefixes his output so that clojurebot doesn't interpret it

22:27 rasmusto: print a backspace character

22:40 xeqi: echo ,(println "&(+ 1 2)")

22:40 lazybot: ,(println "&(+ 1 2)")

22:40 clojurebot: &(+ 1 2)\n

23:19 gfredericks: $mail clojurebot ,(println "hello")

23:19 lazybot: Message saved.

23:19 gfredericks: $mail clojurebot ,(def sent true)

23:19 lazybot: Message saved.

23:20 gfredericks: ,sent

23:20 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sent in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:33 TimMc: gfredericks: clojurebot would have to ask for mail.

23:52 amalloy: oh my god. now lazybot is going to be /msging clojurebot all the time

23:52 i'm glad i added $unmail for admins

Logging service provided by n01se.net