#clojure logs

2009-12-19

00:19jasappdoes anyone remember how to use the different regular expression flags?
00:20somnium`like #"(?i)FoObAr+" ?
00:20jasappyup, that's what I was looking for
00:20jasappthanks
00:21jasappis that in the docs anywhere? I couldn't find it
00:21_atohttp://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
00:21_atoprobably the Clojure documentation should link to that
00:21somnium`a perl/javascript syntax would be nice
00:22somnium`maybe with cinc
00:24chouseris it that different?
00:24somnium`no
00:25somnium`mostly just move the flags to the end it appears
00:26devlinsfchouser: ping
00:26chouserdevlinsf: hi!
00:26devlinsfJust saw your feedback
00:27devlinsfI modified withMeta because the original code use it
00:27devlinsfWanted to do something "Similar"
00:28devlinsfDo you know why the use of EMPTY is there?
00:28devlinsf(That was causing the bug, btw)
00:29devlinsfHmm... I wonder if withMeta loses the comparator
00:29chouserthat's how the other collections do it
00:30chouserdevlinsf: it used to, I think, but was fixed by using the two-arg constructors. :-)
00:31devlinsfRight
00:31devlinsfSo, should I just break convention here?
00:31devlinsf(A quick REPL test shows we're okay)
00:32chouserI can't tell you what rhickey is more likely to accept, but that's what I'd do.
00:33devlinsfOkay. I'm adding a comment to explain the deviation in the source.
00:34devlinsfShould I include some tests too?
00:34chouserwell, it's different from what used to be there and from the other collections, but it's a pattern used elsewhere in that file.
00:35chouserif you want, sure. tests are great. if you do, please put them in the same patch file, though they can be a separate commit if you want.
00:36devlinsfHmm... sounds good
00:37devlinsfI'm curious. What's the process of these patches getting into core? Does Rich review all of them?
00:37chouseryep, each and every one.
00:37devlinsfOkay.
00:39chouserI think if people comment that the patch is good, he may be able to approve it more easily, I'm not sure.
00:40devlinsfWell, I appreciate the review
00:40chouseronce he approves, he or I can push it to github.
00:40chousersure, happy to have the help. thanks!
00:41chouserI have no sense if he'll want this in 1.1 or not, but I'd like it to be.
00:43devlinsfMe too
00:43devlinsfIt's a bug fix, so that's gotta make the case easier, right?
00:43chouserI'd think so.
00:44chouserok, bedtime. thanks again for working on this.
00:45devlinsfnp
00:46devlinsfI'll have patch #2 ready tonight
02:27scottj_Does technomancy's swank-clojure try to use tramp to find the source of a function and bail on Windows or is it something else in my setup?
02:27scottj_(M-.)
03:41LauJensenMorning gents
04:24triyoThe bean function returns a map that represents the bean. The map contains the :class key with the Class value. When running (json-str (bean my-bean)) it complains about the Class value bound to :class as json write process doesn't know how to convert it I guess.
04:24triyoone solution I can think of is to dissoc the :class, is this the best option?
04:25triyoalso, how do I do this when the bean in question could have number of nested levels of beans with their own :class keys
04:32triyook, the json lib source says the following: "You can extend this library to handle new types by adding methods to
04:32triyoprint-json."
05:38BjeringWhat am I doing wrong here?
05:38Bjering(build-dataflow[(cell :source a) (cell b (* 2 ?a))])
05:52vegaiwhat's the error? Are you supposed to have a space before [?
05:55Bjering#<Object java.lang.Object@d70b42>) (NO_SOURCE_FILE:0)>
05:56Bjeringah
05:57Bjeringfound it, a missing arg when defining cell a
05:57vegaiah, right
05:57BjeringThis worked (build-dataflow [(cell :source a 0) (cell b (* 2 ?a))])
06:18hamzahey guys, i would like to call a function with side effects n times is there a repeat like call for this? i don't care about the return value.
06:19_ato,(doc dotimes)
06:19clojurebot"([bindings & body]); bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1."
06:20_ato,(dotimes [i 3] (println "hi"))
06:20clojurebothi hi hi
06:21hamza_ato: thanks a lot.
07:18Ankouhi, the documentation of clojure.walk talks of some examples but where are those examples?
07:22Ankoubecause I can't figure out what clojure.walk is doing?
07:37hoeckAnkou: there are some examples of walk at the bottom of its source
07:42hoeckAnkou: for example, there: http://github.com/richhickey/clojure/blob/master/src/clj/clojure/walk.clj#L52
08:46interferoni compiled a clojure file to java bytecode. when i run it from the command line with "java" it runs everything in -main, but then doesn't terminate
08:46interferoncould it be because of still-running threads?
08:48the-kennyhm.. good question
08:53interferonactually, it did terminate after maybe a minute
08:54notallamaman. glsl is really picky. (or my implementation is). in a for loop, "++i" works, but "i = i + 1" does not.
08:54interferonbut there's nothing in -main except a print statement, and that has already passed
08:57notallamaalso, would anyone here be interested in a clojure wrapper for lwjgl? i'm working on one, and i'll probably put it on github soon. (i'm going a different direction than penumbra. less gpgpu, more game engine)
08:57the-kennynotallama: Sounds cool
08:58the-kennyI would at least try it
08:59notallamai just got a geometry shader running in it. :) i'll probably put it up and make a post later today or tomorrow.
09:01interferonany way to pass in a default value for a param?
09:01interferondo i have to do (def foo ([x] (foo x 0)) ([x y] ...)) ?
09:04jasapptake a look at defnk in clojure.contrib.def
09:05interferon,defnk
09:05clojurebotjava.lang.Exception: Unable to resolve symbol: defnk in this context
09:07jasapp,(require 'clojure.contrib.def)
09:07clojurebotnil
09:07jasapp,defnk
09:07clojurebotjava.lang.Exception: Unable to resolve symbol: defnk in this context
09:08jasappheh
09:08jasapp,clojure.contrib.def/defnk
09:08the-kenny,clojure.contrib.def/defnk
09:08clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.contrib.def/defnk
09:08clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.contrib.def/defnk
09:08jasappit's early, I'm slow this morning :)
09:08lpetit,(doc defnk)
09:08clojurebot"clojure.contrib.def/defnk;[[fn-name & fn-tail]]; Define a function accepting keyword arguments. Symbols up to the first keyword in the parameter list are taken as positional arguments. Then an alternating sequence of keywords and defaults values is expected. The values of the keyword arguments are available in the function body by virtue of the symbol corresponding to the keyword (cf. :keys destructuring). defnk accepts
09:08lpetit~source defnk
09:09lpetitnot so early in France :-p
09:11jasapptrue
09:12lpetitthere has been also a discussion recently (one to two month from today) on the ml concerning a generalization of defnk via something called like (if I remember correctly) let-kw ...
09:14jasappthat'd be interesting
09:14lpetitthere it is: http://groups.google.com/group/clojure/browse_thread/thread/d6b5fa21073541c1/551f6527b31900ca?lnk=gst&amp;q=defnk#551f6527b31900ca
09:14jasappI have to admit, I do miss cl's default arguments
09:16lpetit~lisppaste
09:16clojurebotlisppaste8: url
09:16lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
09:16lisppaste8lpetit pasted "last version of let-kw placed on the ml" at http://paste.lisp.org/display/92353
09:17lpetitmust leave, bye guys
09:17jasappthanks for that link
09:17jasappbye
09:28patrkrisThe documentation for clojure and clojure-contrib found on clojure.org/api is for clojure 1.1? Is there anywhere documentation can be found for just 1.0? I'm just asking out of curiosity.
10:04devlinsf,(transient (sorted-map 1 2 3 4))
10:04clojurebotjava.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be cast to clojure.lang.IEditableCollection
11:13LauJensenMostly for the young: I blogged about 4 simple Rosetta problems as well as the Rosetta project: http://www.bestinclass.dk/index.php/2009/12/rosetta-serving-dish-4/
11:32jasappLauJensen: cool
11:58a_strange_guyclojurebot: paste?
11:58clojurebotlisppaste8, url
11:58lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:59lisppaste8devlinsf pasted "test" at http://paste.lisp.org/display/92355
12:05lisppaste8a_strange_guy pasted "cond-let?" at http://paste.lisp.org/display/92356
12:05a_strange_guyhi everyone
12:05a_strange_guydoes anyone use cond-let from contrib?
12:06devlinsfHmmm... what ns is it in?
12:06a_strange_guyin c.c.cond
12:07a_strange_guyi thought that it works like if-let
12:07a_strange_guywas trying to replace my nested if-lets with it
12:08devlinsfNever use it much
12:08a_strange_guybut it doesn't work as expected, and the docs dont make any sense to me
12:09devlinsfYeah, the docs are opaque
12:10ksmHow do I force a stop in the repl?
12:11devlinsfksm: C-c C-c
12:11devlinsfAt least, that works in SLIME
12:11the-kennydevlinsf: In Emacs, of course
12:11ksmI'm using the vimclojure
12:12devlinsfksm: Enclojure has a "reset REPL" option
12:12devlinsfSorry, can't help :
12:12devlinsf:(
12:14a_strange_guydoes emacs+slime provide a better repl than enclojure?
12:15the-kennya_strange_guy: Emacs + Slime is the nonplusultra for lisp programming.
12:16a_strange_guygotta try emacs for once ^^
12:16devlinsfI love SLIME. The one thing I like about Enclojure better is that it does a better job of handling classpath/build stuff. I wish emacs had support for easy classpath stuff
12:17the-kennydevlinsf: It has: M-x swank-clojure-project
12:17a_strange_guyhow well does slime handle completions?
12:17devlinsfOh?
12:17a_strange_guyclojure aswell as java completions
12:17the-kennydevlinsf: If you have a "default" setup (lib/ src/ and classes/) you can invoke swank-clojure-project on the dir and emacs will start a repl
12:17devlinsfthe-kenny: Could you post a link to docs for that
12:18the-kennydevlinsf: It's perfect if you use leiningen
12:18the-kennyStand By
12:18the-kennydevlinsf: http://github.com/technomancy/swank-clojure "Project Layout"
12:18the-kenny(In the Readme)
12:19devlinsfOkay
12:19the-kennya_strange_guy: Clojure completions are either based on "simple" expansion of buffer contents or based on reflection of the clojure api.
12:20a_strange_guyso it looks up the current vars?
12:20the-kennya_strange_guy: Yes, it detects all the contents of the current namespace.
12:20the-kennya_strange_guy: It also supports fuzzy completion: "skeys" expands to "select-keys"
12:21a_strange_guydoes that also work for java Classes and calls?
12:21a_strange_guyi'm trying to make java scriptable
12:21the-kennyhm.. I'm not sure
12:22the-kennya_strange_guy: Looks like it works for imported classes, but not for their methods
12:23the-kennya_strange_guy: Shouldn't be very hard to implement.. maybe I'll give it a try someday
12:24a_strange_guythe-kenny: do you have any good links for setting up emacs+slime on linux
12:24proppyHi, how do I install package from clojars ?
12:27proppyah got it I should create a skeleton project first
12:27the-kennya_strange_guy: Yeah, the readme. It covers anything clojure-specific. A tutorial for emacs is included in emacs
12:27the-kennyC-h t or so
12:30the-kenny(C-h t means: Hold ctrl, press h, release ctrl and press t
12:30the-kenny+)
12:34alexykchouser: any better idea how built-in sort-by beats a Schwarzian transform?
12:51chouseralexyk: nope. It's a HotSpot Christmas Miracle!
12:52chouserafaict, there's no way as it's written for the java routine that actually does the sorting to know avoid calling the keyfn twice for every comparison
12:53chouserand the way I wrote it, which should do a very fast transform once before and once after a simpler sort doesn't go any faster.
12:53alexykchouser: we'll take such miracles any day, and twice for xmas! :)
12:53chouserI haven't profiled mine. Perhaps I'm doing something dumb that's slowing it down.
12:58jweissif i want to truly treat code as data - let's say i want to generate new fns using an existing fn as a template (but i can't change the original fn). i know there's the "source" fn to use in a macro to get the code of the original fn, but it doesn't work in a repl. is there another way?
12:59devlinsfjweiss: What exactly are you trying to do?
13:00Chousukethe source function is not a reliable way to get the function source
13:00jweissdevlinsf: I want to use existing fns as a template, keeping the original fn as-is (as readable as it was before), and create new "patched" fns from it
13:00Chousukeit's just a quick and dirty repl tool :)
13:00devlinsfAh
13:00jweissChousuke: is there another way?
13:00Chousukeno.
13:01Chousukethe source of a function is not stored anywhere after the function is defined.
13:01Chousukeunless you use a custom macro I guess.
13:01devlinsfIs the "Patch" easy to encapsulate in a fn?
13:01jweissyeah, i realize i could make all my fns macros, but that sounds like a bad idea to me
13:02Chousukeno I mean, a custom macro for defining the fns
13:02the-kennyjweiss: You could create a new macro based on defn: defn-source or so.
13:02Chousukeinstead of defn.
13:02devlinsfTry writing it as a higher order function
13:02jweissoh i see
13:02Chousukebut yeah, I think a higher-order function would be the most idiomatic approach :/
13:02jweissi'm not sure what that means
13:02jweisswrite what as a higher order fn
13:03devlinsfjweiss: can you post your fn & a "patched" version?
13:03jweissok
13:03devlinsfLike, on the group or lisppaste?
13:04jweiss(defn myproc [] (print "a") (print "b")) -> (defn myproc2 [] (println "hello") (print "b"))
13:04devlinsfAh
13:04jweissi just want to replace one of the forms. i'm ok with marking the form somehow
13:04devlinsfDoes your fn have side affects?
13:04jweissdevlinsf: yes
13:04devlinsfAh. I vote for a macro
13:05jweissdevlinsf: how would i do that
13:05Shantanuhi all
13:05jweissthe macro won't have access to the original forms of the fn
13:05devlinsfWell... wait a sec
13:05Shantanucan anybody tell me a Maven2 repo for Clojure 1.1 RC ?
13:06devlinsf,(let [myproc-2 (fn [f] (f "a") (f "b))] (myproc-2 print))
13:06clojurebotEOF while reading string
13:07devlinsf,(let [myproc-2 (fn [f] (f "a") (f "b"))] (myproc-2 print))
13:07clojurebotab
13:07devlinsf,(let [myproc-2 (fn [f] (f "a") (f "b"))] (myproc-2 println))
13:07clojurebota b
13:07devlinsfNotice that myproc-2 takes a fn as an argumet
13:07devlinsfargument
13:08devlinsfThat's called a higher-order fn
13:08jweissdevlinsf: yeah, but that's too simplistic, my real examples won't be using the same arguments either
13:08devlinsfWell, can you post the real deal?
13:09jweissdevlinsf: i'll have to think of an example that clojurebot can evaluate
13:09devlinsfNah, just use lisppaste
13:09jweissbut basically i want to be able to replace (print "b") with ANY form
13:09devlinsfhttp://paste.lisp.org/new/clojure
13:10devlinsfAny form? Hmmm... maybe you want to use clojure.template?
13:10jweissi want a way to tell clojure "this new fn is just like the old one, but replace this form with this one"
13:10devlinsfThat's custom macro teritory
13:10devlinsfAs in (defmacro defmycustom...)
13:12jweisshm templates seems to be somethnig i could make use of
13:12Shantanu(Repeat question) Can anybody tell me a Maven2 repo for Clojure 1.1 RC ?
13:15devlinsfShantanu: Here's Rich's post
13:15devlinsfhttp://groups.google.com/group/clojure/browse_thread/thread/24b9745199afbd89#
13:15devlinsfShantanu: No mention of maven, though :(
13:16Shantanudevlinsf: Thanks, i guess i would use a local copy for a while until 1.1 arrives in th Maven repo
13:17devlinsfShantanu: Yeah, sorry. Mention this on the group. I know Rich is interrested in having Maven work
13:17Shantanudevlinsf: I was expecting clojars.org to have it at least, but no luck there :-(
13:18Shantanudevlinsf: I will
13:19devlinsfjweiss: If clojure.template solves you problem, could you post your experience to the list?
13:20jweissdevlinsf: well, it won't solve the problem by itself, that's for sure. biggest hurdle right now is keeping the source of the original fn somewhere as data. which Chousuke pointed out i might do with a customized defn-like macro
13:20the-kenny4Isn't the one from build.clojure.org usable in maven?
13:21jweissbut it would be nice if the language did this for me
13:21jweissi guess it's pretty rare that someone would want that
13:22devlinsfjweiss: Do you really need to keep the source? Could you provide a list of symbols & custom forms, and def everything at once?
13:22jweissdevlinsf: i probably could, i'm just worried the resulting code would be pretty unreadable.
13:23devlinsfThat's where the template comes in... hmmmm...
13:24the-kennyMaybe a (binding) is possible to
13:24the-kennySomething like a macro which does bindings according to some table where the changed symbols are kept
13:25abedrais there an easy way to make the return of a function into a regex pattern?
13:26abedrae.g i have a function "delimiter" that decides what a string delimiter is
13:26the-kennyabedra: (re-pattern your-string)
13:26abedraand i want to take the return of that and just call re-split (delimiter foo)
13:27abedrathanks
13:27abedrai think that will do it
13:32devlinsfjweiss: You totally want clojure.template :)
13:34devlinsfjweiss: Check this out http://gist.github.com/260186
15:06devlinsfchouser: ping
15:07chouserdevlinsf: hi
15:07devlinsfchouser: Just saw your comment
15:08devlinsfchouser: I used the exact same filename. Was that bad form?
15:08chouserhm... I thought I checked for that.
15:08devlinsfchouser: lemme check too
15:09devlinsfchouser: Yeah, the file is attached to the ticket.
15:09devlinsfchouser: It has the changes in it.
15:10chouserohhh, I see.
15:11chouseryou've got the previous patch in there too, adding the 2-arg withMeta, and then removing it again.
15:12devlinsfYeah
15:12devlinsfIs that a problem
15:12devlinsf?
15:15devlinsfchouser: I did everything in the same branch. Still learning git
15:15chouserwell, it's probably less good.
15:16chousersame branch is a matter of personal preference. The generated patch is fine either way.
15:17devlinsfokay. I'll keep that in mind next time
15:17chouserI should say, rhickey hasn't provided firm direction on most of this, so all I can give is my own opinion.
15:17chouserI'd genereally try to keep the diff itself as small as possible -- less for people to review.
15:18chouserso deleting unreleated commented-code, for example, I'd generally avoid.
15:19devlinsfRight, I can see that
15:19chouserand including code in one commit that's deleted in the next, all in one patch, can also be confusing.
15:20chouserYour fix, in the end, is just replacing two lines and adding some tests. It'd be nice if that's all that shows up in the diff.
15:21devlinsfRight.
15:21devlinsfResubmit or leave it?
15:21chouserI can do it if you don't want to.
15:22devlinsfOnly if it's quick. Don't want to eat up too much of your time on this issue
15:23chousersure, I'll do it.
15:23Chousukesquashing commits is pretty easy with git.
15:24devlinsfCool
15:26chouseroh, shoot, I should have included your tests.
15:27devlinsfchouser: What about the java comments I added above empty?
15:27devlinsfDo they make the next guy's job easier?
15:31chousergood question
15:31devlinsfI don't follow Rich's style here (because that was causing the bug)
15:33chouserwhat do you mean?
15:33devlinsfWell, Rich uses a static field EMPTY to generate empty each time
15:34chouseroh, right. but avoiding the use of EMPTY is used elsewhere in that same file for the same reason.
15:34devlinsfHe calls EMPTY.withMeta(meta())
15:35devlinsfNot always. Look at create(items)
15:36devlinsfAnyway, this departs from the way things are done in the rest of Clojure
15:36devlinsfHence, the /** java commets*/ Are probably a good idea. Javadoc will pick those up, too.
15:37devlinsfThat's what I was thinking when I put them in.
15:39hiredmanwithMeta :(
15:43chouserdevlinsf: Sometimes it's appropriate for comments to describe an alternate way something could be implemented and explain why it isn't, but I think those cases are pretty rare.
15:43chouserhiredman: what's wrong with withMeta?
15:44devlinsfchouser: Okay, cool. I guess the tests will prevent regression, so this should be fine.
15:44hiredmanit replaces the map with another map, which leads to multiple functions that muck with metadata stepping on each other's feet
15:45devlinsfmetdata is persistent
15:45devlinsfhiredman: I had your reaction initially
15:46hiredmanfor example, zippers store stuff in metadata
15:46hiredman(-> some-zipper some-function-which-naively-uses-withmeta zip/node) ;*BOOM*
15:47hiredmanbetter to use vary-meta or similar where possible
15:48devlinsfhiredman: can you reproduce the bug?
15:48hiredman,(use 'clojure.zip)
15:48clojurebotjava.lang.IllegalStateException: next already refers to: #'clojure.core/next in namespace: sandbox
15:48hiredman,(require '[clojure.zip :as zip])
15:48clojurebotnil
15:49hiredman,(-> '(1 2 3) zip/seq-zip)
15:49clojurebot[(1 2 3) nil]
15:49hiredman,(-> '(1 2 3) zip/seq-zip (with-meta {}) zip/node)
15:49clojurebot(1 2 3)
15:49hiredmangah
15:49hiredman,(-> '(1 2 3) zip/seq-zip meta)
15:49clojurebot{:zip/branch? #<core$seq_QMARK___4482 clojure.core$seq_QMARK___4482@1b53c44>, :zip/children #<core$identity__4959 clojure.core$identity__4959@1cf287e>, :zip/make-node #<zip$seq_zip__8135$fn__8137 clojure.zip$seq_zip__8135$fn__8137@7173bf>}
15:50hiredman,(-> '(1 2 3) zip/seq-zip zip/down meta)
15:50clojurebot{:zip/branch? #<core$seq_QMARK___4482 clojure.core$seq_QMARK___4482@1b53c44>, :zip/children #<core$identity__4959 clojure.core$identity__4959@1cf287e>, :zip/make-node #<zip$seq_zip__8135$fn__8137 clojure.zip$seq_zip__8135$fn__8137@1808c77>}
15:51hiredmangah
15:51hiredmanok, zippers don't work exactly like I thought
15:51hiredmanbut the metadata thing is still an issue
15:52chouservary-meta is build on withMeta()
15:52slashus2Is there a good tutorial on using zippers? The only ones I see are in Haskell.
15:52hiredmanchouser: sure
15:53hiredmanI'm not saying withmeta is horrible, I am saying using it without regard for what metadata might already exist is bad
15:53chouseryes, true.
15:54chouserbrb
16:18the-kennyIf I use swap on an atom, is the supplied function f retried when another thread has changed the value?
16:18the-kenny*value of the atom
16:22Chousukethe operation is atomic, so yes.
17:17radsanyone know why when I do `lein swank` I get "Could not find clojure.main. Make sure you have it in your classpath"?
17:18the-kennyrads: Try running lein deps first
17:22radsthe-kenny
17:22radser, that worked, thanks
17:22the-kennyYou're welcome
17:26radswhen I do M-x slime-connect it seems to connect fine, but no REPL pops up
17:50the-kennyInteresting blog post about tail call optimization in the jvm: http://weblogs.java.net/blog/forax/archive/2009/12/18/tailcall-anyone
17:52hiredmanI can't figure out how to emit the wide bytecode withe the asm lib bundled with cojure
17:52alexykliebke: ping
17:53liebkealexyk: hey
17:53alexykcouple questions: if I want to contribute, e.g. the clustered scatter-plot, where should I add it in a fork?
17:53alexykor, rather, preprocessing of xy's to compressed xy's
17:54liebkeah, good question
17:55liebkewhat about transformations
17:55alexykok
17:55alexykat top level?
17:55liebkeyeah
17:56alexykso, src/main/clojure/incanter/transformations.clj?
17:56liebkeyep
17:57alexykok. Another problem: when I chart from remote server via X, (use '[incanter ...]) inits the local X on my MacBook. From that moment on, if MBP goes to sleep, that kills remote X server and the clojure repl, with gigs of painfully loaded data.
17:58liebkehmmm
17:58alexykSo I'm stuffing it all back into Mongo, thank G-d for that. But is there a way to unload incanter after plotting, or disconnect from X, or something?
17:59liebkegood question, but I don't have an answer
17:59the-kennyhm.. I will give mongodb a try
17:59liebkeif you figure out a fix, let me know
18:00alexykI tunnel X via ssh -X or ssh -Y. In general, I think it's a common setup for data mining on big boxes remotely, so would be good to find a way to be able to suspend clients without killing servers.
18:00the-kennyFast: Best mongodb-lib for clojure
18:00alexykthe-kenny: congomongo
18:00liebkeyeah, I use ssh -X myself
18:01alexykliebke: did you experience this server quitting?
18:01liebkeI haven't run into the problem yet, but it doesn't mean I won't
18:03hiredmanthe issue is really with the X protocol, your best bet is just not to let your laptop go to sleep
18:04Anniepooquestion for all - I'm needing to do a fuzzy word match. Anybody here with any experience with such?
18:04hiredmanyou might try using some kind of vnc instead of tunneling x11
18:04hiredmanx2vnc or something
18:05liebkehiredman: hmm, interesting idea. I guess it's good to know about this problem with x11
18:07thearthurwhats the functions to return true if any member of a collection matches a predicate?
18:07hiredmanputting the laptop to sleep will kill the X connection, and the x archtecture makes it not, uh, "restartable"
18:07hiredmansome
18:09thearthurhiredman, thanks, had my brain stuck on any?
18:10gravityThere are programs that will act as the equivalent of "screen" for X11. I don't know if they'll work for OSX though, but it's worth a look
18:10hiredmanreally? I guess I shouldn't be surprised
18:10liebkegravity: thanks, I'll have to look for one
18:11gravityhttp://www.insanelymac.com/forum/index.php?showtopic=80076 lists mac-specific options (xmove)
18:12alexykhiredman: interesting
18:12liebkegravity: cool thanks
18:12gravitynp
18:27the-kennymh.. congomongo looks so... big and ugly compared to clojure-couchdb
18:34jasappthe-kenny: how so?
18:35qedhttp://blog.labnotes.org/2009/12/19/all-your-maven-are-belong-to-us/
18:35qedinteresting stuff
18:35jasappI've been using congomongo, but haven't used couchdb at all
18:36the-kennyjasapp: I think it's because the interface to couchdb is much simpler (just http).
18:37jasappahh
18:38somniumwriting BSON encoders for tcp/ip is definitely a PITA
18:39the-kennyOh sorry somnium, I didn't want to decry your work.
18:39somniumthe-kenny: *shrug* Ive been wrapping the java driver
18:40jasappdid you have any ideas on doing the map reduce stuff, or the sorting?
18:40jasappsomnium, for congomongo?
18:40jasappI've got some time over the next few weeks, and I wouldn't mind hacking on it some.
18:40somniumjasapp: yes, the biggest obstacle is the java driver
18:41jasappI guess I haven't looked at the java part too closely
18:41jasappwhat's limiting?
18:41somniumjasapp: the encoding, its in Bytes or one of the subclasses
18:42somniumah, for map-reduce etc, its mostly there in the java driver
18:43jasappis there anyway to write map reduce functions in clojure, instead of js?
18:43jasappshort of using the clojure to js translator
18:44somniumjasapp: have to gen js somehow
18:44the-kennythere are two clojure -> js libs I'm aware of
18:45somniumIm working on one with basic support for TCO and clojureish semantics
18:45jasappcool
18:46somniummaybe just alter the prototype for array and object to support seq could work
18:47somniumbut clojure encoders would mean sorted-maps, hash-sets, whatever could be stored in mongo with great performance
18:48jasappif there is anything I can help with, please let me know
18:48somniumjasapp: if working on a tcp/ip BSON client sounds like a fun project... (hint hint)
18:48jasapphmm, I might be interested in tackling that
18:49jasappso you avoid using the java drivers completely?
18:50somniumyeah, the main issue is performance
18:51somniumbut right now some work is being repeated, so deftype based clojure encoders should be equivalent if not faster
18:52jasappI'll take a look at bson and see if it's something I can handle
18:53somniumits bit twiddling the byte buffers where Im mostly clueless
18:53jasappsomeone mentioned on here the other day that clojure was particularly slow when it cames to bits
18:54jasappI think that's maybe fixed in 1.1 though
18:55somniumhopefully byte arrays are pretty fast
18:56somniumthe driver uses os-streams through java.nio
19:03_atojasapp: bit-twiddling and arithmatic in Clojure should be no slower than Java as long as you are careful about it and use appropriate casts to avoid boxing.
19:04jasapp_ato: thanks for the info
19:04jasappI wish I could remember who said that, and what exactly they said
19:04jasappdoes clojurebot keep a log?
19:05the-kennyjasapp: Yes
19:05somniummaybe the bit-shift operators?
19:05the-kennyclojurebot: logs
19:05clojurebotlogs is http://clojure-log.n01se.net/
19:05_atoit could be because the bit-shift operators are java function ca
19:05_atolls
19:05_atobut I would have thought hotspot would inline them anyway
19:08somniumhmm, bit-and calls out to clojure.lang.Numbers, do they get boxed on the way?
19:08_ato~def bit-shift-right
19:08_atohmm
19:08_atoyou're right
19:08_atothat's worrying
19:08_atosince they're wrapped in Clojure functions without inlines that's going to be forcing boxing
19:09somniumjasapp: the encoders just need to bash on ByteBuffers, no actual bit-twiddling needed
19:10jasappalright
19:10_atobit-not, bit-or etc have inlines, just looks like set, test and shifts are missing them
19:11somniumive only ever used bit-twiddling on euler problems :/
19:11hbockhas anyone attempted to run clojure on an embedded JVM, e.g., Squawk?
19:12the-kennyhbock: I've not.. but I would like to see it running on the lejos-jvm :)
19:12hiredmana lot of that stuff doesn't use "modern" jvms
19:13hiredmane.g. 1.5 or later
19:13hbockthe-kenny: interesting.
19:13_atohbock: it works in jamvm, it's kind of slow though
19:13hiredmansquawk is j2me which is 1.4
19:13hiredmanso no dice
19:13hbock:(
19:13hbockdamn.
19:13hbockFIRST robotics is using the Squawk JVM
19:14hbockwe were hoping to get clojure running on our bot.
19:15hiredmanhbock: I could be wrong, there might be some kind of j2me that is 1.5+
19:15hiredman(not as far as I can tell though)
19:16hiredman~maxine
19:16clojurebotTitim gan éirí ort.
19:16hiredmanclojurebot: maxine is http://research.sun.com/projects/maxine/
19:16clojurebotRoger.
19:19notallamaso, would it count as writing a jvm in java if you wrote it in clojure?
19:21hiredmanI'm not sure if maxine does a bytecode transform or a transform over source (to get the native bits)
19:22hiredmanmaybe asm could be reworked to emit some special bytecodes
19:22hbockhmm. newbie question: does paredit work without modification with clojure?
19:22somniumdoes hotspot completely rewrite the output from javac?
19:23hiredmansomnium: eh?
19:24somniumI watched a talk a while back, and the gist I got was that hotspot undoes all of javac's optimizations and completely reoptimizes at runtime
19:25hbockahh. looks like there's a clojure-paredit.el
19:26hiredmansomnium: hotspot generally is about generating native code from bytecode
19:27somniumhiredman: it was yegge bashing on java/c++ I think, so some of it might have been hyperbole I guess
19:27hiredmanit might not be
19:28hiredmanbut hotspot watches for hotspots and kicks in, so you have to do x executions before it kicks in
19:29hiredmanx is generally on the order of 1000, I hear
19:29chousersomnium: I'm under the same impression, that hotspot decompiles what javac produces and then does its own optimizations.
19:29somniumhttp://www.youtube.com/watch?v=tz-Bb-D6teE
19:29hiredmanso for the first 1000 you have only what javac gave you
19:30somniumit does make Foo foo = ((Foo)Foomaker.MakeFoo()) seem particularly silly
19:32hiredmanthat is purely a compiler issue
19:33hiredmanwhile the bytecode is typed and you do casts and such, the compiler could be smarter and do inference, etc
19:35lopexjavac doesnt do any optimizations
19:35lopexexcept for very obvious ones, like constant propagation for static finals
19:48interferondo lazy sequences do any kind of caching? if i evaluate the first 10 elements of a lazy sequence and then later ask for the first 20, will the first 10 be computed again?
19:48somniuminterferon: if its the same lazy-seq it will be cached
19:49somnium,(doc lazy-seq)
19:49clojurebot"([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls."
19:49interferongreat. thanks.
19:58alexykhow do you refer to the whole pattern, e.g. fn [[k v]] -- how do you get [k v] back too?
19:59somnium,(let [[k v :as all] [1 2]] (list k v all))
19:59clojurebot(1 2 [1 2])
20:00alexykah
20:43xochipil1ifffffffffffffffffffffffff
20:43xochipil1iwtf
21:06alexyksomnium: can mongo do merges?
21:14somniumalexyk: like (merge {:a :b} {:c :d}) ?
21:14alexykyeah, inside mongo
21:14alexykbefore returning
21:15alexykI have two big collections, same keys
21:15alexyk:user
21:15somniumalexyk: I dont know :/
21:16somniumtry #mongodb?
21:16alexyksomnium: I have a sense it might... will ask mongo ppl
21:16alexykyeah
21:17somniummy actual use of mongo so far has just been as a read-only fact-table
21:19somnium /join #mongodb
21:19somnium\join mongodb
21:19somniumsry
21:21alexyk,(count (second (first [[:a [1 2 3]] [:b [4 5]]]))) ; how do I use comp to get rid of some ()s?
21:21clojurebot3
21:22chouser,(->> [[:a [1 2 3]] [:b [4 5]]] first second count)
21:22clojurebot3
21:23chouser,((comp count second first) [[:a [1 2 3]] [:b [4 5]]])
21:23clojurebot3
21:23alexykchouser: cool. But is comp applicable here too?
21:23alexykah yes
21:24chouser:-)
21:24hiredman:)
21:24somnium♥ ->>
21:43devlinsfquick git question
21:43devlinsfhow do I "forget" all the changes since my last commit
21:45dnolendevlinsf: git reset --hard HEAD^
21:46dnolenremove --hard if you don't want to blow away the index
21:46tolstoygit --reset --har..... ah, yeah.
21:47devlinsfWorks, thanks!