#clojure logs

2009-06-16

00:22arohneris there an api for an agent like call, where I don't care about the return value?
00:23arohnerI just want to call a fn in another thread
00:39hiredmanarohner: future
00:39hiredman(.start (Thread. some-function))
00:39hiredmanetc
00:40arohnerhiredman: thanks
01:07arohnersigh. I wrote my own shell functions before finding chouser's excellent c.c.shell-out
02:19tbatchelli2hi, 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"))))
02:22hiredmanerm
02:23hiredmanvars dispatch .invoke to their contents
02:23hiredmanso you don't need the var-get
02:23kotarakThough, that might go away, IIRC.
02:23hiredmanorly
02:24hiredman:(
02:24hiredmanthat would be very annoying
02:24tbatchelli2well, what I am trying to do is a form of introspection
02:24hiredmantbatchelli2: that's how it's done
02:25tbatchelli2ok... thanks! good to know :)
02:57replacaanyone 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)?
02:58replacacalled from different parts of the program, so stateful-ish
02:59stuhoodatom and agent won't work... gotta try a ref?
03:00replacawhy won't (swap! at inc) on an atom 'at' work?
03:00replacaam I missing something?
03:01stuhoodyou could replace any value that was already in the atom right? if you were decrementing
03:01stuhoodah, no, nevermind.
03:01replacayeah, i just want a mechanism to get an int that keeps increasing
03:02replacabasically, I want to put ids on things so I don't have to = the structures to see if they're the same
03:02stuhoodyea, that should work, sorry about that
03:03replacacool, thx
03:04replacabut thinking about it, what I really want is just to use identical? !
03:10stuhoodhaha, oops
03:11stuhoodalso, clojure caches the hashes of structures, since they are immutable, so (=) might not be that terrible either
03:12stuhoodanyway, late for me too. sorry for the stupid advice =)
03:12stuhoodg'night
03:14replacagoodnight. thanks!
04:45lowlycoderwhat's a goodd database backend to use with clojure?
05:04eleftheriosrys: 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
05:04eleftheriosbut they are trying to resolve now
05:04eleftheriosand their emails were nice this time
05:05rysAh, that's great
05:05eleftheriosso maybe we'll have an updated version soon, they are doing test chapters
05:05eleftherioswith wrapped code
05:05eleftheriosit is not ideal but may be better than truncated code
05:06eleftheriosrys: I'll let you know :-)
05:06ryscheers, that's much appreciated :)
05:06rysAnd that's reminded me to check if my local bookstore has the print copy yet
05:07rysNope, still waiting for stock :(
05:07eleftheriosamazon doesn't either?
05:07eleftheriosthey are fast at delivering
05:09rysI could try amazon I guess
05:09eleftheriosthey even have next day delivery
06:47eevar2what 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
06:51achimeevar2: can you give an example of how input and output of the operation are supposed to look like?
06:59eevar2achim: atm i'm doing something like this: (loop [output [] generator n]) .... (recur (conj ouput (expand(generator))) (- generator 1) )
07:00jdzlooks very much like an infinite loop to me
07:00eevar2eventually (expand generator) returns []
07:01jdzoh, there are dots in there
07:03eevar2yea, silly pseudo code with errors
07:03eevar2and a missing exit condition
07:06Chousukeeevar2: so wait, "output" will be a vector of what, some items?
07:07eevar2yup
07:07achimeevar2: that look much like (map expand (iterate dec n))
07:08achimwhat do the dots do? do they affect output or generator?
07:08Chousukeiterate will go past 0 if you let it, though :)
07:08achimthe loop will as well :)
07:08Chousukegood point :P
07:09eevar2never mind about that example code. i want to do (expand generator), collecting the output as a sequence until it returns []
07:10Chousukeis generator stateful somehow? :/
07:10Chousukeor does expand feed it different values?
07:11achimdo you want a seq of generator, expand(generator), expand^2(generator), ... ?
07:11eevar2generator is actually a number that i'm factoring
07:11Chousukeah
07:12Chousukeyou want to factor a number, then factor what it returns until it returns "nothing"?
07:12Chousuketo get teh final factorisation
07:12Chousukehmm
07:13achim(take-while (complement seq) (iterate expand generator)) or somethin like that?
07:13achim(untested)
07:14achimah, nonsense, leave out the complement
07:15eevar2okies, so what i've been looking for is the 'iterate' function
07:49Xcaliborgreetings
07:50Xcaliborany example of how to construct as hash-map by parsing the lines of a very big file? should I rebind inside a (let [] )?
08:29frodefI'm trying to create a JTree with nodes, where each node is displayed by taking it's userobject's toString method.
08:30frodef..how do I set up a userobject that both implements a suitable toString and another callback function?
08:30jdzproxy?
08:31frodefI can do e.g (proxy [Object] [] (toString [] "foo")), but then how would I add my own callback method/function/whatever?
08:31frodefjust adding another method besides toString doesn't seem to work.
08:32frodefI guess the method has to be part of some interface?
08:32jdzyes
08:32hoeckfrodef: you could create your own interface with gen-interface
08:32frodefI couldn't get gen-interface to work..
08:33frodefthat is, proxy couldn't resolve the interface I tried to create.
08:33hoeckone drawback is, once created, the interface cannot change
08:33cemerickfrodef: are you trying to implement an existing callback interface related to TreeNodes, or your own interface?
08:33frodefmy own interface (just one simple callback method)
08:33cemerickfrodef: Then you'll want to do something like (proxy [YourInterfaceName] [] ...)
08:33Chouserfrodef: May I suggest AFn?
08:34frodefChouser: That I proxy the AFn interface?
08:34Chouser(def myfoo (proxy [AFn] [] (toString [] "foo") (invoke [arg1] ...)))
08:34Chouserright
08:34Chouserthen you can call the invoke method by doing: (myfoo 5)
08:35hoeckwhy not IFn?
08:35frodefChouser: that was actually one thought I hadd too, but I didn't know what the name of the class was :) thanks.
08:35frodef..so what's AFn vs. IFn?
08:35ChouserIFn is a pure interface, no implementation.
08:36Xcaliborre'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 [] )?
08:36hoeckwhat I'm always wondering is wether all those interfaces are actually part of the official clojure language or more or less implementation details
08:36jdzXcalibor: conj?
08:36Xcaliborhoek: AFAIK and following the docs, it seems it's a part of the language itself
08:36Xcaliborjdz conj, I'll have a look at it, thx!
08:36ChouserAFn 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
08:37jdzXcalibor: well, for a hash map you may want to look at assoc, too
08:37jdzXcalibor: but i must confess i don't quite see what your problem is from the question as stated
08:37Xcaliborjdz: nod... assoc does what I want, but my trouble is with the new data
08:37frodefjava.lang.RuntimeException: java.lang.Exception: Can't resolve: AFn (NO_SOURCE_FILE:359)
08:38jdzXcalibor: assoc adds the new data
08:38hoeckfrodef: clojure.lang.AFn, or import it first
08:38jdzXcalibor: you just must use the returned value of assoc
08:38XcaliborI 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...
08:39AWizzArdXcalibor: put a ref on the hashmap then
08:39Xcalibora ref...
08:39AWizzArd(def data (ref {}))
08:39jdznah, no ref needed
08:39frodefhoeck: oh right, thanks.
08:39cemerickXcalibor: to be clear, assoc doesn't *copy* the hash-map
08:39Xcalibormmm... I don't yet know those...
08:40jdzjust loop/recur all the lines and collect stuff in your hash map or whatever
08:40Xcaliborcemerick: nod, it adds the new data and returns a new hash-map with the old and new keys and values...
08:40mattreplXcalibor: (into {} (map #(re-split some-delimiter %) (line-seq some-reader))) doesn't work?
08:40cemerickXcalibor: right, I just thought I'd mention it since you said "recreating the hash"...
08:41Xcaliborthing is, I am not supposed to (def myhash (assoc myhash :key val))
08:41Xcalibormattrepl: I haven't tried, to be true I didn't know that was even possible...
08:41cemerickright, you want to gather the data from each line into a hashmap, which mattrepl showed an example of above
08:42XcaliborOK, I'll give it a try! I guess I won't be able to use read-lines from duck-streams, though
08:44cemerickXcalibor: read-lines and line-seq are mostly interchangeable...
08:44Xcaliborcemerik: ah, cool... I'm testing right now
08:53XcaliborI 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?
08:54Chouser,(seq (.split "A;B;C" ";" 2))
08:54durka42~marco
08:55durka42(let [parts (.split "A;B;C" ";")] (assoc the-map (first parts) (next parts)))
08:55XcaliborChouser: ah, I see, seq allows me to limit the number of chunks it's splitted into... I can then split it further if needed...
08:56durka42no, seq is just for making it into something you can see at the REPL instead of an ugly java L[;String thing
08:56durka42(in this case)
08:58ChouserXcalibor: durka42 is right -- it's the String .split() method that takes a number limiting how much to split it.
09:01Xcaliboraha
09:04Xcaliborwell, it's proving something a little bit difficult, because into doesn't like my entries... I'll keep digging and let you know, brb
09:08Chouser(into {} foo) wants foo to be a seq of 2-item vectors, like: ([:a 1] [:b 2])
09:09Chousermaybe (into {} (map #(vec (.split % ";" 2)) (line-seq myfile))
09:31frodefI have some dynamic bindings that (obviously) aren't visibile from the swing event thread.. is there some idiomatic way to deal with this?
09:33ChouserI think the normal route is to stuff the dynamic values you need into lexicals.
09:34Chouser(let [foo *foo*] (Swing/invokeLater #(prn foo)))
09:35Chousersomething 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.
09:35Chouserwill something like that work?
09:35ChouserI've seen macros that bundle several values like this for you, but I'm not finding any of them at the moment.
09:39XcaliborChouser: ah, with that vector mapping it seems to work!
09:41frodefChouser: sure, that works fine. Just a bit of a hassle.
09:41frodefthanks
09:48XcaliborChouser: 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
09:48Chouseryou want the semi-separated second part to be in a vector?
09:48Chouser{"A" ["B" "C"]} ?
09:51Xcaliboryup!
09:51XcaliborI 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
09:52ChouserXcalibor: (let [[k & v] (.split "A;B;C" ";")] [k (vec v)])
09:55Xcaliborah, cool! I can use it inside that #() thing--- a reader macro, maybe?
09:55Chouseryes
09:56XcaliborChouser: nevertheless that works beatifully, thanks a lot!
09:56Chousersure!
10:19Chousukehmhm
10:20Chousukeimproving the error messages for defn etc. seems to be not so trivial ;/
10:22Chousukethey 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:22Chousukemaybe it'd be easier to define a checkless defn etc. first and then later redefine it using itself *with* the checks :P
10:37Xcaliborwell, I am obviously obtuse today, but I don't seem to find a way to splice a list?
10:41cemerick,(partition 3 (range 10))
10:41cemerickhrm, no bot?
10:43cemerickXcalibor: lots of ways. partition, split-with, split-at, etc.
10:45Xcaliborcemerik: i see... off I go to read the docs, thx!
11:07cemerickmap-invert should really be moved into clojure.core.
11:08dnolen_cemerick: what are you using that for?
11:08cemerickdnolen_: inverting maps ;-)
11:08dnolen_heh, i know
11:09dnolen_but what's a common case where you need to do that?
11:10cemerickwhen 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:10cemerickvisualization of overlapping datasets, in my current specific case
11:10opqdonut(float-array x y) doesn't create a real two-dimensional array?
11:11stuartsierraJava doesn't have "real" 2-d arrays.
11:11dnolen_opqdonut: and you should avoid them, dereferencing them is dog slow.
11:11opqdonutwell, i gotta do what the api tells me
11:11dnolen_cemerick: aww, nice.
11:12opqdonut(make-array (. Float TYPE) x y) works
11:12cemerickheh, 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:12stuartsierraWhat you're getting there is an array of pointers to arrays, not a 2-d array.
11:12dnolen_opqdonut: gotcha, you need to talk to a specific Java interface.
11:13stuartsierraoh, I see
11:13stuhoodopqdonut: (make-array Float x y) should do the same thing
11:13cemerickopqdonut: you definitely want make-array -- float-array (and it's cousins) use the second value as an initial value, not an additional dimension.
11:14cemerickstuhood: nope, Float gives you Float[][] -- Float/TYPE gives you float[][]
11:14stuhoodcemerick: oo, thanks.
11:15cemerickyeah, array type params don't get unboxed on the way out.
11:15cemericke.g. Float -> float, but Float[] -/> float[]
11:16DTrejogood morning guys
11:16DTrejocould someone tell me how I might get this to work? http://mibbit.com/pb/Ynef2e
11:17DTrejothanks
11:20achimDTrejo: works for me - did you try this in a fresh REPL?
11:21cemerickDTrejo: 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:21Chousercemerick: right, because float is not an Object, but float[] is.
11:21opqdonutcemerick: ahhhhh
11:21opqdonuti misread the docs
11:23achimDTrejo: what does it say if you just enter "println" and hit enter? (no parentheses)
11:23DTrejoachim: I'll play around with it some more
11:23cemerickhuh, I've actually never seen a fibonacci impl like that :-)
11:23DTrejoits from the programming clojure book
11:24cemerickMine hasn't arrived yet.
11:24DTrejoachim: it crashes my repl
11:24DTrejoso pitiful :(
11:25achimDTrejo: might it be that you accidentally redefined println?
11:25DTrejowell, what you see in the pastebin is all the code in that file
11:26DTrejois there some way to accidentally redefine println from outside of that file or something?
11:27cemerickyou'd have to do something like (defn println ...)
11:27Chouserbut that won't do anything harmful unless you're in the core namespace, which is an odd place to be.
11:27DTrejooh I didnt do that, so that's not it I don't think
11:27cemerickDTrejo: just out of curiosity, what is the value of *clojure-version*?
11:28ChouserDTrejo: can you paste the stack trace you get when you try println with no parens?
11:28DTrejoto print the version: (println clojure-version) ?
11:29cemerickjust *clojure-version* will do
11:29cemerickincluding the asterisks
11:30DTrejoit 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:30cemerickDTrejo: sounds like you have an old version....
11:30ChouserDTrejo: that means pre-1.0. Where/when did you get it?
11:30DTrejothat would be a problem hmm
11:30cemerickah, which would explain the classcastexception
11:31cemerick(wasn't lazy-cat a mapcat in early lazy impls?)
11:34DTrejothanks for the help, now i'll try and download a new version of clojure
11:35DTrejoshould I download 1.0 or go for the latest release?
11:36DTrejoClojure release 20090320
11:36Chousuke1.0 is latest.
11:37Chousukebut, hmm
11:37DTrejoI
11:38Chousukenow I managed to get argument checking for fn a bit nicer
11:38DTrejoI'd rather not be cutting edge
11:38Chousukeuser=> (fn ([] 1) foo)
11:38Chousukejava.lang.IllegalArgumentException: Malformed arguments. Expected: a function overload of the form ([params*] body-exprs*); got: foo (NO_SOURCE_FILE:0)
11:38DTrejoso if I stick with 1.0 I will be fine Chousuke ?
11:38Chousukeyeah
11:39Chousukeit's the latest release :)
11:43DTrejohow do you guys recommend I go about learning clojure?
11:43ChouserDTrejo: did you say you had the book already?
11:43DTrejoI do, but it is not the latest version
11:44Xcaliborwell, gotta go.. thanks for all, it's working around nicely :-)
11:44Xcaliborlaters!
11:44Chousukehttp://java.ociweb.com/mark/clojure/
11:44DTrejoit's probably a good idea to keep going thru the book, but if there was anything else I could do
11:45Chousukethe LONG article is a fairly good introducion
11:45Chousuke+t
11:45la_merDTrejo: The book is current through v1.0...definitely the place to start, if you like books.
11:47DTrejothanks Chousuke
11:49DTrejoI downloaded 1.0, but I wonder if I need to update my clojure-contrib.jar as well?
11:49ChouserDTrejo: possibly, depending on how old it is.
11:50DTrejoI don't see it here: http://code.google.com/p/clojure/downloads/list
11:50la_merDTrejo: I would. FYI, svn rev 756 is the one that corresponds with clojure v1.0
11:50DTrejooh wow I noticed the version I have is .2
11:50DTrejoso yea I probably need a r756
11:52Chousukeclojure-contrib is still only available from git/SVN
11:52xcaliborre's... that was short :-)
11:53Chousukehm. apparently contrib's not at git yet after all
11:54DTrejoI hate all this configuration braindeath
11:54xcaliborChousuke, I got to get it grom svn just last night
11:54DTrejoand I have to remember it's not even bad compared to regular lisp
11:55cemerickDTrejo: it really should be as easy as grabbing clojure v1.0 and putting it in your classpath...
11:55Chouserwe should have a .jar with clojure 1.0 and contrib together.
11:56stuartsierrayes
11:56cemerickit 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:57Chouserclojure 1.0 is a zip not a jar, right? Do we know why that is?
11:57ChousukeWho will maintain a 1.0 branch of contrib? :P
11:58Chousercemerick: most people who clone contrib already have clojure, don't they?
11:58xcaliborhow 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:58DTrejocemerick: so I won't have a problem with a really old version of clojure contrib with my clojure jar at version 1.0?
11:58ChouserChousuke: the same people who maintain clojure 1.0 branch.
11:58Chousukeis someone actually maintaining it? :D
11:58cemerickDTrejo: no, you definitely want to upgrade clojure contrib, if you're using it.
11:58DTrejokk
11:58ChouserChousuke: is it broken?
11:59cemerickChouser: well, c-c needs clj for a proper build anyway, so adding the latter as a submodule is appropriate.
11:59Chouserif not, I say it's "maintained" at least at the moment.
12:00Chousukecemerick: but then you might end up with two clojure clones :/
12:00Chousukecemerick: or your clojure clone will be a subdir under clojure-contrib.
12:01ChousukeI think it
12:01cemerickChousuke: that's bad?
12:01Chousukeit's too complicated to be worth it. :/
12:01cemerick*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:02Chousukethey could also not want a clone at all, instead they would use a downloaded clojure jar
12:02cemerickwell, it's TBD how and where a "unified" clojure+c-c jar file is being produced, then.
12:03DTrejoso there's no easy way at the moment to get both at once?
12:03ChouserWell, Wrexsoul doesn't use contrib.
12:03ChousukeDTrejo: there's the clojure box for windows :P
12:03cemerickDTrejo: not in one jar file, no. Two jar files aren't a big deal, though IMO :-)
12:04DTrejooh 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:05technomancyso who wants to write a dependency injection library for Clojure?
12:06Chousertechnomancy: 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:06cemericktechnomancy: waitaminute -- we've got to haggle about guice vs. spring first! :-P
12:07technomancymaybe we could implement it using a library that provides M-expressions
12:07technomancyso newbies will want to use it
12:08technomancysorry.
12:08technomancyI'm done.
12:11DTrejoalright, I guess I'm switching to use clojure box now, just gotta get over the emacs learning curve hehe
12:11xcalibormmm... sort-by uses a Collator... how do I create one to do a reverse sort on a numerical vector, for example?
12:13Chouser,(sort #(compare (last %2) (last %1)) '([:a 2] [:b 1]))
12:13DTrejoarg I'm already overwhelmed :(
12:13ChouserDTrejo: I wouldn't recommend trying emacs just to avoid fetching contrib yourself.
12:14DTrejolol
12:14gnuvinceuser=> (sort #(compare (count %1) (count %2)) ["aaa" "bb" "c"])
12:14gnuvince("c" "bb" "aaa")
12:14xcaliborah, that was just cool, Chouser... thanks a bunch!
12:15xcaliborgnuvince, thanks, I see... I'll have to study #() carefully to understand that, though :-P
12:15gnuvincexcalibor: oh sorry. (fn [a b] (compare (count b) (count a))) is equivalent
12:15Chouser(sort-by count ["aaa" "bb" "c"]) ==> ("c" "bb" "aaa")
12:15gnuvince#() is syntactic sugar for anonymous functions that I happen to use probably too often.
12:16xcaliborgnuvince, #() is just a lambda?
12:16ChouserI miss clojurebot
12:16gnuvince#(print %) => (fn [x] (print x))
12:16xcaliborno, I have already met it, it's my fault for not understanding it by then :-)
12:16xcaliborcool, very useful, thanks
12:16gnuvinceyou can use %1, %2, etc. to refer to multiple parameters.
12:16gnuvincexcalibor: beware that #() do not nest.
12:17gnuvinceChouser: who took him offline?
12:17xcaliborI see... well, most of the time it will be for things like these anyway... and you can put a proper lambda inside, right?
12:17gnuvinceYes
12:17Chouserxcalibor: also beware that #([1 2 3]) is not (fn [] [1 2 3])
12:18Chousergnuvince: dunno, I assume he died of natural causes and hiredman hasn't noticed yet.
12:18gnuvinceChouser: ok
12:19xcaliborChouser: I see... thanks, I'll try to remember :-)
12:23xcaliborOK, now I understand it, cool :-)
12:23xcaliborthanks a bunch, guys... laters!
12:24DTrejohave a good day guys, thanks for the help
12:37mib_xusidq,(use 'clojure.contrib.repl-utils :only '(source))
12:40mib_xusidqclojurebot: where are you?
12:41jkantzI've used maven to simplify dependency management
12:41jkantzhave a look at http://github.com/kantzhub/clojure2go
12:41Chousukeurgh.
12:41jkantzwhat would be nice if clojure and contrib were in maven repo
12:42technomancyjkantz: clojure is on the list
12:42technomancybut it moves slowly
12:42ChousukeI have an idea for improving destructure but its current implementation makes my brain hurt.
12:42jkantzcool is it clojure 1.0?
12:42technomancyjkantz: contrib hasn't seen an official release yet, so it hasn't been submitted
12:42technomancyyes
12:42technomancyjkantz: also: I've been working on my own little deps management tool that wraps maven: http://github.com/technomancy/corkscrew
12:42duck1123Maven works great if all the deps you need are in a repository
12:43duck1123horribly if not
12:43jkantzeasy enough to install a jar locally
12:43stuartsierraCan't you create a "local" repository?
12:43technomancyduck1123: that's why corkscrew also lets you install out of a git or svn repository.
12:43duck1123technomancy: did you get the maven integration working yet?
12:43technomancyduck1123: no! I'm stuck on one tiny little showstopper that's driving me nuts.
12:43technomancyyou can't use the MavenCli class out of the box because it needs to be run out of a plexus component repository
12:44technomancyI have no idea what that means.
12:44technomancybut I've been banging my head against that for quite some time now.
12:44technomancyso... if anyone knows how plexus works I would be grateful for some help
12:44duck1123It was driving me nuts the other day trying to build a clojure:repl goal for the clojure-maven-plugin
12:45duck1123it shouldn't be this hard to simply run a program from java with the in/out bound properly
12:45duck1123I gave up and switched to better things
12:46technomancyyeah, I've tabled it until I can get a lead on how that stuff works.
12:46technomancythe documentation is incomprehensible
12:46jkantzyeah maven is a bit of a swamp
12:47technomancythe 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:47cemerickjkantz: hrm, that's generous :-)
12:49technomancyso any help (hint, hint) would be awesome. I don't think it's particularly tricky once you understand what's going on.
12:52jkantztechnomancy, corkscrew looks neat, will have to take a closer sometime soon
12:53mib_xusidqtrying to build clojure, I get this: file:C:/clojure/build.xml:1: Unexpected attribute "xmlns:mvn"
12:53mib_xusidqdo I just need a newer Ant?
12:54mib_xusidqor do I need Maven?
12:54technomancyjkantz: 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:54technomancybut that's super-lame
12:56jkantzpoll: what editors do people use?
12:56technomancyemacs
12:58mib_xusidqjkantz: do you have a statistically significant result yet? ;)
12:59duck1123technomancy: do you keep your source in src/ or src/main/clojure/
12:59duck1123100% of clojure users use emacs (+- 99.99%)
12:59stuartsierraemacs
13:00liebkevim
13:00jkantzyou can get a programmer to try a new language, but ask him/her to switch editors ...
13:00cemerickenclojure
13:01gnuvinceemacs
13:01technomancyduck1123: just src
13:01technomancyduck1123: I don't get paid by the directory.
13:04duck1123technomancy: you should make your src locations customizable in your el files.
13:04technomancyduck1123: which elisp library in particular?
13:05duck1123corkscrew and clojure-test-mode are the two I've come across
13:07Chousuke,(destructure '[[x y] [1 2]])
13:07Chousukehm
13:07Chousukewhere did clojurebot go :(
13:09gnuvinceNPE I imagine
13:09gnuvince;)
13:10Chousukebehold my new and improved destructure! first, the old:
13:10Chousuke(destructure '[[x [y z]] [1 [(int 2) [c]]]])
13:10Chousuke[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:10Chousuke(destructure '[[x [y z]] [1 [(int 2) [c]]]])
13:10Chousuke[x 1 y (int 2) z [c]]
13:10Chousuke:)
13:10Chousukethough there's a slight problem still.
13:11rhickeyhrm, 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:11rhickeyI'm concerned about gicing non-members full edit rights...
13:12rhickeygiving
13:12gnuvinceChousuke: does it work with non-vector collections such as lists?
13:12rhickeyhttp://forum.assembla.com/forums/3-Bug-reports/topics/1500-Non-members-can-make-themselves-watchers?page=1#posts-4775
13:12Chousukegnuvince: not yet
13:12duck1123rhickey: you don't want bug reports about viagra?
13:12gnuvinceChousuke: ok
13:13gnuvinceCool work though
13:13rhickeyduck1123: no thanks, actually that was never a problem on gcode, but with full edit rights people could change status, assign, close etc
13:13gnuvinceChousuke: will you put it on github (*snif*)?
13:13rhickeythose things are for the people doing the work
13:14Chousukegnuvince: I guess I could. not yet though. I still need to make it not break when you do (let [[x y] [1]] ...) :)
13:14gnuvinceChousuke: cool
13:14Chousukerest params will be a problem too. :P
13:14gnuvinceKeep me appraised; I used manual vector dereferencing in my starcraft lib because it performs better, but this would be better
13:16ChousukeI think the performance difference comes mostly from the fact that the three-parameter version of 'nth is not inlined :/
13:17duck1123does anyone know why imenu is picking up the newline after my function names as part of the name?
13:17duck1123anyone here using imenu for clojure code?
13:18technomancyduck1123: yeah... suspect a bug in clojure-def-regexp
13:20Chouserrhickey: What does assembla's bug tracker do better than gcode?
13:20technomancyduck1123: 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:21technomancypatches welcome. =)
13:22duck1123regex is arcane enough, why did emacs have to make it that much harder
13:22gnuvinceduck1123: why did Perl have to make it that much easier?
13:22technomancymight have something to do with the fact that its implementation pretty much older than time itself. =)
13:23gnuvinceduck1123: Emacs' regex implementation pre-dates what is considered mainstream nowadays
13:24herdrickhello all, i have a question about clojure swank
13:24herdricki'm getting OutOfMemoryError in the REPL so I need to change my Java heap space
13:24herdrickI'm not seeing where the invocation to 'java' is
13:24technomancy,dv swank-clojure-extra-vm-args
13:25technomancyoops... there's no fsbot here.
13:25herdricktechnomancy: thanks!
13:25herdricki can probably find it with that alone on Google, yes?
13:25technomancyherdrick: better to use C-h v from within Emacs
13:25technomancybut yeah
13:25herdrickthis perhaps will work: http://paste.lisp.org/display/71211
13:26herdrickoh, ok
13:26technomancyherdrick: clojure-slime-config from clojure-mode will do most of that setup for you
13:27herdricki do use closure-slime-config in my .emacs file
13:27herdrickbut you're saying i should invoke it again now?
13:27technomancyno, I mean half the stuff in your paste is already done for you by that function
13:27herdrickoh, all right thanks
13:28rhickeyChouser: hopefully not stink! It's much richer and works with the milestone system
13:28technomancyherdrick: 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:28herdricklooks like the C-h v , swank-clojure-extra-vm-args is going to do the trick for me
13:28herdricktechnomancy: yeah, I noticed that
13:29herdricki got rid of mine
13:29herdrickhave a brand new install now
13:29technomancyherdrick: also, do you know about M-x clojure-install?
13:30technomancyit looks like you've already done the work of the installation, but next time that should be able to automate it for you
13:30herdricktechnomancy: yep, that's how I installed it this time
13:30technomancyoh, ok
13:30herdricksorry, that paste is not from me
13:30technomancyoh, that explains it. =)
13:30herdrickit was the first result for Googling swank-clojure-extra-vm-args
13:30herdrickyeah, :)
13:32dysingerI don't use the clojure-install method
13:32dysingerit didn't work for me and also I already had those projects in different dirs.
13:32dysingerso I just came up with my own .emacs black
13:32dysingerblock
13:33dysingerby looking at what clojure-install function does
13:33rhickeyChouser: 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:34Chouserah, ok.
13:34rhickeyboth seem to have an appalling lack of 'sort by last activity'
13:35dysingermine looks like this herdrick http://paste.lisp.org/display/81938
13:36Chousukegnuvince: http://github.com/Chousuke/clojure/tree/simple-destructure ... I make no guarantee that it works at all. It seems to, though.
13:36gnuvinceoh, it's not a separate lib
13:37gnuvincehmmm
13:37gnuvinceweird: I can't see beyond line 1908 of core.clj
13:37herdrickdysinger: ok, thanks. the clojure-install is working well for me so far, though
13:37dysingerok good
13:38herdrickdysinger: slime-fancy sounds interesting tho. with a name like that...
13:38Chousukeoh crap
13:38Chousukerepl error :P
13:38Chousukeapparently using defn- wasn't allowed ;(
13:39technomancyherdrick: slime-fancy is just a module that loads "a whole bunch of stuff outside core slime"
13:39duck1123technomancy: you have a pull request
13:40technomancycool
13:40herdricktechnomancy: thanks
13:41Chousukeshould at least compile-test my edits I suppose :P
13:47Chousukethe more difficult task is to extend that to support &, :as and map destructuring :P
13:48rhickey... your import for clojure-contrib has completed. http://github.com/richhickey/clojure-contrib/tree/master
13:53technomancyalready to the #1 forked and #1 watched Java project; not bad: http://github.com/languages/Java
13:55cemerickwell, this week, anyway. We'll see how things stack up over time.
13:55cemerick(though I'm hoping, of course)
13:58ChousukeClojure is still 83% java? that's scary.
13:59replacaChousuke: that's measured by LoC
13:59Chousukeyeah
13:59replacaI assume
13:59Chousukescary.
13:59duck1123the kevinoneill version is among the most watched overall
13:59replacaIf we assume clojure code is twice as dense, that would change the equation substantially
14:00cemerickJava is almost 100% java :-P
14:00cemerick(my snarky way of saying, hey, it works!)
14:01Chousukethe target, of course, is to have Clojure be 100% Clojure :)
14:02dnolenheh I thought 90% was rhickey's goal.
14:02ChousukeNot ambitious enough!
14:02cemerickyeah, definitely a good goal, but I wouldn't say the current state is scary
14:03dnolencemerick: it's nice to see that Clojure the language is so small.
14:03duck1123wouldn'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:03dnolenlooks like Monday is the big day for rhickey's commits
14:03dnolenhttp://github.com/richhickey/clojure/graphs/punch_card
14:04eevar_yay, contrib is out on github as well now
14:04cemerickheh, a lot of people have complained about how large clojure's core is (w.r.t. # of special forms)
14:04replacaI'm glad I fixed the typo in my last commit comment last night before pushing :-).
14:08eevar_btw. isn't it common for the /test to lie alongside /src?
14:08stuartsierraIn Java-land, it is common.
14:09Chousukecemerick: most of the special forms are java interop anyway :P
14:10cemerickoh, I know, but some of the rabble don't like that. *shrug*
14:10rhickeycemerick: most of the complaints are about the reader stuff, there aren't many special forms
14:11replacadnolen: That shows that rhickey isn't a *real* hacker. Real hackers have the majority of their checkins between midnight and 6AM :-)
14:11cemerickrhickey: I got an earful from some people @ ILC about try/catch/finally in particular.
14:12rhickeycemerick: ok
14:12cemerickThey (unsurprisingly) thought interop is irrelevant, and something like restarts and such should have been bolted in.
14:13mrsoloclojure core is large?
14:17slashus2cemerick: What did they say about try catch finally? Was it because it is a special form?
14:18cemerickslashus2: yes -- a wart inherited from Java, in their opinion.
14:18cemerickThey were certainly coming from a very particular perspective, of course.
14:24duck1123it's not like you have to use them
14:24mrsolowell for me java interop is the primary reason that i have picked clojure over others
14:24duck1123thank god Clojure doesn't have checked exceptions
14:24Chousermrsolo: you're by no means alone.
14:25Chouserbut people at a lisp conference are unlikely to care much about java, interop or otherwise.
14:28hiredmanhttp://groups.google.com/group/comp.lang.lisp/msg/a86c91091ae16970 <-- zing!
14:29rhickeyhiredman: did that seem too harsh?
14:30hiredmannot too harsh
14:30mrsolonot at all.. he was trolling imho
14:31rzoom_nj to rhickey on that
14:32liebkerhickey: it was a good explanation of the objectives of the ants simulation too
14:32cemerickrhickey: I'm really surprised your responded at all, actually
14:34duck1123is c.l.l worth reading for someone into clojure, but not that concerned with CL or others?
14:35technomancyonly if you like fireworks
14:35rhickeycemerick: 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:35cemerickduck1123: it's a very toxic forum, IMO
14:35rhickeyduck1123: no, it really is a Common Lisp crowd
14:35hiredmanduck1123: c.l.l is icky
14:36cemerick#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:36cemerick(maybe there's anti-demagoguery demagoguery here?)
14:36baetis-flytechnomancy: wasn't that the same guy?
14:36technomancybaetis-fly: I get all the different Pascals confused.
14:37baetis-flytechnomancy: ah, perhaps I am as well.
14:37cemerickrhickey: I totally understand. Of course, there's always people wrong on the internet, and only one of you (or ~100 of us, perhaps) :-)
14:37hiredmanI 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:37technomancyhiredman: especially since it would be easy for someone to glance at the CL version without realizing its shortcomings.
14:40technomancyanyway if I were named after a procedural language I would probably be pretty grumpy too.
14:41baetis-flyfor the record, different Pascal.
14:42rsynnottoh, #lisp isn't that bad these days, anyway
14:42rsynnott(about half the people on c.l.l are actually insane, though)
14:43mrsolowell there is a way to do ant demo without lock at all right?
14:44cemerickwell, as rhickey pointed out, the objective is to do more than just draw stuff on the screen
14:44mrsoloright
14:44duck1123it 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:45duncanmanyone good with git here?
14:45cemerickyou'd end up writing a bad, custom STM impl, I'd think
14:45technomancyduncanm: we're all learning, these days. =)
14:45technomancywhat's the question?
14:45mrsoloi am just saying that cl version doesnt' do it that way, still use lock
14:45duncanmtechnomancy: i'm 10+ commits past origin/master on my own master branch
14:46duncanmtechnomancy: i'd like to branch my own changes to its own branch, and keep master tracking origin/master
14:46Chousukeyou want to move that to its own branch?
14:46duncanmright
14:46Chousukeeasy.
14:46technomancyoh, that _is_ bad. I hope you saved. (http://www.penny-arcade.com/comic/2006/12/20/)
14:46technomancy(just kidding)
14:46duncanmi've been switching back and forth between git and hg, so now i'm all confused
14:46duncanmi think i know how to do that in hg, maybe
14:46rsynnottcemerick: there are a few cl implementations of software transactional memory, though not sure how good they are
14:47duncanmChousuke: what's the trick?
14:47Chousukegit co -b changes; git co master; git reset origin/master; should do it.
14:47Chousukeassuming no uncommitted changes.
14:48Chousukeand 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:48Chousuke(with reset that is)
14:48Chousukealso, co = checkout
14:48duck1123use "gitk --all" if you like working with a gui
14:50duncanmperfect
15:38ChouserNice! Looks like assembla watches github commits to update ticket status: http://www.assembla.com/spaces/clojure-contrib/github_tool
15:51rhickeyChouser: yup
15:52rhickeythere are some magic word we can use to associate commits with tickets
15:54rhickeyChouser: also, looks like the support tool is just the ticket for non-member participation
16:42vika23hello , i can't seem to get function "get-connection" in clojure.contrib.sql to work ,repl refuses to recognize it ,any help appreciated
16:43rhickeycontrib github repo seem ok?
16:44Chousukeno problems so far.
16:44stuartsierraSo can all contrib members push to the github repo?
16:45rhickeystuartsierra: should be yes, only 8 have given me their github ids
16:45rhickey4 missing
16:47replacabut we need pics of the contributors, too :-)
16:47Chouseroh, is there a list somewhere?
16:47ChouserI haven't been able to find one on the github project.
16:47rhickeymaybe only on the admin page
16:47Chouserhm. seems odd.
16:47rhickeyyes
16:48replacarhickey, Chouser yeah, I was looking for that on the rails project the other day and couldn't find the list there either
16:52achimvika23: 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:53mstevenshello!
16:54achimvika23: note that you can use connection and find-connection inside the with-connection body to get hold of the connection handle
16:54replacamstevens: good afternoon
16:55replacamstevens: you'll find it's a friendly place
16:55mstevensreplaca: nearly everything on freenode seems to be.
16:55stuartsierraWhere everybody knows your name...
16:55replacastuartsierra: I grew up aroud the block from that bar :-)
16:56replaca*around
16:56vika23achim: great! thanks
16:56Chousermstevens: glad to hear you've had such positive experiences.
16:57ChousukeEveryone wishes for that :)
16:57ChouserI was hoping the book was sufficient.
16:58stuartsierraDocumentation is like sex. Even when it's bad, it's still better than nothing. And everybody wants more of it.
16:58mstevensChosuke: well it seems to be happening! So I can't complain too much.
16:58Chousukehttp://java.ociweb.com/mark/clojure/ I'll keep spamming this link forever to newbies
16:59Chousukemight be a bit redundant if you have the book, but nice anywya
16:59Chousukeanyway*
16:59dnolenmstevens: 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:00cemerickis BDFL really rhickey's title? Seems like we should have something original :-)
17:00Chouseralso, no better way to get the basics down well than to anwser the same questions several times.
17:01rysEHDFL :p
17:01rysepic-haired > benevolent
17:02mstevensSTM looked much cooler than I expected
17:05ccmtaylor\openany % keine Leerseiten
17:05mstevensChousuke: I saw the snake game in the book :)
17:05ccmtaylorwhoops, wrong buffer ;)
17:06ccmtaylor\openany % keine Leerseiten
17:06Chousuke:p
17:06ccmtaylord'oh. thats what you get from using a new .emacs.d
17:06ccmtaylorM-V didn't used to be paste
17:14ccmtayloropenany % keine Leerseiten
17:15ChousukeToday 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:15Chousukethe worker function to handle the complex stuff. It actually compiled and ran correctly for simple inputs on the first try :P
17:16Chousukeafter a few more tweaks I got it working for even rather complicated inputs.
17:17ChousukeI'm quite certain that if destructure were in any way stateful I wouldn't have been able to pull this off :P
17:17ChouserChousuke: yes, it's amazing how much you can do while understanding only a small part of the code.
17:18Chouserlike algebra
17:21Chousukestate is like a global variable that everyone has unrestricted access to.
17:21dnolenmstevens: 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:22Chousukeyou just need to know how your code affects it, or things will break
17:22mstevensWell I've just been noticing how many java bugs I get from invalid state, and how much immutable objects can simplify things.
17:23mstevensI'm occasionally tempted to make everything in java "final" by default, but it's not java-ish.
17:30ChousukeIt's also much more fun.
17:31Chousuke"No way this will work" "oh. it does."
17:32mstevensChousuke: that was one thing I noticed with the book, everything's weirdly general
17:33ChousukeMany of the small things together in clojure are what make it so neat.
17:36Chousukethere'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:36Xcaliborgreetings
17:37mstevenshello
17:37Chousukeall kinds of small things that you might not notice that together contribute a lot to the language
17:38Xcalibormay 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:39Chousukehmm
17:39mstevensmy first answer would be java.util.concurrent, but that's not very clojure-ish I suspect
17:40mstevens<- java person who snuck in
17:40ChouserXcalibor: you need to do a distance func on every combination of hash-map-key to name-list-item?
17:41ataggartout of curiosity, what practical application does this have?
17:42XcaliborChouser: 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:42mstevensDidn't work very well though
17:42ChousukeXcalibor: first I guess you should partition the huge list.
17:43tashafaHello!
17:43Xcaliborataggart: 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:43tashafa(doc doto)
17:43tashafa,(doc doto)
17:43Chousukeclojurebot is offline :(
17:43tashafa:'(
17:44hiredman:(
17:45XcaliborI 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:46ChouserXcalibor: I still don't quite understand what you're trying to do, but I suspect pmap might help.
17:46michelHullo! was wondering if anyone could help doing a (hopefully simple) debugging
17:47Chouserif 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:47Chousermichel: probably -- ask away.
17:48michelI 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:48XcaliborChouser: 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:48ataggart"I just wrote a macro" ... ominous
17:48kotarakmichel: did you restart the repl?
17:48michelataggart: yes and no. it makes testing easier: (dotrace (+ -) (+ 10 20 30))
17:49Jetienhi 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:49kotarakmichel: jars cannot be reloaded.
17:49michelkotarak: yes. and I checked the JAR, and it does contain class files for the new macro
17:49michelusing clojure-contrib/launchers/bash/clj-env-dir to start the REPL
17:49kotarakJetien: what's the filetype of the buffer? (The mappings are only set for clojure buffers)
17:50Jetienkotarak: how can i find out the filetype of the current buffer?
17:50kotarak:set filetype? (<- with ?)
17:50ChousukeXcalibor: something like (pmap (partial reduce [] (fn [acc item] (if (match item) (conj item acc) acc))) (partition (/ (count huge-list) 4))))
17:50michelI'll try modifying an existing macro in that file, and see if I could get the changes to take effect.
17:51XcaliborChouser: 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:51Chousuke(count huge-list) has to be divisible by four though
17:51Chousukethat won't short circuit though :/
17:51Chousukeand I overuse though :p
17:52Jetienkotarak: i did a set filetype="clojure" - is that right?
17:52Jetieni got parens matching and indention, so my guess is that it worked
17:52kotarakJetien: yes. do the bindings show up in ":nmap" output?
17:53Jetienkotarak: nothing which looks like vimclojure
17:53kotarakJetien: did you put "let clj_want_gorilla = 1" in your .vimrc?
17:53XcaliborChousuke: 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:53Jetienkotarak: i did
17:54kotarakhmm
17:54Jetienkotarak: theere were also no erros in the installation
17:54achimdoes 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:55ChousukeXcalibor: that's what I intended to show there.
17:55kotarakJetien: do a ":source ~/.vim/ftplugin/clojure.vim". Are the mappings now there?
17:55XcaliborChousuke: 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:55ChousukeXcalibor: you need to partition your huge list, then launch a search on each partition, and then concatenate the results.
17:56Jetienkotarak: no
17:56ChousukeXcalibor: how fast an operation is nsearch though?
17:56michelOK, 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:58Chouserachim: seqs over vectors are chunked already (head)
17:58Chouser(class (seq (vec (range 100)))) ==> clojure.lang.LazilyPersistentVector$ChunkedSeq
17:58XcaliborChousuke: "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:59Chouserachim: 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:00Xcaliborif 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:00Chouserachim: so as long as you're composing those chunk-aware fns, you'll get extra speed with no work.
18:01achimChouser: nice, thanks for the info! so there will be a (supported, public) way to get hold of the chunks?
18:01Chouserachim: 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:01Xcaliborthis would have to happen some hundred of times for all the users...
18:01Jetienkotarak: is there a quick fix in clojure.vim to workaround this problem maybe?
18:01Chouserachim: yep! Gotta go now, though.
18:02ChousukeXcalibor: hm.
18:02achimthat sounds exciting
18:02ChousukeXcalibor: I really can't form an image of what you're trying to do
18:02ChousukeXcalibor: but most likely spawning a thread for each user is not worth it.
18:02ChousukeXcalibor: so partition your users
18:03technomancythis is pretty cool: http://github.com/richhickey/clojure-contrib/graphs/impact
18:03ChousukeXcalibor: and spawn a thread for each partition
18:03XcaliborChousuke: you think so?
18:03technomancyI can't wait till the history for clojure itself actually records authorship.
18:03ChousukeXcalibor: well, unless the search per user is going to take >500ms, then no.
18:03kotarakJetien: 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:04XcaliborI 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:04ChousukeXcalibor: you can use future or pmap
18:04ChousukeXcalibor: see the documentation :)
18:04technomancywhoa; microsoft gave a grant to the Scala team to bring the .NET port to parity with the JVM one.
18:05Xcaliboryep! I will.. future and pmap, great... thanks a lot!
18:05Jetienkotarak: alright, no problem. i try to find out myself and come back some other time. danke schonmal!
18:05technomancy(according to dean wampler anyway: http://twitter.com/deanwampler/status/2156940937)
18:08ataggartChousuke: any reason why agents wouldn't be appropriate to Xcalibor's problem?
18:09replacatechnomancy: yeah, I saw that graph too. Pretty sweet.
18:10Chousukeataggart: I think futures are simpler
18:11ataggartperhaps my mental model is off, but I think of them as being mostly equivalent
18:11Chousukeataggart: if you just create an agent and then send a single job to it, that's equivalent to a future
18:12Chousukeataggart: but agents are meant to receive multiple sends over time, which you don't want in this case :/
18:12Chousukefutures are simpler to use as well. they're kind of like "read-only" agents.
18:13Chousuke(after the first job has run, of course)
18:14dnolenspeaking 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:15dnolenone thought is that they are useful for interactive functions at the REPL.
18:15dnolenis that a silly idea?
18:16Xcaliborone 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:17ChousukeXcalibor: did you require it?
18:17Xcalibori use it...
18:17Xcaliborjava.lang.ClassNotFoundException: jsr166y.forkjoin.ParallelArray (parallel.clj:0)
18:18hiredmanyeah, you need the jsr11y jar
18:18Xcaliborweird...
18:18hiredmaner
18:18Xcaliboris that an ant task? or do I have to download more code?
18:18ataggarthttp://gee.cs.oswego.edu/dl/concurrency-interest/index.html
18:19hiredmanclojure.parallel has not been looked after, as far as I know
18:19hiredmanlast I heard the classes in the jsr166 jar had been renamed and parallel had not been updated
18:20Xcaliboroh, i see... well, i was wondering...
18:20Xcaliboras for promises, are they similar to Scheme's?
18:20hiredmanyeah, I would ignore it (I have been ignoring it)
18:20hiredmannope
18:20ataggartdnolen: is there a link to that stuff?
18:20hiredmanscheme's promises are clojure's delays
18:21dnolenattagart: no but it was discussed on irc.
18:21ataggartrgr
18:21Xcaliboroh, the I have no idea of what those promise/deliver are :-P any link to info?
18:21hiredmana clojure promise is a sort of write only atom, where all reads block until the atom as been written
18:22hiredmanXcalibor: (doc promise) in the repl
18:22dnolenand throws on any successive writes beyond the first
18:22dnolenit 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:22Xcaliborhiredman: 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:23hiredmanXcalibor: git
18:23hiredman~github
18:23hiredmandamn it!
18:23ataggartcan't live without clojurebot
18:23Xcaliborah... bleeding edge stuff, uh?
18:23hiredmanXcalibor: promise/deliver are brand new
18:23dnolenhmm nothing comin up on Chouser's irc log.
18:24hiredmanblocking stuff is always neat to setup pull based computations
18:24Xcaliborso an atom that only allows one write and blocks any reading until it's fully written to?
18:25hiredmansomething like that
18:25Xcaliborare they first-class citizens? I mean, can you send them over the net, for example?
18:26hiredmanuh
18:26hiredmanyou definition of "first-class" does not compute
18:26Xcaliborit seems something useful to build up state objects that can be used to spread estate to a farm of proceses
18:27Xcaliborhiredman: nod, it's unfortunate... not like first-class citizens as applied to functions, and so one (that can be returned, passed along, etc)
18:27hiredman"send them over the net" is a serialization operation and has nothing to do with "first-class" this or that
18:28ChousukeI don't think they're meant for distributed computing
18:28hiredmannone of clojure's concurrency primitives are meant for distribution across jvms
18:29Xcaliborbut 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:29mrsolothe exception raised by agent, is it binded to a particular thread?
18:29hiredmanmrsolo: huh?
18:29mrsoloif an agent raised an exception due to validator error
18:29dnolen_Xcalibor: for distributed computing some work has been done integrating Clojure with Terracotta.
18:30hiredmanmrsolo: 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:30hiredmanhttp://clojure.org/agents
18:30mrsolook
18:30Xcalibordnolen_: terracotta? is that some Java framework? i'm not really much into Java per se... i'll have to check it out
18:30mrsoloeveybody gets it basically
18:30ChousukeI really can't tell what kind of work promise/deliver would be good for :/
18:31hiredmanpull based stuff
18:31dnolen_Xcalibor: yes
18:31Chousukeperhaps a producer/consumer kind of system with multiple concurrent producers and consumers.
18:32hiredmanhttp://leansoftwareengineering.com/2009/01/08/mechanics-of-pull-development-workflow/
18:32Chousukethen you could have a manager distributing promises all around
18:32Xcalibordnolen_: ok, i'll have a look, it seems something promising: distributed over several multicore boxes could give a huge power... :-)
18:32Chousukeand someone delivers them
18:32dnolen_Xcalibor: search the google group for Terracotta for reference
18:33hiredmanwell, that is not a good exmple
18:33Xcalibordnolen_: great, thanks! now it's already tomorrow in here, time to go to bed... thanks for all your help, and good night!
18:35Chousukeyou 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:36dnolen_Chousuke: hmm interesting.
18:37dnolen_I suppose you can design a series tasks that are complete asynchronously, then the process unblocks filling yet another task, et. al.
18:37hiredmanChousuke: yeah for fanning out
18:39Chousukeyou 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:40dnolen_Chousuke: now that I think about it sounds like a good way to maximize concurrency no need for explicit awaits.
18:40mrsolonice, is it available yet?
18:40Chousukemrsolo: recent commit in git
18:40Chousuke(svn too but you should forget that!)
18:42mrsoloso it is git from now?
18:42Chousukeis it actually official yet?
18:42Chousukebut anyway, yeah.
18:43mrsolobtw is pom.xml official? or it is just there
18:43mrsoloi keep doing my own version for mvn
18:43mrsolofor clojure-contrib that is
18:44Chousukehttp://www.assembla.com/spaces/dashboard/index/clojure http://www.assembla.com/spaces/dashboard/index/clojure-contrib
18:45ataggartit'd be nice if contrib had an official release
18:46opqdonutmhmm
18:47opqdonutsynced with the clojure releases
18:47ataggartrandomly pulling down whatever happens to be in trunk at that moment makes me nervous
18:48ataggartand I'm a bit unclear about what rationale is used to decide whether something goes in clojure, clojure-contrib, or some separate project
18:56hiredmanhttp://en.wikipedia.org/wiki/Dataflow_programming <-- hash map thing it mentions could actually be implemented using promise/deliver
19:06Chousukehiredman: but after delivering a single promise, you'd have to reconstruct the graph again, wouldn't you?
19:06Chousuketo get new deliverable promises.
19:07hiredmanChousuke: if you used promise
19:07Chousukethe dataflow in contrib is implemented using agents I think
19:09hiredmansome dataflows are imutable
19:09hiredmanactually
19:10hiredmanstrictly speaking, they have to be
19:10Chousukeum, but they aren't immutable in the sense that once you give one input, you can no longer give any more? :/
19:11hiredmanit's not exactly a fan out style thing
19:12hiredmanit'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:17durka42or you run them all at the same time :)
19:17durka42there's dataflow in contrib? i'll have to play with this
19:23hiredmandurka42: yeah, you wrap all your function calls in future, and all paramteres in promises
19:24hiredmanor all your functions internally call future and return a promise
20:04wavisanyone considered the possibility of compiling clojure to parrotvm?
20:39rhickeyIt's official: http://groups.google.com/group/clojure/msg/ca4fb58428052554
20:40arohnerrhickey: great!
20:44Chousera one-time scrape of gcode issues and push to assembla tickets might be a nice little enlive project for someone.
20:46quidnuncWhat does Assembla do that is special?
20:50rhickeyquidnunc: it has a richer tickets/milestone system than gcode, a wysiwyg wiki, logged chat, and just generally better collab and project management tools
20:52rhickeysame kind of thing as unfuddle etc
20:52quidnuncrhickey: Were any other alternatives in contention? Assembla is non-gratis right?
20:52michelgreat news. just curious -- how does it compare to Sun's Kenai?
20:52rhickeyassembla is free for open source projects where everything is public
20:52rhickeyso, free for Clojure
20:55rhickeymichel: 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:56rhickeyI also don't really get the cross-project focus of Kenai, and it has fewer tools
20:57michelah, 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:57rhickeythat's the goal
21:10durka42is rhickey managing contrib now then?
21:10rhickeydurka42: what does that mean?
21:11durka42i mean, if it's in your name on github
21:11durka42are you the gatekeeper?
21:11rhickeyI was the admin before and am still
21:11durka42oh, ok
21:11durka42I thought it was Chouser for a while
21:13Chouseroh dear, no. I'm not in charge of anything.
21:13Chouserby lines of code, I've contributed about 5% of what's currently in contrib.
21:14durka42:)
21:14ChouserI'm flattered you thought so, though. :-)
21:28jackdempseyhey 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:29rhickeyjackdempsey: hi, thanks
21:30jackdempseynp, think its a great move, but i remember starting with git....can be a bit intimidating at first
21:30jackdempseyi've got a bunch of useful git links, etc scattered about....has anyone sent something like that to the group?
21:32rhickeyone 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:34jackdempseyyeah, i can see one worrying about that....in practice, i don't think i've ever really been bogged down by that
21:34Chouserhiredman mentioned the idea of using a date/time in place of svn rev (when asking clojurebot for the latest, for example)
21:34jackdempseyi think there are several ways to deal with something like that
21:35jackdempseyyep 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:35jackdempseyif you do have it, then something else is the culprit
22:06jackdempseyrhickey: giving any talks on clojure near DC anytime soon?
22:18wy_hello
22:19Chouserwy_: hi
22:20wy_Chouser: Hi
22:20wy_I heard clojure has some of the lazy features?
22:21Chouseryep, Clojure's seqs can be lazy
22:23wy_only seqs?
22:23hsuhhi. i'm failing to define a function to swap! this atom (def x (atom [0 0 0 0 0 0]))
22:24hsuhi 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:24hsuhbut then (swap! x update-vals 1 2 3 4 5 6) gives me wrong number of arguments...
22:24hiredmancorrect
22:24Chouserwy_: 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:25hiredmanbecause update-vals takes 6 args, and swap! is passing 1
22:25hiredmanactually swap! is passing 2
22:25hsuhbut swap if f x y & args ...
22:25hsuhhm
22:26hsuhs/if/is
22:26hiredmanits like (apply update-vals @x '([0 0 0 0 0 0]))
22:26Chouserhsuh: your update-vals takes 6 args
22:27hiredmanwhich, in turn, is like (update-vals @x [0 0 0 0 0 0])
22:27hsuhdo we have a pastie?
22:27Chouserhsuh: your swap! call there passes the atom value plus the 6 args, for a total of 7.
22:27hiredman2 args
22:27hiredmanoh
22:27hiredmanwhoops
22:27hiredman~url
22:27hiredmanbah!
22:28hiredmanlisppaste8: url
22:28lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
22:28lisppaste8hsuh pasted "untitled" at http://paste.lisp.org/display/81963
22:29hsuhi thought that would work, passing a single vector...
22:29hiredmanhsuh: read the docstring for swap!
22:29Chouserhsuh: (swap! x foo [1 2 3]) will call (foo x-val [1 2 3]) -- 2 args
22:29hsuhok... i dont get why "+" works
22:30hiredmanhsuh: swap! applies the function to the current value of the atom and any other args you pass
22:30hiredmanso if you have (atom 1)
22:30hiredman(swap! (atom 1) + 2)
22:30hiredmanyou get 3 in the atom
22:30hsuhok.. got it now..
22:52hsuhso 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:53hsuh(i mean java's "new" to clojure)
22:56arohnerhsuh: (let [p1 (new Point)])
22:56arohneror (let [p1 (Point.)])
22:56hsuhwill that be an atom ?
22:56arohnerthat will be a local "variable"
22:56arohnerthat only exists inside the scope of let
22:56arohnerI say "variable" because it cannot be changed
22:56hsuhok, but then later on the code it is set..
22:57hiredman(defstruct point :x :y :z)
22:57arohnerhsuh: does it need to be modified, or can it be set once at the beginning?
22:58hsuhwell, if i wanted to map the code directly, this object is set inside a loop
22:58hiredmanwell, then you don't want to do it directly
22:58hsuhi dont know if setting the value on the java code has any other side effects
22:59hsuhthere's a wrapper for point already
22:59hsuh(defn point
22:59hsuh ([x y] (.point *applet* (float x)(float y))))
23:03cadshey, how do i parse strings into numbers?
23:04arohnercads: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
23:04arohnernm, I'm sleepy
23:13arohnercads: try this http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html
23:14cadsno to-int anywhere?
23:14arohnernot in clojure, yet
23:15arohneryou could (read), if you know you're getting ints
23:15arohnerbut that has it's own issues
23:16arohner,(doc read)
23:17arohnerclojurebot?