#clojure logs

2009-10-31

04:00hiredmanhttp://gist.github.com/222974
04:11paowhich is the idiomatic form for (map println #{:name "x" :surname "y"})? I don't want to collect results...
04:13paoin haskell it would be mapM_
04:16Chousukeuse doseq
04:16Chousukeor if you insist on using map, then wrap it with dorun
04:16paoChousuke: thanks
04:19paoChousuke: thanks a lot
04:22tomojdoseq is safe with chunked seqs, right?
04:23Chousukesure.
04:23paoI'm evaluating clojure for a data crunching problem... manipulating double-array... can I expect similar performance to java with not so big optimization efforts?
04:24Chousukehonestly? no. :P
04:24paoChousuke: :-)
04:24Chousukeone big reason is that functions don't support primitive arguments
04:25Chousukeso if you manipulate arrays of primitives you'll end up boxing and unboxing a lot
04:25Chousukeunless you inline everything, which is not always otimal
04:25Chousukeoptimal*
04:25Chousukeprimitive support for functions is planned, but not implemented yet
04:27tomojwhat's wrong with (definline foo [] (rand))?
04:27paoChousuke: so the tag force a cast in the function body but the argument is always passed boxed, right?
04:27hiredmanit's not a cast
04:27hiredmanit is boxing/unboxing
04:28paohiredman: yep
04:28paowhat is the penalty I can expect? 10 times slower?
04:28paojust looking for an order of magnitude...
04:29Chousukewell, it's not so easy to tell. :/
04:29Chousukeyou *can* manipulate arrays quickly, but it's easy to ruin performance by allowing boxing/reflection to happen
04:29paoIt's a little sad that clojure is not present in the language shootout
04:30paoshootout is useful to get an idea...
04:30Chousukebut it's just my opinion that Clojure is not particularly well suited for manipulation of large amounts of *mutable* data... not yet, anyway :)
04:31paoChousuke: I'm my case the arrays are not mutable... I use them as immutable input
04:31Chousukeah. hmm. that might change things :D
04:32paoChousuke: I just have to try :-)
04:32Chousukejust make sure you typehint your arrays properly
04:32Chousukereflection on array accesses doesn't show up with *warn-on-reflection* :/
04:33Chousukeand any reflection will likely slow you down one order of magnitude, at least
04:34Chousukeif in a tight loop, that is.
04:40paoChousuke: can you provide a micro example for "typehinting arrays"?
04:42Chousukewell, if you have an array of ints you just need to use aget so that: (aget #^ints the-array (int idx))
04:43paoChousuke: thanks
04:43pao(int idx) helps?
04:43Chousukeit's needed.
04:44Chousukeyou can also do that in a let: (let [#^ints thearray (get-array)] (dostuff (aget thearray ...) (aget thearray ...)))
04:45paoChousuke: get-array?
04:45paoyou mean my function that returns an array
04:45Chousukeyeah.
04:46Chousukewhatever it is :)
04:46paoyep
04:51paoChousuke: thanks for your help...
05:33avitalHi. I've installed clojure on emacs using clojure-mode using M-x clojure-install. After it was done I erased the src/ directory it downloaded to and tried again. Now it seems just to get stuck during git and it seems that git isn't really doing anything. Has anyone ever encountered this?
05:34hiredmanuh
05:35hiredmanin the clojurebot git repo src is a subdirectory
05:36hiredmaner
05:36hiredmanclojure
05:38tomojavital: did it not work the first time?
05:38tomojor, why did you delete src/ (guess you mean the src/ dir where clojure-install downloaded the repos?)?
05:39avitaltomoj: It did but I didn't follow the .emacs instructions - the next time I ran emacs I couldn't do M-x slime, so I prefered to just start over again.
05:39avitaltomoj: Yes, that src/.
05:39tomojah
05:39tomojwell, I dunno why it would hang now when it worked before
05:39tomojbut you could always check the git repos out yourself
05:39avitalI may just need to reinstall emacs or something
05:39avitalit's weird
05:39avitalah
05:39tomojcertainly no need to reinstall emacs
05:40avitalok, i'll check them out manually. thanks
05:41tomojI think the only thing you need for your .emacs if you're just using slime with clojure is (clojure-slime-config "/the/path/to/your/src")
05:42tomojand you should clone clojure, clojure-contrib, technomancy/slime, and technomancy/swank-clojure
05:42avitalok great
05:42tomojand you'll probably have to run ant in clojure and clojure-contrib
05:42Licenseraloa
05:43tomojI think slime and swank-clojure don't need to be built beforehand
05:43steigeravital: or even easier, install ELSA (google) and then install clojure through it
05:45avitalthat's what i did initially
05:45avitalwhich is not working now
05:45avitaloh wait no i install ELPA
05:45avitalwhat is ELSA
05:47steigeri meant.. elpa
05:59tomojso we can use hyphens in package names because clojure will translate them to underscores when looking for files
06:00tomojbut it seems that means that when referring to a class from java, we have to use the underscore?
06:00tomoje.g. for the Main-Class manifest attribute
06:00tomojI have foo.bar-baz/-main, so I must do java -jar foo.bar_baz ?
06:01hiredmanyes
06:02hiredmanwell
06:02hiredmanjava -jar jarfilename.jar
06:02tomojoh, yes
06:02tomojjava -cp jarfilename.jar foo.bar_baz
06:02tomojor Main-Class: foo.bar_baz
06:03hiredmanyou can also overide the name of the generate class if you want to use camelCase
06:03tomojif I can expect the people using my executable jar to have clojure, I don't need to bundle it into the jar, I guess?
06:04tomojbut then, how would they tell my executable jar where to find clojure?
06:04steigeri think clojure needs a better distribution system
06:05tomojor does an executable jar have to contain all its dependencies?
06:06tomojeven using the slim jars my jar is 1.1M and it's just a single println really
06:07tomojI guess rather than an executable jar I should just provide a wrapper script with a configurable classpath
06:37tomojdoes *foo* have any special meaning or should I feel free to use it whenever I like for atoms/vars
06:38djpowelltomoj: you can put a Class-Path: clojure.jar in your jar's manifest, if you are going to bundle clojure.jar in the same directory
06:38tomojdjpowell: ah great
06:39tomojand I guess that means someone can specify the path to clojure.jar when they build
06:40tomoj... how did you even know I was talking about that? you just got here
06:40steigerweird
06:41djpowellwas lookiing at the chat logs on the website
06:41djpowelli think it is probably easiest to bundle a script at the moment tho
06:42djpowellthe java installed extensions stuff, sounds like it might be useful - but I tend to find I have loads of different JVMs on my system, and it is never obvious which one is getting used
06:42tomojit would be cool if there were something like rubygems that could install binaries
06:44djpowellperhaps we can just standardise an environment variable like CLOJURE_HOME pointing to a directory containing the clojure and contrib jars - and then people can use that in scripts
06:46djpowelli would like some sort of package management system, rather than the current status of bundling everything in contrib
06:47tomojis maven that kind of thing?
07:02djpowelldon't know. lots of people seem to like maven, but an equal number seem to think it is horrible
07:39gerry_when will clojure 1.1 be released?
07:40gerry_and clojure reify/datatypes/protocol will be in 1.2?
07:40gerry_anyone knows?
07:41hiredmanthere may not be a 1.1
07:43gerry_?
07:43gerry_jump to 1.2?
07:44hiredman2009:Oct:26:13:40:18 stuartsierra : At the rate he's going, he's going to have to call it Clojure 2.0 instead of 1.1.
07:45hiredmanspeak of the devil
07:45Licenserheh
07:45Licenserdamn now we've to stop talking aout rhickey behind his back :P
07:45gerry_2.0 is grrrt
07:47maaclchouser: that's a brilliant qsort - thanks
07:50gerry_i have to use proxy but reify when using swing, reify not support super class but interfaces ,right?
07:51gerry_extends JFrame and implemnets even interface is common with swing
07:52gerry_s/even/event
07:53modulushmm, the example code to make swing windows on a tutorial doesn't work for me
07:53gerry_hmm
07:54modulushttp://java.ociweb.com/mark/clojure/article.html#DesktopApps
07:54gerry_any error msg?
07:55modulussec
07:55modulusa few
07:56moduluswhen i paste this: (ns com.ociweb.swing
07:56modulusi get
07:56modulusjava.io.IOException: Not enough storage is available to process this command
07:57gerry_your harddisk is full?
07:57modulusnot by far
07:58gerry_works perfectly on my box
07:58modulushmm
07:58modulusstrange.
07:59gerry_it semms not problem of clojure code anyways ;)
08:01modulushmm this is weird
08:02modulusi wonder if it's something to do with the copy paste because when i type it by hand it seems not to cause this problem.
08:02gerry_linux?
08:03gerry_i'm using ubuntu now, paste works
08:03modulusok, weird, now it worked.
08:03moduluswin32.
08:06gerry_windows is werid sometimes
08:12gerry_how to adjust emacs clojure-mode to autoindent?
08:24tomojany of you clojurites know couchdb? trying to figure out a good way to write view functions in clojure
08:24tomojwriting them like you would a standard function passed to clojure's map is nice, but sometimes you want to emit more than one pair per doc
08:27Licensertomoj: there is work on a clojure mongodb driver, perhaps you can talk to the sumnium person as I think couch and mongo are pretty much the related
08:30tomojexcept mongodb, afaik, doesn't use mapreduce
08:30tomojbut thanks
08:30Licenserit does
08:31tomojoh, I see
08:32tomojI read some old comparison from before it had mapreduce I guess
08:33Licenseryes map reduce is somewhat new I think
08:33Licenserbut I'm somewhat new to it all too :P
08:50djpowellgerry_: don't know exactly; M-x local-set-key <RET> newline-and-indent seems to do something
08:52djpowellgerry_: something here http://www.emacswiki.org/emacs/AutoIndentation
08:58modulushmm
08:58moduluswhen i do (def *warn-on-reflection* true) clojure complains
08:58moduluswhat do I need to be doing instead?
08:58chouserset! instead of def
08:58modulusah, thx.
08:59gerry_djpowell: thx
09:05gerry_djpowell: it works, but sometimes, indent too many in clojure, such as when using proxy with swing
09:06gerry_i just want only indent two space
09:22gerry_(doc reify)
09:22clojurebotGabh mo leithscéal?
09:22gerry_java.lang.Exception: Unable to resolve var: reify in this context
09:22gerry_,(doc new)
09:22clojurebotIt's greek to me.
09:23gerry_hmm
09:24gerry_,(doc set!)
09:24clojurebotIt's greek to me.
09:26gerry_clojurebot begin to speak french or greek? :)
10:19CalJuniorI have an incredibly newbie question (I come to Clojure from R rather than LISP or Java), please be gentle. I am trying to call functions from a third party library (TWS Java API from Interactive Brokers) but get "ClassNotFoundException" when I try to import the Java source files. I am quite sure the files are in the classpath as I have tried all possible -cp paths. Again, I am a Java virgin and I might well be trying to do the impossible as
10:19Chousukehm
10:19ChousukeI think you got cut off
10:20Chousukeanyway, show the code you're using to import things :)
10:20CalJunior(import '(com.ib.client EWrapper))
10:21CalJuniorEWrapper is the .java source file in the com/ib/client directory of the API library.
10:21Chousukethat should work. doesn't look like an inner class either
10:21Chousukeis there a .class file too?
10:21CalJuniorthis is what I get: java.lang.ClassNotFoundException: com.ib.client.EWrapper (NO_SOURCE_FILE:1)
10:21CalJuniorno
10:21Chousukeoh, well, that's the problem then :)
10:21CalJuniorok
10:22pao(set (take 1000000 (cycle (range 10)))) goes OutOfMemoryError in the repl ... shouldn't it be lazy?
10:22Chousukeyou need to compile the library first so that it produces the class files. though most likely there should be a .jar of the whole thing already :/
10:22CalJuniorthere is
10:22Chousukepao: the (take ...) is, but not (set ..) :/
10:22CalJuniorwell the source files from the jar file.
10:23CalJuniorthere is an example java client that needs to be compiled before use.
10:23spuzCalJunior: you need a jar with .class files in
10:23ChousukeCalJunior: add the .jar file to your classpath and retry?
10:24Chousukejava is always compiled, but libraries are usually distributed as .jar files containing .class files
10:24CalJuniorOK, I will have another look and get back. Thanks for the help so far. Appreciate it.
10:24paoChousuke: (reduce conj #{} (take 10000000 (cycle (range 10)))) does the trick in fact, is there a better way?
10:25Chousukepao: hm, probably apply holds onto the entire seq then :/
10:25Chousuke(into #{} (take ...))
10:25Chousukethat ought to be faster
10:25Chousuke(into uses transients when possible, reduce doesn't.)
10:26Chousuke~transients
10:26clojurebothttp://clojure.org/transients
10:26Chousuke,(time (into #{} (take 100000 (cycle (range 10)))))
10:26clojurebot#{0 1 2 3 4 5 6 7 8 9}
10:26clojurebot"Elapsed time: 259.965 msecs"
10:26Chousukeer, heh.
10:26Chousuke,(time (reduce conj #{} (take 100000 (cycle (range 10)))))
10:26clojurebot#{0 1 2 3 4 5 6 7 8 9}
10:26clojurebot"Elapsed time: 109.714 msecs"
10:27Chousukehmm, curious
10:27Chousuke,(time (reduce conj #{} (take 100000 (iterate inc 0))))
10:27clojurebot#{0 32768 65536 98304 1024 33792 66560 99328 2048 34816 67584 3072 35840 68608 4096 36864 69632 5120 37888 70656 6144 38912 71680 7168 39936 72704 8192 40960 73728 9216 41984 74752 10240 43008 75776 11264 44032 76800 12288 45056 77824 13312 46080 78848 14336 47104 79872 15360 48128 80896 16384 49152 81920 17408 50176 82944 18432 51200 83968 19456 52224 84992 20480 53248 86016 21504 54272 87040 22528 55296 88064 23552 5632
10:27clojurebot"Elapsed time: 862.803 msecs"
10:27Chousuke,(time (into #{} (take 100000 (iterate inc 0))))
10:27clojurebot#{0 32768 65536 98304 1024 33792 66560 99328 2048 34816 67584 3072 35840 68608 4096 36864 69632 5120 37888 70656 6144 38912 71680 7168 39936 72704 8192 40960 73728 9216 41984 74752 10240 43008 75776 11264 44032 76800 12288 45056 77824 13312 46080 78848 14336 47104 79872 15360 48128 80896 16384 49152 81920 17408 50176 82944 18432 51200 83968 19456 52224 84992 20480 53248 86016 21504 54272 87040 22528 55296 88064 23552 5632
10:27clojurebot"Elapsed time: 270.477 msecs"
10:28Chousukeokay, that's better :)
10:29paoChousuke: I'm my repl results are identical!
10:29pao,(dotimes [n 10] (time (reduce conj #{} (take 100000 (cycle (range 10))))))
10:29clojurebot"Elapsed time: 100.55 msecs" "Elapsed time: 86.706 msecs" "Elapsed time: 87.757 msecs" "Elapsed time: 114.743 msecs" "Elapsed time: 87.801 msecs" "Elapsed time: 86.615 msecs" "Elapsed time: 88.365 msecs" "Elapsed time: 84.042 msecs" "Elapsed time: 86.377 msecs" "Elapsed time: 115.112 msecs"
10:29pao,(dotimes [n 10] (time (reduce conj #{} (take 100000 (cycle (range 10))))))
10:29clojurebot"Elapsed time: 95.895 msecs" "Elapsed time: 97.044 msecs" "Elapsed time: 97.358 msecs" "Elapsed time: 98.305 msecs" "Elapsed time: 125.912 msecs" "Elapsed time: 98.004 msecs" "Elapsed time: 94.851 msecs" "Elapsed time: 95.979 msecs" "Elapsed time: 94.452 msecs" "Elapsed time: 126.823 msecs"
10:29Chousukewhich version of clojure are you using?
10:29paoops
10:30pao(dotimes [n 10] (time (into #{} (take 100000 (cycle (range 10))))))
10:30pao,(dotimes [n 10] (time (into #{} (take 100000 (cycle (range 10))))))
10:30clojurebot"Elapsed time: 74.41 msecs" "Elapsed time: 70.652 msecs" "Elapsed time: 72.579 msecs" "Elapsed time: 71.295 msecs" "Elapsed time: 104.413 msecs" "Elapsed time: 71.383 msecs" "Elapsed time: 73.598 msecs" "Elapsed time: 69.669 msecs" "Elapsed time: 72.419 msecs" "Elapsed time: 69.731 msecs"
10:30paoclojure 1.0.0
10:30paointo is faster in fact
10:30Chousukeright. it doesn't have transients yet.
10:30paois trunk "usable"?
10:30Chousukealso, try with the iterate example. the cycle example only ends up having ten items in the set :/
10:30Chousukeyes.
10:30CalJuniorChousuke & spuz: found the .jar file and succesfully imported the source file. Thanks a lot.
10:31spuzCalJunior: nice
10:35tomojI guess the iterate is much faster because after you get the ten items in the cycle example, you don't modify anymore, so transients don't help as much?
10:36Chousukeprobably.
10:36tomojI'm glad you talked about this so that I just learned transients.. they were very mysterious to me before
10:37Chousukejust remember not to "bash in place" if you use them
10:38Chousukethey're mutable, but designed so that you build them in the same recursive manner as a regular, persistent collection.
10:38tomojthat just means hang onto return values, not previous versions, right?
10:38Chousukeyeah.
10:43paois there something more idomatic for (let [r (java.util.Random.)] (map (fn [_] (.nextDouble r)) (range 100))) =
10:43pao?
10:44Chousuke,(let [r (java.util.Random.)] (map (fn [_] (.nextDouble r)) (range 100)))
10:44clojurebot(0.3154344624915727 0.37512283998423845 0.8366170003227745 0.9907907818259915 0.3092291147857362 0.8369312205887557 0.24789550379379632 0.21980509598251174 0.6357182175766286 0.953836500425072 0.32714391409897914 0.16484684561450946 0.6886259088197438 0.9104236798549015 0.7465173104687564 0.1646862383991332 0.7965716185231517 0.08071172858954145 0.8224364365244278 0.8133656540962697 0.7350804829440669 0.22327827025118463
10:45The-KennyHello.. I have a small problem with swank-clojure and the new-branch from clojure: http://gist.github.com/221618
10:45Chousuke,(take 10 (repeatedly rand))
10:45clojurebot(0.05471816439340649 0.711553380600737 0.25236443140571485 0.26077964272849863 0.8548458661979857 0.10696059894112442 0.941348441140806 0.6678450961633237 0.12957791848863587 0.20202135380470665)
10:45The-Kenny(Not my gist, but this person had the same problem)
10:45paoChousuke: thanks ... I have a long road to run...
10:46Chousukepao: heh.
10:46pao:-)
10:47Chousukeit's sometimes difficult to remember to use higher-order functions.
10:47Chousukeit's so easy to just write a loop :P
10:47paotrue
10:48tomojif you want to dynamically bind a file writer, would you do (with-open [file ...] (binding [*file* file] ..))?
10:49Chousukesomething like that should work.
10:49Chousukejust be aware of laziness
10:50notallamaloops are code smell to me now. sometimes they're the right thing to do, but i always feel dirty writing one.
10:50paonotaliama it's a sin :-)
10:50Chousukenothing wrong with loops sometimes.
10:50Chousukeas long as they're functional, recursive loops :P
10:51paoIn my case, what I miss is a basic knowledge of library functions....
10:51Chousuketomoj: if you use a lazy seq to manipulate the file and it exits the binding scope before it's fully realised... *boom* :)
10:52tomojyeah
10:52tomojjust using it for logging
10:52tomoj(with-log-writer "foo.log" (log "hello log file")) :)
10:54paotransients remind me of Haskell's ST monad...
10:54tomojoh, and that macro there wraps my entire -main, so I don't think there will be a problem
10:54modulushow do you do networking on clojure, use java functions?
10:55tomojwell, there's clojure.contrib.server-socket
10:56modulushmm
10:56tomojbut for clients I guess you would just use java, yeah
10:57moduluswould be nice to have more lispy wrappings of java core
10:57modulusi guess it will come with time
10:57tomojyou can write one yourself pretty easily
10:57tomoja few lines I think
10:57modulusyeah, that may be a good way of getting started with clojure.
10:57tomoj(for client sockets I mean)
10:58modulusyeah
10:58tomojmodulus: https://gist.github.com/5f59ff4e091bc015a8a6
10:59tomoj(with-socket [in out] {:host "foo.com" :port 1234} (...do stuff here with in and out...))
11:00tomojprobably want to wrap those streams in something
11:01modulushmm looks like a nice itnerface.
11:04spuz~zip
11:04clojurebotHuh?
11:05spuz~zipper
11:05clojurebotTitim gan éirí ort.
11:05spuzhmm
11:05spuzAnyone know what a zipper is?
11:05spuzhelp the clojurebot out here...
11:09tomojare you looking for the academic papers?
11:09spuzJust a description
11:10notallamafrom what i understand, it's a tree that you can move around in. like from any node, you can transform it into another zipper with either child or a parent as the root. i have not used them, though.
11:10tomojhttp://clojure.org/other_libraries#toc5
11:11tomojyeah basically lets you move around and "modify" tree-like data
11:12spuztomoj: thanks
11:12notallamayeah. the benefit being that changing the root of a tree functionally is O(1)
11:13tomojI don't really understand what you mean by that
11:15notallamaif you 'modify' a tree, and you want to keep the old copy around, you have to change the element, and its parent, and its parent, etc. until you get to the root. just changing the root is easy: it's like replacing the head of a linked list.
11:16tomojby "root" you're referring to the current zipper node?
11:18notallamai guess so. as i said, i have not actually used zippers, so i'm not too familiar with them. my last two messages were about trees in general, but they should apply to zippers if i understand them correctly.
11:20tomojif zippers are trees, I still don't understand them
11:21tomojchanging the root node with a zipper doesn't make much sense to me
11:21tomojwouldn't that just be totally replacing the data with something else?
11:22tomojguess it depends on what kind of thing you're zipping around in
11:22notallamawell, 'change'. as in make a copy and modify it.
11:23tomojoh, I think I understand what you mean, maybe
11:25notallamalike, when you change a normal immutable tree, the number of operations depends on how deep you are in the tree. if you use a zipper, you can do things near the zipper location in constant time.
11:28tomojok
11:28tomojbut doesn't unzipping require more than constant time?
11:29tomojrather, zipping, I guess
11:29tomojI mean the final call to zip/root
11:29tomojand you need more than constant time to even get down to a deep loc anyway, right?
11:29notallamameaning moving the zipper up to the root again? yeah.
11:30tomojoh, I guess that means you do a bunch of constant time operations rather than a bunch of more-than-constant
11:31notallamayeah.
11:35The-Kennyah, just got swank-clojure working again :)
11:57tomojhttps://gist.github.com/43274c3405a2a2b917db
12:41drewrtomoj: have a look at http://github.com/drewr/clot/blob/master/src/com/draines/clot/main.clj#L14
12:41drewrthat's how I invoke swank
12:44tomojhmm
12:44tomojI usually just do (swank.swank/start-server "blah" :port XXXX)
12:45tomojwhich works fine from the slime repl
12:45tomojbut causes that weird exception when running a compiled class
13:29The-KennyJust found defnk in contrib... That's what I've missed in clojure.
13:32djpowellcase is pretty cool. why does it do that shift and mask stuff tho?
13:53chouserdjpowell: that's part of how it can provide constant-time lookup
13:53chouserI haven't looked at it closely enough to know exactly what it's doing.
13:55rhickeyit's pretty simple - it just takes the set of hashes, starts with a mask of 1, sees if by shifting all of the hashes a certain amount and masking with the mask, they are all unique, if so, done, yieldsin shift and mask, else expands the mask to 11 and tries again
13:56rhickeygiven the shift and mask, can make a table (usually 1-4x the # of keys) that can be indexed by the shifted and masked hashes
13:57rhickeymaps that to the JVM tableswitch instruction, which requires a packed table, sets and blank entries to the case default
13:57rhickeysets any
13:58rhickeyat runtime - hash, shift, mask, index
13:59rhickeyso, it works with anything with stable hashes
13:59chouserwhich is a lot in clojure
13:59rhickeyno need to wait for JDK 7 switch on strings support :)
14:00rhickeyfiguring out the shift and mask and mappings of tests to expressions is all done in Clojure
14:01rhickeythe JAva side just assembles the tableswitch, and emits bytecode for hash/shift/mask/tableswitch
14:36tomojdrewr: why do you use clojure.main/repl?
14:36tomojI copied that swank! function and now my compiled class can start a swank server
14:36tomojbut swank crap gets dumped into stdout which will mess things up
14:43spuzHow do you redirect *out* to a string?
14:43tomojwith-out-str
14:44rhickey,(with-out-str (prn {:a 1 :b 2}))
14:44clojurebot"{:a 1, :b 2}\n"
14:44tomojrelatedly, how do you redirect *out* to nothing at all?
14:44tomojnil doesn't work :(
14:44tomojguess I could bind it to write to /dev/null but that seems strange
14:49notallamaperhaps make a proxy of whatever class system.out is?
15:08spuzrhickey: thanks, by the way, how come the emit function in xml.clj is not documented?
15:08spuzshould we be using it?
15:12djork_does anybody have Google Wave invitations?
15:50djorkI'm going to try an experiment and teach my non-programmer (with some HTML/CSS experience) how to program with Clojure. I'm worried about hitting some speedbumps when it comes to the Java stuff.
15:50thearthuranyone know what version of intellij IDEA and La Clojure plugin will work together?
15:53chouserdjork: yeah, I've wondered the same. Clojure is fantastically practical, and that's what its java interop is all about.
15:53djorkyeah
15:54hiredmanclojure's java interop is a great way to learn java :P
15:54chouserbut to use it you need to import this orthagonal set of concepts about methods, inheritence, javadocs, etc.
15:54djorkright
15:54djorkit's like you need to know two languages
15:54chouseryou don't need to know java well, but not knowing OO at all might be a problem.
15:55djorkwhich isn't a problem for programmers, since 99% of them know Java one way or another
15:55chouserright, or at least some flavor of OOP
15:55hiredmanchouser: I wonder how much those concepts come into to play for simple java library use
15:55djorkhe wants to do games
15:55djorkso maybe a LWJGL wrapper
15:55djorkmaking it more idiomatic
15:55chouserwhen confronted with a similar opportunity, I discussed with my student his actual goals, and we ended up going with JavaScript. :-P
15:56djorkheh
15:56hiredmanchouser: chicken
15:57chouserwe haven't gotten very far yet, but I'm already wondering whether I should try to steer him away from mutating locals and the like. gah.
15:57chouseryes, chicken.
15:57djorkscheme?
15:57chouserheh.
15:57hiredman~laugh
15:57clojurebotha ha
15:59hiredmanhuh
15:59djorkblargh
15:59hiredmanjs1.7 has a let construct
17:51KjellskiHi there!
18:01Kjellski((into {1 11} {1 10 2 20}) 1)
18:02Kjellski,((into {1 11} {1 10 2 20}) 1)
18:02clojurebot10
18:02KjellskiCould someone give me a hint how I can foce the map to use a function for merging the maps?
18:02technomancy,(doc merge-with)
18:02clojurebot"([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
18:03Kjellskitechnomancy : Thanks.
18:03technomancyno problem
18:04Kjellski,((merge-with #(+ %1 %2) {1 11} {1 10 2 20}) 1)
18:04clojurebot21
18:04KjellskiSometimes I just can´t believe how simple things are...
18:06KjellskiSo, thanks again... gone for a cup of sleep...
18:26RaynesMan, I wish I would have asked him to bring me some back. :(
18:28technomancyyeah, didn't realize sleep came in draught form now
18:36technomancysneak peek: http://p.hagelb.org/leiningen.html
18:41hiredmanfancy smancy
18:55technomancyI am particularly fond of the name and the quotation at the top.
19:04hiredmanright, army of ants, cute
19:23pmooserI made a post yesterday on the google group about blowing out the heap using a loop/recur along with destructuring under JDK 1.5. Did anyone happen to see my post, and have any suggestions ?
19:25paocan anyone tell me if this is idiomatic? http://gist.github.com/223306
19:25paoam I reinventing the wheel?
19:25tomojare vectors good for a bunch of 2-tuples?
19:25hiredmanpmooser: I would tinker with the macor expansion of your code
19:26hiredman(doc partition)
19:26clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
19:26pmooserhiredman, that's a good suggestion - thank you !
19:29paohiredman: that means I was reinventing the wheel I guess
19:36paoI'm trying to understand why my group-n version overflows the stack while partion doesn't... can anyone give me a clue?
19:37hiredmanpartition is lazy
19:37hiredman~def partition
19:38djpowellah - i now see why case does that shift and mask stuff - it is because the tableswitch opcode is just a lookup table; i'd assumed that it was a list of value/target pairs
19:41paohiredman: I could try to make my definition a lazy seq with lazy-seq right?
19:42hiredmansure
19:42pmooserHmm, hiredman, I did a macroexpansion of the simple destructuring, and posted my interpretation on the group.
19:42pmooserIf I am interpreting it correctly, it makes sense that it blows the heap, but it is hard to believe, since it seems like destructuring makes it very easy to hold on to the head of seqs.
19:43hiredmanI would be surprised
19:43hiredmaner
19:43hiredmanwouldn't
19:43hiredmandestructure is a complex macro
19:44pmooserIf this is true, I hope rich considers this to be a 'bug' because I love the destructuring capability and if I have to avoid it with seqs that will make it much less interesting to me.
19:45namorWhat kind of references would you use for a double linked list?
19:45hiredman:(
19:45pmooserMaybe there's something I don't understand about the semantics of let* or something.
19:45hiredmanlet* is let minus destructure
19:46hiredmannamor: you wnat to use refs
19:46hiredmanbut I would not use doubly linked lists
19:46chouseractually, I can't imagine you actually want a doubly linked list
19:47chouseryeah
19:47namorhiredman, ok. I was unsure as I thought refs were just for STM and such, but good, I'll use refs.
19:47hiredmanI saw some thing some where about functional doubly linked lists
19:47namorThe double-linked list was rather an example. I have a tree structure, and I need to traverse up- and downwards.
19:47hiredmanI'm not sure how that would work and I didn't bother reading it
19:48hiredmannamor: you will want to use the STM
19:48chouserfinger trees do most of what you'd want a doubly-linked list to do, I think.
19:48hiredmanbecause you will want to coordinate changes to the references
19:48hiredmanchouser: and they are just dreamy to boot
19:48chousernamor: for trees you might consider clojure.zip
19:49chouserimmutable trees that allow navigation in every direction
19:49notallamawouldn't zip make a good doubly linked list, too? a list is just a special case of a tree, after all.
19:50namorchouser, Hmm, sounds interesting indeed. I'll have a look at them for sure.
19:51chousernotallama: hm! I think you're right!
19:51djpowellwho was working on finger trees? how is that going?
19:55chouserthey're working, but need some cleanup, better measure/reduce design, and some docs
19:56chouseroh, and it requires an old version of the 'new' branch, so needs to be updated.
19:59djpowelli heard about them from http://blog.sigfpe.com/ - a really interesting blog about haskell and weird abstract maths that turn out to have practical applications
20:14paocan anyone help me optimize this micro benchmark http://paste.pocoo.org/show/148047/?
20:25pmooserdjpowell, I remember doing that buffon's needle problem in school :)