#clojure logs

2008-10-03

00:35johnwaynerHopefully this is a FAQ: I've gotten the src and 'mvn install'd it. But when trying to start up the repl, it just hangs. No input is being read and no output printed on the screen. Java is 1.5.0. Platform is Windows 2003 server. TIA
00:36arohnerhow are you starting the repl?
00:36johnwaynerjava -cp target/clojure-lang-1.0-SNAPSHOT.jar clojure.lang.Repl
00:37arohnerI've always used ant
00:37arohnerthough I would assume they both work
00:38johnwaynerI didn't get any errors. And the jar is definitely there.
00:38johnwaynerStrangely, I tried just throwing some debug println's in the Repl main(), and they aren't showing up either.
00:38johnwaynerI may have other java issues, I suppose.
00:39arohnerwhat terminal are you using?
00:39johnwaynerI've tried the standard "Command Prompt" and M-x shell in emacs
00:39johnwayner...which should be the same really
00:41johnwaynerI'll play around some more. I am using a pre-boxed java set up that my company has put together. I'll try just using a stand JVM installation.
00:44johnwaynerHmmm... musta been something there. It's working on a 1.6 JRE I had lying around.
00:44johnwaynerThanks.
01:16arohnerjohnwayner: good
02:23rk98x03Morning gents, can somebody please stimulate my sense of (map (fn [])) ? :) I have a list of titles, and each title has subsequent subtitles. I need to map them out into an array, so that
02:23rk98x03title1-sub1-sub2-sub3
02:23rk98x03maps to "title1: sub1" "title1:sub2" "title1:sub3"
02:23rk98x03and so forth
02:27Lau_of_DKok, simplified, if I want an infinite sequence of the word "hi", how do I make it?
02:28Lau_of_DKSo that (take 1 seq) = "Hi", take 2 = "Hi" "Hi"
02:31Lau_of_DKk got it
02:31Lau_of_DKthanks for listning
03:06avidaLau_of_DK: (take 3 (iterate #(str % " " "hi") "hi"))
03:06avidahrm, that only creates strings
03:07avidathis will return sequences: (take 3 (iterate #(conj % "hi") (list "hi")))
03:18Lau_of_DKavida , thanks, you can also (replicate 1000 "hi")
03:18Lau_of_DKThere are a few options
03:19avidaha, i totally misunderstood how take worked, thanks
03:21avidayou can use (cycle (list "hi")) too
03:24Lau_of_DKoh that was a good one :)
03:24Lau_of_DKmy first was (for [x (range 1000)] "hi")
03:39jdzLau_of_DK: it looks like 1000 is infinity for you...
03:40Lau_of_DKhehe, its about 995 hits more than I expect to get at the most
03:40Lau_of_DKAnyway, I'm having some trouble outputting the object[][] type to Java, how would I do that?
03:41Lau_of_DKex (to-array [(to-array [1 2]) (to-array[1 2]) ...]) would to be an array within an array, but it still fires a ctor argument error
03:49jdzLau_of_DK: how about (to-array [[1 2][1 2]]) ? i admit i have started looking at clojur only yesterday
04:30Lau_of_DKsame result im afraid
04:35jdzthe form i mentioned works without errors for me...
04:35Lau_of_DKI see that Chouser has posted something like a bug-report on the issue
04:35Lau_of_DKhttp://paste.lisp.org/display/61639/xml
04:36Lau_of_DKremove the /xml from the url
05:14achim_pLau_of_DK: question still open? try to-array-2d
05:14achim_preason is: to-array constructs an array of objects, without conveying information about the types inside. so an array of arrays looks like a 1D array of objects to java. see also (doc into-array)
05:44Lau_of_DKachim_p, still open, but thanks that was a good suggestion, I didnt find that procedure documented on the website, but I'll give it a go
05:53Lau_of_DKachim_p, you got a sec?
05:55Lau_of_DKI actually think it working now, it constructs like it should, but the JTable Im populating just hangs afterwards
05:56Lau_of_DKIm getting some ArrayIndexOutofBounds, which is weird since I never assign a size
06:00achim_pmmh, hard to say. are the inner arrays all equal-sized? maybe a jtable doesn't like ragged 'matrices'. i don't know much about jtables, though
06:03lisppaste8Lau_of_DK pasted "2d array w. bad dimensions" at http://paste.lisp.org/display/67849
06:03Lau_of_DKachim_p, this routine digs into an xml structure thats like <problem> <title> bla </title> <solution> blub </solution> </problem>
06:03Lau_of_DKAnd its supposed to return "title" "solution"
06:03Lau_of_DK2d
06:04jdzLau_of_DK: the code layout sucks to be honest.
06:04Lau_of_DKthe layout?
06:05H4nsrather offensive usage of white space :)
06:05jdzLau_of_DK: and you are still putting arbitrary constants in your code when you have been given a solution that does not involve doing so...
06:05Lau_of_DKokay, when you girls are done prettying up, could you look at the actual code?
06:05H4ns*g*
06:05jdzLau_of_DK: the problem is we can't see the code...
06:06H4nsbut really, get an editor that does the identation right so that it is easier to just read it.
06:06H4nsas, say, an act of politeness.
06:07Lau_of_DKnoted
06:07achim_pLau_of_DK: what does (map (fn [x] (get-problem x)) titles) return?
06:08Lau_of_DKthe function (get problem) is also pasted, its supposed to return a 1d array like ["title" "solution"]
06:08Lau_of_DKWhich then should be wrapped in another array
06:08Lau_of_DKso its like [["title1" "sol1"] ["title2" "sol2"]]
06:09H4nsdid you try it? does it do so?
06:09achim_pyes, i can see what it should do, but does it actually? ;)
06:09Lau_of_DKPositively maybe
06:09achim_pplease try the map call in isolation, and print the result
06:09Lau_of_DKuser=> (get-problem "Bad Cable")
06:09Lau_of_DK(["Bad Cable" "Try with another cable"] ["Bad Cable" "Try wifi"] ["Bad Cable" "I
06:09Lau_of_DKnform hotel of broken cable in room."])
06:11H4nsjust as it would be easier to read: (fn [x] (foo x)) is equivalent to just foo, no?
06:12Lau_of_DKyea, im using map to cycle all the xml hits
06:14H4nsso, what does (xml-> w-xml :problem :title text) actually return?
06:14H4nsisnt that a sequence of sequences?
06:14Lau_of_DKThe return the text from all xml nodes in /problem/title/
06:15Lau_of_DKuser=> (xml-> xml :problem :title text)
06:15Lau_of_DK("--- INFO ---" "3.rd MAC" "Bad Cable"
06:15Lau_of_DK...
06:16H4nslooks proper. i'd freely insert some print statements at this point :)
06:17Lau_of_DKhuh?
06:17achim_pand you made sure that get-problem returns a 2-tuple for each of these?
06:18Lau_of_DKNo im not 100% sure - how can I be +
06:19achim_pi think you'll have to make sure. i think either the first row of the matrix or the maximum of row sizes serves as an implicit size declaration for jtable.
06:20achim_p(that's wild guessing)
06:20H4nsLau_of_DK: it does not look as if there is a way for get-problem to return anything but an array of seqs
06:20H4nsno, a seq of arrays really
06:20H4nsLau_of_DK: print statements as in "make the program print what it is doing to trace the problem"
06:21H4nsLau_of_DK: with common lisp, i'd trace get-problem, but clojure does not have trace on the repl yet, or does it?
06:22Lau_of_DKno it doesnt
06:22Lau_of_DKOk, I'll have to hit this again on monday, thanks for the input guys
06:22H4nsLau_of_DK: one last thought:
06:23Lau_of_DKshoot
06:23H4nsLau_of_DK: what happens if get-problem returns nil?
06:23H4nscould solutions be nil at any time?
06:23Lau_of_DKI suppose I get an array of nils
06:23H4nsah, no. :)
06:24H4nswell, without the input data set, proper formatting and some more clojure experience it is just guesswork. :)
08:21prunedtreehow small can a deployable and standalone "hello world" in closure ? (including all the JVM machinery)
08:34H4nsdepends on much time you want to invest stripping down the jre
08:35H4nsclojure itself is below 500k, but the jre as distributed uses around 54 mb on-disk
08:35prunedtreeok
08:36prunedtreeI'm extremely unfamiliar with Java (the platform)
08:37prunedtreehow does it perform as a desktop deployement ? Is it common to deploy application along with their own java runtime ?
08:37H4nsyes. shrink-wrapped applications come with their own jre.
08:38prunedtreeIs there any issue distributing commercial apps this way ? (regarding sun's licencing on the jre for instance)
08:39H4nsany issue, well. there is a license agreement, but you can distribute the jre at no cost if you follow sun's guidelines.
08:40prunedtreeok, so it's viable for commerical desktop applications
08:41H4nscertainly
08:41rhickeyprunedtree: sure, look at IntelliJ for instance
08:41prunedtreewith all the web madness, some language seem to think it's 'all okay' not to be distributable because they run on servers anyway
08:42prunedtreeas I said, I'm scarily ignorant about Java (the platform/the language)
08:42prunedtreeI know how sun's JVM internals works very well, but that's because I know the roots of it (not java)
08:43rhickeyprunedtree: there's Java Web Start too
08:43prunedtreehow fast does the JVM boot these days ? haven't tried for years
08:43prunedtreerhickey : oh great, you are on IRC :)
08:43prunedtreethe web is very scarce on implementation details of closure
08:44rhickeywell, there is the source
08:44prunedtreeI've tried to read everything I could find on clojure. I've watched the 'clojure for lisp programmers' screencast. looked very good
08:45prunedtreeI don't come from a Lisp background, but from smalltalk. so Java always looked like a regression to me. but the way clojure does polymorphism looks nice
08:46prunedtreeI have no idea how to setup a Java environnement and so on... I wonder how many clojure newbies have no idea how to do Java at all
08:46rhickeyH4ns: great! it's been fun watching you dive in
08:47H4nsprunedtree: i have used java a little, but only a little. it is a relatively friendly environment to work in, and most stuff is usually described from a professional or enterprise perspective.
08:48prunedtreethat's great. actually, I've always been tempted to use the JVM given the great compiler/GC/threading technology
08:48prunedtreebut in my memories it could take dozens of seconds to boot... and I'd really like my applications to boot under 2 seconds
08:49H4nsrhickey: i want member, at least. find would be nice, too, but given that the standard library is rather minimal, (first (member ..)) would do
08:50prunedtreeI've looked into what can be done with JNI, and I've seen that there have been many many changes over the years
08:50prunedtreeIt used to be ungodly slow
08:50H4nsprunedtree: all the java programmers i know avoid the jni at all cost.
08:50rhickeyH4ns: you've seen: http://groups.google.com/group/clojure/msg/ff8777fc5f5d0157 ?
08:51prunedtreeH4ns : my idea is quite simple. I have a single JNI method to implement
08:51prunedtreewith { return getBufferAddress(...)() } in the body
08:51H4nsrhickey: yes, that is what i am referring to.
08:52prunedtree(ie, a native call on a bytebuffer)
08:52prunedtreeplus a hack to get the base address of nio direct buffers
08:52prunedtreewith that, you can do anything
08:52rhickeyIt's been an experiment of mine to see how long people can go without them - the answer is, pretty long!
08:53rhickeyA nice thing about not having them is it discourages slow code, people use the associative structures more rather than using lists when inappropriate
08:54rhickeybut I understand their utility for small things
08:54prunedtreere JNI. the thing is, I want to write very high performance apps, and clojure will not be fast enough
08:54prunedtreeit's not because of clojure. even java isn't fast enough... and C isn't either
08:55prunedtreeI have absolutely no issue writing compilers that produce machine code myself, and clojure should be up to the task
08:56blackdogrhickey: did you see charlie nutter's post about Xbootclasspath speeding up jruby boottime significantly? i'm not sure if it would make a difference for clojur or not
08:57drewrblackdog: I've been using it in my clojure run script and it only gives me about 0.1s improvement.
08:57blackdogok, there it is :)
08:57prunedtreehow long is your boot time overall ?
08:57drewrAbout 1.4s. :-(
08:57blackdogjruby probably has a lot more overhead in base classes than clojure
08:58prunedtree1.4 sec... well that's much better than it used to be. still huge but I (my users) could live with that I think
08:58H4nsrhickey: find/member are the cl programmer's set membership operations, and it is often useful to consider a vector or list to be a set. if clojure has other techniques for achiving that, what are they?
08:58rhickeyH4ns: use sets
09:00drewrprunedtree: Yeah, it's not ideal, but I don't use Clojure for fast, shell-style things. If I'm doing reports from a db, however, I don't care about adding another second on a multi-second process.
09:00rhickeythat was my point before, without sets in the language, you use lists/vectors and it doesn't scale, with sets in the language, you should use them
09:00prunedtreemight be okay for shell things if you keep an instance open I guess
09:00drewrI also use -Xverify:none, which saves another 0.1s.
09:01prunedtreethen simply pipe some shell arguments to the running instance, which will spawn a worker thread for it
09:01prunedtreethere might be some way to achieve that using xargs/netcat... or simply write a trivial C app that does it
09:02rhickeyblackdog: with AOT compilation of Clojure we could precompile boot.clj. That + Xbootclasspath would probably make a difference
09:02H4nsrhickey: so please do not include member or find in the standard library. i'll actually print the pdf today and read it on my flight home, so i'll know how i determine set membership on the weekend :)
09:02prunedtreerhickey : btw, I was surprised by one element of the syntax while viewing your presentation
09:02blackdogrhickey: ok, nice
09:05prunedtreewhy are maps {:keyA x, :keyB y } but destructuring them {x :keyA, y :keyB} ?
09:05prunedtreethis seems very confusing
09:08rhickeyprunedtree: you are using x and y there for 2 different purposes, in the first case they are the values, in the second the let-bound names
09:08drewrprunedtree: They aren't. He just happened to used keywords as values in the destructuring slide.
09:08drewr(I'm assuming you're talking about the recent talk.)
09:08rhickeyin destructuring, you are really making a mapping from a let-bound name to a key
09:09prunedtreerhickey : bound to values, right ?
09:09rhickeyyes
09:09prunedtreeso they should be to the same place as values (imho)
09:10prunedtreeit looks as if you're bouding names to keys with :a being the value (inverse mapping)
09:10prunedtreeto my untrained eyes
09:10rhickey I disagree, when you say let [x 42] the value comes second, here, the value isn't supplied directly, rather its key is, also second
09:11prunedtreebinds x to the index of the vector that has value 42 ?
09:11prunedtreeweird
09:11rhickeyno, I'm comparing to normal let
09:12prunedtreeah, (x 42) in lisp...
09:12rhickeylet [name value]
09:12prunedtreeyeah, must be my lack of familiarity with Lisp speaking. but the lack of symetry is disturbing
09:12rhickey(let [ {name value-key} value-map]
09:12prunedtreeIf it's idiomatic I'll get used to it hopefully
09:13prunedtreewhere value-map could be a former binding, right ?
09:13rhickeyI don't disagree that one could see it differently, but this is how it is, and, as I said, this way is necessary in order to support :as and :or
09:14prunedtreeokay
09:15drewrprunedtree: I see what you mean now. I haven't destructured maps very much.
09:15rhickey:and :or :keys etc are very powerful
09:17prunedtreealso there's a weird difference between ident and :ident.. aren't both symbols ? what is the rationale behind that ?
09:17prunedtree(especially when uou have strange forms like :or / :as .. which are obviously not keys)
09:17rhickeyno, keywords are not symbols in Clojure
09:18rhickey(symbol? :key) -> false
09:19prunedtreeso the difference is in the resolution ?
09:20rhickeythey are read as different types of objects
09:20prunedtreewhy aren't :or/:as keywords ? old lisp convention ?
09:21rhickeythey are keywords, not in the 'reserved words' sense
09:22rhickeya keyword is just a datatype with the useful property that it always evaluates to itself
09:22prunedtreewhereas symbols are resolved ?
09:25rhickeyprunedtree: yes, see: http://clojure.org/reader and http://clojure.org/evaluation
09:26prunedtreeyeah, I've read that. I guess the sourcecode provides the most information
09:26rhickeythat's in those docs, no need to read the source to Clojure in order to use it
09:27prunedtreewell the docs seem very barebones. I've read it and it feels more than a teaser than real documentation. no offsence meant :)
09:29rhickeyhttp://clojure.org/evaluation : "Strings, numbers, characters, nil and keywords evaluate to themselves."
09:31prunedtreeah yes, keywords aren't symbols. I'm not used to that denomination, sorry
09:37jdzClojure: what would it [Lisp] be like if you had been given a second chance.
10:13drewrSo I fired up a JVM with the requisite jswat flags, and I'm running the jswat application.
10:13drewrAnd I've attached to the socket.
10:13drewrHow do I get an exception in the REPL to appear in jswat?
10:17leafwuncatched exceptions will appear in the plugged debugger
10:18drewrI just ran:
10:18drewruser=> (throw (Exception. "foo"))
10:18drewrjava.lang.Exception: foo (NO_SOURCE_FILE:0)
10:18drewrBut jswat doesn't seem to care.
10:18leafwbecause the reader is catching it. I don't know how one can stop the reader from doing so.
10:19rhickeydrewr: usually there is some break-on-exception setting
10:19drewrleafw: Ah, that makes sense.
10:20drewrrhickey: Looking...
10:21rhickeybecause there are so many exceptions-as-flow-control uses, they make you say which ones to break on
10:21prunedtreein java or in clojure ?
10:21rhickeyno exceptions as flow control in Clojure
10:22rhickeyexcept in the transaction system
10:22drewrThere's a Breakpoints window, with "Uncaught exceptions" checked. Perhaps leafw is right that since the REPL is catching the exception to show it to me, the debugger doesn't know about it.
10:24drewrThat seems counterintuitive though, since the point of the attached debugger is to monitor a running JVM.
10:24leafwdrewr: jswat is just a wrapper for jdb
10:24leafwdrewr: jdb only shows uncatched exceptions
10:26rhickeynew breakpoint|breakpoint type|exception pick exception type etc
10:27drewrrhickey: Yeah, just trying that...
10:27leafwha, so it can be configured :)
10:27drewr...and getting somewhere now.
10:29drewrI think it would be worth adding a sentence in the "Getting Started" section that says something to the effect of, "Make sure you set up a breakpoint for something other than the default uncaught exceptions rule..."
10:31prunedtreewhat is the prefered environnement for clojure under win32 ? eclipse ?
10:31Chouserdrewr: you could add details here: http://en.wikibooks.org/wiki/Clojure_Programming#Getting_Started
10:31drewrprunedtree: For me? Emacs.
10:32H4nsprunedtree: emacs-23 and slime work for me.
10:32Chouserprunedtree: gvim and a command prompt, just like everywhere else. :-)
10:35prunedtreeon windows, sure....
10:35prunedtreeI guess that would be somewhat doable, but why not use the candy
10:36prunedtreearen't there good Java IDEs with decent integration of clojure ?
10:36baetis-flyi thought someone was working on a netbeans plugin, but i agree, emacs + slime.
10:36dudleyfprunedtree: enclojure is a plugin for Netbeans
10:36H4nsthere is enclojure which integrates into netbeans, but that seemingly does not run on windows.
10:37prunedtreeohh
10:37Chousercandy rots teeth. Or maybe I'm already too old-fashioned. I understand gvim and command prompts, so I use them.
10:37prunedtreeso emacs it is on windows then... ironic :)
10:37ChouserH4ns: oh, I'm sure that must be a temporary failure. I'm pretty sure enclojure is meant to work on Windows.
10:37cemerickenclojure certainly is supposed to run on windows; I don't have any experience, but I've seen reports of success on the google group
10:38prunedtreeI'll give it a try then
10:38H4nsoops - i am alone, then.
10:39H4nsso i stand corrected. enclojure does not work for me on vista/x64 right now but i'll try the next version.
10:39drewrHm, this doesn't seem very productive. I have to reattach the session after every exception.
10:39rhickeycemerick: I haven't heard you chime in on the potential maps as java.util.Maps change - iirc you were one of the few to stand up for keeping them Collections
10:39prunedtreeit looks like it's made for OSX not windows
10:39prunedtreequoting the site: At the moment enclojure has only been tested on Mac OSX. If you are testing on Windows/Linux, please post any issues you find in the enclojure group.
10:40cemerickrhickey: I've been very distracted by other stuff...
10:40prunedtreewell, can't be much worse than emacs in windows
10:41rhickeycemerick: short story is I'm thinking about making the change
10:42Chouserrelevent thread: http://groups.google.com/group/clojure/browse_thread/thread/e83e3de776fd8143/26c4a2995fbc959c
10:42Chouser^ cemerick
10:42cemerickChouser: thx, reading now
10:46cemerickwwmorgan: do you have any opinion on this maps as j.u.Map change?
10:49wwmorganit's easy enough to go from a j.u.Map to an IPersistentMap, because you can use (into {} m)
10:50cemerickwwmorgan: I think the general concern is pushing clojure maps out into java libs that require j.u.Maps; or, implementing java interfaces that require a j.u.Map
10:54wwmorgancemerick: I see. Up to now you would need a function like this http://paste.lisp.org/display/67857
10:54abrooksThis shows how little Java background I have. Can't a class implement multiple interfaces? Why can't Clojure maps implement both j.u.Map and yadda.yadda.collection ?
10:55cemerickabrooks: j.u.Map and j.u.Collection have a conflict (with the remove method returning different types -- void in one and an Object in another, I think)
10:55abrooksAh! Okay. Now I see.
10:55wwmorganabrooks: I think the main concern is how you handle mutability
10:57cemerickThat's a good point. Making cmaps implement j.u.Map gets you one step closer to java compatibility, but given that so many java libs assume that Maps are mutable, would we simply be setting ourselves up to fail further down the call stack?
10:57wwmorganit would be pretty disastrous if users started .put-ing their clojure maps because they can
10:58wwmorganinstead of using assoc, I mean
10:59rhickeycemerick: there's a well defined subset of read-only methods, all of the others are optional
11:00cemerickrhickey: Sure. It's unfortunate that there isn't a separate MutableMap interface; however, the optionality of those methods is entirely defined by API contract and nothing else. There's a *lot* of java code out there that simply assumes mutability of Maps.
11:01cemerickI'd suggest that that's not the case for j.u.Collection, which was long just a stand-in before Iterable was available.
11:02rhickeycemerick: then a common use case might be just calling a java.util.XXXMap ctor passing a Clojure map, which you can't do right now
11:03cemerickrhickey: calling that ctor from clojure, you mean?
11:04rhickeycemerick: from Java, for interop
11:05rhickeycemerick: I agree about optional being a lame contract, but doesn't reduce the utility of read-only
11:07cemerickrhickey: no, the utility isn't diminished at all -- I'm just trying to think of the gestalt of java Map usage I've seen/written. Assuming mutability is pretty common. I might be wrong about that, of course.
11:08prunedtreemaybe you could have in/out args for java interop
11:08cemerickI think this is a choice between six of one and a half-dozen of another. There's pitfalls on either side.
11:08wwmorganIf clojure maps implement java.util.Map, then getting a mutable map is as easy as calling the HashMap constructor and passing in a clojure map. Although it might be confusing for new users
11:08prunedtreelet java mutable your structure and give you the mutated one back as if the changes where atomic
11:09rhickeycemerick: enough people are asking for Clojure maps as Maps, indicating the read-only limitation of that is not prohibitive
11:10cemerickrhickey: True -- at least for the current Clojure-using population.
11:11cemerickrhickey: is Stuart right in assuming/hoping that seq on a map would continue to emit key-value pairs after this change?
11:12rhickeyabsolutely
11:16dudleyfImmutability is such a stand-out feature of Clojure that most users are not going to be too surprised by a read-only limitation on Clojure Maps
11:17cemerickdudleyf: I think the surprise will be more in the neighborhood of passing clojure maps to libraries or returning clojure maps from gen-class impl functions where the recipient assumes mutability
11:18cemerickI guess I'm essentially neutral on the change. I certainly see some upside, but losing the single base for all clojure collections is unfortunate, IMO.
11:18dudleyfcemerick: Sure, but I found it much more surprising that clojure maps weren't Maps
11:19dudleyfMaybe we should just start a JSR to make the Collection and Map interfaces compatible
11:19dudleyf;-)
11:19Chousercan't we just submit a patch to fix j.u.Collections remove method?
11:20cemerickdudleyf: for sure, it falls outside of one's expectations. I think there's solid reasons behind Rich's choice there, though. The rising tide of Java<-->Clojure intermingling seems to be nudging the needle, tho.
11:21dudleyfcemerick: Yeah, it makes sense once you understand the reasoning behind it
11:21cemerickAch, Map doesn't extend Iterable (or, Iterable<Entry<K,V>>, I suppose)! That's really unfortunate. I was hoping that I could fall back to expecting that all clojure collections were Iterable.
11:24rhickeycemerick: Clojure maps will still be Iterable
11:24cemerickrhickey: actually, could you make clojure maps Iterable? That would be helpful.
11:24rhickeyand IFn and all of their other goodness
11:26cemerickrhickey: OK, I'm +0 on it as a whole. ;-)
11:27rhickey+0 - that gives me all the points I need! :)
11:28cemerickI always knew you were a low maintenance benevolent dictator.
11:28cemerickThe mutability issue may be more important than our particular circle appreciates, though. I wouldn't be super surprised if the common idiom becomes (HashMap. clojure-map) in a year's time.
11:29Chouserrhickey: did you see my new patch for clojurescript? I don't need any response except that you're aware of it or not.
11:29rhickeyChouser: sorry, saw your message, yes, haven't looked at the patch
11:29dudleyfcemerick: But isn't that the idea?
11:30Chouserrhickey: ok, thanks.
11:31cemerickdudleyf: I wouldn't think so; if that's expected to be the norm, then a simple helper function to remap a map to a j.u.HashMap is a simpler, easier choice.
11:32rhickeycemerick: are you suggesting a copy-free mapper class that implemented mutability?
11:34cemerickrhickey: I thought a patch for such an approach was put forth over the summer -- perhaps in the same discussion around making vectors implement j.u.List?
11:34ChouserI think prunedtree suggested that -- could be a little thing wrapping a ref and a persistent map
11:36cemerickhrm, I think I missed that, but that approach sounds very pleasant. There are many Java methods that take a map, fiddle with it, and return void.
11:39Chouserwould that be better than just copying a PersistentMap into a j.u.Map, passing it in, and creating a new PersistentMap afterward?
11:41cemerickChouser: I'd think so, especially in those cases where you need to capture changes being made to a j.u.Map in a method without a return value.
11:42cemerickBut that's sort of orthogonal to what I've understood the demand to be: that is, that clojure maps should directly implement j.u.Map.
11:46Chouserorthogonal, yes.
11:47Chouserbut while we're still talking about it, rhickey is nearly done implementing it. Next words from him will be "IPersistentMap now implements j.u.Map"
11:47cemerickI mean, that approach would be generally more useful IMO, but then I can't really give voice to the view that implementing j.u.Map is really important.
11:47cemerickheh, yeah, that's a safe bet.
12:09prunedtreewow. expected it to be kinda slow, but not that much (microbenchmarking :s)
12:42prunedtreeis naive fibonnaci an isolated case or are function calls really expensive in clojure ?
12:43Chousera clojure function call should cost the same as a java function call
12:44cemerickprunedtree: you can paste your microbenchmark if you like. I'll bet a type hint will bring the clojure into parity with Java.
12:44prunedtree(defn fib [n]
12:44prunedtree (if (< n 2)
12:44prunedtree n
12:44prunedtree (+ (fib (- n 1))
12:44prunedtree (fib (- n 2)))))
12:44prunedtreenote, I tested on two other very very dynamic systems that do not need any type hint to produce ridiculously superior performance
12:45prunedtreein fact, even an interpreter performs faster...
12:45prunedtreemaybe it's the JVM I have which sucks ?
12:46prunedtreeJava: 1.6.0_07; Java HotSpot(TM) Client VM 10.0-b23
12:48cemerickprunedtree: you'll likely be happier with (defn fib [#^Integer n] ...
12:49cemerickfwiw, you'd be better off using loop/recur, which won't blow stack
12:53prunedtreeas I said, I tested on other systems that do not have types
12:53prunedtreeand I have the same difference (an order of magnitude) if a feed a ratio as input (to avoid fixnum arith)
12:53ozzileeprunedtree: What kind of times are you seeing?
12:54prunedtree(fib 36) takes 17 sec
12:54blackdogdoes that include jvm starup time?
12:54Chouser(fib 36) is 1.8 seconds here.
12:55waltersprunedtree: what hardware architecture?
12:55Chouseruser=> (time (fib 36))
12:55Chouser"Elapsed time: 1814.196797 msecs"
12:55ozzilee(fib 25) is 11.8 seconds on a 700mhz PPC :-)
12:56prunedtreecore2duo ulw
12:56prunedtree1 ghz
12:56Chouserprunedtree: that's faster than my machine. there must being something "wrong" with your environment.
12:56waltersprunedtree: oh, client VM...hm. you might use -server
12:57waltersi think in the latest openjdk beta there is no -client and -server anymore which will be nice
12:57cemerickclient/server shouldn't impact things that much...
12:57dudleyfunless it does include jvm startup time
12:57prunedtreeand i'm getting under 5 sec in interpreted smalltalk
12:58Chouseryeah, even without -server I'm at about the same speed
12:58prunedtree <dudleyf> unless it does include jvm startup time << doesn't, it's inside a program
12:59dudleyfThen client/server won't make much of a difference until you run the same benchmark 10,000 times or so
12:59prunedtree<Chouser> "Elapsed time: 1814.196797 msecs"
12:59prunedtreewhat is your hardware ? that's closer to what i'd expect to see...
13:00Chouserprunedtree: core 2 duo, 800 MHz
13:00prunedtreeand anything specific jvm-wise ?
13:03Chouserjava version "1.6.0_06" Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)
13:03prunedtreemaybe the client VM is at fault
13:03prunedtreehow do you get the server thing ? j2ee ?
13:04lisppaste8abrooks pasted "lazy fib performance" at http://paste.lisp.org/display/67863
13:04ChouserI doubt that's the issue, but I guess maybe ... I just have a pretty stock ubuntu install. Not sure how I got server instead of client.
13:04abrooksLazy fib 36 (i.e. 35) takes 0.242755 msecs
13:05abrooksprunedtree's fib on the same system takes 2549.496222 msecs
13:05abrooksThat's crazy.
13:05abrooks1000X slowdown.
13:06abrooksI think prunedtree has spotted a real performance issue.
13:06ChouserWith OpenJDK Server VM (build 1.6.0_0-b11, mixed mode), I'm still getting (fib 36) in 1.5 seconds
13:07Chouserabrooks: your algorithm is different -- you're caching values instead of recomputing.
13:07abrooksChouser: I know.
13:07ChouserI assume prunedtree is using an algorithm that is intentionally beating on function calls.
13:07prunedtreeyes
13:07dudleyfprunedtree: just pass -server to the java command
13:08prunedtreedoesn't work. I have j2se
13:08ChouserBut for some reason his is taking 10x longer than mine. I think that's an environment issue, somehow.
13:08prunedtreemaybe there's something wrong with the client VM
13:10dudleyfprunedtree: I think you're right
13:10prunedtreehumm 2 mb... good that sun has good proxies here...
13:11prunedtree100 mb, not 2
13:11dudleyfuser=> (time (fib 36))
13:11dudleyf"Elapsed time: 13347.682 msecs"
13:11dudleyfwith -client
13:11cemerickprunedtree: I just tried your function on -client and -server, no timing difference.
13:11prunedtreeclient still doesn't use the c2 compiler ? urgh... thought they fixed that years ago
13:12prunedtreeI hope the server performance is more reproducible than the client one ;)
13:12dudleyfuser=> (time (fib 36))
13:12dudleyf"Elapsed time: 2936.406 msecs"
13:12dudleyfwith -server
13:12prunedtreethat creates a huge incentive to bundle the VM with any app you distribute
13:12danlarkin(time (fib 36))
13:12danlarkin"Elapsed time: 8332.648 msecs"
13:13danlarkinthat's with prunedtree's fib function
13:13prunedtreewouldn't want my clients using the client version and getting horrible performance
13:14waltersprunedtree: ah...i think both VMs are shipped with the J2SDK or whatever it's called, they created a -client because they thought it would make a large startup time impact as I understand it
13:15dudleyfIt does cut down startup time significantly, but I've never seen that kind of performance gap on simple benchmarks
13:15leafwwalters: :if that's the reason, makes no sense anymore: here a jdk takes one or 2 seconds to launch (T60 laptop)
13:15waltersleafw: in a cold cache?
13:16leafwwalters: in cold, it may take 5 or 6 secs
13:16leafwgranted.
13:16leafwwith -server flag, we are talking.
13:19prunedtreebah
13:19prunedtreethe sun website sucks
13:20prunedtreeI have no idea how to get the server VM....
13:20Chouserprunedtree: what happens when you use -server -- error? no change?
13:21prunedtreeerror
13:21prunedtreetells me I don't have the right dll
13:21prunedtree(ie I don't have the server VM)
13:23dudleyfprunedtree: http://tinyurl.com/5ptq6n
13:24dudleyfFrom there you should be able to pick your platform and download the jdk
13:24dudleyfOr wait, are you on a Mac?
13:24prunedtreewindows
13:25prunedtreeand I tried the jre 1.6u7
13:25dudleyfThen you should be able to download it from there ^^^
13:25prunedtreeand also the jdk
13:25dudleyfYou want the jdk
13:26prunedtreeand they don't give me the server thing :/
13:26prunedtreemaybe I should remove the jre and put the jdk ?
13:26dudleyfMaybe
13:27dudleyfI haven't installed a JRE without the JDK in a long time
13:28prunedtreeuninstalling both. the jdk you linked to was the one I had btw
13:29achim_pChouser: just read your post to the list regarding shell calls. since that's on my todo list anyway, i could as well do it as a seperate library
13:29achim_pfor now my needs are simple, sth like ruby's/python's popen* would do (in conjunction with expect), but i'm not settled on it. you don't seem to like it - care to elaborate on where you see the shortcomings?
13:30waltersChouser: btw if you do take influence from something, python's subprocess is very good and the only one i've used that isn't broken or very limited
13:31abrookswalters: Subprocess is better than the others but is still horribly awkward. Launching programs sucks in Python.
13:31waltersthe hard part about implementing it is you can't do it on top of the JDK ProcessBuilder class since it won't let you do prefork functions
13:31waltersabrooks: it sucks everywhere as far as i know
13:31waltersit's like remoting
13:32waltersthey'll just never be as nice as local library call
13:33abrooksI have a Python library partially constructed that allows for much better process control.
13:33abrooksprint pl("ls", "/dev")("grep", "-i", "tty")().stdout
13:34abrooksThere's also IFS parsing available if you don't want each argument as a separate string.
13:35waltersyeah, i have a shell (http://hotwire-shell.org) which implements a trivial language specifically for this, but i don't think it necessarily makes sense in the core subprocess invocation library
13:37Chouserwalters: that looks nifty
13:37abrooksI don't know if belongs in the core library but I want something better as part of the distribution. Your project looks very interesting.
13:40ChouserI guess my objections to python's popen* revolve around the combinatorially named functions and that the mechanisms for when you want to capture none of the output, just stdout, or stdout and stderr each feel rather different.
13:40ChouserI don't think I've ever used subprocess.
13:40waltersyeah, popen* is broken
13:40Chouserso as long as we don't do that, I'm golden. ;-)
13:41prunedtreereinstalled everything, rebooted.... and still no server
13:41ChouserI find it unlikely that implementing something akin to abrooks' api would be that much harder.
13:41Chouserprunedtree: :-(
13:42Chouserhm, looking at my Windows VM, I see I also have the Client VM
13:44abrooksCan't you just switch the VM with the -client/-server flags or is that only with the VM provided with the Sun JDK?
13:45ChouserSo on my 800MHz laptop, in a VMPlayer running XP, using the Sun Java Client VM, (fib 36) takes 7.6 seconds.
13:46prunedtreehow come it's so much faster than me ?
13:46Chouserabrooks: apparently the VM package for windows understands the switch, but doesn't include the actual server VM.
13:46ChouserError: no `server' JVM at `C:\opt\java\bin\server\jvm.dll'.
13:46prunedtree<abrooks> Can't you just switch the VM with the -client/-server flags or is that only with the VM provided with the Sun JDK? << I installed the jdk... which installs the jre
13:47ChouserI think I have only the JRE
13:47abrooksOkay. I'm only half paying attention. Sorry.
13:49prunedtreeman I sure hope there's a way to avoid all this mess when I deliver application, or that platform is simply not usable (how do they manage to have something immature after more than a decade ? it takes some serious skills....)
13:49prunedtreeyou think it's legal to build the VM from the source and distribute it in a commercial package ?
13:49prunedtreewithout all the sun clutter
13:50waltersthe icedtea project has removed all proprietary plugs, but it's targeting Free operating systems and not Windows, but i doubt it would be hard to get it to build for Windows
13:51achim_phow about
13:51achim_p(popen "ls" ...) -> [in out err]
13:51waltersi believe the goal is to get upstream openjdk to this point as well, but they are more concerned about complete compatibility
13:51achim_p(with-popen ["ssh" ...] in out err
13:51achim_p (expect in "^[uU]sername: " (fn [match] ...)
13:51achim_p ... ))
13:51walterse.g. icedtea just doesn't implement SNMP
13:52cemerickprunedtree: there's a *lot* of people using Java very successfully in a lot of different scenarios. It's certainly not unusable.
13:52abrooksachim_p: I like the context manager ("with") style much better -- much more lispy.
13:52abrooksYou'd want both, I'd suppose.
13:53achim_pabrooks: yes, both
13:54prunedtreeI'm one very unlucky people
13:54prunedtreethe only positive side is that I am an incredible beta-tester ^^;
13:59Chouserwouldn't the with- version be equiv to (let [[in out err] (popen "ssh" ...)] (expect in...))
14:01abrooksChouser: Often context managers will automatically close/dealloc/cleanup the managed item on exit of the block.
14:01Chouserabrooks: ah, good point.
14:09achim_pperhaps a third version would be nice, one that slurps out+err and returns a string
14:12achim_pand timeouts for expect - has anybody come up with a simple way to perform blocking calls with a timeout?
14:13lisppaste8achim_p pasted "with-timeout" at http://paste.lisp.org/display/67868
14:13waltersachim_p: you can call Thread.interrupt() on the blocking thread, not sure how that appears in clojure
14:17achim_pwalters: thanks, i'll have to look into java threading. right now i'm abusing agents for that
14:20prunedtree4.5 seconds
14:20prunedtreei'm still very far from 1.5 sec...
14:20prunedtreestill much better than the client VM
14:22prunedtreeChouser : you use a 64 bit system ?
14:27Lau_of_DKHas anybody here got a clojure example of a successful initialization of a JTable using the object[][] object[] constructor?
14:27Chouserprunedtree: 32 bit
14:28ChouserLau_of_DK: I saw you were poking at that. I dug out my example, and found I bailed on that constructor. ...so no, I do not.
14:28prunedtreec2duo ?
14:28Chouserprunedtree: core 2 duo, 800MHz
14:28prunedtreeare you sure you tested the same function ? no integer hint or such
14:29Chouserno integer hint (which wouldn't help anyway since these are not calls to java methods)
14:29Lau_of_DKChouser the all-seeing - Okay. Its a little weird, I managed to get it initialized, so it was accepted as an object[][] (the data), but when rendering it fails and throws some outofbounds errors....
14:30prunedtreeso how come we have different performance results ?
14:30prunedtreeI have a 1ghz c2duo
14:31Chouserprunedtree: that's an excellent question, and I'm afraid I don't really know.
14:31ChouserMaybe there's some Java forum where they would know such things? I knowledge of Java is pretty shallow.
14:32prunedtreeI'd say that it's speedstep messing up your measurements (giving you something that's not realtime)
14:33prunedtreecan you try something that takes a dozen seconds to check it's true real time ?
14:33prunedtreeand not time scaled on some virtual high frequency clock
14:33prunedtreefib 40 should do (if that doesn't take too long)
14:34Chouser(fib 37) in my VMPlayer, Windows XP, etc. just took 13 seconds, counting manually
14:36prunedtreeother than -server, what parameters do you use ?
14:37Chouserno -server in my Windows install. C:\>java -cp h:\build\clojure\clojure.jar clojure.lang.Repl
14:38Chouserthen I pasted your fib fn at the prompt, and ran (time (fib 36))
14:38prunedtree"Elapsed time: 6308.444789 msecs"
14:38prunedtree24157817
14:38ChouserI can see one of CPU meter peg at 50% for 7 or 8 seconds.
14:38prunedtreefor fib 37
14:39Chouseroh! that's better, isn't it?
14:39prunedtreedidn't feel like realtime
14:39prunedtreeah, it is
14:40prunedtreethe VM takes a few seconds too boot, too
14:40prunedtree4 sec to boot
14:40Chouserbut still, in linux (no vmplayer) with -server, (fib 37) takes 2.8 seconds (not counting java boot)
14:42prunedtreeException in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Repl
14:42prunedtreeCaused by: java.lang.ClassNotFoundException: clojure.lang.Repl
14:42prunedtreestrange, I can't do what you did
14:43prunedtreeah no, wrong path
14:44prunedtreeChouser : and it's not a 64-bit linux ?
14:44prunedtreeI guess you must have some hidden VM parameters, as you didn't have to add -server
14:45prunedtree(which gives me the client version here...) (or maybe -server is the default on linux... discrimination !)
14:46prunedtreeI have consistent timings ...
14:46prunedtreeuser=> (time (fib 36))
14:46prunedtree"Elapsed time: 3704.085855 msecs"
14:46prunedtree14930352
14:57ChouserOn linux (32 bit) without -server I get 2836 msecs and with -server I get 2818
14:58Chouserah, but -client gives me 13403 msecs
14:59Chouserso it does appear to be client vs. server setting -- you got -server to work on Windows now?
14:59prunedtreeyes
14:59prunedtreeotherwise I get 18 sec
14:59prunedtreeit looks like the speeddown for client is consistent
14:59prunedtreeI wonder if it's not a timing error from windows/linux
15:00prunedtree(well, I do measure 4 seconds of real time myself)
15:00prunedtreeyou are sure that the numbers you get are accurate on linux ?
15:01ChouserI'm not including java boot time
15:02rhickeyeven with -server you may need to run it a bunch of times to get the server to optimize it
15:03achim_pwhoa, shockingly slow on a power pc (1ghz). 40 secs for (fib 36)
15:03dudleyfrhickey: But is it expected for -client to run the simple fib 8-9x slower than -server?
15:04Chouser(fib 38) in linux with -server is definitely taking no more than 5 realtime seconds.
15:04rhickeythis kind of benchmarking is a huge time-suck
15:04dudleyfNo kidding ;-)
15:04Chouserprunedtree: at least you're beating your smalltalk numbers now
15:04prunedtreeno I'm not :)
15:05prunedtreebut it's closer to something acceptable
15:05Chouserhmph.
15:05danlarkinwhich version of fib are you all using now?
15:06prunedtree4.5 sec on my system is the time for /interpreted/ smalltalk
15:07prunedtree<rhickey> even with -server you may need to run it a bunch of times to get the server to optimize it << actually it doesn't make any difference to me
15:07prunedtreeOSR works well
15:07Chouserdanlarkin: http://clojure-log.n01se.net/date/2008-10-03.html#12:44a
15:08danlarkinChouser: thanks
15:08Chousernote that's not a good fib implementation, but it's a pretty punishing way to test function call speed.
15:09rhickeyexcept all of your numbers are not bound at all by function call speed, but by arithmetic boxing!
15:10danlarkinChouser: haha agreed, but I want to try it with -server and -client on my machine
15:10rhickeythis test is dominated by boxing
15:10prunedtreeyeah, I think so
15:11prunedtreeI wonder if the linux VM has some different internal compiler tweaks
15:11ozzileeachim_p: What PPC? G4?
15:13achim_pozzilee: yes, inside an aging powerbook
15:14danlarkinso I get about 8.1 seconds with -client, 5.3 seconds with -server, -client being the default on my Leopard macbook pro
15:15prunedtreeI get ~5x difference between client/server. but I'd like to have Chouser's numbers ;p
15:18prunedtreeanyway, that's decent enough. as long as you are within 10-5x of the C time I'd say it's acceptable for most stuff
15:19danlarkinI don't see any speed improvement by hinting n to an Integer
15:19danlarkinunless I'm doing it wrong, which is totally possible
15:19danlarkin(defn fib [#^Integer n] ...
15:21ozzileeozzilee: My 700mhz G3 is still cranking away... 8 minutes so far...
15:23prunedtreelet's try a much more interressing benchmark...
15:23dudleyfdanlarkin: That only affects Java method calls where Clojure might otherwise need to use reflection
15:23dudleyfIf I'm not mistaken
15:23ozzileeachim_p: I meant to reply to you :-)
15:24Chouserdudleyf: right
15:25lisppaste8rhickey pasted "hinted fib" at http://paste.lisp.org/display/67873
15:25prunedtreehumm. how do I get an interval ? call java ? code it myself ?
15:26rhickeydudleyf: no, hinting can impact arithmetic too. The main problem here is that the recursive calls take and return Objects, but inside the fn we can optimize a bit, see paste
15:27prunedtreewell, to make it interressing I tested (fib 301/10) also
15:28prunedtreeother polymorphic systems would still win by a huge margin. hard to tell if it's the way you do polymorphism or number unboxing
15:29prunedtreeanyways, ints are so common in code that it's likely to impact everything. hopefully the next generation of VMs will unbox stuff. it's actually trivial compared to more exotic stuff they do with locks and so on
15:29danlarkinhinted fib clocks in at 1.2 seconds with -server, 3.5 with -client... down from 5.3 and 8.1 respectively
15:29rhickeyall Lisp and Smalltalk system that have tagged numbers will beat all JVM langs that box on this benchmark, until the JVM supports tagged numbers or optimizes the escape analysis across calls
15:30achim_pozzilee: wow, 8 minutes :) i wonder why (un)boxing is so much more expensive on the jvm for ppc.
15:31rhickeydanlarkin: not too shabby
15:31ozzileeachim_p: Oh it's still going. 15 minutes or so now.
15:32Chousercljs performs poorly for this test.
15:32abrooksChouser: heh. Really? </ironic>
15:33Chouser(fib 30) costs 4 seconds in Rhino
15:38abrooksChouser: That's really impressive, actually. I assume that's the hinted fib?
15:38achim_palright, enough of this for me - signore fibonnaci would likely turn around in his grave if he knew what the kids were doing with his sequence nowadays ;)
15:38abrooksOh, it's also fib 30.
15:40Chouserno, hinting doesn't work in cljs yet.
15:53ozzileeachim_p: 39.31 minutes. I win.
15:54danlarkinouch
17:24lisppaste8prunedtree pasted "stack overflow without recursion" at http://paste.lisp.org/display/67882
17:25prunedtreewrote a bytearray implementation because immutability sucks to do sieves
17:25prunedtreestack overflow at 10k iterations is a problem for something that should iterate over 10 million elements...
18:37Chouserprunedtree: http://paste.lisp.org/display/67882 is pretty interesting.
19:08Chouser(dorun (for [i (range 10000) j nil] nil)) --> java.lang.StackOverflowError
19:24ChouserIt's all lazy-cat's fault.
19:56Chousergot it.
20:01Chouserprunedtree: I think this patch to boot.clj fixes the problem you found: http://clojure.googlegroups.com/attach/1a9afd4aed95c26c/for-overflow.patch
20:25PupenoHello.
20:25ChouserPupeno: hi
20:25PupenoHow does this thing of adding a dot at the end of a name work? like JFrame.
20:26PupenoI mean, what is it supposed to do? I couldn't get anything but errors.
20:26Chouser(Foo. x y) is the same as (new Foo x y)
20:26Chouserwhich is like "new Foo(x, y)" in Java
20:26Pupenooh, ok.
20:27PupenoThanks.
20:27Chousernp
20:35PupenoCan you ship a Clojure program in a jar?
20:44Chouseryep
20:45PupenoNice. Thank you.
20:45ChouserMany of the clojure lib functions will find .clj files in the classpath, including in .jars
20:46danlarkinso is the (Foo. x y) a reader special-case? It has to be, right? Because Foo. is not in the namespace so it can't be called like a normal function or macro
20:48rhickeydanlarkin: It's actually special macroexpansion: (macroexpand '(Foo. x y)) -> (new Foo x y)
20:49Chouserdanlarkin: it's not in the reader, technically, since "Foo." is a valid symbol and is read that way. The docs say Foo. turns into "new Foo" at "macro expansion time"
20:49achim_phi! it's probably really easy, but it won't cross my mind right now: how to obtain a lazy seq of ((1) (1 2) (1 2 3) ...) from (1 2 3 4) in one pass? i'd like to produce a lazy seq of "growing" reads, given a reader ("h" "he" "hey")
20:51danlarkinrhickey: Okay, so macroexpand-1 knows how to deal with the (Foo. x y) form, but how does clojure know to try to macroexpand it? For instance, (Foo x y) won't be passed to macroexpand.. or will it?
20:53Chouserachim_p: (map (fn [a b] (take a s)) (iterate inc 1) s)
20:54ChouserThat's one way -- I'm sure there's something better.
20:54rhickeydanlarkin: in looking to see if a form is a macro form, the compiler looks for leading or trailing dots, which are reserved for this purpose, then knows it gets special expansion, otherwise looks to see if was a defmacro var etc
20:55Chouserrhickey: you saw the stack overflow in "for"/
20:55Chouser?
20:56achim_pChouser: thanks! that's quadratic-time though, but it should do for now
20:57rhickeyChouser: yes, thanks for chasing that. Your fix works ok for that case, but I think there may be a deeper problem
20:57Chouserrhickey: ok.
20:58danlarkinrhickey: excellent, thank you for the explaination
20:58Chouserachim_p: what? it's a lazy seq of lazy seqs -- each level of seq produces the next item in constant time
20:59danlarkinsorry if I'm asking a bunch of arcane annoying questions of y'all, but it helps me learn a lot about the language
21:00Chouserdanlarkin: tell you what, nothing helps learn arcane and annoying details of a language like writing a new back end -- know anything about JavaScript?
21:00Chouser:-)
21:00danlarkinChouser: oh jeez, more than I'd like to
21:01Chouserhm... looked at clojure-contrib/clojurescript at all?
21:01achim_pChouser: of course you're right, i misread. i should get some sleep :) thanks again!
21:01Chouserachim_p: np
21:01danlarkinChouser: I'm scared of it!
21:02Chouseryeah, me too :-( well, just so long as you know it's there...
21:03danlarkinTBH I haven't looked at it. Saw it was there but moved on
21:03danlarkinalthough now I'm looking
21:04rhickeyachim_p: no, you are right, the takes, when consumed grow with N
21:04achim_pChouser: erm, but take takes longer for growing a, doesn't it?
21:05achim_pah, ok
21:05lisppaste8rhickey pasted "taking" at http://paste.lisp.org/display/67889
21:05rhickeytry that
21:05Chouserah, I see.
21:07Chouserif you touch each item produced, though, aren't they the same?
21:08Chouser"taking" is a win if you're doing something sparse on each vector, like using nth.
21:08rhickeyno, because each take starts at the beginning, while each step of mine just adds one item to the vector
21:09achim_prhickey: perfect, thank you!
22:18danlarkin((fn [a b c d] b) 1 2 3 4) => 2
22:18danlarkin((fn [a b c d :as lst] b) 1 2 3 4) => java.lang.Exception: Unsupported binding form: :as (NO_SOURCE_FILE:57)
22:18danlarkin:-(
22:19danlarkinohhh
22:19danlarkinwait!
22:20danlarkinno.. still don't get it
22:22danlarkinoh.. must I do it like this, ((fn [[a b c d :as lst]] b) [1 2 3 4])?
22:23rhickeydanlarkin: yes
22:25danlarkinI see -- so it's not quite like "def fun(*args)" if you're familiar with Python. I was assuming it worked that way, but come to think of it I shouldn't have, based on the let example of destructuring
22:26lisppaste8baetis-fly pasted "Faster nsieve vs. prunedtree" at http://paste.lisp.org/display/67899
22:43lisppaste8danlarkin pasted "metadata" at http://paste.lisp.org/display/67900
22:45danlarkinso my question about that is why does one way of defining a function get an :arglists key in its metadata, but the other way doesn't
22:47Chouserdanlarkin: the :arglists metadata is added by the defn macro itself
22:47Chouserboot.clj, line 207
22:47danlarkind'oh!
22:47danlarkingood reason