#clojure logs

2009-04-29

00:02kadaver?
00:03hiredmanwell, find the code that is generating the exception
00:05kadaveryeah uh
00:07hiredmanare you using the latest contrib?
00:08kadaver_clojure.lang.Repl")
00:08kadaver_that suspect
00:08hiredmannope
00:08kadaver_that namespace doesnt exist anymore?
00:08hiredmanthat is not a namespace
00:08hiredmanthat is a java class
00:09kadaver_oh well
00:09hiredman(and it does still exist)
00:10kadaver_well
00:10kadaver_i can start the prompt so was stupd
00:11hiredmanare you using the latest contrib?
00:11hiredman(if you say "yes", I am going to ask you to prove it)
00:14kadaver_fakk i think it is because i deleted my user.clj
00:14kadaver_because i cant find it
00:14hiredmanI doubt it
00:14hiredmanare you using the latest contrib?
00:14kadaver_yes
00:15hiredmanare you sure?
00:16hiredmanare you sure?
00:16kadaveri cloned from github
00:16kadaverabout 1 hour ago
00:16hiredmanwrong answer
00:17hiredman~contrib
00:17clojurebotcontrib is http://code.google.com/p/clojure-contrib/
00:17hiredman^-- not github
00:17kadaverno downloads there
00:18hiredman...
00:18hiredmanok
00:18replacahiredman: github is usually pretty up-to-date
00:18hiredmanhttp://code.google.com/p/clojure-contrib/source/checkout
00:19kadaversvn
00:20replacakadaver: the version you cloned from github should be fine
00:21replacakadaver: you may need to do an "ant clean" as part of your build, if you have built before
00:22kadaverclean?
00:22replacaafaik there is no pre-built version of contrib
00:22kadavereven the buildsystemhas unwanted side-effects?
00:23replacakadaver: sometimes build state get stuck on both clojure and clojure-contrib - not sure why
00:23chessguy,(map vector [1 2] [3 4] [5 6])
00:23clojurebot([1 3 5] [2 4 6])
00:38kadaverfakk
00:38kadaverit has broken everything
00:38kadaverwhat version is clojure now?
00:39hiredman~latest
00:39clojurebotlatest is 1359
00:40hiredman~latest contrib
00:40hiredmanhaha
00:40hiredmanthrows an exception
00:49unlink2heh
00:50hiredman~todo
00:50clojurebottodo is not what you think it is
00:50hiredman~todo is http://clojure.org/todo
00:50clojurebotIk begrijp
01:08Carkwhat's an application server ? JBoss for instance ...what is that used for ?
01:09Carkhum nevermind
04:45AWizzArdMoin
04:50Carkgood morning AWizzArd
05:01jdz_is there already functionality to convert Java Hashtable to a map?
05:12stuhoodjdz: not without copying the whole thing, but if you don't mind that, you can use (into {} old-hash-map)
05:13stuhood,(into {} (doto (new java.util.HashMap) (.put 1 "1") (.put 2 "2")))
05:13clojurebot{2 "2", 1 "1"}
05:13jdzok, thanks
05:54Lau_of_DK(map #(vector % (Math/abs (- % 150))) *comp-types*)
05:54Lau_of_DK([110 40] [120 30] [130 20] [140 10] [150 0] [160 10] [190 40] [510 360])
05:54Lau_of_DKIs there an idiomatic oneliner kinda of a way, to get that vector which has the lowest (second) ?
05:54Lau_of_DKThinking out loud (apply min (map second ...)) - which ofc doesnt work, because it doesnt give me the (first)
05:56ChousukeI think there's a min-by or something in contrib
05:57djpowellRe: utf-8, it looks to me that clojure should be specifying utf-8 for loading clojure files, but it should be using the platform default encoding for *in* *out* and *err*. so it is just those constants that need fixing.
05:58djpowellif you actually want utf-8 for output - eg to write to a file - then you can just rebind *out* yourself
05:59ChousukeLau_of_DK: (reduce (fn [x y] (if (< (second x) (second y)) x y)) coll)
06:16Lau_of_DKThanks Chou
06:30unlink1danlarkin: ping
07:37AWizzArdHi rhickey
07:37rhickeyhey
07:38AWizzArdI have a question: nearly every day I see you coming online around this time. You join the channel, stay a few moments and leave again. Some time later you come back and stay. Is that just a check to see if the channel is still there? ;)
07:39rhickeyI have a bunch of machines and places where I work, so I go in and out when switching
07:41AWizzArdI see
07:44AWizzArdIs there a way to decide what test function to use for hashtable lookups? For example, I insert the key "AbC" but want to look up (and find) "abc". (make-hash-table :test #(.equalsIgnoreCase %1 %2) ...)
07:46rhickeyAWizzArd: no, equality test and hash fn must go together, and are not pluggable
07:47AWizzArdOkay
07:49AWizzArdSo if my keys are strings I should maybe convert them to lowercase before inserting them, and also convert user input to lowercase before doing a lookup.
07:49rhickeyor use a sorted-map with a compare fn
07:51AWizzArdAh, sorted-map-by would allow me to use equalsIgnoreCase then it seems.
07:52rhickeyright
07:52AWizzArdgood good, that was what I was looking for
07:52AWizzArdBtw, is there a way to print macro expansions without the namespace qualifiers, for easier readability during debugging?
07:54rhickeymaybe pprint has an option?
07:56AWizzArdgood idea, it has *print-suppress-namespaces*
08:04AWizzArdIs it possible to have the JVM automatically use swap space on its host if needed (vs. throw an Out of Memory exception)?
08:05mccraigAWizzArd: -Xmx switch specifies max heap size... make that as big as u like [ on a 64-bit machine ]
08:21AWizzArdmccraig: sounds good
09:12AWizzArdhttp://github.com/schacon/hg-git/tree/master
09:15danlarkinunlink1: pong
09:16unlink1danlarkin: I was wondering about the design decision of using a custom template engine in Madison.
09:16unlink1I feel that one of the greatest strengths of clojure on the web is how natural it is to make an HTML-outputting DSL in clojure.
09:18danlarkinit becomes very hard to separate the presentation layer from the logic layer when you're using HTML-outputting code
09:19unlink1You can simply not perform application logic in the template.
09:19unlink1The sequence constructs in clojure are just too good to pass up when outputting HTML.
09:20unlink1And first class functions make an excellent macro facility.
09:20unlink1All for free.
09:20chessguy_work'morning
09:22chessguy_worki gotta say, i keep digging just a little bit deeper into clojure, and it keeps impressing me. i haven't had this many 'aha' moments since learning haskell
09:23danlarkinwell you're free to just not use the templating engine and instead use whatever html generation method you like, of course
09:23chessguy_workthough i probably shouldn't have stayed up until 1:30 am this morning watching the clojure for java programmers screencast
09:23danlarkinbut I think writing html-generating code is a big long-term maintainability mistake
09:24unlink1I've maintained and extended django(/jinja)-style templates for awhile. I think the fundamental idea is very flawed.
09:26unlink1I'm not saying a lisp DSL is the antidote; I haven't even built a large application with one yet. It simply seems to address my concerns based on my limited experience iwth compojure's.
09:28danlarkinwe've built several large sites with django templates and while of course we have out complaints (why isn't this easier, why do I have to jump through hoops to do that) I think it's better than any of the alternatives
09:28unlink1Well, I find jnija templates to be a VAST improvement over django, at least.
09:29tWipwell most templates are code, in one sense or another... and it's not nearly as nice to code in than Clojure
09:30danlarkinI should get around to trying jinja, then...
09:30tWipI'd much rather write Clojure code than HTML+some special markup
09:30unlink1Macros and real function calls are the killer features.
09:31unlink1Actual expressions would be a close 3rd.
09:31unlink1My current project uses neither include nor extends.
09:32tWipyeah, you write the functions and macros that speak your specific UI needs... and you don't need to work directly with HTML tags
09:32danlarkinI feel like it's walking the path down to spaghetti code
09:32unlink1You just have to be careful.
09:32tWipmy experience with templating systems is that that leads to spaghetti (JSP being the most horrible one)
09:33unlink1If you're doing something like myobj.related.filter(foo="bar").order_by("bat"), then you are probably doing something wrong.
09:34tWipbut in any case, you do need to be clear about separating concerns... whatever the approach
09:34unlink1Yes.
09:35unlink1danlarkin: If you do make the switch, be sure to check out http://bitbucket.org/trevor/chouwa/ -- make the transition much smoother.
09:36danlarkinyes, and at the very least you can always just call an html-generating function at the end of your normal madison view function, instead of the render-to-response to use the templating engine I wrote
09:36unlink1yeah
09:47danlarkinunlink1: I'm glad you even took the time to look at madison though :)
09:47unlink1I'm glad I saw it, I was about to do the same thing.
09:48danlarkinhaha
09:48danlarkinoh good, then you can help!
09:48unlink1definitely
09:48unlink1be careful, I'm very opinionated about how web frameworks should work O:-)
09:49danlarkinit's a little rough around the edges, and missing some of the really helpful parts of django
09:49unlink1I have been thinking about how forms should be done a lot lately. Havne't seen how you do it in Madison, but it sucks in django about 60% of the time.
09:50danlarkinI haven't done any forms or models yet
09:51danlarkinI know what you mean though
09:52danlarkinwell I know forms and models wont' be working /exactly/ like in django, because of the statefullness on the django side
09:53danlarkinit would be nice to have them work in a more functional way... perhaps monoids... I don't know
09:55unlink1yeah
09:55unlink1Well it's something to think about.
09:55unlink1Um, and yeah, ORM, uhh
09:55chessguy_work,(first [1,2,3])
09:55clojurebot1
09:56chessguy_work,(seq? [1,2,3])
09:56clojurebotfalse
09:57unlink1http://trevor.caira.com/scripts/clojuredoc
10:05chessguy_work,(conj 1 "abc")
10:05clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentCollection
10:05chessguy_work,(cons 1 "abc")
10:05clojurebot(1 \a \b \c)
11:22grzmi'm attempting to get emacs, slime, and clojure all working happily together.
11:23grzmI'm currently getting a "clojure.congrib.javadoc/javadoc can now be found in clojure.contrib.repl-utils." exception thrown when slime is loading.
11:24grzmI'm having a hard time figuring out what is trying to load clojure/contrib/javadoc.clj.
11:25grzmcheckouts fresh this morning
11:25grzmany pointers would be appreciated
11:38stuartsierragrzm: do you have a user.clj file trying to load clojure.contrib.javadoc?
11:39grzmstuartsierra: that is exactly it. thank you thank you thank you
11:39grzmslime loads just fine now :)
11:47stuartsierragrzm: you're welcome
12:02cemerickgah, I keep typing namespace/:keyword instead of :namespace/keyword :-/
12:43unlinkSo, compiling classes you run with "java" seems pretty well documented. What I'd like to do is create static methods on a Java class. Is this something that's possible to do with Clojure?
12:53arohnerunlink: I think so
12:54cemerickunlink: see http://clojure.org/API#gen-class, under :methods
12:55cemerickcan't expand on that a.t.m., trying to do real work :-)
12:55arohnerStatic methods can be specified with #^{:static true} in the
12:55arohner signature's metadata.
13:24kadaverto upper and to lower?
13:27dliebke,(.toUpperCase "hello")
13:27clojurebot"HELLO"
13:27dliebke,(.toLowerCase "HELLO")
13:27clojurebot"hello"
13:27Raynes,(.toUpper "Hello")
13:27clojurebotjava.lang.IllegalArgumentException: No matching field found: toUpper for class java.lang.String
13:28RaynesI could have swore that worked.
13:29replacaRaynes: no, that wouldn't be verbose enough for Java :-)
13:31kadaverwhen i try to C-c C-l in emacs clojure-mode it loads the interpreter but I get: java.lang.Exception: No such namespace: clojure (NO_SOURCE_FILE:37)
13:31kadaverpretty useless error message
13:31kadaveri can C-x e a function to the interpreter but not load a file
13:39technomancykadaver: what's your classpath look like?
13:40technomancykadaver: also: do you get the same problem with C-c C-k?
14:13kadaverC-c C-k is undefined
14:13kadaverhttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=4404#a4404
14:13kadavermy .emacs clojure-part
14:17technomancykadaver: I've never seen slime configured like that. did you try using M-x clojure-install?
14:17technomancythat's the simplest way to get it working
14:19technomancywhich begs the question: how can we make it clearer to newcomers that they shouldn't be manually configuring slime?
14:19technomancyclojurebot: slime?
14:19clojurebotslime is icky
14:20technomancyclojurebot: slime is best configured using M-x clojure-install once you have clojure-mode installed. Please *don't* configure it manually unless you know what you're doing.
14:20clojurebotc'est bon!
14:20kadaverclojure-mode not slime
14:21kadaverim not a newcomer but i havent used cllojure for a while, i wrote an mp3player in clojure and now i wanted to update it,use a database and reinstalling broke everything :(
14:21Chouserreinstalling what?
14:22kotarakclojurebot: slime is also icky
14:22clojurebotIn Ordnung
14:22kotarakhiredman gets angry when overwriting factoids...
14:24kadaverreinstall clojure and clojure-contrib
14:27technomancykotarak: heh, yeah. I didn't realize he had added "is also"
14:28technomancykadaver: I meant newcomers to slime.
14:40kadaverso whats up with the clojure-namespace, i mean what could have caused this?
14:40technomancyprobably the classpath isn't set up right
14:45kadaverbut was their anything wrong in the path i posted?
14:46technomancydepends on where you installed things
14:47technomancybut in general constructing your own inferior-lisp-program value is much more error-prone than having swank-clojure create it for you
14:49kadavershould the javapath not be in there anymore?
14:49kadaverjava -cp clojure.jar clojure.lang.Repl
14:49kadaversays the website now that worked
14:54kadaverbut i still cant C-c C-l
14:55technomancywhy are you configuring it by hand?
14:56kadaveri never liked slime
14:56kadaveri want clojure-mode
14:57technomancyoh, you're not using slime at all? hmm, then I have no idea if that will work.
14:57kadaverwhere is that package with slime?
14:57kadaverforgot hwta its called
14:57technomancyswank-clojure?
14:57kadaverits a bundle of slime+emacs+clojure+contrib(i think)
14:58kadavermaybe
14:58technomancyoh, maybe you're thinking of ClojureBox?
15:00kadaveryes
15:08kadavergoing with that let's see
15:11kadaverdoesnt clojruebox come with syntaxhighlithing?
15:11kadaverand how do i fire upt he repl?
15:18kadaverFile error: Cannot open load file, clojure-auto
15:19kadaverok shouldnt that come with clojure-box?
15:46kadaverso anyone using clojure-box?
15:56kadaveranyoe know what clojure-auto is?
15:56kadaveri give up
15:56kadaveri rewrite the whole crap in haskell instead
15:56kadaver will be better anyway
15:57hoeckkadaver: no, don't!
15:58hoeckI believe clojure-auto was part of clojure-mode.el, but is now obsolete
15:59kadaverso why does clojure-box ask for it?
15:59hoeckgood question
16:00kadaveri put it in there now anyway and still doesnt find it
16:00hoeckit must be on emacs' load-path
16:00hoeckclojurebox is a windows.exe?
16:01hoeckkadaver: where did you download it?
16:01kadaverhttp://clojure.bighugh.com/
16:01kadaveryes an exe
16:04cemerickis there not a subset? predicate floating around somewhere?
16:05dnolenquestion is there something in contrib that deals with regex matches? dealing with java.util.regex.Pattern is less than satisfactory.
16:05cemerickah, clojure.contrib.set/subset
16:07arohnerdnolen: there is some stuff in core, and some stuff in contrib.str-utils
16:07arohnerdnolen: (find-doc "re-")
16:08dnolengreat thanks! :)
16:08hoeckdnolen: especially re-seq
16:08hoeck
16:08dnolenI always forget about (find-doc ...)
16:09arohner(find-doc "regex") is probably a better search
16:11kadaver==>>
16:11arohnerI use find doc to find functions I wrote :-)
16:11hoeckkadaver: just downloaded the latest clojurebox here, and it installs & runs without any problems
16:12kadaverwindows vista?
16:13kadaverClojure Box 20090320, published April 8, 2009, built with the official Clojure 20090320 release. ?
16:13hoeckno, tablet xp, latest release, yes
16:17hoeckkadaver: maybe the clojurebox installed emacs is looking at your old emacs' init.el ???
16:18kadaveryeah not ven my current one but some old bastard file i found it now
16:18technomancycemerick: it's really easy to get slime set up, it's just that for some reason folks insist on doing it the hard way.
16:19cemericktechnomancy: emacs is the hard way IMVHO, but we're *deep* in personal preference now :-)
16:20technomancycemerick: well kadaver is on Windows too, so that's the double-hard way.
16:21cemerickouch.
16:22kadaverwell how do you compile your program i you dont use an editor?
16:22kadaveri have namespaces and alls etup and just really need to run compile to generate the player
16:23hoecktechnomancy: not really, it was so with slime an opensource-cl's, but with clojure its just java and emacs-lisp, both very portable
16:23cemerickkadaver: I use netbeans + enclojure with very good results. There's intellij and eclipse clojure environments as well.
16:24technomancyhoeck: in theory, sure. but it's harder to find others who can help with your questions.
16:24kotarakkadaver: java -cp clojure.jar:src:classes clojure.lang.Compile my.fance.namespace
16:25technomancybtw; anyone want to code-review my patch? http://code.google.com/p/clojure/issues/detail?id=13
16:26kotarakkadaver: and there's VimClojure for Vim (for completeness sake)
16:26kadaverwhich version is clojure now? would be ncie if it stabilized
16:26kotarak1.0 to come soon, it seems.
16:33cadshey, I've got a collection of particles in n-dimensional space, and I want to keep a list of each particle's 3 closest neighbors. What's a good way to accelerate that computation and speed recalculation after incremental updates to the particles?
16:35kadaverkd-tree?
16:37kadaveruser=> (load-file "C:/clojure/progs/mp3player/mp3player.clj")
16:37kadaverjava.lang.ClassNotFoundException: net.miginfocom.swing.MigLayout (miglayout.clj:
16:37kadaver0)
16:38kadaverah wait
16:39cadshey, in contrib I see something about a type system with algebraic types
16:39cadsis that usable?
16:41kadaverhttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=4408#a4408 <- any ideas why that could be? layout is a function I defined and it IS there...
16:45Chousukekadaver: C:/clojure/ is not in the classpath? :)
16:46hoeckkadaver: this is referring to an anonymous function inside layout, namely fn__451
16:48kadaverokidoki but it is compiling that gives the error
16:48kadaver(binding [*compile-path* "C:\\clojure\\classes"]
16:48kadaver (compile 'progs.mp3player.mp3player))
16:48kadaverthat part
16:48kadaverjust running main and it works
16:49stuhoodkadaver: as Chousuke said, you need C:/clojure/ on your classpath
16:50cemerickdoes anyone have any pointers to some discussion on idiomatic multimethod usage? (a group thread or somesuch?).
16:50hoeckbut isn't . always on the classpath?
16:50kotarakkadaver: you need the classes directory in your classpath, your src directory as well as everything else needed, clojure, miglayout, ...
16:50stuhoodkadaver: and also wherever you have defined the output classes will go: see *compile-path*
16:51stuhoodhttp://clojure.org/api#toc12
16:52kotarakhttp://clojure.org/compilation
16:53kadaverI have
16:53kadavercould be somehting in miglayout that changed?
16:53stuhoodkadaver: from what you showed us, *compile-path* isn't in your classpath
16:55kadaverok got it
16:55kadaverit worked now
17:01cemerickhuh, I wasn't expecting this:
17:01cemerick,^#^{:foo '5}(range 5)
17:01clojurebotnil
17:01cemerick,^#^{:foo '5}[]
17:01clojurebot{:foo 5}
17:01kadaverstill weird that C-c C-l doesnt work
17:02technomancydoes anyone have a good overview of using character buffers and char arrays in Clojure?
17:02technomancyit seems like a very common problem you see with Java interop; I'm thinking there's got to be some nicer abstractions than what I end up using.
17:13stuhoodcemerick: it seems like metadata would make a lot more sense if the object didn't have to support it
17:14stuhoodcemerick: maybe clojure could just keep a map of object-id -> metadata for each namespace or something, rather than attaching it to the object
17:14technomancyis it a common idiom for readers' .read methods to return an int representing how many bytes/chars were read?
17:15technomancyleaving the return value of .read undocumented seems to be *very* common, I'm wondering if that's just an assumption everyone has
17:16stuhoodrhickey: what do you think about keeping metadata detached from the object, in a global map?
17:16technomancyit's frustrating to hear static typing fans complain about not being able to know what return values are in dynamic languages when you have the same problem with Java. "OK, so you return an int. What on earth does it _mean_?"
17:18albinomeans it's not null?
17:18stuhoodtechnomancy: heh... and you can't even subclass Integer to give it a type
17:18stuhoodmore specific* type
17:19stuhoodi know that would be the Haskell solution
17:21dnolenstuhood: how would metadata get garbage collected then? (just wondering, i don't know much about GC techniques at all)
17:21technomancythere's got to be a better abstraction for this reader stuff though.
17:21lisppaste8technomancy pasted "getting a string from a reader" at http://paste.lisp.org/display/79427
17:21technomancyseven lines to get a string from a reader is just sad. =\
17:23stuhooddnolen: shoot.
17:24kadaversgl/update-values - why doesn't it take a function? I mean I want to increment the count in a record, not supply a new value.
17:28stuhooddnolen: oh... what about WeakHashMap? the key would be the object itself
17:29dnoleninteresting how does WeakHashMap work?
17:29stuhooddnolen: i don't know if there could be an immutable equivalent, but the implementation is described here: http://java.sun.com/javase/6/docs/api/java/util/WeakHashMap.html
17:33kadaveranyoen have any example of sql/update-values ?
17:36stuhooddnolen: do you think it's worth bringing up on the group?
17:38dnolenstuhood: It does seem really interesting, I guess one thought is that map could get really large really fast right? again I'm no expert, so I'm not sure if it matters.
17:39dnolenor not
17:39dnolenseems interesting
17:39stuhooddnolen: only items with metadata would need entries
17:40kotarakIt becomes a bottleneck if a lot of parallel updates are done to the metadata of objects. I'm not sure this is realistic though....
17:40stuhoodthere is terracotta to consider too... apparently they don't support WeakHashMaps atm
17:40dnolenyeah I think it's worth bringing, but I'm no Java expert ;)
17:41dnolenahh, yeah, that's probably a deal breaker, unless they have it on their roadmap.
17:41stuhoodkotarak: true, but there are (hash)map implementations that provide ridiculous amounts of concurrency
17:42stuhooddnolen: there is a ticket... not too old https://jira.terracotta.org/jira/browse/CDV-608
17:42stuhoodoh... '08
17:42stuhoodugh
17:44dnolenit does seem like they aren't against the idea tho
17:45AWizzArdrhickey: did you decide yet if you want to switch away from svn?
17:46technomancyAWizzArd: sounds like it's not going to happen soon
17:47technomancyactually... he posted that before Google Code announced hg support. he just said moving to git is not going to happen soon.
17:47technomancybut it seems unlikely, especially for core clojure.
17:48AWizzArdI don't know if you followed the discusson from two days ago where Rich asked if we are ready for the switch to hg.
17:49technomancyAWizzArd: oh, I'm just going from what I read on the mailing list; sounds like you're more informed than I am.
17:49technomancyinteresting.
17:49AWizzArdRich was discussing it with us two days ago, for one hour or so.
17:50technomancyI've got to say, mercurial definitely has the best name of all the DSCMs.
17:50AWizzArd;-)
17:50technomancybzr has the best logo though.
17:50stuhood~def meta
17:52technomancyI guess Sun is big into hg these days too
17:52AWizzArdseems so
17:52kotarakclojurebot: kotarak
17:52clojurebotHuh?
17:52kotarakhmm..
17:53AWizzArdI have the impression that the OpenJDK alone has as many LOC as nearly all the projects under git have together.
17:53rsynnottthat seems improbable
17:53technomancymozilla and python are the only non-Sun projects I recognize on the ProjectsUsingMercurial page
17:53AWizzArdWith Mozilla having nearly as much code as the Linux Kernel
17:53rsynnottespecially if you count the ten different copies of every ruby library with the same names on techcrunch
17:54AWizzArdand the OpenJDK with waaay more LOC
17:54technomancymozilla's codebase is frighteningly massive
17:54rsynnotteh, techcrunch? I meant github
17:54kotarakIs Xen also Sun?
17:54rsynnottdon't think so
17:54rsynnottisn't it of Microsoft-ish origin?
17:55p_lnope
17:55p_lthey had NT5.1 support in Xen 1.0, though
17:55kotarakXen also uses hg, AFAIR.
17:56technomancyso hg can do rebasing now; is that right?
17:56AWizzArdThe latest numbers in LOC that I got was: about 2,5mio for the Linux Kernel and about 2,4 mio for Mozilla
17:56kotarakyup
17:56AWizzArdAnd the OpenJDK enjoyes over 6,5 mio LOC
17:56AWizzArdenjoys even
17:56kotarakthe yup was meant for technomancy
17:57AWizzArdanyway, git *and* hg both should have no problems with the code base for Clojure and Contrib.
17:57technomancykotarak: cool. and in-place branching too?
17:57AWizzArdyou mean many branches in one repo?
17:57rsynnottah, Xen had financial support from Microsoft Research Cambridge
17:57kotaraktechnomancy: do you mean several branches in one dir? hg supports that for ages...
17:57rsynnott(along with the UK government and Intel, so not really particularly MS-sepecific)
17:58technomancykotarak: so the main difference with branches is you clone all of them by default rather than just master and whatever you ask for, right? (vs git)
17:58kotaraktechnomancy: yes. there are no "private" branches
17:59AWizzArdtechnomancy: the basic idea is to start a new repo for a branch. That is in reality no problem. BitBucket and most likely google have direct support for that.
17:59kotaraktechnomancy: although there is now the bookmark plugin...
17:59AWizzArdYou only need one account. Under that you can easily branch.
17:59AWizzArdNo need to register (and even pay) multiple times for different branches.
18:00kotarakVimClojure uses two branches in the repository, the default and the bleeding-edge branch. But that's a rather overviewable code base...
18:01AWizzArdFor rhickey it is just important that he can checkout his work on whatever compi he is, do some coding, and bring it back to the central server.
18:01AWizzArdThat will be easily possible with hg (and git of course).
18:02AWizzArdGoogle wrote that they decided for hg not only because it is easier, but also because cloning via http is much more performant. For their tests about 8 second for hg vs 178 seconds for git.
18:03stuhoodGoogle <3's HTTP
18:03AWizzArdstrange hmm? ;-)
18:03AWizzArdwell...
18:03stuhoodi tend to agree: custom protocols suck
18:03kotarakSomeone compared hg with Denzel Washington and git with Wesley Snipes. The latter provides more fancy action, while the first just does its job quite unspectacularly.
18:04AWizzArdSo, when is the Clojure VCS ready? *g*
18:05AWizzArdI think what the world really needs is another vcs
18:05stuhoodwith STM!
18:06stuhoodhmm... i wonder how close the implementation details of STM are to a VCS
18:07rsynnottnot particularly, except that it has transactions, I would think
18:08stuhoodthe transaction is just how you add to the end of an object's history
18:15technomancyso it sounds like even though Google Code supports hg, there's still a lot of features that bitbucket has that Google doesn't?
18:26yonatandoes anybody have a guess as to why all the slime-eval-*** functions don't show any output in my REPL buffer?
18:26yonatan(does show up in *slime-events*)
18:27technomancyyonatan: like when you're calling those functions from elisp?
18:27yonatani guess. i just hit ^X ^E
18:27technomancyyonatan: C-x C-e output goes to the minibuffer
18:28yonatanC-c C-c does the same
18:28yonatanC-c C-k throws an exception
18:28yonatanis there something else i'm supposed to use?
18:28technomancyI usually just use C-c C-c and C-c C-k.
18:29yonatanand it shows up in your repl?
18:29technomancyno, in the minibuffer
18:29technomancyoh... you mean output like from println?
18:29yonatanyes
18:29technomancyrather than the output of the return value
18:29technomancygotcha
18:29yonatanor return value. nothing goes to my repl buffer
18:30technomancythe return value should show in the minibuffer. anything that gets written to *out* should show in the *slime-repl clojure* buffer
18:31technomancybut it doesn't show at the very bottom; it shows above the last prompt
18:31yonatanhmm
18:31yonatani don't have an *out* or a *slime-repl clojure*. just *inferior-lisp*
18:31cp2Time flies like an arrow. Fruit flies like a banana.
18:31yonatani take it theres something wrong with my setup then?
18:32technomancyyonatan: it could be better. =) have you tried M-x clojure-install?
18:32hiredmanclojurebot: the future?
18:32clojurebothiredman: the fn created by future (like all fns) doesn't close over dynamicly scoped stuff
18:32technomancythat will set everything up the easiest way
18:32yonatantechnomancy: you're kidding?
18:32yonatani'll try it right now
18:32hiredmanclojurebot: literal [?] the future
18:32clojurebot0
18:33technomancyyonatan: what you have will work, I'm just not sure what *out* gets hooked up to without the slime-repl configured.
18:33hiredmanclojurebot: the future is Time flies like an arrow. Fruit flies like a banana.
18:33clojurebotIk begrijp
18:33hiredmanclojurebot: tell me about the future
18:33clojurebotthe future is Time flies like an arrow. Fruit flies like a banana.
18:33hiredmanclojurebot: the future is <reply>Time flies like an arrow. Fruit flies like a banana.
18:33clojurebotRoger.
18:33Chousukehiredman: bad joke is bad.
18:34hiredmancp2's fault
18:35cp2lol
18:35cp2not a joke
18:35Chousukehiredman: feature request: in case of a fuzzy match, add something that indicates what the triggered factoid actually was
18:35cp2just an example of lexical ambiguity in english
18:35hiredman:(
18:35cp2could be fruit flies (as in the bug) like a banana
18:36cp2or fruit flies (verb) like a banana
18:36technomancywhen you call .read on a reader and it expects an offset, does that offset count from the beginning or from the last place you read from?
18:36hiredmanChousuke: I think that would take away from the magic
18:36Chousukehiredman: hm, good point
18:36Chousukeclojurebot: magic
18:36clojurebotExcuse me?
18:36technomancycp2: yeah, english would be so much clearer if it used prefix notation. =)
18:36cp2haha
18:36Chousukehiredman: see above :(
18:36hiredman~jdoc java.io.Reader
18:37Chousukeprefix notation in english? how would that work
18:37technomancyhiredman: that doesn't specify how the offset parameter is interpreted
18:37hiredmantechnomancy: I wonder if it is implementation specific
18:38technomancyworking directly with readers like this is pretty tiresome. is the streams stuff that rich talks about meant to address this?
18:38hiredmanno
18:38hiredmanstreams are not io streams
18:38Chousuke(say '(assert (= this (with-meta {:syntax 'clojure} english))))
18:39hiredmanthere are sort of like alternative lazy-seqs
18:39hiredmanthey
18:39technomancyah too bad; this stuff is crying out for a better abstraction. =)
18:39cp2oi Chousuke
18:39cp2i think thats worse :)
18:39hiredmantechnomancy: the scope stuff will help
18:40hiredmana little
18:40hiredman~scope
18:40clojurebotscope is at http://paste.lisp.org/display/73838
18:40technomancythanks; will take a look
18:40hiredmanso you can have "self" closing resources
18:40cp2oh
18:40cp2thats neat
18:40technomancyinteresting
18:42AWizzArda propos resources.. when I have data out of which I want to create a huge string (say 1-2 gb) which I want to write to a file, is there then a way to (print ..) directly into that file instead of first creating that whole string in ram and then spitting it?
18:42AWizzArdI would print chunks of a few chars up to a few MBs
18:42Chousukebind *out* to a filewriter?
18:43AWizzArdcan the writer function from clojure.contrib be used for that?
18:43hiredmanAWizzArd: sure, use .write instead of print
18:43AWizzArdI just don't know what JVM classes to use and such, but maybe contrib already has it (duck-streams maybe)
18:43hiredmantechnomancy: in the simple form demo'ed there they are pretty easy to implement
18:44duncanmis DO the equivalent of BEGIN in Scheme?
18:44duncanmi always forget that
18:44hiredmanAWizzArd: duck-streams must have something for making Writers, use that
18:44hiredmanwhat does BEGIN do?
18:44Chousukeduncanm: is begin equivalent to progn in CL? :P
18:44duncanmyeah
18:44Chousukethen yeah
18:44hiredmantechnomancy: http://github.com/hiredman/clojurebot/blob/9216e6b2f6c5402be06d093d01590a7dd33131c3/hiredman/horizon.clj
18:45AWizzArdhiredman: when I want to use .write instead of print, what class should the object have with which I use .write?
18:45hiredmanI should move that into odds-and-ends and out of clojurebot
18:45AWizzArdis that one of these bufferedWriter beasts?
18:45hiredmanAWizzArd: some kind of Writer
18:45Chousuke,(if 1 (do (println "hey") (println "ho"))) ; I assume this is what you want
18:45clojurebothey ho
18:46hiredmanI don't think you use bufferedwriters so much
18:46AWizzArdhiredman: would duck-streams (with-out-writer ..) do?
18:46hiredmandunno, I haven't used duck-streams
18:46AWizzArdk
18:46Chousukeshould work for you :/
18:47Chousukethat way, you can just use the print functions like usual but instead of the standard output, the stuff goes into whatever you specify. :)
18:48technomancyhiredman: nice to see clojurebot all grown up these days. =)
18:48replacahiredman: hey, what do you think about making clojurebot be able to jump to the contrib autodoc pages? I could generate you a formatted index pages and hide it in the docs wiki (it ignores any files that don't end in wiki)
18:48technomancyback when I first joined the channel he was but an idea.
18:48AWizzArd~def with-out-writer
18:49kadaverto pass something that is def'ed, is namespace/symbol or (namespace/symbol) correct?
18:49Chousuke(namespace/symbol) would be a function call :/
18:49hiredmanreplaca: sure
18:50hiredmanhmmm
18:50replacahiredman: what format would you like? I think the info is namespace, var-name, url
18:50hiredmanI would like to provide uniform acess to core and contrib
18:51hiredmanright now all it does for core is doc lookup and view source
18:51ecyrbhi all. clojure newb. I'm trying to proxy TreeNode to recursively build a tree from a list. Trouble is, I need to pass "this" so the children know their parent. How would I do this?
18:52replacahiredman: I could have doc url & src url in the file, since I have them both available
18:52ecyrber, I guess I mean seq instead of list. Old habits.
18:52hiredman(doc proxy)
18:52clojurebotclass-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, must be first. If not provided it defaults to Object. The interfa
18:53replacahiredman: ya want csv, xml, json?
18:53hiredmanecyrb: well, easiest way, all the "methods" in a (proxy ...) are closures
18:53hiredmanso they can just close over stuff
18:53hiredmanreplaca: json is good for me
18:54Chousukeisn't "this" implicitly available in proxy forms? :/
18:55hiredmanChousuke: yes, but he isn't really talking about "this"
18:55hiredmanhe is talking about the parent node I assume
18:56hiredmanecyrb: I would recomend using zippers (clojure.zip) for functional tree stuff
18:56hiredmanthe java road will lead to pain
18:56replacahiredman: cool, I'll get it building something and we can work from there
18:57hiredmanExcellent
19:04cp2hrm
19:04cp2is there a sort of if-not-let
19:05cp2er wait
19:05cp2lol
19:32replacaactually, if-not is anaphoric; it assigns the result of the test to the variable "nil" which you can use to represent the result of the computation later
19:32Carknot quite true !
19:33Carkhow about (if-not false ....
19:34replacaCark: joking!
19:34Carkhehe yes
19:35replacaCark: plus, mot places nil will do you pretty much the same as false so you'll usually be alright (counterexamples not accepted).
19:35cp2well what i meant to ask for was an if-let style function but with the branches in opposite order
19:35cp2then i realise what i said when i asked in here
19:35cp2realised*
19:39kadaverC:\clojure\classes>Exception in thread "Thread-3" java.lang.RuntimeException: ja
19:39kadaverva.sql.SQLException: No suitable driver found for jdbc:derby:C:/clojure/progs/mp
19:39kadaver3player/mp3.db
19:39kadaverhttp://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4412
19:40kadaver^^ nyone can say how I need to pass around the database connection?
19:53yonatantechnomancy: M-x install-clojure did the trick. Thanks!
19:54technomancyyonatan: cool!
19:54technomancytell all your friensd!
19:58kadaver_^^ nyone can say how I need to pass around the database connection?
19:58kadaver_http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4412
19:58kadaver_i missed if someone commented....
20:08replacacp2: I understood. I was just amusing myself :-)
20:09cp2heh
20:25ecyrbhiredman: I figured it out. using something like (let [children nil, myProxy (proxy...), children (map myProxy childlist)] myProxy)
20:26ecyrbbasically, in Java, you can recurse in a constructor passing "this" as a parameter to have your children know their parent
20:27ecyrbso in clojure I'm creating the chicken, the egg, and then the chicken where it came from. or something like that
20:27hiredmanI am not sure what you are doing, but I feel confident that you are making a mistake
20:28hiredmaneasiest way is (defn make-some-proxy [arg] (proxy [SomethingProxied] [] (some-method [] arg)))
20:29kadaverhttp://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4412
20:29kadaveronce again my internet...
20:29hiredmanre-binding children like that will not change the value for children that your proxy form captures
20:29ecyrbyes, it does
20:29hiredmannah, it doesn't
20:29ecyrbjust try (let [x 0 y x x y] [x y])
20:30hiredmansure, but it does not change the value that (proxy ...) captures
20:30hiredmanit is not assignment
20:30cp2,(let [x 0 y x x y] [x y])
20:30clojurebot[0 0]
20:31cp2well
20:31ecyrbwell, it seems to be. where can I post a code snippet and get a tiny url?
20:31cp2they will both be the same no matter what
20:31cp2so..
20:31hiredman,(let [x 0 y (fn [] x) x 1] [(y) x])
20:31clojurebot[0 1]
20:31hiredmanlisppaste8: url
20:31lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
20:32lisppaste8ecyrb pasted "build-tree" at http://paste.lisp.org/display/79434
20:32cp2hehe
20:33cp2'kids'
20:33hiredmanthat does not do what you want
20:34hiredmanand don't use ArrayList
20:34lisppaste8ecyrb annotated #79434 "untitled" at http://paste.lisp.org/display/79434#1
20:35ecyrbyou're right. It doesn't do what I want
20:36hiredmanI know I am right
20:36ecyrbkids keeps its initial binding just like you said
20:36hiredmanlet is not assignment
20:38lisppaste8hiredman annotated #79434 "using closures" at http://paste.lisp.org/display/79434#2
20:39hiredmanyou could possibly use (binding ...) to do something structurally similar to what you had, but there is little point in doing it
20:41ecyrbI don't quite follow yours as myProxy isn't bound...
20:42hiredmanso?
20:42hiredmanoh
20:42hiredmanI see
20:42hiredmanyou can rewrite kids as a function
20:43hiredman(doc proxy)
20:43clojurebotclass-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, must be first. If not provided it defaults to Object. The interfa
20:43ecyrbactually, I think you might be right about binding.
20:43hiredmanif you read the whole docstring (clojurebot's is truncated) this is bound to the object inside each method
20:45hiredmanwhy are you using TreeNode?
20:47ecyrbI'm trying to build a tree for use with a JTree. I know I don't have to use TreeNode, I just thought I'd try to learn something about clojure
20:48hiredmanI think the best idea would be to move the logic for producing kids into it's own function, then memoizing that function
20:50ecyrbCan I do that inside of the proxy expression?
20:51hiredmando it in the let
20:51hiredman(let [kids (memoize (fn [p] ...))] ...)
20:52ecyrbright... so how do the kids know who their parent is?
20:52hiredman(kids this)
20:53hiredmanhmmm
20:54cp2hiredman: whats a good/elegant way to expand nested lists
20:54hiredman,(doc tree-seq)
20:54clojurebot"([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."
20:54cp2as in ((:foo :bar) (:baz) :boof)
20:55cp2oh nice
20:55cp2well
20:55cp2nvm
21:06ecyrbhiredman: Alrighty! I have something working now
21:06ecyrbThanks for all of the help!
21:09lisppaste8hiredman annotated #79434 "zipper->TreeNode" at http://paste.lisp.org/display/79434#3
21:10lisppaste8hiredman annotated #79434 "zip->treenode usage" at http://paste.lisp.org/display/79434#4
21:16kadaverhow come clojure-code looks much uglier than common lisp?
21:29kadaverhttp://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4416
21:32kadaverif i paste all the code,300loc ,ayone wanna look?
21:35kadaverwhy cant it find the driver? i psass the damn thing...
21:35kadaversql/transaction should set up the connection right?
21:51kadaverbah im going crazy
21:51kadaverthis language sucks
21:51kadaverwas a mistake to write my player in it
21:53Carksis you put the suitable jdbc driver in your class-path ?
21:53Carkdid*
21:54Carkand can you instanciate it from the repl ?
22:01cp2lisppaste8: url
22:01lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
22:02lisppaste8cp2 pasted "*sizzle*" at http://paste.lisp.org/display/79441
22:02cp2im stuck :|
22:02Carkyou're trying to flatten ?
22:02cp2yes
22:03Carkthere's an implementation of this by rickey somewhere
22:03Carkmaybe in the controbs
22:03Carkcontribs
22:03cp2http://markmail.org/message/56r3eflx4a6tasoe
22:03cp2ah
22:04cp2(let [s? #(instance? clojure.lang.Sequential %)]
22:04cp2weird
22:04Carkcarefull that's pretty old and sequences changed a bit during the patch of doom
22:04Carkbetter check contrib
22:04cp2yeah will do
22:05Cark~def flatten
22:05cp2http://www.google.com/codesearch/p?hl=en#oduOV9Ab97s/trunk/src/clojure/contrib/seq_utils.clj&amp;q=flatten%20package:http://clojure-contrib\.googlecode\.com
22:05cp2got it
22:06Carkahyes there it is conveniently placed in seq-utils =P
22:09kadaverah
22:09kadaverclojure doesnt suck anymore :P
22:09Carkthat's you sucking less ! =)
22:09gnuvince_*zing*
22:10gnuvince_Cark: hey, I'm going to bed, but if you have any more perf improvement suggestions, be sure to send them by way. Execution time is currently ~80s for Clojure vs ~12s for Java.
22:11Carkoh
22:11Carki had a couple seconds better but that's it
22:12Carkstill the same address ?
22:12gnuvince_yes
22:12Carki'm on a new project right now, but i'll have a look
22:12gnuvince_no problem
22:12gnuvince_If you think of something, let me know.
22:12Carksure thing =)
22:13gnuvince_-Xprof and -Xrunhprof:cpu=samples both seem to report that ByteBuffer.position and Cons.first are two of the biggest culprits.
22:13Carkthat's pretty low level
22:14gnuvince_yeah
22:14gnuvince_at this point, if I want some improvements, I'll need to look at how I attacked the problem and see if I can't find a better way of doing it
22:14Carkexactly change the algorythm
22:15Carkbut it's pretty simple as it is ...
22:15gnuvince_I think it is
22:15Carkyou have to consider that the garbage collector is under stress with this kind of tests
22:15Carknot as much using java is my guess
22:16gnuvince_Well, I'm off to read about integrals and then sleep
22:16gnuvince_See you later
22:16Carki can't remember the switch to check that but you should look into it and see how much of this time is spent in the gc
22:16Carkhehe gnight !
22:16Carki'm off to be too
22:17Carkto bed =/
22:24kadaverwoot
22:24kadaveranyone want an mp3player written in clojure?
22:24Carkpost it on the mailing list =P
22:24Carkoff to bed for real now !
22:24kadaveri dont like the code personally.
22:25kadavermaybe it is just all the java interop that makes it look ugly
22:25kadaverand force it into non functional land
22:28cp2they dont float down there
22:55kadavermy 300 LOC mp3player generates 2600 files...
22:55kadaver.class files
23:02durka42one for each clojure function
23:03hiredman,(doc subs)
23:03clojurebot"([s start] [s start end]); Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive."
23:07kadaveris there no way to make an exe? right now I run a python script that passes everything on the command line
23:22durka42kadaver: java doesn't do exes. you can make jars.
23:31kadaverbut jars arent executable, you need java blah
23:31kadaverwhat i mean is really one click run
23:31kadavernot necessarily .exe
23:32durka42windows is sometimes set up that way
23:32durka42if .jar is associated to Jar Launcher or whatever
23:34kadaverhow do I make a jar in clojure?
23:46kadaverhow do I make a jar in clojure?
23:47durka42i am not sure; you could look at somebody's build.xml?
23:47durka42or even the one that comes with clojure
23:57zakwilsonYou can make executable jars by hand if you AOT compile Clojure and your code and package up the appropriate files from the classes folder in your jar. Using ant is probably better.
23:57hiredmanI've just been using make
23:58zakwilsonEvery Windows machine I've tried it on executed a jar made that way. Obviously, you don't actually want to do it by hand most of the time.