#clojure logs

2009-04-06

01:48jsankey(java.io.File. "a\\b")
01:49jsankey,(java.io.File. "a\\b")
01:49clojurebot#<File a\b>
01:50jsankey,(.parentFile (java.io.File. "a\\b"))
01:50clojurebotjava.lang.IllegalArgumentException: No matching field found: parentFile for class java.io.File
04:43kefkaI've noticed that ArrayList access seems to be slow in a Clojure REPL. Am I doing something wrong?
04:44AWizzArdmore info please
04:44AWizzArdyou are using the default JVM methods, so it should not be any slower
04:44kefka,(time (let [a (new ArrayList (range 10))] (doall (for [i (range 100000)] (.get a 5)))))
04:44clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: ArrayList
04:44kefka,(time (let [a (new java.util.ArrayList (range 10))] (doall (for [i (range 100000)] (.get a 5)))))
04:45kefkaIt takes about 1.3 microseconds per access on my machine.
04:45cconstantineI've got a crazy idea; Would it make sense to read files as a lazy-seq? Each element in the sequence would be an item from the file (Something like a line, or other defined chunk). This would make reading a file in a (dosync ...) easy/fast and would allow you to use all the nice drop, drop-while, filter, etc. lazy-seq functions. Am I crazy?
04:46kefkaI'm on a 2.6 GHz machine, so this is thousands of clock cycles
04:46kefkaper .get
04:47kefka,(time (let [a (new java.util.ArrayList (range 10))] (dorun (for [i (range 100000)] (.get a 5)))))
04:47kefkadorun, not doall... I think my doall might have hurt the Clojurebot
04:47cconstantinekefka: that returns a long list
04:47kefka,(+ 3 4)
04:48kefkaYes, I should have been using dorun. dorun doesn't return.
04:48Cark,(doc line-seq)
04:48kefkadoall returns a huge seq
04:48Carkdid you guys kill poor clojurebot ?
04:48kefkaClojurebot seems to have been killed by my huge doall. Sorry. :(
04:48kefkaHow does one get it back?
04:48cconstantineI get "Elapsed time: 66.048 msecs"
04:49cconstantinetalk to hiredguy?
04:49Carkanyways constantine : have a look to line-seq
04:50kefkacconstantine: It takes me about 100 msec, but that seems a lot longer than it should be, for 100k ArrayList accesses.
04:50kefkaOn a 2.6 GHz machine, that's 2600 clock cycles per access
04:50cconstantineCark: that is pretty close to what I was thinking of :)
04:51Carkyes though i'm not sure the file gets closed if you never go to the end of it
04:51Carkat least it should be upon GC
04:51cconstantineCark: right, it would have to be wrapped in either a generator func or macro
04:51cconstantinefor the file open/close
04:52Carki don't know ... i think rhickey was working on something for this ...
04:52cconstantinekefka: no idea what's up.... I've had disapointing results timing simple counting loops (last (range 1 100000)) compared to C
04:53Carkyou're not comparing the same thing
04:53Carkuse loop/recur
04:53cconstantineI got similar timings with loop/recur
04:53Carkon server jvm
04:53cconstantineyup
04:53Carkdid you take "warm up " into account ?
04:54cconstantineI'm inclined to think clojure isn't 100 times slower than C, and that I'm doing it wrong
04:54Carkand used unsafe maths ?
04:54cconstantineunsafe maths (unchecked-inc ...) didn't seem to effect speed
04:54Chousukedid you make sure there is no reflection?
04:54Carkyou coerced the counter to integers ?
04:55cconstantineno reflection?
04:55cconstantineI started with raw numbers at the reader, and used unchecked-inc
04:56Chousukewell, (.get foo 5) would cause reflection without a type hint.
04:56Chousukebind *warn-on-reflection* to true :/
04:56cconstantineah, and the time-to-run was linear with the number of increments, so the there was no "warm-up" factor
04:56cconstantineah, I've done that. I wasn't getting reflection
04:57cconstantinepoor clojurebot
04:58cconstantineI dunno, the only reason I cared even a little was that a friend doing project clojure was getting answers 10/100 times faster in C than I was in clojure using the same basic algorithms
04:58cconstantineI'm not too worried; another friend is using haskell and getting similar timings to me
04:59cconstantines/project clojure/project euler/
05:00cconstantineand our runtimes are on the order of 1-5 seconds
05:01gnuvinceFor simple problems like that, Clojure doesn't have much of a problem with performance.
05:02cconstantineit's ok, I beat him on code simplicity, code length, and generality of solution (his won't work for N too large)
05:03gnuvinceHe's probably not using Integer
05:04cconstantineHe's using C, so his types are like 'int'
05:04Carkhum testing this i just discovered that i can't run the server jvm on my 64bit computer =/
05:04gnuvincecconstantine: oh, I thought he was using Haskell
05:05cconstantinegnuvince: ah, yes the haskell guy is using Integer
05:09Carki have a deamatic increase in speed when using server jvm, and running the test several times
05:09Carkdramatic
05:09Carklisppaste8: url?
05:09lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
05:10lisppaste8cark pasted "untitled" at http://paste.lisp.org/display/78102
05:13hiredman~ticker JAVA
05:13clojurebotNo entiendo
05:13hiredmanuseless
05:14AWizzArd,(doc for)
05:14clojurebot"([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when test. (take 100 (for [x (range 100000
05:15AWizzArdkefka: You use dorun and not dotimes?
05:16AWizzArdOn my machine your (time (let [a (new java.util.ArrayList (range 10))] (dorun (for [i (range 100000)] (.get a 5))))) ==> "Elapsed time: 55.393632 msecs"
05:16AWizzArdkefka: but (time (let [a (new java.util.ArrayList (range 10))] (dotimes [i 100000] (.get a 5)))) ==> "Elapsed time: 7.141131 msecs"
05:17AWizzArd'(/ 100000 7.141131)
05:17AWizzArd,(/ 100000 7.141131)
05:17clojurebot14003.384057791407
05:17AWizzArd14000 reads per millisecond
05:17jgracinHi! Could someone please help me resolving a "not releasing the head" problem. I'll paste it in a sec.
05:17lisppaste8jgracin pasted "Out of heap space" at http://paste.lisp.org/display/78104
05:17AWizzArdNo wait, nonsense of course. That is lazy and was not run.
05:19Carki think it gets optimized out
05:21jgracinis it because "lines" is a parameter which stays bound until the function exits? I guess that's it, isn't it?
05:22mihandhey guys! is (int (/ a b)) the idiomatic way to do truncating division ?
05:22Chousermihand: quot
05:24Carkjgracin : when you call find-save-debug the lines parameter points to the head of the lines sequence
05:24Carkso you're retaining the head
05:25jgracinCark: thanks! Is there any way I can deal with this? Is this what streams are for? Where are the streams?
05:26Carkyou could change entire-log-line-seq to return a function that will return the sequence
05:26Chouserstreams are experimental, not in trunk
05:26Carkand pass that as a parameter to find-saved-debug
05:26Carkhey hello chouser
05:27RaynesHey hello hi Chouser.
05:27RaynesCark: I win.
05:27Chouserhi guys
05:27cemerickhey, Chouser's back, all's right with the world again! :-D
05:27jgracinSo I can't pass infinite lazy sequences into functions because that will necessarily blow up the heap.
05:28jgracinI mean, if they decide to make a long search through the seq.
05:28lisppaste8cark annotated #78104 "untitled" at http://paste.lisp.org/display/78104#1
05:28Chouserhm, that can't be quite right, since you can pass infinite lazy seqs to 'filter' without a problem.
05:28Carktry this untested change
05:28Carkchouser : filter probably uses recur
05:29Chouserno, it's lazy. uses lazy-seq
05:29Cark~def filter
05:29Carkwell then it returns immediately
05:29jgracinmy entire-log-lines-seq uses concat which I counted on using lazy-seq internally.
05:31Chouserthat should be ok (though mapcat would be more succinct)
05:32Carkjgracin : try my solution and tell us how it goes !
05:35jgracinCark: yup, it works. Thanks! I do understand how and why. It's just that it doesn't seem quite elegant. Does the streams address this kind of problem or are they for different purposes?
05:35Carkyes they do
05:35Carkhum there is another way
05:35Carkyou could build your own filtered lazy sequence
05:35Cark~def filter
05:36Chouserare locals cleared out before tail calls?
05:38lisppaste8cark annotated #78104 "untitled" at http://paste.lisp.org/display/78104#2
05:39Carknot sure if that will do it
05:41Carkchouser : my guess would be that the pointers are overwritten
05:41Carkso no more reference, so garbage collectable
05:48Chouseryes, that appears to be the case. if so, then just moving the call to 'first' out of find-saved-debug might do it
05:48Chouseroh
05:48Chouserlike Cark's second annotation.
05:48Chouser:-)
05:48Cark=)
05:49jgracinthanks!
05:49Chouserexcept saved-debugs is still a fn that needs to be called with the right args, but that's the gist I was headed for.
05:49Chouseroh, nm.
06:06Mecis there an opposite of slurp that writes a string to a file?
06:07dliebke,(doc clojure.contrib.duck-streams/spit)
06:07clojurebotjava.lang.Exception: Unable to resolve var: clojure.contrib.duck-streams/spit in this context
06:08dliebkeclojure.contrib.duck-streams/spit writes a string to a file
06:09Mecthanks
06:10Mechmm class not found exception
06:10Cark,(use 'clojure.contrib.duck-streams)
06:10clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath:
06:10Carkworks on my machine !
06:11Mecyup i got it now
06:11Mecwill spit overwrite the file?
06:13dliebkeyes, it appears to overwrite the file
06:14Mecexcellent, thanks
06:24hiredman~ticker JAVA
06:24clojurebotPardon?
06:24hiredmanclojurebot: are you for real?
06:24clojurebotfor is not a loop
06:26cconstantineok, so it turns out I'm not using a java server
06:26cconstantineis there a place that talks about how to do that?
06:28cconstantinenm, I needed to ask the question for me to answer it myself
06:31hiredman~ticker JAVA
06:31clojurebotJAVA; -1.98
06:38cemerickis it true that there's no way to determine how many arguments a fn can accept?
06:39Chouseryou can call it with n args, and if you get an exception then it doesn't except that many.
06:39Chouseror of those types.
06:39Chouseror something else is wrong.
06:39hiredmancemerick: it is true
06:39cemerickso if I pull a fish out of a random hole, I get to keep the fish? ;-)
06:40Chouseryou can look at the :arglists metadata of a var
06:40Chouserbut that can be overwritten by the user, so ... *shrug*
06:40hiredmanChouser is trying to sugar coat it for you
06:41Chouseryou can do what the 'source' macro does to find the clojure source for the fn, use 'read' and 'macroexpand' and analyze the results...
06:42cemerickI think I'd just make a macro that attaches arity metadata :-)
06:43cemerickbut wow, dropping to the source macro is imaginative...
06:43Chouserbut so very very wrong
06:44hiredmanFn objects don't let you attach metadata
06:44cemerickah, damn
06:44hiredmanYeah
06:44Chouserwell, they don't let you *change* metadata. You can use proxy to provide unalterable metadata when you creating the instance.
06:45hiredmanwell, I guess there is that
06:45Chouserwhich actually sounds about perfect for arity
06:46cemerickah, AFn has metadata. I'd think IFn would extend IObj.
06:46Chouserwhat would this metadata look like? a set of the accepted arities?
06:46Chouserbut then what about variadics?
06:46cemerickI'm not sure yet. We need a little more than just arity (type info, aaack!), but it'd always be immutable.
06:47cemerickI don't think we have any variadic fns in this particular corner of things.
06:48cemerickeh, maybe we should just pass around maps with a :fn key where the actual function lives. I'll bet we'll want to assoc some amount of stuff into a fn's 'metadata' eventually.
07:17Chouserrecur is a bit of a problem
07:18Chouserit refers to it's own kind of scope -- not dynamic, not lexical of the sort that can be closed over.
07:21cemerickthat's the tradeoff for constant-space stack usage, right? The "real" solution is TCO or trampolining.
07:23ChouserIt seems it might be theoretically possible to recur to a named loop in your lexical scope...
07:23Chouserhm, maybe not -- if you close over that name, then call the closure from outside that lexical scope, where does the recur go?
07:23cemerickoh, so you could choose to recur to the next loop up, or optionally to an outer loop or the fn you're in?
07:24cmvkkwhat are you trying to do?
07:24Chousercemerick: yeah, that's what I was thinking, but I specifically wanted to be able to close over that name, so that I could 'recur' to a named loop instead of having to recurse to a named fn.
07:25Chousercmvkk: fix error-kit
07:25Chouserugh, sounds like I might be asking for continuations without knowing it.
07:25cemerickyou inch towards a reified environment at that point, I think.
07:25cemerickindeed
07:26cemerickthat's not entirely horrible in the scope of error-kit, though, right?
07:27Chouserwhat's not horrible, continuations?
07:28cemerickwithin the scope of using error-kit facilities, requiring people to work with a separate, reified environment
07:28cemerickpenalty there, certainly
07:29Carki'm trying to use clojure.contrib.pprint/pprint it works ok in the repl, but i can't seem to make it work from an executable jar file, any idea on how i could make it work ?
07:29Chouseroh, I see. But building that kind of reified env is more than I'd like to do. So far I've avoided any real code-walking.
07:30Chousermy problem is that the body of a 'handle' form is a closure, so that it can use names from the 'with-handler' scope. But since the handler can do 'continue-with' which requires it be executed in the dynamic and call-stack scope of the 'raise'
07:31Chouserthat's all fine until someone tries to 'recur' from inside a 'handle' form, excepting it to jump back to a 'loop' outside of the 'with-handler'
07:31cemerickah, I get it
07:31cemerickwell, how does CL do it in the face of goto?
07:32Chouserno idea. But since it has neither 'continue-with' (as far as I can tell) nor 'recur', it may just not have that problem.
07:33cemerickwell, recur is just a special case of goto
07:34cemerickcontinue-with (if I understand the semantics) is the trickier problem, it seems. That's a big jump from an error providing a set of fixed restart options.
07:35cemerickCark: what error/problem are you seeing?
07:35Carknothing, it just does not output a thing
07:35ChouserI already toss bits of extra data up the call stack -- I suppose I could provide a 'kit/recur' that causes the recur to happen at the right scope.
07:36ChouserI could even code-walk and try to replace 'recur' with 'kit/recur' where appropriate
07:36cmvkkthat seems like the only option, if you're trying to remove a point of recurrance
07:38Chouserbut I'm sure it's another strike against ever getting this into core (if there was any chance left anyway)
07:38cmvkkwould it be possible for a no-recurring-fn special form to exist, out of curiosity?
07:38cmvkkan fn that doesn't affect recur, i mean
07:39cemerickCark: I'm afraid I've never used it myself. In general, it sounds like *out* isn't being bound properly, or something similar.
07:40cemerickChouser: seems like two separate issues: implementing delimited continuations, and secondly building error-kit on top of them
07:40Carkcould be that, thanks cemerick
07:43cgrandChouser: mutable state + ugly macroing can help you intercept a recur without code walking
07:44cgrandhmmm, no it won't work without knowing the number of args to recur which require code walking :-(
07:45cemerickhrm, more ammo for my decorate-fns-with-arity-info suggestion ;-)
07:46Drakesonhow can I memoize a lazy Var? imagine (def fibs (lazy-cat (list 1 2) (map + fibs (drop 1 fibs))))
07:47Chousercgrand: how would I prevent 'recur' from just doing it's normal special-form thing? no macro or fn is going to get in the way, is it?
07:48cgrandI was thinking of introducing a... hmm wait, must check something
07:53Carkcemerick : output wasn't flushed before my program exited
07:53Carkthanks
07:53cemerickCark: ah-ha! :-)
07:53cemerickheh, I didn't no anything
07:56lisppaste8cgrand pasted "bad idea" at http://paste.lisp.org/display/78118
07:57kotarakhiredman: a problem?
07:57Chouserah! very nice.
07:58Chousercgrand: where "nice" == "twisted and evil"
08:01Chousercgrand: did you try using a variadic fn instead of loop?
08:02Chouserdoesn't work, because recur wants you to pass the variadic part as a seq
08:04Chouserhuh, you can't 'recur' from a catch or finally either. maybe not supporting 'recur' in a 'handle' isn't so bad.
08:06triddellDoes anyone know of a change (in the last month or so) which would cause "Wrong number of args passed" error on gen-classed code that was working just fine before?
08:08triddellFrom Java I'm calling a function which then calls another Clojure function and I get this error now. The method which is called from Java includes "this" are the first argument but the inner call doesn't (and didn't need to before.)
08:10triddellProbably doesn't make much sense, but I'm calling a function with four arguments (which takes four arguments) and now I'm getting this error.
08:15lisppaste8slashus2 pasted "stm test" at http://paste.lisp.org/display/78119
08:15slashus3Why doesn't await-for stop the agents after the timeout in this case?
08:16slashus3oh... wait, I need to add print-agt to the await-for
08:17slashus3I don't think that worked either.
08:17slashus3And I am curious to why the print agent isn't printing anything.
08:18slashus3Beware. Be sure to kill this process asap, it will eat up your memory.
08:19cmvkkwell nothing gets sent to print-agt until after the other agents have finished
08:20slashus3cmvkk: Why don't they timeout?
08:20cmvkkanyway, when i run that it returns for me
08:21slashus3Does it return false?
08:21cmvkkyes.
08:21cmvkkafter about 5 seconds, as expected.
08:21slashus3You better kill the process. They are still running.
08:21cmvkkyeah. they are.
08:21slashus3It will return nil if it returned because of a timeout, but it returns false?
08:22cmvkkyeah that's weird, because it's supposed to be nil or non-nil.
08:22slashus3right
08:22cmvkkbut if you wanted to test against it, why would you return false?
08:22cmvkkand being able to test against it is the point of returning nil or non-nil
08:23slashus3I would think that it should kill all of the agents after the timout, but it just kills my computer slowly after returning.
08:23slashus3That is why I am using await-for there.
08:24slashus3I wanted it to print out the results of the two agents for 5 seconds and stop.
08:24cmvkkit's an infinite loop, and all it does is sen-off and commute.
08:24cmvkkassuming those things are waiting until after the original fn returns
08:24cmvkkthen they just build up a huge queue, then when await-for stops them, they do all the send-offs at once?
08:24cmvkkmaybe?
08:25slashus3Well with each transaction, I would think there should be a send-off.
08:25slashus3I would think that those prints would be interleaved with the other agents.
08:25slashus3I know it is bad practice, but even if you use (println) it won't kill them after 5 seconds.
08:29slashus3If await-for doesn't work in this case, how would you handle this situation?
08:31slashus3:-(
08:34slashus3There is no way to control agents with infinite loops?
08:34kotarakslashus3: you have to probably rewrite them to send to themselves.
08:35slashus3kotarak: I guess that is the solution. await-for won't stop agents that have infinite loops.
08:36kotarakI think await only waits for them to finish. But maybe I'm mistaken...
08:36kotarak(doc await-for)
08:36clojurebotBlocks the current thread until all actions dispatched thus far (from this thread or agent) to the agents have occurred, or the timeout (in milliseconds) has elapsed. Returns nil if returning due to timeout, non-nil otherwise.; arglists ([timeout-ms & agents])
08:36slashus3apparently it returns false if the agent is still going after the timeout.
08:43lisppaste8slashus2 annotated #78119 "stm test again" at http://paste.lisp.org/display/78119#1
08:43slashus3kotarak: This still doesn't stop when await-for is called.
08:44kotarakslashus3: I don't think, that await-for stops something.
08:46kotarakYou'll have to use some flag: (send *agent* (fn this-fn [_] (when @*running* (send *agent* this-fn)))), when you want to stop the agent loop, you have to do a (reset! *running* false) (assuming that *running* is an atom)
08:46Lau_of_DKGood evening all
08:46kotarakHi Lau
09:09cgrandChouser: varidic support in recur was what I checked just before pasting :-)
09:22twansitHello all!
09:22Lau_of_DKYo dude
09:22twansitquestion what is the most effecient way to turn a json object to a clojure object with the keys as keywords?
09:23twansitor is it just not advisable
09:23danlarkin(json/decode-from-str string) of course!
09:23twansitah..is that in clojure-contrib?
09:24danlarkinthere is a json lib in contrib yes, but there's also clojure-json
09:24twansityeah the contrib version doesn't do this
09:25kotarako.O sheesh I really got out of sync with contrib...
09:25twansitdanlarkin : i see you are plugging yourself :)
09:25danlarkinsomebody's gotta :)
09:27hiredman~google clojure-json
09:27clojurebotFirst, out of 1880 results is:
09:27clojurebotdanlarkin&#39;s clojure-json at master - GitHub
09:27clojurebothttp://github.com/danlarkin/clojure-json/tree/master
09:27twansitgittin
09:27twansitgittin' it
09:28kotarakhiredman: why do you hit my poor vc?
09:28hiredmanclojurebot uses clojure-json for google search results
09:28hiredmankotarak: I retract my hitting
09:29kotarakhiredman: oh ok, thought there was a problem ...
09:30hiredmanI am getting weird indentation, but it is on a scrap file, so maybe I have a unbalanced paran somewhere
09:30kotarakok, hopefully. There are some corner cases. But they should happen rarely.
09:31twansitdanlarkin: thanks!
09:33danlarkintwansit: my pleasure
09:38erohtar_is there a way to pass a dynamically constructed vector to the binding form?
09:39kotarakerohtar_: (try (clojure.lang.Var/pushThreadBindings {varA valA varB valB}) ..... (finally (clojure.lang.Var/popThreadBindings)))
09:52pjstadigclojurebot: what is our mascot?
09:52clojurebotthe official mascot of clojure is a futuristic ninja robot
09:54Lau_of_DKpjstadig, I was under the impression that danlarkin was our mascot?
09:54danlarkinoh jeez
09:55pjstadigLau_of_DK: danlarkin is a futuristic ninja robot??!!!
09:55opqdonutwow!
09:55Chouserthat's so much better than any of the historical ninja robots
09:55Lau_of_DKThats certainly true
09:56pjstadighistorical ninja robots are so 1999
09:56Lau_of_DK~at least the were so 1999, when suddenly...
09:56clojurebotCLABANGO!
09:56pjstadigclojurebot: historical ninja robots is <reply>historical ninja robots are so 1999...
09:56clojurebotIn Ordnung
09:56pjstadig~historical ninja robots
09:56clojurebothistorical ninja robots are so 1999...
09:57pjstadigclojurebot: futuristic ninja robots is <reply>sooo much better than historical ninja robots
09:57clojurebotc'est bon!
09:57pjstadig~futuristic ninja robots
09:57clojurebotsooo much better than historical ninja robots
09:58pjstadighiredman: these are facts that should have been programmed into clojurebot from the beginning....I'm astonished!
09:59erohtar__kotarak: sorry - having network problems today
11:08taggartCan anyone see where I'm ging wrong with this port of an SICP example?
11:08taggart(def fibs (lazy-seq (cons 0 (cons 1 (map + (next fibs) fibs)))))
11:09taggartgetting a stack overflow so it's not as lazy as I had hoped
11:12Chouserthe problem is that cons is not itself lazy
11:13Chouserso as soon as you try to take one value from fibs, it computes 0 and 1 and (map ...)
11:13taggartI thought that was dealt with by the lazy-seq
11:13Chouserlazy-seq only makes one level lazy
11:13taggartahh
11:14Chouserwithout it, you'd get the overflow as soon as you def, instead of only after you try to take something from it
11:14taggartmap is lazy though, so wouldn't I just the 0 and 1 be resolved immediately?
11:15Chousermap is lazy, but cons is not. the second cons forces map to do one step
11:16taggartah, and then the cycle starts
11:16taggartgot it, thx
11:16Chouser...which in turn forces fibs itself, which does the cons's, ... right.
11:16Chouserso find the one expression that you need to delay, and put lazy-seq around that instead.
11:17taggart(def fibs (lazy-seq (cons 0 (lazy-seq (cons 1 (lazy-seq (map + (next fibs) fibs)))))))
11:17ChouserI keep forgetting to try a more Socratic method.
11:17kotarakWhy so many lazy-seqs?
11:17taggartI guess I really only need one around map?
11:18Chouser"so where would you put lazy-seq to avoid the recursion?"
11:18Chouser"what is the value of delaying the evaluation of the constants 0 and 1?"
11:18Chouser:-)
11:18taggartnada
11:19taggart(def fibs (cons 0 (cons 1 (lazy-seq (map + (next fibs) fibs)))))
11:19taggartwoot
11:19opqdonut:)
11:21ChouserHow would the 'fibs' definition look if it were written by scgilardi and put in clojure.contrib.lazy-seqs?
11:22pjstadigwhat is the air speed of a swallo?
11:22pjstadig*swallow
11:22Chouser~google what is the air speed of a swallow?
11:22clojurebotFirst, out of 227000 results is:
11:22clojurebotWhat is the air-speed velocity of an unladen swallow
11:22clojurebothttp://indianajones.arystoteles.pl/swallow.htm
11:43lisppaste8slashus2 pasted "stm test again" at http://paste.lisp.org/display/78128
11:45slashus3What is causing the strange print results? Since running was set to false and I await all of the agents, should the function only return when all of the agents are finished?
11:46Chouserawait only waits for actions dispatched from the current thread or agent.
11:48stuhoodits probably implemented as some kind of sentinel value in the queue that the agent acts on to call back to the awaiting thread
11:48stuhood~def await
11:49stuhoodyea
11:50slashus3How would I go about keeping the function from returning until all of the agents have finished their business?
11:51Chouseryou could use CountDownLatch yourself.
11:51slashus3Is there any other way?
11:52Chousergenearlly if you need specific blocking behavior for task management, you'll need to use something from java.util.concurrent
11:53slashus3I think I found the solution.
11:53ChouserOne exception is 'future', but I doubt that would help you here.
11:54lisppaste8slashus2 annotated #78128 "fixed?" at http://paste.lisp.org/display/78128#1
11:54slashus3Chouser: I made the send-off the last thing in the agent.
11:54slashus3I guess it sort of fixes the problem?
11:55kotarakWhere do the file and line information in the exceptions come from? I set Compiler/LINE and Compiler/SOURCE, but get only Unknown Source...
11:56stuhoodslashus3: you'd still have a race
11:56Chouserslashus3: not really. I'm still seeing extra prints after the fn returns
11:56Chouserslashus3: and I don't think await is doing you any good there.
11:57stuhoodanything generated by the last action sent to the agent will go into the queue after the Latch sent in by (await)
11:57slashus3Mine counts to 49 every time. I suppose I may get that result if I run it enough times.
11:58Chouserkotarak: (binding [*source-path* "foo"] (eval '(asdf)))
11:58Chouserthat works for me.
11:58slashus3Would it make the difference than I am on a single core computer?
11:59stuhoodslashus3: that might hide the race condition, yea
11:59kotarakChouser: Hmm.. *source-path*. Is this handled in the Reader? The compiler seems to use Compiler/SOURCE....
11:59Chouserkotarak: those are the same Var
12:00slashus3ugh... I didn't think this would be so hard.
12:00Chouser,clojure.lang.Compiler/SOURCE
12:00clojurebot#'clojure.core/*source-path*
12:00kotarakhmmmm.....
12:01Chouserslashus3: why don't you want to use CountDownLatch? make one that starts at 2, then have each agent action countdown when they quit running.
12:01Chouserthen you can await on the latch, and it'll block until they're done.
12:02slashus3Chouser: I need to figure out how to use it.
12:02Chouserslashus3: or perhaps stop having the agents send to themselves -- do a regular loop that terminates if @running is false. Then await should do what you want.
12:02clojurebotwe can't stop here! this is bat country!
12:02stuhoodi think rhickey chose to call them Agents instead of 'Actors' for a reason: the mainloop case isn't what he was going for
12:03Chouserthough that's how he uses them in the ant demo
12:03stuhoodhmm.
12:04stuhoodso its a single agent call then, with a function containing an infinite loop?"
12:04slashus3It sends-off itself
12:04Chouseroh, no, I meant the send-to-self loop
12:04Chouserright
12:05stuhoodweird.
12:05kotarakChouser: sorry, I have to ask again. I want to set the file and line numbering and the eval some def. I would expect, that then the source info is set correctly. But in the stack trace only "Unkown Source" shows up....
12:05Chouserthe main reason I've heard for using send-to-self rather than a loop/recur is so that you can redef the action and get new behavior without restarting anything.
12:06kotarakIs there a remedy?
12:06Chouserkotarak: the example I posted above gives me this error: java.lang.Exception: Unable to resolve symbol: asdf in this context (foo:39)
12:06stuhoodChouser: that's true, but implementation wise your loop would be moving between threads and cores on your cpu, which would suck for performance
12:06hiredmanChouser: also so sends get released
12:06Chouserso it looks like it's getting the source name ok. I'm not sure about the line number.
12:07kotarak-.-
12:07kotarakOk. Will try again.
12:07Chouserstuhood: hm could be, though moving between threads doesn't necessarily mean moving between cores, right?
12:08kotarakFor the line number, I have this by the way: (proxy [LineNumberingPushbackReader] [reader]
12:08kotarak (getLineNumber [] (+ offset (proxy-super getLineNumber)))))
12:08kotarakProxy is cool. :)
12:08stuhoodperhaps the agent could simple loop calling a defn'd fun, and then you could redefine the fun
12:08erohtar_i have to ask again (having network problems) -
12:08slashus3Should I be using regular java threads with this, or is this the right way to model the problem?
12:08clojurebot?
12:08erohtar_is there a way to use the binding form meta-programmatically
12:09kotarakerohtar_: you have to use Var/push(pop)ThreadBindings directly.
12:10erohtar_kotarak: those methods accept a map? the vars are passed as keys?
12:10kotarakerohtar_: yes, what binding uses underneath.
12:11erohtar_where can i find the documentation?
12:11slashus3I have no idea how to use CountDownLatch here.
12:11slashus3Do I send the latch to the agent?
12:11erohtar_kotarak: where can i find the documentation? is there javadoc?
12:11stuhoodslashus3: it would be in a var, like 'running'
12:11kotarakerohtar_: no, but you can look at the definition of binding
12:12erohtar_ok
12:12kotarak~def binding
12:12stuhoodslashus3: when the agents are done running, have them .countDown on the latch
12:12slashus3(.countDown agt alatch)
12:12erohtar_kotarak: will do, thanks!
12:13Chouser(defmacro nil-binding [n & body] (apply @#'binding [n nil] body))
12:13Chouserkotarak: how about that?
12:14Chouserhm
12:15Chouserwait, what's wrong again with: (defmacro nil-binding [n & body] `(binding [~n nil] ~@body))
12:15stuhoodslashus3: (.countDown alatch)
12:16stuhoodChouser: perhaps what is missing is some kind of agent shutdown functionality that prevents new items in the queue for the agent
12:16clojurebotChouser might make night
12:17kotarakChouser: I'm not sure what's the nil about, but I want a driver for binding that takes a map (programmatically created at runtime) and a thunk being invoked as the body. A macro won't help here.
12:17Chouserstuhood: well, there is shutdown-agents, but that's rather a large hammer
12:17Chouserkotarak: ah, right of course. Sorry, took my eye off the ball there.
12:17slashus3(shutdown-agents) messes up everything after that. Maybe something a little lighter wait.
12:17slashus3weight*
12:18stuhoodslashus3: yea
12:19slashus3I am looking at the source code for await, and I don't see what I would do that would be different than what await does with CountDownLatch.
12:19Chouserso right, you have to use the static methods of Var directly.
12:20stuhoodslashus3: await adds the latch to the end of the agent queue, but the agent is running in a separate thread, and it can add an item after the latch
12:22stuhoodso immediately after await returns, it will run the queued action
12:23stuhoodactually, i guess you could await it twice?
12:24stuhoodah, no.
12:25Chouseryou need to make sure the countDown is done after the agent has noticed that @running is false
12:25ChouserI think the only way to do that is in the agent action itself -- when it sees @running false, countDown.
12:26slashus3Chouser: I tried running the agent's body in a (while @running , but the output just bursts out at the end, and I still get some weird output.
12:26stuhoodslashus3: actually, i think running await twice will work
12:27Chouserhm, that's an interesting point -- you might need to (flush) too, to prevent output coming after the prompt.
12:27slashus3stuhood: It seems like it should.
12:28stuhoodbecause the first time guarantees that the @running has been seen, and the second time makes sure that the final action queued from within the agent is cleared
12:28slashus3That isn't a very elegant solution though.
12:28slashus3If that is the case, in the await function, could you just (send agent count-down) twice?
12:29stuhoodno, you have to wait for the first (await) to return
12:29slashus3okay
12:29stuhoodbecause when it returns there may-or-may-not be one last action sitting in the queue, which you need to wait for
12:30slashus3I think await would be more useful if it had the wait until all queued agents were finished.
12:31stuhoodagreed.
12:32stuhoodmaybe (await-shutdown) that would prevent new actions for an agent
12:32slashus3(await-shutdown agt1 agt2 print-agt)
12:37slashus3maybe (await-shutdown can be implemented by just calling await twice on the agents sent in?
12:37stuhoodthe only problem would be the agent api changes: (send) would need a 'agent is shut down' failure case
12:37stuhoodslashus3: that works here because you only have two threads adding to the agent queue
12:37slashus3Wait, that only works because I am using *running*
12:37slashus3Okay, yeah
12:39stuhoodslashus3: maybe you could bring this use case up on the list?
12:39stuhoodyou shouldn't have to resort to java code to accomplish this
12:39slashus3I wonder what would be the best way to present it? With this example?
12:40stuhoodyou only need 1 agent to demonstrate it
12:43stuhoodoh... (send) already has an error case if (shutdown-agents) has been run
12:44stuhoodso there would be good symmetry with a (shutdown-agent) function
12:45kotarakChouser: just for the records: the Vars to modify are SOURCE and SOURCE_PATH. I'm not sure, but it seems, that one has to set both... Now it works. :D
12:46slashus3stuhood: Would we have to use that exception when we determine if there are no agents in the agent queue?
12:46slashus3Can't we just loop through the agents and (.getQueueCount a)
12:47slashus3When all of the agent's (.getQueueCount a) is zero, we are finished?
12:51slashus3Hmm this seems to work.
12:53lisppaste8slashus2 annotated #78128 "fixed??!" at http://paste.lisp.org/display/78128#2
12:53slashus3stuhood: Check this out.
12:55slashus3Maybe I should await before the while in that function.
12:57slashus3stuhood: Because not-every is not atomic, I want to be sure that there are no further agents being emitted.
12:57slashus3sent
12:57slashus3Then I would wait until the queue was empty.
13:01lisppaste8slashus2 annotated #78128 "added await to the await-shutdown" at http://paste.lisp.org/display/78128#3
13:02slashus3Chouser: Would this be an acceptable solution?
13:08rosejnShould any object implementing Associative be usable both like (obj :foo) and like (:foo obj)?
13:08rosejnI'm implementing it in a proxy for a storage layer, and it only works with the key first.
13:08slashus3That seems to be the case.
13:10rosejnIt seems that this error shouldn't be feasible then:
13:10rosejn actual: java.lang.ClassCastException: clojure.proxy.java.lang.Object$Associative cannot be cast to clojure.lang.IFn
13:11slashus3hmm
13:11slashus3Maybe not then.
13:11rosejnYeah, strange...
13:13kotarakrosejn: It probably has to implement clojure.lang.IFn to be used in the functions position.
13:13rosejnhmmmm, ok. I'll give it a try.
13:13rosejnkotarak: thanks
13:14kotarakrosejn: invoke with one and two arguments is probably enough. (thing key) and (thing key default-if-not-found). This is the usual behaviour of maps, IIRC. You can have look at their implementation.
13:17slashus3kotarak: Looks like AFn takes in IPersistentMap
13:19slashus3rosejn: APersistentMap extends AFn, which takes in an IPersistentMap.
13:29rosejnawesome!
13:29rosejnkotarak: that worked, thanks
13:29rosejnjust had to implement invoke
13:29kotarakrosejn: good to hear :)
13:31rosejnkotarak: Hey, you do vimclojure right?
13:31kotarakrosejn: right
13:31rosejncool. Quick question. In a number of places it seems to indent more than I want it to.
13:32kotarakrosejn: do you have an example?
13:32rosejnFor example:
13:32rosejn (deftest my-test []
13:32rosejn (test-stuff ...))
13:32rosejnWhere I'd like the (test-stuff ...) to just be two spaces over.
13:33kotarakrosejn: ok. try this: :setlocal lw+=deftest
13:33kotarakDoes this work for you?
13:33rosejngreat
13:33rosejnyeah, that worked
13:34kotarakrosejn: You can put such clauses in ~/.vim/after/ftplugin/clojure/my-lispwords.vim. I'm working on some heuristic, but it will likely be fragile.
13:35rosejngot it, thanks for all the work you've done for vim
13:35kotaraknp
13:35rosejnI'm using it daily now, with the repl and everything
13:35rosejnfairly often I get errors and I have to restart the ng-server though
13:35rosejnit would be nice if it could be started automatically
13:36rosejnalso if there were a way to clear the repl state, to load libraries fresh
13:36kotarakHmmm... I'll look into starting it automatically. However, the next version will be more robust on missing server.
13:36rosejngreat
13:36kotarakyou can reload libraries via (require :reload-all 'the.library)
13:37rosejnyeah, but weird errors can crop up on redefinition after refactoring things
13:37rosejnlike moving a function from one namespace to another, where they were using each other
13:37rosejnit complains of multiple definitions, so you have to unmap the original
13:38kotarakAh. Ok. That may happen.
13:41kotarakHmm... Maybe some Repl command like ",nuke the.library".
13:42rosejnyeah, that would be perfect
13:43rosejnmaybe it should be a different argument to require... (require :fresh 'my-lib)
13:44rosejnActually, I guess those are just functions being called by require.... so a new function that nukes then reloads.
13:47kotarakrosejn: Thanks for the feedback. Gotta go to bed now. Bye.
13:48rosejnkotarak: thanks for the tools. Guten abend.
14:11replacaerohtar_: if you want to see an example of binding using runtime discovered maps, look at clojure/contrib/pprint/pprint.clj
15:30cp2hiredman: kevin.clj for life !
15:31hiredmankitten: totally
15:31hiredmaner
15:31hiredman:(
15:39cp2why are the clojure shirts on zazzle so expensiv
15:39cp2e
15:39cp2i dont want to pay like $60 for 3 shirts
15:54Drakesonhow can I pop a certain element (nth) of a vector or list, whichever is easier?
15:56cp2what would you name a 3 byte integer value? im trying to think of something that doesnt sound lame
15:56hiredmanpop?
15:57Drakesonhiredman: I want to remove nth element of a vector/list
15:58hiredmanDrakeson: vectors and lists are not designed for that sort of behaviour
15:58hiredmanyou might look at filter or remove
15:59cp2hiredman: any suggestions ? :)
15:59hiredmantryte
15:59cp2ah
15:59cp2i like that
15:59cp2thanks
16:03Drakesonhiredman: deleting an element from a linked-list is very cheap, once you can refer to the element. It sounds a bit strange if it is not implemented here.
16:03Drakesonso, I guess I am missing something
16:06hiredman,(doc pop)
16:06clojurebot"([coll]); For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception. Note - not the same as next/butlast."
16:07hiredmanDrakeson: but clojure's library is based around sequences, not linked lists
16:08Carkit isn't cheap to find the nth element of a list in order to delete it
16:08Carkthat's what sets are there for
16:08hiredman(doc rvec)
16:08clojurebotExcuse me?
16:08Carkthough i agree that this function is missing
16:11Cark,(doc ordered-set)
16:12clojurebotjava.lang.Exception: Unable to resolve var: ordered-set in this context
16:12Cark,(doc order-set)
16:12clojurebotjava.lang.Exception: Unable to resolve var: order-set in this context
16:12Cark,(doc sorted-set)
16:12clojurebot"([& keys]); Returns a new sorted set with supplied keys."
16:14DrakesonCark: thanks
16:14Carkthis was for my information, not trying to help you !
16:15Carksometimes you need the ordered nature of a list and the add/remove capabilities of a set
16:15Carkthat would require an ordered set data structure
16:15Carkbut there is none in clojure
16:15Drakesonwhat I feel is missing (or I cannot find) is a standard way to point to an element (O(n) for finding nth in a list), and then call an imaginary pop-by-ref and get a new list without that element.
16:16Carkwell you can use filter
16:16Carkit's "kind of" O(1) as it's lazy
16:21cp2O(1) (no guarantees!)
16:24stuhood~def c.l.Agent
17:06dysingerIf I call (with-open #^javax.mail.Folder folder forms*) is it going to not work because close takes true/false (expunge) ?
17:06dysingerI can try it just curious
17:06dysingerif there was any magic
17:06stuhoodha, i had the same question and never tried it, because i assumed there wasn't =/
17:06stuhoodmagic, that is
17:09dysingerthat's what I figured
17:09dysingeryou only get so much magic for free
17:10stuhoodi love with-open though
17:11stuhoodit's more complete in python, with the 'with' statement and context managers
17:11dysingeryeah - ruby has similar with closure blocks
17:14stuhoodi guess the java way would be to add an interface that an object could implement to play nicely with 'with-open'
17:14stuhoodand otherwise clojure would just attempt to call close()
17:15dysingeror you could wrote an alternate macro
17:15stuhoodmm, indeed
17:15stuhood~def with-open
17:33dakrone_hbis anyone else having trouble building clojure-contrib using the clojure jar from svn?
17:34Raynesdakrone_hb: What do you mean by building? Compiling it? Usually you just jar it or copy the directories.
17:34dakrone_hbRaynes, http://pastie.org/439181
17:35dakrone_hbI was under the impression that you needed to build it
17:36dakrone_hbgiven the Getting Started page lists building it with ant
17:36Raynesdakrone_hb: Just cd to the directory of clojure-contirbs build file and "ant build"
17:37dakrone_hbRaynes, Target "build" does not exist in the project "clojure-contrib".
17:37dakrone_hbis the error
17:37danlarkindakrone_hb: yeah, just "ant"
17:37dakrone_hbdanlarkin, yea, I get http://pastie.org/439181
17:37danlarkinyou don't need to specify clojure.jar
17:37RaynesI didn't mean to quote build, just ant.
17:38danlarkinthat's only if you want to AOT compile
17:38dakrone_hbdanlarkin, even though it warns that I should?
17:38dakrone_hboh, okay
17:38dakrone_hbit warns things like pretty print won't work
17:38RaynesEnclojure has some neat new REPL features!
17:38dakrone_hbis thhat correct?
17:38Raynes:D
17:38danlarkinis your clojure up to date?
17:39danlarkinmake sure you're on the google code SVN and not the sourceforge SVN
17:39RaynesAll it does is jar everything, you don't even really have to jar it at all. All the ant script does is jar whats in src.
17:39dakrone_hbdanlarkin, Ahhhhhhhhhh
17:39dakrone_hbdanlarkin, it's been a while since I checked out ;)
17:39dakrone_hbdanlarkin, how long ago did Clojure switch?
17:40danlarkinDecember? I think?
17:40dakrone_hbthat would definitely be some changes
17:41dakrone_hbdanlarkin, I'm sure this will fix it, thank you much
17:45danlarkindakrone_hb: let us know if it doesn't
17:46hiredman~latest
17:46clojurebotlatest is 1338
17:51dakrone_hbdanlarkin, worked great, thanks :)
17:59danlarkindakrone_hb: fantastic
17:59dysingerwhats the best idiom for recur on exception with a finally ?
18:00dysingerit says I cant recur because my recur is not on the tail
18:02dysinger~(loop [x 1] (try (println "hello") (catch Throwable t (recur x))))
18:02clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline dysinger
18:03dysingerseems like retry on exception is common enough for IO stuff
18:03dysingerat least for the computerwebs and tcp/ip
18:04dreish_The only think I can think of would be a little ugly, so I'd wrap it in a macro, but you could return either a value or the exception, then check outside the try; if it's an exception, recur.
18:05danlarkinyou could also possibly use a trampoline
18:05dreish_(defmacro retry-on-exception [& exprs] ...)
18:11dysingerclojure so totally scratches my lisp itch but with tens of thousands of libs
18:11dysingeryayz
18:28replacadakrone_hb: I just added the pretty print stuff to contrib and it require AOT, thus the warning
18:28replacaso now it's better to do a "real" compile
18:29Chouserreplaca: was requiring AOT necessary or just convenient?
18:30replacaChouser: necessary, cause I need to make classes that wrap java.io.Writer
18:30replaca*needed
18:30Chouserand proxy was insufficient?
18:30replacaChouser: remember our discussions from a *looong* time ago
18:31Chouserheh. apparently not.
18:31replacaI tried super-hard to make proxy work but it just didn't have what I needed
18:31Chouseryou needed some state and a sane way to get at it from the object itself?
18:31replacaI came up with an idea for a super-proxy, but I haven't done that yet
18:31replacayeah, there's actually a lot of state in the current application
18:32ChouserI've gotten into the habit recently of deriving a proxy class from something and also implementing IDeref
18:32replacacause all the info is kept in the writer
18:32dakrone_hbI'm sorry for the dumb question, but what does AOT stand for?
18:32clojurebotfor is not used often enough.
18:33replacaAhead of time compilation
18:33dakrone_hbreplaca, ahh, thanks
18:33Chouserthen I can implement the deref method, and use @ to get at whatever object state I need.
18:33replacaBut really, Chouser :gen-class is not something to be afraid of!
18:34ChouserI don't fear it. I dislike it.
18:34replaca:-)
18:34hiredmannot afraid, annoyed by
18:34Chouser"make" is for C++ and Java.
18:35replacaBut, more to the point, PrettyWriter has a bunch of methods on the class that make sense as methods
18:35slashus2Chouser: Sorry to bring this up again, but did you ever see my solution to the agent problem?
18:35replacaChouser: or Lisp or Haskell - everything but perl, ruby and python
18:36replacaand even python guys use the compiler for stuff they load all the time
18:36replacathus the plethora of .pyc files
18:37Chouserslashus2: interesting. I assume it works?
18:38slashus2Chouser: It seems to work on my dual core machine.
18:38Chouserreplaca: optional AOT for performance or whatever doesn't bother me, but Clojure is has so much less state than other systems, it's a shame to require the on-disk state of compilation just to accomplish a particular task.
18:38replacaOne nice thing about :gen-class is that the implementation can be completely dynamic, only the interface requires loading
18:38slashus2Chouser: I think the function should probably be called await-finished instead of await-shutdown.
18:38Chouserreplaca: yes, it's a pretty impressive compromise, but still not as nice as proxy.
18:38replacaChouser: yeah, I hear you. Unfortunaltely what I was doing here was really writing a Java class in clojure
18:39replacaChouser: if proxy worked for the use case, yes :-)
18:39slashus2Chouser: Maybe I should make a proposal on the list?
18:39Chouserslashus2: two possible issues: you're doing a busy wait after the blocking await, and you're using an implementation detail of agents
18:39replacathe alternative was pretty limiting, where you wouldn't be able to be pretty across calls
18:40Chouserreplaca: hm. giving up user features isn't acceptible.
18:40replacawhich would be nasty for apps that were reformatting larger chunks of stuff
18:40Chouserslashus2: of the two, the busy wait would bother me more.
18:40replacabut I still like the idea of a super-proxy :-)
18:40slashus2Chouser: Is there a way to do it without the busy wait?
18:44Chouserslashus2: it's important to be mixing refs and agents like this?
18:46slashus2huh?
18:46Chouseragt1 and agt2 sotre state that you apprently aren't using
18:47Chouserstore
18:47slashus2Chouser: I could probably do it a different way, but I was testing out refs.
18:47Chouserok
18:48slashus2It was only an exercise to learn the behavior of agents, etc.
18:48Chousersure
18:48ChouserI'm just feeling out the constraints of your exercise. :-)
18:49slashus2There are probably many situations were you would want to wait until all of the agents finish their queues before returning a function.
18:54lisppaste8Chouser annotated #78128 "a couple options for slashus2" at http://paste.lisp.org/display/78128#4
18:54hiredmanslashus2: I would uses agents for that
18:54hiredmaner
18:54hiredmanwouldn't
18:55hiredmanfor map/reduce you can use pmap/reduce
18:55hiredmanpmap uses the agent threadpool via futures
18:56replacaChouser: do you have some examples of your proxy + Ideref solution - I'll look at that and see if I could use it
18:57slashus2Chouser: So there is no general solution like my await-shutdown that doesn't use a busy wait?
18:58Chouserslashus2: oh, there may be... perhaps using watchers or something.
18:59slashus2hiredman: I know this isn't the best way to do this, but I was just wanting to try out the behavior of the STM.
19:00Chouserreplaca: this is on a different topic, but includes an example of proxying IDeref to carry some mutable state: http://groups.google.com/group/clojure/msg/79a09fa877cb48d0
19:01replacaChouser: thanks, I'll check it out
19:02Chouserok, g'night all.
19:02slashus2Chouser: Hmm. Watchers monitor for a change of state... goodnight
19:03replacagoodnight Chouser
19:09slashus2I wonder why I would want to use a watcher inside of a watch in this case.
19:09slashus2instead*
19:23rlbIs there already any easy way to treat a large binary file of 64-bit integrers as a (lazy) sequence?
19:24rlbs/integrers/integers/
19:35replacarlb: not that I know of, but duck-streams/read-lines does it with strings. Maybe you could adapt it?
20:42banisterfiendwhat's the name of the clojure repl?
20:43rlbreplaca: ok, thanks. One of the things I'm trying to do is keep track of what's effectively a 10 or so million element hash table mapping 128-256 bit values to an integer triple. I may just use sqlite or jdbm, but I was just looking around clojure itself...
20:43rlbbanisterfiend: in debian, it's clojure-repl, but otherwise I just invoked it manually.
20:43rlbbanisterfiend: If you mean the class, it's clojure.lang.Repl.
20:44banisterfiendthx
20:44rlband if you want readline-alike:
20:44rlb java -cp /usr/share/java/jline-0.9.94.jar:/usr/share/java/clojure.jar:/usr/share/java/asm3-commons.jar:/usr/share/java/asm3.jar jline.ConsoleRunner clojure.lang.Repl
20:44banisterfiendis tehre another name for the repl?
20:44banisterfiendi think i installed it ages ago, but i cant remember what it's called
20:44banisterfiendclojure-repl doesn't work
20:45rlbWell, the repl class is in clojure.jar.
20:45rlb(normally)
20:47banisterfiendthanks rlb
20:47banisterfiendyou have mad skillz
21:20cp2Microsoft Boasts 96% Netbook Penetration
21:21cp2how very kinky
22:57tsdhHi. In my clojure code I want to run a java classes main method. That's no problem, but is it also possible to do that in an own JVM with own JVM args?
23:18cgrandtsdh: if you want to start another JVM then there's no more facility than for starting a random program. See clojure.contrib.shell-out
23:20tsdhcgrand: Basically what I want is something like ant's fork, e.g. the new JVM should use the same classpath, etc. But ok, I'll use shell-out till I find something that suits my needs better.