#clojure log - Jun 16 2009

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

0:22 arohner: is there an api for an agent like call, where I don't care about the return value?

0:23 I just want to call a fn in another thread

0:39 hiredman: arohner: future

0:39 (.start (Thread. some-function))

0:39 etc

0:40 arohner: hiredman: thanks

1:07 sigh. I wrote my own shell functions before finding chouser's excellent c.c.shell-out

2:19 tbatchelli2: hi, does anyone here know how to obtain a function from a string? For example, I have a string "book", and I want to find the function #'user/book-controller. I found the following way, but looks too convoluted: (var-get (find-var (symbol "user" (str "book" "-controller"))))

2:22 hiredman: erm

2:23 vars dispatch .invoke to their contents

2:23 so you don't need the var-get

2:23 kotarak: Though, that might go away, IIRC.

2:23 hiredman: orly

2:24 :(

2:24 that would be very annoying

2:24 tbatchelli2: well, what I am trying to do is a form of introspection

2:24 hiredman: tbatchelli2: that's how it's done

2:25 tbatchelli2: ok... thanks! good to know :)

2:57 replaca: anyone here to remind a sleepy guy of the fastest way to do a counter (i.e. each time a get it i get the next int)?

2:58 called from different parts of the program, so stateful-ish

2:59 stuhood: atom and agent won't work... gotta try a ref?

3:00 replaca: why won't (swap! at inc) on an atom 'at' work?

3:00 am I missing something?

3:01 stuhood: you could replace any value that was already in the atom right? if you were decrementing

3:01 ah, no, nevermind.

3:01 replaca: yeah, i just want a mechanism to get an int that keeps increasing

3:02 basically, I want to put ids on things so I don't have to = the structures to see if they're the same

3:02 stuhood: yea, that should work, sorry about that

3:03 replaca: cool, thx

3:04 but thinking about it, what I really want is just to use identical? !

3:10 stuhood: haha, oops

3:11 also, clojure caches the hashes of structures, since they are immutable, so (=) might not be that terrible either

3:12 anyway, late for me too. sorry for the stupid advice =)

3:12 g'night

3:14 replaca: goodnight. thanks!

4:45 lowlycoder: what's a goodd database backend to use with clojure?

5:04 eleftherios: rys: pragmatic programmers responded to my emails, explaining in detail what the problem is with the epub and that they are at the mercy of the device for the code which they had to render in bitmap

5:04 but they are trying to resolve now

5:04 and their emails were nice this time

5:05 rys: Ah, that's great

5:05 eleftherios: so maybe we'll have an updated version soon, they are doing test chapters

5:05 with wrapped code

5:05 it is not ideal but may be better than truncated code

5:06 rys: I'll let you know :-)

5:06 rys: cheers, that's much appreciated :)

5:06 And that's reminded me to check if my local bookstore has the print copy yet

5:07 Nope, still waiting for stock :(

5:07 eleftherios: amazon doesn't either?

5:07 they are fast at delivering

5:09 rys: I could try amazon I guess

5:09 eleftherios: they even have next day delivery

6:47 eevar2: what lazy sequence operation would you use to encapsulate 'expanding' a sequence, e.g. factoring a number? -- i'm currently using loop + recur, which might not be 100% ideomatic clojure

6:51 achim: eevar2: can you give an example of how input and output of the operation are supposed to look like?

6:59 eevar2: achim: atm i'm doing something like this: (loop [output [] generator n]) .... (recur (conj ouput (expand(generator))) (- generator 1) )

7:00 jdz: looks very much like an infinite loop to me

7:00 eevar2: eventually (expand generator) returns []

7:01 jdz: oh, there are dots in there

7:03 eevar2: yea, silly pseudo code with errors

7:03 and a missing exit condition

7:06 Chousuke: eevar2: so wait, "output" will be a vector of what, some items?

7:07 eevar2: yup

7:07 achim: eevar2: that look much like (map expand (iterate dec n))

7:08 what do the dots do? do they affect output or generator?

7:08 Chousuke: iterate will go past 0 if you let it, though :)

7:08 achim: the loop will as well :)

7:08 Chousuke: good point :P

7:09 eevar2: never mind about that example code. i want to do (expand generator), collecting the output as a sequence until it returns []

7:10 Chousuke: is generator stateful somehow? :/

7:10 or does expand feed it different values?

7:11 achim: do you want a seq of generator, expand(generator), expand^2(generator), ... ?

7:11 eevar2: generator is actually a number that i'm factoring

7:11 Chousuke: ah

7:12 you want to factor a number, then factor what it returns until it returns "nothing"?

7:12 to get teh final factorisation

7:12 hmm

7:13 achim: (take-while (complement seq) (iterate expand generator)) or somethin like that?

7:13 (untested)

7:14 ah, nonsense, leave out the complement

7:15 eevar2: okies, so what i've been looking for is the 'iterate' function

7:49 Xcalibor: greetings

7:50 any example of how to construct as hash-map by parsing the lines of a very big file? should I rebind inside a (let [] )?

8:29 frodef: I'm trying to create a JTree with nodes, where each node is displayed by taking it's userobject's toString method.

8:30 ..how do I set up a userobject that both implements a suitable toString and another callback function?

8:30 jdz: proxy?

8:31 frodef: I can do e.g (proxy [Object] [] (toString [] "foo")), but then how would I add my own callback method/function/whatever?

8:31 just adding another method besides toString doesn't seem to work.

8:32 I guess the method has to be part of some interface?

8:32 jdz: yes

8:32 hoeck: frodef: you could create your own interface with gen-interface

8:32 frodef: I couldn't get gen-interface to work..

8:33 that is, proxy couldn't resolve the interface I tried to create.

8:33 hoeck: one drawback is, once created, the interface cannot change

8:33 cemerick: frodef: are you trying to implement an existing callback interface related to TreeNodes, or your own interface?

8:33 frodef: my own interface (just one simple callback method)

8:33 cemerick: frodef: Then you'll want to do something like (proxy [YourInterfaceName] [] ...)

8:33 Chouser: frodef: May I suggest AFn?

8:34 frodef: Chouser: That I proxy the AFn interface?

8:34 Chouser: (def myfoo (proxy [AFn] [] (toString [] "foo") (invoke [arg1] ...)))

8:34 right

8:34 then you can call the invoke method by doing: (myfoo 5)

8:35 hoeck: why not IFn?

8:35 frodef: Chouser: that was actually one thought I hadd too, but I didn't know what the name of the class was :) thanks.

8:35 ..so what's AFn vs. IFn?

8:35 Chouser: IFn is a pure interface, no implementation.

8:36 Xcalibor: re's... damned connection... sorry to ask again, but is there any example of how to construct as hash-map by parsing the lines of a very big file? should I rebind inside a (let [] )?

8:36 hoeck: what I'm always wondering is wether all those interfaces are actually part of the official clojure language or more or less implementation details

8:36 jdz: Xcalibor: conj?

8:36 Xcalibor: hoek: AFAIK and following the docs, it seems it's a part of the language itself

8:36 jdz conj, I'll have a look at it, thx!

8:36 Chouser: AFn is an abstract base class -- it'll throw arity exception if the wrong number of args are given and it'll support 'apply' calls automatically

8:37 jdz: Xcalibor: well, for a hash map you may want to look at assoc, too

8:37 Xcalibor: but i must confess i don't quite see what your problem is from the question as stated

8:37 Xcalibor: jdz: nod... assoc does what I want, but my trouble is with the new data

8:37 frodef: java.lang.RuntimeException: java.lang.Exception: Can't resolve: AFn (NO_SOURCE_FILE:359)

8:38 jdz: Xcalibor: assoc adds the new data

8:38 hoeck: frodef: clojure.lang.AFn, or import it first

8:38 jdz: Xcalibor: you just must use the returned value of assoc

8:38 Xcalibor: I have a huge CSV file and I have to construct a hash-map from parsing the file lines... trouble is I cannot load it all at once, so I have to go line-by-line and recreating the hash... that's why I was asking, considering they are inmutable...

8:39 AWizzArd: Xcalibor: put a ref on the hashmap then

8:39 Xcalibor: a ref...

8:39 AWizzArd: (def data (ref {}))

8:39 jdz: nah, no ref needed

8:39 frodef: hoeck: oh right, thanks.

8:39 cemerick: Xcalibor: to be clear, assoc doesn't *copy* the hash-map

8:39 Xcalibor: mmm... I don't yet know those...

8:40 jdz: just loop/recur all the lines and collect stuff in your hash map or whatever

8:40 Xcalibor: cemerick: nod, it adds the new data and returns a new hash-map with the old and new keys and values...

8:40 mattrepl: Xcalibor: (into {} (map #(re-split some-delimiter %) (line-seq some-reader))) doesn't work?

8:40 cemerick: Xcalibor: right, I just thought I'd mention it since you said "recreating the hash"...

8:41 Xcalibor: thing is, I am not supposed to (def myhash (assoc myhash :key val))

8:41 mattrepl: I haven't tried, to be true I didn't know that was even possible...

8:41 cemerick: right, you want to gather the data from each line into a hashmap, which mattrepl showed an example of above

8:42 Xcalibor: OK, I'll give it a try! I guess I won't be able to use read-lines from duck-streams, though

8:44 cemerick: Xcalibor: read-lines and line-seq are mostly interchangeable...

8:44 Xcalibor: cemerik: ah, cool... I'm testing right now

8:53 I have a small problem though: a sample line is: A;B;C how do I split it so Hashmap accepts the first entry as the key and the rest as a list or vector as a value?

8:54 Chouser: ,(seq (.split "A;B;C" ";" 2))

8:54 durka42: ~marco

8:55 (let [parts (.split "A;B;C" ";")] (assoc the-map (first parts) (next parts)))

8:55 Xcalibor: Chouser: ah, I see, seq allows me to limit the number of chunks it's splitted into... I can then split it further if needed...

8:56 durka42: no, seq is just for making it into something you can see at the REPL instead of an ugly java L[;String thing

8:56 (in this case)

8:58 * durka42 has to run

8:58 Chouser: Xcalibor: durka42 is right -- it's the String .split() method that takes a number limiting how much to split it.

9:01 Xcalibor: aha

9:04 well, it's proving something a little bit difficult, because into doesn't like my entries... I'll keep digging and let you know, brb

9:08 Chouser: (into {} foo) wants foo to be a seq of 2-item vectors, like: ([:a 1] [:b 2])

9:09 maybe (into {} (map #(vec (.split % ";" 2)) (line-seq myfile))

9:31 frodef: I have some dynamic bindings that (obviously) aren't visibile from the swing event thread.. is there some idiomatic way to deal with this?

9:33 Chouser: I think the normal route is to stuff the dynamic values you need into lexicals.

9:34 (let [foo *foo*] (Swing/invokeLater #(prn foo)))

9:35 something like that, to get the value of dynamic var *foo* (at the time the invocation is scheduled) and make it available for prn (or whatever) in the other thread.

9:35 will something like that work?

9:35 I've seen macros that bundle several values like this for you, but I'm not finding any of them at the moment.

9:39 Xcalibor: Chouser: ah, with that vector mapping it seems to work!

9:41 frodef: Chouser: sure, that works fine. Just a bit of a hassle.

9:41 thanks

9:48 Xcalibor: Chouser: it would be nice to be able to map into the vector the first and the rest of a full .split, though, so I don't have to process them afterwards

9:48 Chouser: you want the semi-separated second part to be in a vector?

9:48 {"A" ["B" "C"]} ?

9:51 Xcalibor: yup!

9:51 I am trying to get that inside the #(vec ) map but it's not working so far... insofar I need to evaluate the element twice: one for the first, and then a second time for the rest

9:52 Chouser: Xcalibor: (let [[k & v] (.split "A;B;C" ";")] [k (vec v)])

9:55 Xcalibor: ah, cool! I can use it inside that #() thing--- a reader macro, maybe?

9:55 Chouser: yes

9:56 Xcalibor: Chouser: nevertheless that works beatifully, thanks a lot!

9:56 Chouser: sure!

10:19 Chousuke: hmhm

10:20 improving the error messages for defn etc. seems to be not so trivial ;/

10:22 they all do treat their arguments similarly but they're defined separately so I have to duplicate the checks everywhere. and not all of clojure is available for all of them, which makes it fairly cumbersome. :P

10:22 maybe it'd be easier to define a checkless defn etc. first and then later redefine it using itself *with* the checks :P

10:37 Xcalibor: well, I am obviously obtuse today, but I don't seem to find a way to splice a list?

10:41 cemerick: ,(partition 3 (range 10))

10:41 hrm, no bot?

10:43 Xcalibor: lots of ways. partition, split-with, split-at, etc.

10:45 Xcalibor: cemerik: i see... off I go to read the docs, thx!

11:07 cemerick: map-invert should really be moved into clojure.core.

11:08 dnolen_: cemerick: what are you using that for?

11:08 cemerick: dnolen_: inverting maps ;-)

11:08 dnolen_: heh, i know

11:09 but what's a common case where you need to do that?

11:10 cemerick: when you have a bunch of values A that can be associated with some set of keys B, and you want to be able to quickly answer queries like "which elements are associated with key X" and "what key is associated with value Y".

11:10 visualization of overlapping datasets, in my current specific case

11:10 opqdonut: (float-array x y) doesn't create a real two-dimensional array?

11:11 stuartsierra: Java doesn't have "real" 2-d arrays.

11:11 dnolen_: opqdonut: and you should avoid them, dereferencing them is dog slow.

11:11 opqdonut: well, i gotta do what the api tells me

11:11 dnolen_: cemerick: aww, nice.

11:12 opqdonut: (make-array (. Float TYPE) x y) works

11:12 cemerick: heh, I don't think there is such a thing as "real" 2D arrays, given computer architectures over the past 50 years or so. :-P

11:12 stuartsierra: What you're getting there is an array of pointers to arrays, not a 2-d array.

11:12 dnolen_: opqdonut: gotcha, you need to talk to a specific Java interface.

11:13 stuartsierra: oh, I see

11:13 stuhood: opqdonut: (make-array Float x y) should do the same thing

11:13 cemerick: opqdonut: you definitely want make-array -- float-array (and it's cousins) use the second value as an initial value, not an additional dimension.

11:14 stuhood: nope, Float gives you Float[][] -- Float/TYPE gives you float[][]

11:14 stuhood: cemerick: oo, thanks.

11:15 cemerick: yeah, array type params don't get unboxed on the way out.

11:15 e.g. Float -> float, but Float[] -/> float[]

11:16 DTrejo: good morning guys

11:16 could someone tell me how I might get this to work? http://mibbit.com/pb/Ynef2e

11:17 thanks

11:20 achim: DTrejo: works for me - did you try this in a fresh REPL?

11:21 cemerick: DTrejo: works here too -- also, you might want to look at only the first 20 values (using (take 20 fibs)) rather than println, which will print forever.

11:21 Chouser: cemerick: right, because float is not an Object, but float[] is.

11:21 opqdonut: cemerick: ahhhhh

11:21 i misread the docs

11:23 achim: DTrejo: what does it say if you just enter "println" and hit enter? (no parentheses)

11:23 DTrejo: achim: I'll play around with it some more

11:23 cemerick: huh, I've actually never seen a fibonacci impl like that :-)

11:23 DTrejo: its from the programming clojure book

11:24 cemerick: Mine hasn't arrived yet.

11:24 DTrejo: achim: it crashes my repl

11:24 so pitiful :(

11:25 achim: DTrejo: might it be that you accidentally redefined println?

11:25 DTrejo: well, what you see in the pastebin is all the code in that file

11:26 is there some way to accidentally redefine println from outside of that file or something?

11:27 cemerick: you'd have to do something like (defn println ...)

11:27 Chouser: but that won't do anything harmful unless you're in the core namespace, which is an odd place to be.

11:27 DTrejo: oh I didnt do that, so that's not it I don't think

11:27 cemerick: DTrejo: just out of curiosity, what is the value of *clojure-version*?

11:28 Chouser: DTrejo: can you paste the stack trace you get when you try println with no parens?

11:28 DTrejo: to print the version: (println clojure-version) ?

11:29 cemerick: just *clojure-version* will do

11:29 including the asterisks

11:30 DTrejo: it tells me it is not defined: "1:2 user=> java.lang.Exception: Unable to resolve symbol: *clojure-version* in this context (repl-1:1)"

11:30 cemerick: DTrejo: sounds like you have an old version....

11:30 Chouser: DTrejo: that means pre-1.0. Where/when did you get it?

11:30 DTrejo: that would be a problem hmm

11:30 cemerick: ah, which would explain the classcastexception

11:31 (wasn't lazy-cat a mapcat in early lazy impls?)

11:34 DTrejo: thanks for the help, now i'll try and download a new version of clojure

11:35 should I download 1.0 or go for the latest release?

11:36 Clojure release 20090320

11:36 Chousuke: 1.0 is latest.

11:37 but, hmm

11:37 DTrejo: I

11:38 Chousuke: now I managed to get argument checking for fn a bit nicer

11:38 DTrejo: I'd rather not be cutting edge

11:38 Chousuke: user=> (fn ([] 1) foo)

11:38 java.lang.IllegalArgumentException: Malformed arguments. Expected: a function overload of the form ([params*] body-exprs*); got: foo (NO_SOURCE_FILE:0)

11:38 DTrejo: so if I stick with 1.0 I will be fine Chousuke ?

11:38 Chousuke: yeah

11:39 it's the latest release :)

11:43 DTrejo: how do you guys recommend I go about learning clojure?

11:43 Chouser: DTrejo: did you say you had the book already?

11:43 DTrejo: I do, but it is not the latest version

11:44 Xcalibor: well, gotta go.. thanks for all, it's working around nicely :-)

11:44 laters!

11:44 Chousuke: http://java.ociweb.com/mark/clojure/

11:44 DTrejo: it's probably a good idea to keep going thru the book, but if there was anything else I could do

11:45 Chousuke: the LONG article is a fairly good introducion

11:45 +t

11:45 la_mer: DTrejo: The book is current through v1.0...definitely the place to start, if you like books.

11:46 * la_mer really needs to figure out how to permanently get rid of this handle

11:47 DTrejo: thanks Chousuke

11:49 I downloaded 1.0, but I wonder if I need to update my clojure-contrib.jar as well?

11:49 Chouser: DTrejo: possibly, depending on how old it is.

11:50 DTrejo: I don't see it here: http://code.google.com/p/clojure/downloads/list

11:50 la_mer: DTrejo: I would. FYI, svn rev 756 is the one that corresponds with clojure v1.0

11:50 DTrejo: oh wow I noticed the version I have is .2

11:50 so yea I probably need a r756

11:52 Chousuke: clojure-contrib is still only available from git/SVN

11:52 xcalibor: re's... that was short :-)

11:53 Chousuke: hm. apparently contrib's not at git yet after all

11:54 DTrejo: I hate all this configuration braindeath

11:54 xcalibor: Chousuke, I got to get it grom svn just last night

11:54 DTrejo: and I have to remember it's not even bad compared to regular lisp

11:55 cemerick: DTrejo: it really should be as easy as grabbing clojure v1.0 and putting it in your classpath...

11:55 Chouser: we should have a .jar with clojure 1.0 and contrib together.

11:56 stuartsierra: yes

11:56 cemerick: it seems that, once c-c moves to git, the clojure mainline should be added as a submodule, and the c-c build process made to spit out a bare c-c.jar and a clj+c-c.jar

11:57 Chouser: clojure 1.0 is a zip not a jar, right? Do we know why that is?

11:57 Chousuke: Who will maintain a 1.0 branch of contrib? :P

11:58 Chouser: cemerick: most people who clone contrib already have clojure, don't they?

11:58 xcalibor: how do I specify a reverse sort-by? because (sort-by (fn [x] (last x)) '([:a 2] [:b 1])) returns ([:b 1] [:a 2]) as expected...

11:58 DTrejo: cemerick: so I won't have a problem with a really old version of clojure contrib with my clojure jar at version 1.0?

11:58 Chouser: Chousuke: the same people who maintain clojure 1.0 branch.

11:58 Chousuke: is someone actually maintaining it? :D

11:58 cemerick: DTrejo: no, you definitely want to upgrade clojure contrib, if you're using it.

11:58 DTrejo: kk

11:58 Chouser: Chousuke: is it broken?

11:59 cemerick: Chouser: well, c-c needs clj for a proper build anyway, so adding the latter as a submodule is appropriate.

11:59 Chouser: if not, I say it's "maintained" at least at the moment.

12:00 Chousuke: cemerick: but then you might end up with two clojure clones :/

12:00 cemerick: or your clojure clone will be a subdir under clojure-contrib.

12:01 I think it

12:01 cemerick: Chousuke: that's bad?

12:01 Chousuke: it's too complicated to be worth it. :/

12:01 cemerick: *everyone* uses c-c, and it needs a clojure jar to be built properly. Seems like that process should be as straightforward as possible.

12:02 Chousuke: they could also not want a clone at all, instead they would use a downloaded clojure jar

12:02 cemerick: well, it's TBD how and where a "unified" clojure+c-c jar file is being produced, then.

12:03 DTrejo: so there's no easy way at the moment to get both at once?

12:03 Chouser: Well, Wrexsoul doesn't use contrib.

12:03 Chousuke: DTrejo: there's the clojure box for windows :P

12:03 cemerick: DTrejo: not in one jar file, no. Two jar files aren't a big deal, though IMO :-)

12:04 DTrejo: oh I just meant download them both, not necessarily as one file. But I i'll look into clojure box now, since it probably has both jars that I need

12:05 technomancy: so who wants to write a dependency injection library for Clojure?

12:05 * technomancy snickers

12:06 Chouser: technomancy: well, I don't want to use bleeding edge contrib code, so I'm just going to use snippets of public domain code from the google group.

12:06 cemerick: technomancy: waitaminute -- we've got to haggle about guice vs. spring first! :-P

12:07 technomancy: maybe we could implement it using a library that provides M-expressions

12:07 so newbies will want to use it

12:08 sorry.

12:08 I'm done.

12:11 DTrejo: alright, I guess I'm switching to use clojure box now, just gotta get over the emacs learning curve hehe

12:11 xcalibor: mmm... sort-by uses a Collator... how do I create one to do a reverse sort on a numerical vector, for example?

12:13 Chouser: ,(sort #(compare (last %2) (last %1)) '([:a 2] [:b 1]))

12:13 DTrejo: arg I'm already overwhelmed :(

12:13 Chouser: DTrejo: I wouldn't recommend trying emacs just to avoid fetching contrib yourself.

12:14 DTrejo: lol

12:14 gnuvince: user=> (sort #(compare (count %1) (count %2)) ["aaa" "bb" "c"])

12:14 ("c" "bb" "aaa")

12:14 xcalibor: ah, that was just cool, Chouser... thanks a bunch!

12:15 gnuvince, thanks, I see... I'll have to study #() carefully to understand that, though :-P

12:15 gnuvince: xcalibor: oh sorry. (fn [a b] (compare (count b) (count a))) is equivalent

12:15 Chouser: (sort-by count ["aaa" "bb" "c"]) ==> ("c" "bb" "aaa")

12:15 gnuvince: #() is syntactic sugar for anonymous functions that I happen to use probably too often.

12:16 xcalibor: gnuvince, #() is just a lambda?

12:16 Chouser: I miss clojurebot

12:16 gnuvince: #(print %) => (fn [x] (print x))

12:16 xcalibor: no, I have already met it, it's my fault for not understanding it by then :-)

12:16 cool, very useful, thanks

12:16 gnuvince: you can use %1, %2, etc. to refer to multiple parameters.

12:16 xcalibor: beware that #() do not nest.

12:17 Chouser: who took him offline?

12:17 xcalibor: I see... well, most of the time it will be for things like these anyway... and you can put a proper lambda inside, right?

12:17 gnuvince: Yes

12:17 Chouser: xcalibor: also beware that #([1 2 3]) is not (fn [] [1 2 3])

12:18 gnuvince: dunno, I assume he died of natural causes and hiredman hasn't noticed yet.

12:18 gnuvince: Chouser: ok

12:19 xcalibor: Chouser: I see... thanks, I'll try to remember :-)

12:23 OK, now I understand it, cool :-)

12:23 thanks a bunch, guys... laters!

12:24 DTrejo: have a good day guys, thanks for the help

12:37 mib_xusidq: ,(use 'clojure.contrib.repl-utils :only '(source))

12:40 clojurebot: where are you?

12:41 jkantz: I've used maven to simplify dependency management

12:41 have a look at http://github.com/kantzhub/clojure2go

12:41 Chousuke: urgh.

12:41 jkantz: what would be nice if clojure and contrib were in maven repo

12:42 technomancy: jkantz: clojure is on the list

12:42 but it moves slowly

12:42 Chousuke: I have an idea for improving destructure but its current implementation makes my brain hurt.

12:42 jkantz: cool is it clojure 1.0?

12:42 technomancy: jkantz: contrib hasn't seen an official release yet, so it hasn't been submitted

12:42 yes

12:42 jkantz: also: I've been working on my own little deps management tool that wraps maven: http://github.com/technomancy/corkscrew

12:42 duck1123: Maven works great if all the deps you need are in a repository

12:43 horribly if not

12:43 jkantz: easy enough to install a jar locally

12:43 stuartsierra: Can't you create a "local" repository?

12:43 technomancy: duck1123: that's why corkscrew also lets you install out of a git or svn repository.

12:43 duck1123: technomancy: did you get the maven integration working yet?

12:43 technomancy: duck1123: no! I'm stuck on one tiny little showstopper that's driving me nuts.

12:43 you can't use the MavenCli class out of the box because it needs to be run out of a plexus component repository

12:44 I have no idea what that means.

12:44 but I've been banging my head against that for quite some time now.

12:44 so... if anyone knows how plexus works I would be grateful for some help

12:44 duck1123: It was driving me nuts the other day trying to build a clojure:repl goal for the clojure-maven-plugin

12:45 it shouldn't be this hard to simply run a program from java with the in/out bound properly

12:45 I gave up and switched to better things

12:46 technomancy: yeah, I've tabled it until I can get a lead on how that stuff works.

12:46 the documentation is incomprehensible

12:46 jkantz: yeah maven is a bit of a swamp

12:47 technomancy: the plexus documentation assumes you are familiar with the problem it's designed to solve, but I can't even understand what the problem is because I don't use crap languages that are prone to it.

12:47 cemerick: jkantz: hrm, that's generous :-)

12:49 technomancy: so any help (hint, hint) would be awesome. I don't think it's particularly tricky once you understand what's going on.

12:52 jkantz: technomancy, corkscrew looks neat, will have to take a closer sometime soon

12:53 mib_xusidq: trying to build clojure, I get this: file:C:/clojure/build.xml:1: Unexpected attribute "xmlns:mvn"

12:53 do I just need a newer Ant?

12:54 or do I need Maven?

12:54 technomancy: jkantz: it currently works fine (for an alpha) as long as you're OK with launching mvn as a subprocess with shell-out instead of using it in the same VM.

12:54 but that's super-lame

12:56 jkantz: poll: what editors do people use?

12:56 technomancy: emacs

12:58 mib_xusidq: jkantz: do you have a statistically significant result yet? ;)

12:59 duck1123: technomancy: do you keep your source in src/ or src/main/clojure/

12:59 100% of clojure users use emacs (+- 99.99%)

12:59 stuartsierra: emacs

13:00 liebke: vim

13:00 jkantz: you can get a programmer to try a new language, but ask him/her to switch editors ...

13:00 cemerick: enclojure

13:01 gnuvince: emacs

13:01 technomancy: duck1123: just src

13:01 duck1123: I don't get paid by the directory.

13:04 duck1123: technomancy: you should make your src locations customizable in your el files.

13:04 technomancy: duck1123: which elisp library in particular?

13:05 duck1123: corkscrew and clojure-test-mode are the two I've come across

13:07 Chousuke: ,(destructure '[[x y] [1 2]])

13:07 hm

13:07 where did clojurebot go :(

13:09 gnuvince: NPE I imagine

13:09 ;)

13:10 Chousuke: behold my new and improved destructure! first, the old:

13:10 (destructure '[[x [y z]] [1 [(int 2) [c]]]])

13:10 [vec__10 [1 [(int 2) [c]]] x (clojure.core/nth vec__10 0 nil) vec__11 (clojure.core/nth vec__10 1 nil) y (clojure.core/nth vec__11 0 nil) z (clojure.core/nth vec__11 1 nil)]

13:10 (destructure '[[x [y z]] [1 [(int 2) [c]]]])

13:10 [x 1 y (int 2) z [c]]

13:10 :)

13:10 though there's a slight problem still.

13:11 rhickey: hrm, Assembla supports only edit or view rights for various subsystems including tickets, kind of a pain vs gcode where non-members could only enter/view/comment on tickets

13:11 I'm concerned about gicing non-members full edit rights...

13:12 giving

13:12 gnuvince: Chousuke: does it work with non-vector collections such as lists?

13:12 rhickey: http://forum.assembla.com/forums/3-Bug-reports/topics/1500-Non-members-can-make-themselves-watchers?page=1#posts-4775

13:12 Chousuke: gnuvince: not yet

13:12 duck1123: rhickey: you don't want bug reports about viagra?

13:12 gnuvince: Chousuke: ok

13:13 Cool work though

13:13 rhickey: duck1123: no thanks, actually that was never a problem on gcode, but with full edit rights people could change status, assign, close etc

13:13 gnuvince: Chousuke: will you put it on github (*snif*)?

13:13 rhickey: those things are for the people doing the work

13:14 Chousuke: gnuvince: I guess I could. not yet though. I still need to make it not break when you do (let [[x y] [1]] ...) :)

13:14 gnuvince: Chousuke: cool

13:14 Chousuke: rest params will be a problem too. :P

13:14 gnuvince: Keep me appraised; I used manual vector dereferencing in my starcraft lib because it performs better, but this would be better

13:16 Chousuke: I think the performance difference comes mostly from the fact that the three-parameter version of 'nth is not inlined :/

13:17 duck1123: does anyone know why imenu is picking up the newline after my function names as part of the name?

13:17 anyone here using imenu for clojure code?

13:18 technomancy: duck1123: yeah... suspect a bug in clojure-def-regexp

13:20 Chouser: rhickey: What does assembla's bug tracker do better than gcode?

13:20 technomancy: duck1123: I may have only tested it for functions that have args on the same line as the def, in which case it works fine.

13:21 patches welcome. =)

13:22 duck1123: regex is arcane enough, why did emacs have to make it that much harder

13:22 gnuvince: duck1123: why did Perl have to make it that much easier?

13:22 technomancy: might have something to do with the fact that its implementation pretty much older than time itself. =)

13:23 gnuvince: duck1123: Emacs' regex implementation pre-dates what is considered mainstream nowadays

13:24 herdrick: hello all, i have a question about clojure swank

13:24 i'm getting OutOfMemoryError in the REPL so I need to change my Java heap space

13:24 I'm not seeing where the invocation to 'java' is

13:24 technomancy: ,dv swank-clojure-extra-vm-args

13:25 oops... there's no fsbot here.

13:25 herdrick: technomancy: thanks!

13:25 i can probably find it with that alone on Google, yes?

13:25 technomancy: herdrick: better to use C-h v from within Emacs

13:25 but yeah

13:25 herdrick: this perhaps will work: http://paste.lisp.org/display/71211

13:26 oh, ok

13:26 technomancy: herdrick: clojure-slime-config from clojure-mode will do most of that setup for you

13:27 herdrick: i do use closure-slime-config in my .emacs file

13:27 but you're saying i should invoke it again now?

13:27 technomancy: no, I mean half the stuff in your paste is already done for you by that function

13:27 herdrick: oh, all right thanks

13:28 rhickey: Chouser: hopefully not stink! It's much richer and works with the milestone system

13:28 technomancy: herdrick: also, if you have the clojure-auto file, you've probably got a pretty old version of clojure-mode; that file is no longer necessary in recent versions

13:28 herdrick: looks like the C-h v , swank-clojure-extra-vm-args is going to do the trick for me

13:28 technomancy: yeah, I noticed that

13:29 i got rid of mine

13:29 have a brand new install now

13:29 technomancy: herdrick: also, do you know about M-x clojure-install?

13:30 it looks like you've already done the work of the installation, but next time that should be able to automate it for you

13:30 herdrick: technomancy: yep, that's how I installed it this time

13:30 technomancy: oh, ok

13:30 herdrick: sorry, that paste is not from me

13:30 technomancy: oh, that explains it. =)

13:30 herdrick: it was the first result for Googling swank-clojure-extra-vm-args

13:30 yeah, :)

13:32 dysinger: I don't use the clojure-install method

13:32 it didn't work for me and also I already had those projects in different dirs.

13:32 so I just came up with my own .emacs black

13:32 block

13:33 by looking at what clojure-install function does

13:33 rhickey: Chouser: I never felt like gcode's tickets was appropriate for features, ok for bugfixes. I think assembla has more tools for planning, stories, milestones etc

13:34 Chouser: ah, ok.

13:34 rhickey: both seem to have an appalling lack of 'sort by last activity'

13:35 dysinger: mine looks like this herdrick http://paste.lisp.org/display/81938

13:36 Chousuke: gnuvince: http://github.com/Chousuke/clojure/tree/simple-destructure ... I make no guarantee that it works at all. It seems to, though.

13:36 gnuvince: oh, it's not a separate lib

13:37 hmmm

13:37 weird: I can't see beyond line 1908 of core.clj

13:37 herdrick: dysinger: ok, thanks. the clojure-install is working well for me so far, though

13:37 dysinger: ok good

13:38 herdrick: dysinger: slime-fancy sounds interesting tho. with a name like that...

13:38 Chousuke: oh crap

13:38 repl error :P

13:38 apparently using defn- wasn't allowed ;(

13:39 technomancy: herdrick: slime-fancy is just a module that loads "a whole bunch of stuff outside core slime"

13:39 duck1123: technomancy: you have a pull request

13:40 technomancy: cool

13:40 herdrick: technomancy: thanks

13:41 Chousuke: should at least compile-test my edits I suppose :P

13:47 the more difficult task is to extend that to support &, :as and map destructuring :P

13:48 rhickey: ... your import for clojure-contrib has completed. http://github.com/richhickey/clojure-contrib/tree/master

13:53 technomancy: already to the #1 forked and #1 watched Java project; not bad: http://github.com/languages/Java

13:55 cemerick: well, this week, anyway. We'll see how things stack up over time.

13:55 (though I'm hoping, of course)

13:58 Chousuke: Clojure is still 83% java? that's scary.

13:59 replaca: Chousuke: that's measured by LoC

13:59 Chousuke: yeah

13:59 replaca: I assume

13:59 Chousuke: scary.

13:59 duck1123: the kevinoneill version is among the most watched overall

13:59 replaca: If we assume clojure code is twice as dense, that would change the equation substantially

14:00 cemerick: Java is almost 100% java :-P

14:00 (my snarky way of saying, hey, it works!)

14:01 Chousuke: the target, of course, is to have Clojure be 100% Clojure :)

14:02 dnolen: heh I thought 90% was rhickey's goal.

14:02 Chousuke: Not ambitious enough!

14:02 cemerick: yeah, definitely a good goal, but I wouldn't say the current state is scary

14:03 dnolen: cemerick: it's nice to see that Clojure the language is so small.

14:03 duck1123: wouldn't you have to have at least something written in another language to bootstrap it if you didn't have another version of clojure to compile with?

14:03 dnolen: looks like Monday is the big day for rhickey's commits

14:03 http://github.com/richhickey/clojure/graphs/punch_card

14:04 eevar_: yay, contrib is out on github as well now

14:04 cemerick: heh, a lot of people have complained about how large clojure's core is (w.r.t. # of special forms)

14:04 replaca: I'm glad I fixed the typo in my last commit comment last night before pushing :-).

14:08 eevar_: btw. isn't it common for the /test to lie alongside /src?

14:08 stuartsierra: In Java-land, it is common.

14:09 Chousuke: cemerick: most of the special forms are java interop anyway :P

14:10 cemerick: oh, I know, but some of the rabble don't like that. *shrug*

14:10 rhickey: cemerick: most of the complaints are about the reader stuff, there aren't many special forms

14:11 replaca: dnolen: That shows that rhickey isn't a *real* hacker. Real hackers have the majority of their checkins between midnight and 6AM :-)

14:11 cemerick: rhickey: I got an earful from some people @ ILC about try/catch/finally in particular.

14:12 rhickey: cemerick: ok

14:12 cemerick: They (unsurprisingly) thought interop is irrelevant, and something like restarts and such should have been bolted in.

14:13 mrsolo: clojure core is large?

14:17 slashus2: cemerick: What did they say about try catch finally? Was it because it is a special form?

14:18 cemerick: slashus2: yes -- a wart inherited from Java, in their opinion.

14:18 They were certainly coming from a very particular perspective, of course.

14:24 duck1123: it's not like you have to use them

14:24 mrsolo: well for me java interop is the primary reason that i have picked clojure over others

14:24 duck1123: thank god Clojure doesn't have checked exceptions

14:24 Chouser: mrsolo: you're by no means alone.

14:25 but people at a lisp conference are unlikely to care much about java, interop or otherwise.

14:28 hiredman: http://groups.google.com/group/comp.lang.lisp/msg/a86c91091ae16970 <-- zing!

14:29 rhickey: hiredman: did that seem too harsh?

14:30 hiredman: not too harsh

14:30 mrsolo: not at all.. he was trolling imho

14:31 rzoom_: nj to rhickey on that

14:32 liebke: rhickey: it was a good explanation of the objectives of the ants simulation too

14:32 cemerick: rhickey: I'm really surprised your responded at all, actually

14:34 duck1123: is c.l.l worth reading for someone into clojure, but not that concerned with CL or others?

14:35 technomancy: only if you like fireworks

14:35 rhickey: cemerick: I just couldn't let it go, leaving people thinking STM code can easily be replaced with locks. There's a reason the ants demo hasn't been reproduced thus far

14:35 cemerick: duck1123: it's a very toxic forum, IMO

14:35 rhickey: duck1123: no, it really is a Common Lisp crowd

14:35 hiredman: duck1123: c.l.l is icky

14:36 cemerick: #scheme is a decent place to be in, as *most* of the people there are level-headed, but there's a lot of demagoguery there as well compared to here

14:36 * technomancy remembers the guy who posted the CL equivalent of rm -rf to a newbie in c.l.l

14:36 * mrsolo hates language nazi

14:36 cemerick: (maybe there's anti-demagoguery demagoguery here?)

14:36 baetis-fly: technomancy: wasn't that the same guy?

14:36 technomancy: baetis-fly: I get all the different Pascals confused.

14:37 baetis-fly: technomancy: ah, perhaps I am as well.

14:37 cemerick: rhickey: I totally understand. Of course, there's always people wrong on the internet, and only one of you (or ~100 of us, perhaps) :-)

14:37 hiredman: I could see rhickey not responding if it just an email about clojure, but ants is a great demo, and his "port" just did not cut it

14:37 technomancy: hiredman: especially since it would be easy for someone to glance at the CL version without realizing its shortcomings.

14:40 anyway if I were named after a procedural language I would probably be pretty grumpy too.

14:41 baetis-fly: for the record, different Pascal.

14:42 rsynnott: oh, #lisp isn't that bad these days, anyway

14:42 (about half the people on c.l.l are actually insane, though)

14:43 mrsolo: well there is a way to do ant demo without lock at all right?

14:44 cemerick: well, as rhickey pointed out, the objective is to do more than just draw stuff on the screen

14:44 mrsolo: right

14:44 duck1123: it would be interesting to see what the CL version would look like now that Rich has clearly stated what any port of the ants demo would need to be able to acomplish to be considered valid.

14:45 duncanm: anyone good with git here?

14:45 cemerick: you'd end up writing a bad, custom STM impl, I'd think

14:45 technomancy: duncanm: we're all learning, these days. =)

14:45 what's the question?

14:45 mrsolo: i am just saying that cl version doesnt' do it that way, still use lock

14:45 duncanm: technomancy: i'm 10+ commits past origin/master on my own master branch

14:46 technomancy: i'd like to branch my own changes to its own branch, and keep master tracking origin/master

14:46 Chousuke: you want to move that to its own branch?

14:46 duncanm: right

14:46 Chousuke: easy.

14:46 technomancy: oh, that _is_ bad. I hope you saved. (http://www.penny-arcade.com/comic/2006/12/20/)

14:46 (just kidding)

14:46 duncanm: i've been switching back and forth between git and hg, so now i'm all confused

14:46 i think i know how to do that in hg, maybe

14:46 rsynnott: cemerick: there are a few cl implementations of software transactional memory, though not sure how good they are

14:47 duncanm: Chousuke: what's the trick?

14:47 Chousuke: git co -b changes; git co master; git reset origin/master; should do it.

14:47 assuming no uncommitted changes.

14:48 and the reset is "safe" in that it won't throw away work. use --hard to actually throw away the commits from master after you've verified they're in the changes branch

14:48 (with reset that is)

14:48 also, co = checkout

14:48 * Chousuke keeps forgetting that's not a standard git alias

14:48 duck1123: use "gitk --all" if you like working with a gui

14:50 duncanm: perfect

14:52 * Chousuke wonders why git config --global alias.co "checkout" is not done by default

15:38 Chouser: Nice! Looks like assembla watches github commits to update ticket status: http://www.assembla.com/spaces/clojure-contrib/github_tool

15:51 rhickey: Chouser: yup

15:52 there are some magic word we can use to associate commits with tickets

15:54 Chouser: also, looks like the support tool is just the ticket for non-member participation

16:42 vika23: hello , i can't seem to get function "get-connection" in clojure.contrib.sql to work ,repl refuses to recognize it ,any help appreciated

16:43 rhickey: contrib github repo seem ok?

16:44 Chousuke: no problems so far.

16:44 stuartsierra: So can all contrib members push to the github repo?

16:45 rhickey: stuartsierra: should be yes, only 8 have given me their github ids

16:45 4 missing

16:47 replaca: but we need pics of the contributors, too :-)

16:47 Chouser: oh, is there a list somewhere?

16:47 I haven't been able to find one on the github project.

16:47 rhickey: maybe only on the admin page

16:47 Chouser: hm. seems odd.

16:47 rhickey: yes

16:48 replaca: rhickey, Chouser yeah, I was looking for that on the rails project the other day and couldn't find the list there either

16:52 achim: vika23: get-connection is an internal function, with-connection is the public variant. if you really need get-connection, you'll have to use/require clojure.contrib.sql.internal

16:53 mstevens: hello!

16:54 achim: vika23: note that you can use connection and find-connection inside the with-connection body to get hold of the connection handle

16:54 replaca: mstevens: good afternoon

16:54 * mstevens has been reading Programming Clojure and I thought I'd check out the irc channel.

16:55 replaca: mstevens: you'll find it's a friendly place

16:55 mstevens: replaca: nearly everything on freenode seems to be.

16:55 stuartsierra: Where everybody knows your name...

16:55 replaca: stuartsierra: I grew up aroud the block from that bar :-)

16:56 *around

16:56 vika23: achim: great! thanks

16:56 Chouser: mstevens: glad to hear you've had such positive experiences.

16:56 * mstevens is very impressed with what I've seen of clojure so far, although I could wish for more documentation.

16:57 Chousuke: Everyone wishes for that :)

16:57 Chouser: I was hoping the book was sufficient.

16:58 stuartsierra: Documentation is like sex. Even when it's bad, it's still better than nothing. And everybody wants more of it.

16:58 mstevens: Chosuke: well it seems to be happening! So I can't complain too much.

16:58 Chousuke: http://java.ociweb.com/mark/clojure/ I'll keep spamming this link forever to newbies

16:59 might be a bit redundant if you have the book, but nice anywya

16:59 anyway*

16:59 dnolen: mstevens: hanging out here is the best way to educate yourself on Clojure. also, it's better place to get a sense of what is going with the project. BDFL has good presence here, not such much on the Mailing List.

17:00 cemerick: is BDFL really rhickey's title? Seems like we should have something original :-)

17:00 Chouser: also, no better way to get the basics down well than to anwser the same questions several times.

17:01 rys: EHDFL :p

17:01 epic-haired > benevolent

17:02 mstevens: STM looked much cooler than I expected

17:05 ccmtaylor: \openany % keine Leerseiten

17:05 mstevens: Chousuke: I saw the snake game in the book :)

17:05 ccmtaylor: whoops, wrong buffer ;)

17:06 \openany % keine Leerseiten

17:06 Chousuke: :p

17:06 ccmtaylor: d'oh. thats what you get from using a new .emacs.d

17:06 M-V didn't used to be paste

17:14 openany % keine Leerseiten

17:15 Chousuke: Today I reaffirmed my opinion that FP is the Right Way to do things :) I was tweaking destructure, which is quite a complex beast; but then I realised I didn't have to care about the complexity. I simply added a special case to the cond statement of the main destructure worker function and wrote my special-case logic in the most straightforward way possible, recursively calling

17:15 the worker function to handle the complex stuff. It actually compiled and ran correctly for simple inputs on the first try :P

17:16 after a few more tweaks I got it working for even rather complicated inputs.

17:17 I'm quite certain that if destructure were in any way stateful I wouldn't have been able to pull this off :P

17:17 Chouser: Chousuke: yes, it's amazing how much you can do while understanding only a small part of the code.

17:18 like algebra

17:20 * mstevens has been increasingly learning to hate state in the java world

17:21 Chousuke: state is like a global variable that everyone has unrestricted access to.

17:21 dnolen: mstevens: or the imperative world period. recently I was horrified by the fact, in a Python interactive session, that almost all Python list operations are mutate the original list and return nothing.

17:22 Chousuke: you just need to know how your code affects it, or things will break

17:22 mstevens: Well I've just been noticing how many java bugs I get from invalid state, and how much immutable objects can simplify things.

17:23 I'm occasionally tempted to make everything in java "final" by default, but it's not java-ish.

17:30 Chousuke: It's also much more fun.

17:31 "No way this will work" "oh. it does."

17:32 mstevens: Chousuke: that was one thing I noticed with the book, everything's weirdly general

17:33 Chousuke: Many of the small things together in clojure are what make it so neat.

17:36 there's destructuring, syntax-quote+let feature, maps/keywords/sets/vectors as functions, using vectors for syntax. then there's the similarity between STM functions like send, alter, swap! etc.

17:36 Xcalibor: greetings

17:37 mstevens: hello

17:37 Chousuke: all kinds of small things that you might not notice that together contribute a lot to the language

17:38 Xcalibor: may I ask for some wisdom on clojure.fu? I have a huge hash-map with names, and a long list of names to match (using Damerau-Levenshtein distance)... I'd like to be able to lauch several concurrent searches at the same time... which strategy would be better to acomplish this?

17:39 Chousuke: hmm

17:39 mstevens: my first answer would be java.util.concurrent, but that's not very clojure-ish I suspect

17:40 <- java person who snuck in

17:40 Chouser: Xcalibor: you need to do a distance func on every combination of hash-map-key to name-list-item?

17:41 ataggart: out of curiosity, what practical application does this have?

17:42 Xcalibor: Chouser: not really... I have a list of names to match on the huge list, and I have a metric where I can cut the calculation once I have a 100% match or I may need to collect those that match over the, say, 90%

17:42 * mstevens gets nostalgic, I wrote something in java once years ago to use edit distance to try to spot reposted job adverts.

17:42 mstevens: Didn't work very well though

17:42 Chousuke: Xcalibor: first I guess you should partition the huge list.

17:43 tashafa: Hello!

17:43 Xcalibor: ataggart: I am trying to integrate a unix passwd file over an existent LDAP, so I have to discover which users may already exist on the LDAP, or otherwise tell them to create an LDAP account, so I can put 'em all using PAM_LDAP

17:43 tashafa: (doc doto)

17:43 ,(doc doto)

17:43 Chousuke: clojurebot is offline :(

17:43 tashafa: :'(

17:44 hiredman: :(

17:45 Xcalibor: I have already done this with Perl, sequentially, but right now the target list is greater than twice, and I am using the problemto learn clojure on the go, thus I thought launching several 'quests' concurrently would be a good job for clojure... :-P

17:46 Chouser: Xcalibor: I still don't quite understand what you're trying to do, but I suspect pmap might help.

17:46 michel: Hullo! was wondering if anyone could help doing a (hopefully simple) debugging

17:47 Chouser: if you've got a big chunk of work to do for each item in a seq (name in a list?), and you want a single result for each of them (percentage of match?), then I think pmap might do quite nicely.

17:47 michel: probably -- ask away.

17:48 michel: I just wrote a macro I intend to contribute to clojure.contrib.trace, and I've tested it and it seems to work. When I add its definition to trace.clj and rebuild the JAR file, though, the definition is not visible from REPL

17:48 Xcalibor: Chouser: I'll have a look at pmap, thanks... as for what I want to do it's easy: the unix machine has local accounts with local uids, but those users do already exist on the ldap with a different uid... I have to match their names and locate their ldap uids, so I can get rid of the local accounts

17:48 ataggart: "I just wrote a macro" ... ominous

17:48 kotarak: michel: did you restart the repl?

17:48 michel: ataggart: yes and no. it makes testing easier: (dotrace (+ -) (+ 10 20 30))

17:49 Jetien: hi kotarak - could you assist me in getting vimclojure to work? although i set the "maplocalleader" variable in vim it doesn't seem to work.

17:49 kotarak: michel: jars cannot be reloaded.

17:49 michel: kotarak: yes. and I checked the JAR, and it does contain class files for the new macro

17:49 using clojure-contrib/launchers/bash/clj-env-dir to start the REPL

17:49 kotarak: Jetien: what's the filetype of the buffer? (The mappings are only set for clojure buffers)

17:50 Jetien: kotarak: how can i find out the filetype of the current buffer?

17:50 kotarak: :set filetype? (<- with ?)

17:50 Chousuke: Xcalibor: something like (pmap (partial reduce [] (fn [acc item] (if (match item) (conj item acc) acc))) (partition (/ (count huge-list) 4))))

17:50 michel: I'll try modifying an existing macro in that file, and see if I could get the changes to take effect.

17:51 Xcalibor: Chouser: well, I can get one result if the match is "unique" (that's over 90% of similarity) but when it's lower, I need a short list of possible candicate accounts to check manually (eg. user johnny, John S. Somebody on the unix machine is uid=udata089, ou=people,o=myorg on the ldap, with cn=John Samuel Somebody)

17:51 Chousuke: (count huge-list) has to be divisible by four though

17:51 that won't short circuit though :/

17:51 and I overuse though :p

17:52 Jetien: kotarak: i did a set filetype="clojure" - is that right?

17:52 i got parens matching and indention, so my guess is that it worked

17:52 kotarak: Jetien: yes. do the bindings show up in ":nmap" output?

17:53 Jetien: kotarak: nothing which looks like vimclojure

17:53 kotarak: Jetien: did you put "let clj_want_gorilla = 1" in your .vimrc?

17:53 Xcalibor: Chousuke: I already have the searching part more or less done (using a lazy list comprehension, or at least I think it's lazy, maybe it's not), i was just thinking about launching several of those counts at the same time to use the multicores on the machine doing the hard job...

17:53 Jetien: kotarak: i did

17:54 kotarak: hmm

17:54 Jetien: kotarak: theere were also no erros in the installation

17:54 achim: does anybody know what's happening re. chunked seqs? i missed that discussion ... i'll need some fast subseq searching soon, and it sounds like chunked seqs could be used to implement sth boyer-moore-like ...

17:55 Chousuke: Xcalibor: that's what I intended to show there.

17:55 kotarak: Jetien: do a ":source ~/.vim/ftplugin/clojure.vim". Are the mappings now there?

17:55 Xcalibor: Chousuke: i was thinking something in the line of (while (not (nil? user-list)) (spawn nsearch (locate user huge-list))) <- this is pseudocode, at best

17:55 Chousuke: Xcalibor: you need to partition your huge list, then launch a search on each partition, and then concatenate the results.

17:56 Jetien: kotarak: no

17:56 Chousuke: Xcalibor: how fast an operation is nsearch though?

17:56 michel: OK, after modifying the output of an existing procedure in clojure/contrib/trace.clj, and rebuilding the JAR (ant clean && ant -Dclojure.jar=/path/to/clojure.jar), it turns out that for some reason the changes are still not picked up

17:58 Chouser: achim: seqs over vectors are chunked already (head)

17:58 (class (seq (vec (range 100)))) ==> clojure.lang.LazilyPersistentVector$ChunkedSeq

17:58 Xcalibor: Chousuke: "pretty fast"... the algorithm is quite optimized... at the moment it takes about nothing to get a 93.67% match on a 100 hash-map... the real one will be almost 3 orders of magnitude bigger, though

17:59 Chouser: achim: eventually most of the seq-consuming fns (map, filter, etc.) will check their arg and if it's a chunked seq operate a chunk at a time for an automatic speed boost.

18:00 Xcalibor: if access is log32N on a hash-map, I don't think it's really heavy for such a big hash-map though, given enough memory is available

18:00 Chouser: achim: so as long as you're composing those chunk-aware fns, you'll get extra speed with no work.

18:01 achim: Chouser: nice, thanks for the info! so there will be a (supported, public) way to get hold of the chunks?

18:01 Chouser: achim: it's only if you're doing your own first/next loops, or producing data that's naturally chunkable, that you might want to write chunk-aware code.

18:01 Xcalibor: this would have to happen some hundred of times for all the users...

18:01 Jetien: kotarak: is there a quick fix in clojure.vim to workaround this problem maybe?

18:01 Chouser: achim: yep! Gotta go now, though.

18:02 Chousuke: Xcalibor: hm.

18:02 achim: that sounds exciting

18:02 Chousuke: Xcalibor: I really can't form an image of what you're trying to do

18:02 Xcalibor: but most likely spawning a thread for each user is not worth it.

18:02 Xcalibor: so partition your users

18:03 technomancy: this is pretty cool: http://github.com/richhickey/clojure-contrib/graphs/impact

18:03 Chousuke: Xcalibor: and spawn a thread for each partition

18:03 Xcalibor: Chousuke: you think so?

18:03 technomancy: I can't wait till the history for clojure itself actually records authorship.

18:03 Chousuke: Xcalibor: well, unless the search per user is going to take >500ms, then no.

18:03 kotarak: Jetien: I'm sorry. I just came back from a >700km tour to Luxembourg. I can't concentrate now. Recheck that the plugin part is really installed correctly. That there are no spelling errors in the configuration. Such things. I'll hopefully be around tomorrow or so. If nothing helps send me an email. (mb ! kotka ? de) You can check the guards for the mapping code in the ftplugin/clojure.vim file.

18:04 Xcalibor: I can do that, of course, when I construct the hash-map, I can create several of them, and then lauch a process to search each chunk in each target hash-map... that may work, now I have to learn to do launch them :-)

18:04 Chousuke: Xcalibor: you can use future or pmap

18:04 Xcalibor: see the documentation :)

18:04 technomancy: whoa; microsoft gave a grant to the Scala team to bring the .NET port to parity with the JVM one.

18:05 Xcalibor: yep! I will.. future and pmap, great... thanks a lot!

18:05 Jetien: kotarak: alright, no problem. i try to find out myself and come back some other time. danke schonmal!

18:05 technomancy: (according to dean wampler anyway: http://twitter.com/deanwampler/status/2156940937)

18:08 ataggart: Chousuke: any reason why agents wouldn't be appropriate to Xcalibor's problem?

18:09 replaca: technomancy: yeah, I saw that graph too. Pretty sweet.

18:10 Chousuke: ataggart: I think futures are simpler

18:11 ataggart: perhaps my mental model is off, but I think of them as being mostly equivalent

18:11 Chousuke: ataggart: if you just create an agent and then send a single job to it, that's equivalent to a future

18:12 ataggart: but agents are meant to receive multiple sends over time, which you don't want in this case :/

18:12 futures are simpler to use as well. they're kind of like "read-only" agents.

18:13 (after the first job has run, of course)

18:14 dnolen: speaking of which, what are the opinions about the new promise/deliver? They seem cool, but I'd like hear how people intend to use them.

18:15 one thought is that they are useful for interactive functions at the REPL.

18:15 is that a silly idea?

18:16 Xcalibor: one silly question: there's a clojure.parallel and I have a parallel.clj on the source tree, but I cannot use it from the repl... shouldn't it be included into the jar file?

18:17 Chousuke: Xcalibor: did you require it?

18:17 Xcalibor: i use it...

18:17 java.lang.ClassNotFoundException: jsr166y.forkjoin.ParallelArray (parallel.clj:0)

18:18 hiredman: yeah, you need the jsr11y jar

18:18 Xcalibor: weird...

18:18 hiredman: er

18:18 Xcalibor: is that an ant task? or do I have to download more code?

18:18 ataggart: http://gee.cs.oswego.edu/dl/concurrency-interest/index.html

18:19 hiredman: clojure.parallel has not been looked after, as far as I know

18:19 last I heard the classes in the jsr166 jar had been renamed and parallel had not been updated

18:20 Xcalibor: oh, i see... well, i was wondering...

18:20 as for promises, are they similar to Scheme's?

18:20 hiredman: yeah, I would ignore it (I have been ignoring it)

18:20 nope

18:20 ataggart: dnolen: is there a link to that stuff?

18:20 hiredman: scheme's promises are clojure's delays

18:21 dnolen: attagart: no but it was discussed on irc.

18:21 ataggart: rgr

18:21 Xcalibor: oh, the I have no idea of what those promise/deliver are :-P any link to info?

18:21 hiredman: a clojure promise is a sort of write only atom, where all reads block until the atom as been written

18:22 Xcalibor: (doc promise) in the repl

18:22 dnolen: and throws on any successive writes beyond the first

18:22 it does seems cool for blocking a computation until user input at the REPL, but it doesn't seem like there's much of an opinion about that :)

18:22 Xcalibor: hiredman: do I have to download any recent stuff from the svn? the 1.0.0 jar doesn't have promise (it throws a Java exception)

18:23 hiredman: Xcalibor: git

18:23 ~github

18:23 damn it!

18:23 ataggart: can't live without clojurebot

18:23 Xcalibor: ah... bleeding edge stuff, uh?

18:23 hiredman: Xcalibor: promise/deliver are brand new

18:23 dnolen: hmm nothing comin up on Chouser's irc log.

18:24 hiredman: blocking stuff is always neat to setup pull based computations

18:24 Xcalibor: so an atom that only allows one write and blocks any reading until it's fully written to?

18:25 hiredman: something like that

18:25 Xcalibor: are they first-class citizens? I mean, can you send them over the net, for example?

18:26 hiredman: uh

18:26 you definition of "first-class" does not compute

18:26 Xcalibor: it seems something useful to build up state objects that can be used to spread estate to a farm of proceses

18:27 hiredman: nod, it's unfortunate... not like first-class citizens as applied to functions, and so one (that can be returned, passed along, etc)

18:27 hiredman: "send them over the net" is a serialization operation and has nothing to do with "first-class" this or that

18:28 Chousuke: I don't think they're meant for distributed computing

18:28 hiredman: none of clojure's concurrency primitives are meant for distribution across jvms

18:29 Xcalibor: but for distributed computing, serialization can be seen as just another operation, like returning, etc... oh, i see... well, i can't figure out right now what would they be useful for, sorry

18:29 mrsolo: the exception raised by agent, is it binded to a particular thread?

18:29 hiredman: mrsolo: huh?

18:29 mrsolo: if an agent raised an exception due to validator error

18:29 dnolen_: Xcalibor: for distributed computing some work has been done integrating Clojure with Terracotta.

18:30 hiredman: mrsolo: If any exceptions are thrown by an action function, no nested dispatches will occur, and the exception will be cached in the Agent itself. When an Agent has errors cached, any subsequent interactions will immediately throw an exception, until the agent's errors are cleared. Agent errors can be examined with agent-errors and cleared with clear-agent-errors.

18:30 http://clojure.org/agents

18:30 mrsolo: ok

18:30 Xcalibor: dnolen_: terracotta? is that some Java framework? i'm not really much into Java per se... i'll have to check it out

18:30 mrsolo: eveybody gets it basically

18:30 Chousuke: I really can't tell what kind of work promise/deliver would be good for :/

18:31 hiredman: pull based stuff

18:31 dnolen_: Xcalibor: yes

18:31 Chousuke: perhaps a producer/consumer kind of system with multiple concurrent producers and consumers.

18:32 hiredman: http://leansoftwareengineering.com/2009/01/08/mechanics-of-pull-development-workflow/

18:32 Chousuke: then you could have a manager distributing promises all around

18:32 Xcalibor: dnolen_: ok, i'll have a look, it seems something promising: distributed over several multicore boxes could give a huge power... :-)

18:32 Chousuke: and someone delivers them

18:32 dnolen_: Xcalibor: search the google group for Terracotta for reference

18:33 hiredman: well, that is not a good exmple

18:33 Xcalibor: dnolen_: great, thanks! now it's already tomorrow in here, time to go to bed... thanks for all your help, and good night!

18:35 Chousuke: you could even send the promises off to agents that would queue and fulfil them whenever they can, and the consumer could just block until the promise it's waiting for is fulfilled.

18:36 dnolen_: Chousuke: hmm interesting.

18:37 I suppose you can design a series tasks that are complete asynchronously, then the process unblocks filling yet another task, et. al.

18:37 hiredman: Chousuke: yeah for fanning out

18:39 Chousuke: you would have a single hub distributing the work and the consumers could be "dumb", knowing nothing about the agents or whateverit is that's doing the actual work.

18:40 dnolen_: Chousuke: now that I think about it sounds like a good way to maximize concurrency no need for explicit awaits.

18:40 mrsolo: nice, is it available yet?

18:40 Chousuke: mrsolo: recent commit in git

18:40 (svn too but you should forget that!)

18:42 mrsolo: so it is git from now?

18:42 Chousuke: is it actually official yet?

18:42 but anyway, yeah.

18:43 mrsolo: btw is pom.xml official? or it is just there

18:43 i keep doing my own version for mvn

18:43 for clojure-contrib that is

18:44 Chousuke: http://www.assembla.com/spaces/dashboard/index/clojure http://www.assembla.com/spaces/dashboard/index/clojure-contrib

18:45 ataggart: it'd be nice if contrib had an official release

18:46 opqdonut: mhmm

18:47 synced with the clojure releases

18:47 ataggart: randomly pulling down whatever happens to be in trunk at that moment makes me nervous

18:48 and I'm a bit unclear about what rationale is used to decide whether something goes in clojure, clojure-contrib, or some separate project

18:56 hiredman: http://en.wikipedia.org/wiki/Dataflow_programming <-- hash map thing it mentions could actually be implemented using promise/deliver

19:06 Chousuke: hiredman: but after delivering a single promise, you'd have to reconstruct the graph again, wouldn't you?

19:06 to get new deliverable promises.

19:07 hiredman: Chousuke: if you used promise

19:07 Chousuke: the dataflow in contrib is implemented using agents I think

19:09 hiredman: some dataflows are imutable

19:09 actually

19:10 strictly speaking, they have to be

19:10 Chousuke: um, but they aren't immutable in the sense that once you give one input, you can no longer give any more? :/

19:11 hiredman: it's not exactly a fan out style thing

19:12 it's sort of like you have a jumbled up bag of functions and you just run them arbitrarily and they either complete or block

19:17 durka42: or you run them all at the same time :)

19:17 there's dataflow in contrib? i'll have to play with this

19:17 * durka42 recently learned labview

19:23 hiredman: durka42: yeah, you wrap all your function calls in future, and all paramteres in promises

19:24 or all your functions internally call future and return a promise

20:04 wavis: anyone considered the possibility of compiling clojure to parrotvm?

20:39 rhickey: It's official: http://groups.google.com/group/clojure/msg/ca4fb58428052554

20:40 arohner: rhickey: great!

20:44 Chouser: a one-time scrape of gcode issues and push to assembla tickets might be a nice little enlive project for someone.

20:46 quidnunc: What does Assembla do that is special?

20:50 rhickey: quidnunc: it has a richer tickets/milestone system than gcode, a wysiwyg wiki, logged chat, and just generally better collab and project management tools

20:52 same kind of thing as unfuddle etc

20:52 quidnunc: rhickey: Were any other alternatives in contention? Assembla is non-gratis right?

20:52 michel: great news. just curious -- how does it compare to Sun's Kenai?

20:52 rhickey: assembla is free for open source projects where everything is public

20:52 so, free for Clojure

20:55 michel: I didn't spend too much time with Kenai, one of my criteria was that it would be something I could also use for commercial/private work - I don't want to learn 2 toolsets

20:56 I also don't really get the cross-project focus of Kenai, and it has fewer tools

20:57 michel: ah, that makes sense. cool -- I just wrote something I wanted to eventually have in contrib, and being able to fork it at github makes it much easier

20:57 rhickey: that's the goal

21:10 durka42: is rhickey managing contrib now then?

21:10 rhickey: durka42: what does that mean?

21:11 durka42: i mean, if it's in your name on github

21:11 are you the gatekeeper?

21:11 rhickey: I was the admin before and am still

21:11 durka42: oh, ok

21:11 I thought it was Chouser for a while

21:13 Chouser: oh dear, no. I'm not in charge of anything.

21:13 by lines of code, I've contributed about 5% of what's currently in contrib.

21:14 durka42: :)

21:14 * durka42 is misinformed

21:14 Chouser: I'm flattered you thought so, though. :-)

21:15 * durka42 has to run

21:28 jackdempsey: hey guys.....fwiw, i'm brand new to clojure, but pretty familiar with git and github, so, happy to help out in that area if i can

21:29 rhickey: jackdempsey: hi, thanks

21:30 jackdempsey: np, think its a great move, but i remember starting with git....can be a bit intimidating at first

21:30 i've got a bunch of useful git links, etc scattered about....has anyone sent something like that to the group?

21:32 rhickey: one practical problem I foresee is that people are used to saying 'I'm having a problem with svn rev 42', 'oh, that's fixed in rev 45', where the order of things is clear, where is isn't with those hashes

21:34 jackdempsey: yeah, i can see one worrying about that....in practice, i don't think i've ever really been bogged down by that

21:34 Chouser: hiredman mentioned the idea of using a date/time in place of svn rev (when asking clojurebot for the latest, for example)

21:34 jackdempsey: i think there are several ways to deal with something like that

21:35 yep there's that, tehre's also quickly doing a git show sha1hash and if you dno't have that, you'll know its upstream and can fetch, rebase, etc

21:35 if you do have it, then something else is the culprit

22:06 rhickey: giving any talks on clojure near DC anytime soon?

22:18 wy_: hello

22:19 Chouser: wy_: hi

22:20 wy_: Chouser: Hi

22:20 I heard clojure has some of the lazy features?

22:21 Chouser: yep, Clojure's seqs can be lazy

22:23 wy_: only seqs?

22:23 hsuh: hi. i'm failing to define a function to swap! this atom (def x (atom [0 0 0 0 0 0]))

22:24 i was trying something with this format: (defn update-vals [a b c d e f] [(+ 1 a) (+ 1 b) (+ 1 c) (+ 1 d) (+ 1 e) (+ 1 f)])

22:24 but then (swap! x update-vals 1 2 3 4 5 6) gives me wrong number of arguments...

22:24 hiredman: correct

22:24 Chouser: wy_: that's the only transparently lazy thing I can think of. There are also futures, delays, promises, etc. but those require explicit derefs to get the value.

22:25 hiredman: because update-vals takes 6 args, and swap! is passing 1

22:25 actually swap! is passing 2

22:25 hsuh: but swap if f x y & args ...

22:25 hm

22:26 s/if/is

22:26 hiredman: its like (apply update-vals @x '([0 0 0 0 0 0]))

22:26 Chouser: hsuh: your update-vals takes 6 args

22:27 hiredman: which, in turn, is like (update-vals @x [0 0 0 0 0 0])

22:27 hsuh: do we have a pastie?

22:27 Chouser: hsuh: your swap! call there passes the atom value plus the 6 args, for a total of 7.

22:27 hiredman: 2 args

22:27 oh

22:27 whoops

22:27 * hiredman confused himself

22:27 hiredman: ~url

22:27 bah!

22:28 lisppaste8: url

22:28 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

22:28 hsuh pasted "untitled" at http://paste.lisp.org/display/81963

22:29 hsuh: i thought that would work, passing a single vector...

22:29 hiredman: hsuh: read the docstring for swap!

22:29 Chouser: hsuh: (swap! x foo [1 2 3]) will call (foo x-val [1 2 3]) -- 2 args

22:29 hsuh: ok... i dont get why "+" works

22:30 hiredman: hsuh: swap! applies the function to the current value of the atom and any other args you pass

22:30 so if you have (atom 1)

22:30 (swap! (atom 1) + 2)

22:30 you get 3 in the atom

22:30 hsuh: ok.. got it now..

22:52 so there is this clojure wrapper for processing.. i was trying to convert some examples. i'm stuck in the one that calls "p1 = new Point" on the original function... any ideas on how these kind of things map to clojure? (or which manual to RTFM..)

22:53 (i mean java's "new" to clojure)

22:56 arohner: hsuh: (let [p1 (new Point)])

22:56 or (let [p1 (Point.)])

22:56 hsuh: will that be an atom ?

22:56 arohner: that will be a local "variable"

22:56 that only exists inside the scope of let

22:56 I say "variable" because it cannot be changed

22:56 hsuh: ok, but then later on the code it is set..

22:57 hiredman: (defstruct point :x :y :z)

22:57 arohner: hsuh: does it need to be modified, or can it be set once at the beginning?

22:58 hsuh: well, if i wanted to map the code directly, this object is set inside a loop

22:58 hiredman: well, then you don't want to do it directly

22:58 hsuh: i dont know if setting the value on the java code has any other side effects

22:59 there's a wrapper for point already

22:59 (defn point

22:59 ([x y] (.point *applet* (float x)(float y))))

23:03 cads: hey, how do i parse strings into numbers?

23:04 arohner: cads: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html

23:04 nm, I'm sleepy

23:13 cads: try this http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html

23:14 cads: no to-int anywhere?

23:14 arohner: not in clojure, yet

23:15 you could (read), if you know you're getting ints

23:15 but that has it's own issues

23:16 ,(doc read)

23:17 clojurebot?

Logging service provided by n01se.net