2009-04-29
| 00:02 | kadaver | ? |
| 00:03 | hiredman | well, find the code that is generating the exception |
| 00:05 | kadaver | yeah uh |
| 00:07 | hiredman | are you using the latest contrib? |
| 00:08 | kadaver_ | clojure.lang.Repl") |
| 00:08 | kadaver_ | that suspect |
| 00:08 | hiredman | nope |
| 00:08 | kadaver_ | that namespace doesnt exist anymore? |
| 00:08 | hiredman | that is not a namespace |
| 00:08 | hiredman | that is a java class |
| 00:09 | kadaver_ | oh well |
| 00:09 | hiredman | (and it does still exist) |
| 00:10 | kadaver_ | well |
| 00:10 | kadaver_ | i can start the prompt so was stupd |
| 00:11 | hiredman | are you using the latest contrib? |
| 00:11 | hiredman | (if you say "yes", I am going to ask you to prove it) |
| 00:14 | kadaver_ | fakk i think it is because i deleted my user.clj |
| 00:14 | kadaver_ | because i cant find it |
| 00:14 | hiredman | I doubt it |
| 00:14 | hiredman | are you using the latest contrib? |
| 00:14 | kadaver_ | yes |
| 00:15 | hiredman | are you sure? |
| 00:16 | hiredman | are you sure? |
| 00:16 | kadaver | i cloned from github |
| 00:16 | kadaver | about 1 hour ago |
| 00:16 | hiredman | wrong answer |
| 00:17 | hiredman | ~contrib |
| 00:17 | clojurebot | contrib is http://code.google.com/p/clojure-contrib/ |
| 00:17 | hiredman | ^-- not github |
| 00:17 | kadaver | no downloads there |
| 00:18 | hiredman | ... |
| 00:18 | hiredman | ok |
| 00:18 | replaca | hiredman: github is usually pretty up-to-date |
| 00:18 | hiredman | http://code.google.com/p/clojure-contrib/source/checkout |
| 00:19 | kadaver | svn |
| 00:20 | replaca | kadaver: the version you cloned from github should be fine |
| 00:21 | replaca | kadaver: you may need to do an "ant clean" as part of your build, if you have built before |
| 00:22 | kadaver | clean? |
| 00:22 | replaca | afaik there is no pre-built version of contrib |
| 00:22 | kadaver | even the buildsystemhas unwanted side-effects? |
| 00:23 | replaca | kadaver: sometimes build state get stuck on both clojure and clojure-contrib - not sure why |
| 00:23 | chessguy | ,(map vector [1 2] [3 4] [5 6]) |
| 00:23 | clojurebot | ([1 3 5] [2 4 6]) |
| 00:38 | kadaver | fakk |
| 00:38 | kadaver | it has broken everything |
| 00:38 | kadaver | what version is clojure now? |
| 00:39 | hiredman | ~latest |
| 00:39 | clojurebot | latest is 1359 |
| 00:40 | hiredman | ~latest contrib |
| 00:40 | hiredman | haha |
| 00:40 | hiredman | throws an exception |
| 00:49 | unlink2 | heh |
| 00:50 | hiredman | ~todo |
| 00:50 | clojurebot | todo is not what you think it is |
| 00:50 | hiredman | ~todo is http://clojure.org/todo |
| 00:50 | clojurebot | Ik begrijp |
| 01:08 | Cark | what's an application server ? JBoss for instance ...what is that used for ? |
| 01:09 | Cark | hum nevermind |
| 04:45 | AWizzArd | Moin |
| 04:50 | Cark | good morning AWizzArd |
| 05:01 | jdz_ | is there already functionality to convert Java Hashtable to a map? |
| 05:12 | stuhood | jdz: not without copying the whole thing, but if you don't mind that, you can use (into {} old-hash-map) |
| 05:13 | stuhood | ,(into {} (doto (new java.util.HashMap) (.put 1 "1") (.put 2 "2"))) |
| 05:13 | clojurebot | {2 "2", 1 "1"} |
| 05:13 | jdz | ok, thanks |
| 05:54 | Lau_of_DK | (map #(vector % (Math/abs (- % 150))) *comp-types*) |
| 05:54 | Lau_of_DK | ([110 40] [120 30] [130 20] [140 10] [150 0] [160 10] [190 40] [510 360]) |
| 05:54 | Lau_of_DK | Is there an idiomatic oneliner kinda of a way, to get that vector which has the lowest (second) ? |
| 05:54 | Lau_of_DK | Thinking out loud (apply min (map second ...)) - which ofc doesnt work, because it doesnt give me the (first) |
| 05:56 | Chousuke | I think there's a min-by or something in contrib |
| 05:57 | djpowell | Re: 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:58 | djpowell | if you actually want utf-8 for output - eg to write to a file - then you can just rebind *out* yourself |
| 05:59 | Chousuke | Lau_of_DK: (reduce (fn [x y] (if (< (second x) (second y)) x y)) coll) |
| 06:16 | Lau_of_DK | Thanks Chou |
| 06:30 | unlink1 | danlarkin: ping |
| 07:37 | AWizzArd | Hi rhickey |
| 07:37 | rhickey | hey |
| 07:38 | AWizzArd | I 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:39 | rhickey | I have a bunch of machines and places where I work, so I go in and out when switching |
| 07:41 | AWizzArd | I see |
| 07:44 | AWizzArd | Is 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:46 | rhickey | AWizzArd: no, equality test and hash fn must go together, and are not pluggable |
| 07:47 | AWizzArd | Okay |
| 07:49 | AWizzArd | So 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:49 | rhickey | or use a sorted-map with a compare fn |
| 07:51 | AWizzArd | Ah, sorted-map-by would allow me to use equalsIgnoreCase then it seems. |
| 07:52 | rhickey | right |
| 07:52 | AWizzArd | good good, that was what I was looking for |
| 07:52 | AWizzArd | Btw, is there a way to print macro expansions without the namespace qualifiers, for easier readability during debugging? |
| 07:54 | rhickey | maybe pprint has an option? |
| 07:56 | AWizzArd | good idea, it has *print-suppress-namespaces* |
| 08:04 | AWizzArd | Is it possible to have the JVM automatically use swap space on its host if needed (vs. throw an Out of Memory exception)? |
| 08:05 | mccraig | AWizzArd: -Xmx switch specifies max heap size... make that as big as u like [ on a 64-bit machine ] |
| 08:21 | AWizzArd | mccraig: sounds good |
| 09:12 | AWizzArd | http://github.com/schacon/hg-git/tree/master |
| 09:15 | danlarkin | unlink1: pong |
| 09:16 | unlink1 | danlarkin: I was wondering about the design decision of using a custom template engine in Madison. |
| 09:16 | unlink1 | I 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:18 | danlarkin | it becomes very hard to separate the presentation layer from the logic layer when you're using HTML-outputting code |
| 09:19 | unlink1 | You can simply not perform application logic in the template. |
| 09:19 | unlink1 | The sequence constructs in clojure are just too good to pass up when outputting HTML. |
| 09:20 | unlink1 | And first class functions make an excellent macro facility. |
| 09:20 | unlink1 | All for free. |
| 09:20 | chessguy_work | 'morning |
| 09:22 | chessguy_work | i 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:23 | danlarkin | well you're free to just not use the templating engine and instead use whatever html generation method you like, of course |
| 09:23 | chessguy_work | though i probably shouldn't have stayed up until 1:30 am this morning watching the clojure for java programmers screencast |
| 09:23 | danlarkin | but I think writing html-generating code is a big long-term maintainability mistake |
| 09:24 | unlink1 | I've maintained and extended django(/jinja)-style templates for awhile. I think the fundamental idea is very flawed. |
| 09:26 | unlink1 | I'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:28 | danlarkin | we'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:28 | unlink1 | Well, I find jnija templates to be a VAST improvement over django, at least. |
| 09:29 | tWip | well most templates are code, in one sense or another... and it's not nearly as nice to code in than Clojure |
| 09:30 | danlarkin | I should get around to trying jinja, then... |
| 09:30 | tWip | I'd much rather write Clojure code than HTML+some special markup |
| 09:30 | unlink1 | Macros and real function calls are the killer features. |
| 09:31 | unlink1 | Actual expressions would be a close 3rd. |
| 09:31 | unlink1 | My current project uses neither include nor extends. |
| 09:32 | tWip | yeah, you write the functions and macros that speak your specific UI needs... and you don't need to work directly with HTML tags |
| 09:32 | danlarkin | I feel like it's walking the path down to spaghetti code |
| 09:32 | unlink1 | You just have to be careful. |
| 09:32 | tWip | my experience with templating systems is that that leads to spaghetti (JSP being the most horrible one) |
| 09:33 | unlink1 | If you're doing something like myobj.related.filter(foo="bar").order_by("bat"), then you are probably doing something wrong. |
| 09:34 | tWip | but in any case, you do need to be clear about separating concerns... whatever the approach |
| 09:34 | unlink1 | Yes. |
| 09:35 | unlink1 | danlarkin: If you do make the switch, be sure to check out http://bitbucket.org/trevor/chouwa/ -- make the transition much smoother. |
| 09:36 | danlarkin | yes, 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:36 | unlink1 | yeah |
| 09:47 | danlarkin | unlink1: I'm glad you even took the time to look at madison though :) |
| 09:47 | unlink1 | I'm glad I saw it, I was about to do the same thing. |
| 09:48 | danlarkin | haha |
| 09:48 | danlarkin | oh good, then you can help! |
| 09:48 | unlink1 | definitely |
| 09:48 | unlink1 | be careful, I'm very opinionated about how web frameworks should work O:-) |
| 09:49 | danlarkin | it's a little rough around the edges, and missing some of the really helpful parts of django |
| 09:49 | unlink1 | I 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:50 | danlarkin | I haven't done any forms or models yet |
| 09:51 | danlarkin | I know what you mean though |
| 09:52 | danlarkin | well I know forms and models wont' be working /exactly/ like in django, because of the statefullness on the django side |
| 09:53 | danlarkin | it would be nice to have them work in a more functional way... perhaps monoids... I don't know |
| 09:55 | unlink1 | yeah |
| 09:55 | unlink1 | Well it's something to think about. |
| 09:55 | unlink1 | Um, and yeah, ORM, uhh |
| 09:55 | chessguy_work | ,(first [1,2,3]) |
| 09:55 | clojurebot | 1 |
| 09:56 | chessguy_work | ,(seq? [1,2,3]) |
| 09:56 | clojurebot | false |
| 09:57 | unlink1 | http://trevor.caira.com/scripts/clojuredoc |
| 10:05 | chessguy_work | ,(conj 1 "abc") |
| 10:05 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentCollection |
| 10:05 | chessguy_work | ,(cons 1 "abc") |
| 10:05 | clojurebot | (1 \a \b \c) |
| 11:22 | grzm | i'm attempting to get emacs, slime, and clojure all working happily together. |
| 11:23 | grzm | I'm currently getting a "clojure.congrib.javadoc/javadoc can now be found in clojure.contrib.repl-utils." exception thrown when slime is loading. |
| 11:24 | grzm | I'm having a hard time figuring out what is trying to load clojure/contrib/javadoc.clj. |
| 11:25 | grzm | checkouts fresh this morning |
| 11:25 | grzm | any pointers would be appreciated |
| 11:38 | stuartsierra | grzm: do you have a user.clj file trying to load clojure.contrib.javadoc? |
| 11:39 | grzm | stuartsierra: that is exactly it. thank you thank you thank you |
| 11:39 | grzm | slime loads just fine now :) |
| 11:47 | stuartsierra | grzm: you're welcome |
| 12:02 | cemerick | gah, I keep typing namespace/:keyword instead of :namespace/keyword :-/ |
| 12:43 | unlink | So, 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:53 | arohner | unlink: I think so |
| 12:54 | cemerick | unlink: see http://clojure.org/API#gen-class, under :methods |
| 12:55 | cemerick | can't expand on that a.t.m., trying to do real work :-) |
| 12:55 | arohner | Static methods can be specified with #^{:static true} in the |
| 12:55 | arohner | signature's metadata. |
| 13:24 | kadaver | to upper and to lower? |
| 13:27 | dliebke | ,(.toUpperCase "hello") |
| 13:27 | clojurebot | "HELLO" |
| 13:27 | dliebke | ,(.toLowerCase "HELLO") |
| 13:27 | clojurebot | "hello" |
| 13:27 | Raynes | ,(.toUpper "Hello") |
| 13:27 | clojurebot | java.lang.IllegalArgumentException: No matching field found: toUpper for class java.lang.String |
| 13:28 | Raynes | I could have swore that worked. |
| 13:29 | replaca | Raynes: no, that wouldn't be verbose enough for Java :-) |
| 13:31 | kadaver | when 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:31 | kadaver | pretty useless error message |
| 13:31 | kadaver | i can C-x e a function to the interpreter but not load a file |
| 13:39 | technomancy | kadaver: what's your classpath look like? |
| 13:40 | technomancy | kadaver: also: do you get the same problem with C-c C-k? |
| 14:13 | kadaver | C-c C-k is undefined |
| 14:13 | kadaver | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4404#a4404 |
| 14:13 | kadaver | my .emacs clojure-part |
| 14:17 | technomancy | kadaver: I've never seen slime configured like that. did you try using M-x clojure-install? |
| 14:17 | technomancy | that's the simplest way to get it working |
| 14:19 | technomancy | which begs the question: how can we make it clearer to newcomers that they shouldn't be manually configuring slime? |
| 14:19 | technomancy | clojurebot: slime? |
| 14:19 | clojurebot | slime is icky |
| 14:20 | technomancy | clojurebot: 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:20 | clojurebot | c'est bon! |
| 14:20 | kadaver | clojure-mode not slime |
| 14:21 | kadaver | im 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:21 | Chouser | reinstalling what? |
| 14:22 | kotarak | clojurebot: slime is also icky |
| 14:22 | clojurebot | In Ordnung |
| 14:22 | kotarak | hiredman gets angry when overwriting factoids... |
| 14:24 | kadaver | reinstall clojure and clojure-contrib |
| 14:27 | technomancy | kotarak: heh, yeah. I didn't realize he had added "is also" |
| 14:28 | technomancy | kadaver: I meant newcomers to slime. |
| 14:40 | kadaver | so whats up with the clojure-namespace, i mean what could have caused this? |
| 14:40 | technomancy | probably the classpath isn't set up right |
| 14:45 | kadaver | but was their anything wrong in the path i posted? |
| 14:46 | technomancy | depends on where you installed things |
| 14:47 | technomancy | but in general constructing your own inferior-lisp-program value is much more error-prone than having swank-clojure create it for you |
| 14:49 | kadaver | should the javapath not be in there anymore? |
| 14:49 | kadaver | java -cp clojure.jar clojure.lang.Repl |
| 14:49 | kadaver | says the website now that worked |
| 14:54 | kadaver | but i still cant C-c C-l |
| 14:55 | technomancy | why are you configuring it by hand? |
| 14:56 | kadaver | i never liked slime |
| 14:56 | kadaver | i want clojure-mode |
| 14:57 | technomancy | oh, you're not using slime at all? hmm, then I have no idea if that will work. |
| 14:57 | kadaver | where is that package with slime? |
| 14:57 | kadaver | forgot hwta its called |
| 14:57 | technomancy | swank-clojure? |
| 14:57 | kadaver | its a bundle of slime+emacs+clojure+contrib(i think) |
| 14:58 | kadaver | maybe |
| 14:58 | technomancy | oh, maybe you're thinking of ClojureBox? |
| 15:00 | kadaver | yes |
| 15:08 | kadaver | going with that let's see |
| 15:11 | kadaver | doesnt clojruebox come with syntaxhighlithing? |
| 15:11 | kadaver | and how do i fire upt he repl? |
| 15:18 | kadaver | File error: Cannot open load file, clojure-auto |
| 15:19 | kadaver | ok shouldnt that come with clojure-box? |
| 15:46 | kadaver | so anyone using clojure-box? |
| 15:56 | kadaver | anyoe know what clojure-auto is? |
| 15:56 | kadaver | i give up |
| 15:56 | kadaver | i rewrite the whole crap in haskell instead |
| 15:56 | kadaver | will be better anyway |
| 15:57 | hoeck | kadaver: no, don't! |
| 15:58 | hoeck | I believe clojure-auto was part of clojure-mode.el, but is now obsolete |
| 15:59 | kadaver | so why does clojure-box ask for it? |
| 15:59 | hoeck | good question |
| 16:00 | kadaver | i put it in there now anyway and still doesnt find it |
| 16:00 | hoeck | it must be on emacs' load-path |
| 16:00 | hoeck | clojurebox is a windows.exe? |
| 16:01 | hoeck | kadaver: where did you download it? |
| 16:01 | kadaver | http://clojure.bighugh.com/ |
| 16:01 | kadaver | yes an exe |
| 16:04 | cemerick | is there not a subset? predicate floating around somewhere? |
| 16:05 | dnolen | question is there something in contrib that deals with regex matches? dealing with java.util.regex.Pattern is less than satisfactory. |
| 16:05 | cemerick | ah, clojure.contrib.set/subset |
| 16:07 | arohner | dnolen: there is some stuff in core, and some stuff in contrib.str-utils |
| 16:07 | arohner | dnolen: (find-doc "re-") |
| 16:08 | dnolen | great thanks! :) |
| 16:08 | hoeck | dnolen: especially re-seq |
| 16:08 | hoeck | |
| 16:08 | dnolen | I always forget about (find-doc ...) |
| 16:09 | arohner | (find-doc "regex") is probably a better search |
| 16:11 | kadaver | ==>> |
| 16:11 | arohner | I use find doc to find functions I wrote :-) |
| 16:11 | hoeck | kadaver: just downloaded the latest clojurebox here, and it installs & runs without any problems |
| 16:12 | kadaver | windows vista? |
| 16:13 | kadaver | Clojure Box 20090320, published April 8, 2009, built with the official Clojure 20090320 release. ? |
| 16:13 | hoeck | no, tablet xp, latest release, yes |
| 16:17 | hoeck | kadaver: maybe the clojurebox installed emacs is looking at your old emacs' init.el ??? |
| 16:18 | kadaver | yeah not ven my current one but some old bastard file i found it now |
| 16:18 | technomancy | cemerick: 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:19 | cemerick | technomancy: emacs is the hard way IMVHO, but we're *deep* in personal preference now :-) |
| 16:20 | technomancy | cemerick: well kadaver is on Windows too, so that's the double-hard way. |
| 16:21 | cemerick | ouch. |
| 16:22 | kadaver | well how do you compile your program i you dont use an editor? |
| 16:22 | kadaver | i have namespaces and alls etup and just really need to run compile to generate the player |
| 16:23 | hoeck | technomancy: not really, it was so with slime an opensource-cl's, but with clojure its just java and emacs-lisp, both very portable |
| 16:23 | cemerick | kadaver: I use netbeans + enclojure with very good results. There's intellij and eclipse clojure environments as well. |
| 16:24 | technomancy | hoeck: in theory, sure. but it's harder to find others who can help with your questions. |
| 16:24 | kotarak | kadaver: java -cp clojure.jar:src:classes clojure.lang.Compile my.fance.namespace |
| 16:25 | technomancy | btw; anyone want to code-review my patch? http://code.google.com/p/clojure/issues/detail?id=13 |
| 16:26 | kotarak | kadaver: and there's VimClojure for Vim (for completeness sake) |
| 16:26 | kadaver | which version is clojure now? would be ncie if it stabilized |
| 16:26 | kotarak | 1.0 to come soon, it seems. |
| 16:33 | cads | hey, 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:35 | kadaver | kd-tree? |
| 16:37 | kadaver | user=> (load-file "C:/clojure/progs/mp3player/mp3player.clj") |
| 16:37 | kadaver | java.lang.ClassNotFoundException: net.miginfocom.swing.MigLayout (miglayout.clj: |
| 16:37 | kadaver | 0) |
| 16:38 | kadaver | ah wait |
| 16:39 | cads | hey, in contrib I see something about a type system with algebraic types |
| 16:39 | cads | is that usable? |
| 16:41 | kadaver | http://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:45 | Chousuke | kadaver: C:/clojure/ is not in the classpath? :) |
| 16:46 | hoeck | kadaver: this is referring to an anonymous function inside layout, namely fn__451 |
| 16:48 | kadaver | okidoki but it is compiling that gives the error |
| 16:48 | kadaver | (binding [*compile-path* "C:\\clojure\\classes"] |
| 16:48 | kadaver | (compile 'progs.mp3player.mp3player)) |
| 16:48 | kadaver | that part |
| 16:48 | kadaver | just running main and it works |
| 16:49 | stuhood | kadaver: as Chousuke said, you need C:/clojure/ on your classpath |
| 16:50 | cemerick | does anyone have any pointers to some discussion on idiomatic multimethod usage? (a group thread or somesuch?). |
| 16:50 | hoeck | but isn't . always on the classpath? |
| 16:50 | kotarak | kadaver: you need the classes directory in your classpath, your src directory as well as everything else needed, clojure, miglayout, ... |
| 16:50 | stuhood | kadaver: and also wherever you have defined the output classes will go: see *compile-path* |
| 16:51 | stuhood | http://clojure.org/api#toc12 |
| 16:52 | kotarak | http://clojure.org/compilation |
| 16:53 | kadaver | I have |
| 16:53 | kadaver | could be somehting in miglayout that changed? |
| 16:53 | stuhood | kadaver: from what you showed us, *compile-path* isn't in your classpath |
| 16:55 | kadaver | ok got it |
| 16:55 | kadaver | it worked now |
| 17:01 | cemerick | huh, I wasn't expecting this: |
| 17:01 | cemerick | ,^#^{:foo '5}(range 5) |
| 17:01 | clojurebot | nil |
| 17:01 | cemerick | ,^#^{:foo '5}[] |
| 17:01 | clojurebot | {:foo 5} |
| 17:01 | kadaver | still weird that C-c C-l doesnt work |
| 17:02 | technomancy | does anyone have a good overview of using character buffers and char arrays in Clojure? |
| 17:02 | technomancy | it 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:13 | stuhood | cemerick: it seems like metadata would make a lot more sense if the object didn't have to support it |
| 17:14 | stuhood | cemerick: maybe clojure could just keep a map of object-id -> metadata for each namespace or something, rather than attaching it to the object |
| 17:14 | technomancy | is it a common idiom for readers' .read methods to return an int representing how many bytes/chars were read? |
| 17:15 | technomancy | leaving the return value of .read undocumented seems to be *very* common, I'm wondering if that's just an assumption everyone has |
| 17:16 | stuhood | rhickey: what do you think about keeping metadata detached from the object, in a global map? |
| 17:16 | technomancy | it'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:18 | albino | means it's not null? |
| 17:18 | stuhood | technomancy: heh... and you can't even subclass Integer to give it a type |
| 17:18 | stuhood | more specific* type |
| 17:19 | stuhood | i know that would be the Haskell solution |
| 17:21 | dnolen | stuhood: how would metadata get garbage collected then? (just wondering, i don't know much about GC techniques at all) |
| 17:21 | technomancy | there's got to be a better abstraction for this reader stuff though. |
| 17:21 | lisppaste8 | technomancy pasted "getting a string from a reader" at http://paste.lisp.org/display/79427 |
| 17:21 | technomancy | seven lines to get a string from a reader is just sad. =\ |
| 17:23 | stuhood | dnolen: shoot. |
| 17:24 | kadaver | sgl/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:28 | stuhood | dnolen: oh... what about WeakHashMap? the key would be the object itself |
| 17:29 | dnolen | interesting how does WeakHashMap work? |
| 17:29 | stuhood | dnolen: 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:33 | kadaver | anyoen have any example of sql/update-values ? |
| 17:36 | stuhood | dnolen: do you think it's worth bringing up on the group? |
| 17:38 | dnolen | stuhood: 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:39 | dnolen | or not |
| 17:39 | dnolen | seems interesting |
| 17:39 | stuhood | dnolen: only items with metadata would need entries |
| 17:40 | kotarak | It 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:40 | stuhood | there is terracotta to consider too... apparently they don't support WeakHashMaps atm |
| 17:40 | dnolen | yeah I think it's worth bringing, but I'm no Java expert ;) |
| 17:41 | dnolen | ahh, yeah, that's probably a deal breaker, unless they have it on their roadmap. |
| 17:41 | stuhood | kotarak: true, but there are (hash)map implementations that provide ridiculous amounts of concurrency |
| 17:42 | stuhood | dnolen: there is a ticket... not too old https://jira.terracotta.org/jira/browse/CDV-608 |
| 17:42 | stuhood | oh... '08 |
| 17:42 | stuhood | ugh |
| 17:44 | dnolen | it does seem like they aren't against the idea tho |
| 17:45 | AWizzArd | rhickey: did you decide yet if you want to switch away from svn? |
| 17:46 | technomancy | AWizzArd: sounds like it's not going to happen soon |
| 17:47 | technomancy | actually... he posted that before Google Code announced hg support. he just said moving to git is not going to happen soon. |
| 17:47 | technomancy | but it seems unlikely, especially for core clojure. |
| 17:48 | AWizzArd | I 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:49 | technomancy | AWizzArd: oh, I'm just going from what I read on the mailing list; sounds like you're more informed than I am. |
| 17:49 | technomancy | interesting. |
| 17:49 | AWizzArd | Rich was discussing it with us two days ago, for one hour or so. |
| 17:50 | technomancy | I've got to say, mercurial definitely has the best name of all the DSCMs. |
| 17:50 | AWizzArd | ;-) |
| 17:50 | technomancy | bzr has the best logo though. |
| 17:50 | stuhood | ~def meta |
| 17:52 | technomancy | I guess Sun is big into hg these days too |
| 17:52 | AWizzArd | seems so |
| 17:52 | kotarak | clojurebot: kotarak |
| 17:52 | clojurebot | Huh? |
| 17:52 | kotarak | hmm.. |
| 17:53 | AWizzArd | I have the impression that the OpenJDK alone has as many LOC as nearly all the projects under git have together. |
| 17:53 | rsynnott | that seems improbable |
| 17:53 | technomancy | mozilla and python are the only non-Sun projects I recognize on the ProjectsUsingMercurial page |
| 17:53 | AWizzArd | With Mozilla having nearly as much code as the Linux Kernel |
| 17:53 | rsynnott | especially if you count the ten different copies of every ruby library with the same names on techcrunch |
| 17:54 | AWizzArd | and the OpenJDK with waaay more LOC |
| 17:54 | technomancy | mozilla's codebase is frighteningly massive |
| 17:54 | rsynnott | eh, techcrunch? I meant github |
| 17:54 | kotarak | Is Xen also Sun? |
| 17:54 | rsynnott | don't think so |
| 17:54 | rsynnott | isn't it of Microsoft-ish origin? |
| 17:55 | p_l | nope |
| 17:55 | p_l | they had NT5.1 support in Xen 1.0, though |
| 17:55 | kotarak | Xen also uses hg, AFAIR. |
| 17:56 | technomancy | so hg can do rebasing now; is that right? |
| 17:56 | AWizzArd | The latest numbers in LOC that I got was: about 2,5mio for the Linux Kernel and about 2,4 mio for Mozilla |
| 17:56 | kotarak | yup |
| 17:56 | AWizzArd | And the OpenJDK enjoyes over 6,5 mio LOC |
| 17:56 | AWizzArd | enjoys even |
| 17:56 | kotarak | the yup was meant for technomancy |
| 17:57 | AWizzArd | anyway, git *and* hg both should have no problems with the code base for Clojure and Contrib. |
| 17:57 | technomancy | kotarak: cool. and in-place branching too? |
| 17:57 | AWizzArd | you mean many branches in one repo? |
| 17:57 | rsynnott | ah, Xen had financial support from Microsoft Research Cambridge |
| 17:57 | kotarak | technomancy: do you mean several branches in one dir? hg supports that for ages... |
| 17:57 | rsynnott | (along with the UK government and Intel, so not really particularly MS-sepecific) |
| 17:58 | technomancy | kotarak: 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:58 | kotarak | technomancy: yes. there are no "private" branches |
| 17:59 | AWizzArd | technomancy: 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:59 | kotarak | technomancy: although there is now the bookmark plugin... |
| 17:59 | AWizzArd | You only need one account. Under that you can easily branch. |
| 17:59 | AWizzArd | No need to register (and even pay) multiple times for different branches. |
| 18:00 | kotarak | VimClojure uses two branches in the repository, the default and the bleeding-edge branch. But that's a rather overviewable code base... |
| 18:01 | AWizzArd | For 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:01 | AWizzArd | That will be easily possible with hg (and git of course). |
| 18:02 | AWizzArd | Google 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:03 | stuhood | Google <3's HTTP |
| 18:03 | AWizzArd | strange hmm? ;-) |
| 18:03 | AWizzArd | well... |
| 18:03 | stuhood | i tend to agree: custom protocols suck |
| 18:03 | kotarak | Someone 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:04 | AWizzArd | So, when is the Clojure VCS ready? *g* |
| 18:05 | AWizzArd | I think what the world really needs is another vcs |
| 18:05 | stuhood | with STM! |
| 18:06 | stuhood | hmm... i wonder how close the implementation details of STM are to a VCS |
| 18:07 | rsynnott | not particularly, except that it has transactions, I would think |
| 18:08 | stuhood | the transaction is just how you add to the end of an object's history |
| 18:15 | technomancy | so it sounds like even though Google Code supports hg, there's still a lot of features that bitbucket has that Google doesn't? |
| 18:26 | yonatan | does anybody have a guess as to why all the slime-eval-*** functions don't show any output in my REPL buffer? |
| 18:26 | yonatan | (does show up in *slime-events*) |
| 18:27 | technomancy | yonatan: like when you're calling those functions from elisp? |
| 18:27 | yonatan | i guess. i just hit ^X ^E |
| 18:27 | technomancy | yonatan: C-x C-e output goes to the minibuffer |
| 18:28 | yonatan | C-c C-c does the same |
| 18:28 | yonatan | C-c C-k throws an exception |
| 18:28 | yonatan | is there something else i'm supposed to use? |
| 18:28 | technomancy | I usually just use C-c C-c and C-c C-k. |
| 18:29 | yonatan | and it shows up in your repl? |
| 18:29 | technomancy | no, in the minibuffer |
| 18:29 | technomancy | oh... you mean output like from println? |
| 18:29 | yonatan | yes |
| 18:29 | technomancy | rather than the output of the return value |
| 18:29 | technomancy | gotcha |
| 18:29 | yonatan | or return value. nothing goes to my repl buffer |
| 18:30 | technomancy | the return value should show in the minibuffer. anything that gets written to *out* should show in the *slime-repl clojure* buffer |
| 18:31 | technomancy | but it doesn't show at the very bottom; it shows above the last prompt |
| 18:31 | yonatan | hmm |
| 18:31 | yonatan | i don't have an *out* or a *slime-repl clojure*. just *inferior-lisp* |
| 18:31 | cp2 | Time flies like an arrow. Fruit flies like a banana. |
| 18:31 | yonatan | i take it theres something wrong with my setup then? |
| 18:32 | technomancy | yonatan: it could be better. =) have you tried M-x clojure-install? |
| 18:32 | hiredman | clojurebot: the future? |
| 18:32 | clojurebot | hiredman: the fn created by future (like all fns) doesn't close over dynamicly scoped stuff |
| 18:32 | technomancy | that will set everything up the easiest way |
| 18:32 | yonatan | technomancy: you're kidding? |
| 18:32 | yonatan | i'll try it right now |
| 18:32 | hiredman | clojurebot: literal [?] the future |
| 18:32 | clojurebot | 0 |
| 18:33 | technomancy | yonatan: what you have will work, I'm just not sure what *out* gets hooked up to without the slime-repl configured. |
| 18:33 | hiredman | clojurebot: the future is Time flies like an arrow. Fruit flies like a banana. |
| 18:33 | clojurebot | Ik begrijp |
| 18:33 | hiredman | clojurebot: tell me about the future |
| 18:33 | clojurebot | the future is Time flies like an arrow. Fruit flies like a banana. |
| 18:33 | hiredman | clojurebot: the future is <reply>Time flies like an arrow. Fruit flies like a banana. |
| 18:33 | clojurebot | Roger. |
| 18:33 | Chousuke | hiredman: bad joke is bad. |
| 18:34 | hiredman | cp2's fault |
| 18:35 | cp2 | lol |
| 18:35 | cp2 | not a joke |
| 18:35 | Chousuke | hiredman: feature request: in case of a fuzzy match, add something that indicates what the triggered factoid actually was |
| 18:35 | cp2 | just an example of lexical ambiguity in english |
| 18:35 | hiredman | :( |
| 18:35 | cp2 | could be fruit flies (as in the bug) like a banana |
| 18:36 | cp2 | or fruit flies (verb) like a banana |
| 18:36 | technomancy | when 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:36 | hiredman | Chousuke: I think that would take away from the magic |
| 18:36 | Chousuke | hiredman: hm, good point |
| 18:36 | Chousuke | clojurebot: magic |
| 18:36 | clojurebot | Excuse me? |
| 18:36 | technomancy | cp2: yeah, english would be so much clearer if it used prefix notation. =) |
| 18:36 | cp2 | haha |
| 18:36 | Chousuke | hiredman: see above :( |
| 18:36 | hiredman | ~jdoc java.io.Reader |
| 18:37 | Chousuke | prefix notation in english? how would that work |
| 18:37 | technomancy | hiredman: that doesn't specify how the offset parameter is interpreted |
| 18:37 | hiredman | technomancy: I wonder if it is implementation specific |
| 18:38 | technomancy | working directly with readers like this is pretty tiresome. is the streams stuff that rich talks about meant to address this? |
| 18:38 | hiredman | no |
| 18:38 | hiredman | streams are not io streams |
| 18:38 | Chousuke | (say '(assert (= this (with-meta {:syntax 'clojure} english)))) |
| 18:39 | hiredman | there are sort of like alternative lazy-seqs |
| 18:39 | hiredman | they |
| 18:39 | technomancy | ah too bad; this stuff is crying out for a better abstraction. =) |
| 18:39 | cp2 | oi Chousuke |
| 18:39 | cp2 | i think thats worse :) |
| 18:39 | hiredman | technomancy: the scope stuff will help |
| 18:40 | hiredman | a little |
| 18:40 | hiredman | ~scope |
| 18:40 | clojurebot | scope is at http://paste.lisp.org/display/73838 |
| 18:40 | technomancy | thanks; will take a look |
| 18:40 | hiredman | so you can have "self" closing resources |
| 18:40 | cp2 | oh |
| 18:40 | cp2 | thats neat |
| 18:40 | technomancy | interesting |
| 18:42 | AWizzArd | a 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:42 | AWizzArd | I would print chunks of a few chars up to a few MBs |
| 18:42 | Chousuke | bind *out* to a filewriter? |
| 18:43 | AWizzArd | can the writer function from clojure.contrib be used for that? |
| 18:43 | hiredman | AWizzArd: sure, use .write instead of print |
| 18:43 | AWizzArd | I just don't know what JVM classes to use and such, but maybe contrib already has it (duck-streams maybe) |
| 18:43 | hiredman | technomancy: in the simple form demo'ed there they are pretty easy to implement |
| 18:44 | duncanm | is DO the equivalent of BEGIN in Scheme? |
| 18:44 | duncanm | i always forget that |
| 18:44 | hiredman | AWizzArd: duck-streams must have something for making Writers, use that |
| 18:44 | hiredman | what does BEGIN do? |
| 18:44 | Chousuke | duncanm: is begin equivalent to progn in CL? :P |
| 18:44 | duncanm | yeah |
| 18:44 | Chousuke | then yeah |
| 18:44 | hiredman | technomancy: http://github.com/hiredman/clojurebot/blob/9216e6b2f6c5402be06d093d01590a7dd33131c3/hiredman/horizon.clj |
| 18:45 | AWizzArd | hiredman: when I want to use .write instead of print, what class should the object have with which I use .write? |
| 18:45 | hiredman | I should move that into odds-and-ends and out of clojurebot |
| 18:45 | AWizzArd | is that one of these bufferedWriter beasts? |
| 18:45 | hiredman | AWizzArd: some kind of Writer |
| 18:45 | Chousuke | ,(if 1 (do (println "hey") (println "ho"))) ; I assume this is what you want |
| 18:45 | clojurebot | hey ho |
| 18:46 | hiredman | I don't think you use bufferedwriters so much |
| 18:46 | AWizzArd | hiredman: would duck-streams (with-out-writer ..) do? |
| 18:46 | hiredman | dunno, I haven't used duck-streams |
| 18:46 | AWizzArd | k |
| 18:46 | Chousuke | should work for you :/ |
| 18:47 | Chousuke | that way, you can just use the print functions like usual but instead of the standard output, the stuff goes into whatever you specify. :) |
| 18:48 | technomancy | hiredman: nice to see clojurebot all grown up these days. =) |
| 18:48 | replaca | hiredman: 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:48 | technomancy | back when I first joined the channel he was but an idea. |
| 18:48 | AWizzArd | ~def with-out-writer |
| 18:49 | kadaver | to pass something that is def'ed, is namespace/symbol or (namespace/symbol) correct? |
| 18:49 | Chousuke | (namespace/symbol) would be a function call :/ |
| 18:49 | hiredman | replaca: sure |
| 18:50 | hiredman | hmmm |
| 18:50 | replaca | hiredman: what format would you like? I think the info is namespace, var-name, url |
| 18:50 | hiredman | I would like to provide uniform acess to core and contrib |
| 18:51 | hiredman | right now all it does for core is doc lookup and view source |
| 18:51 | ecyrb | hi 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:52 | replaca | hiredman: I could have doc url & src url in the file, since I have them both available |
| 18:52 | ecyrb | er, I guess I mean seq instead of list. Old habits. |
| 18:52 | hiredman | (doc proxy) |
| 18:52 | clojurebot | class-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:53 | replaca | hiredman: ya want csv, xml, json? |
| 18:53 | hiredman | ecyrb: well, easiest way, all the "methods" in a (proxy ...) are closures |
| 18:53 | hiredman | so they can just close over stuff |
| 18:53 | hiredman | replaca: json is good for me |
| 18:54 | Chousuke | isn't "this" implicitly available in proxy forms? :/ |
| 18:55 | hiredman | Chousuke: yes, but he isn't really talking about "this" |
| 18:55 | hiredman | he is talking about the parent node I assume |
| 18:56 | hiredman | ecyrb: I would recomend using zippers (clojure.zip) for functional tree stuff |
| 18:56 | hiredman | the java road will lead to pain |
| 18:56 | replaca | hiredman: cool, I'll get it building something and we can work from there |
| 18:57 | hiredman | Excellent |
| 19:04 | cp2 | hrm |
| 19:04 | cp2 | is there a sort of if-not-let |
| 19:05 | cp2 | er wait |
| 19:05 | cp2 | lol |
| 19:32 | replaca | actually, 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:32 | Cark | not quite true ! |
| 19:33 | Cark | how about (if-not false .... |
| 19:34 | replaca | Cark: joking! |
| 19:34 | Cark | hehe yes |
| 19:35 | replaca | Cark: plus, mot places nil will do you pretty much the same as false so you'll usually be alright (counterexamples not accepted). |
| 19:35 | cp2 | well what i meant to ask for was an if-let style function but with the branches in opposite order |
| 19:35 | cp2 | then i realise what i said when i asked in here |
| 19:35 | cp2 | realised* |
| 19:39 | kadaver | C:\clojure\classes>Exception in thread "Thread-3" java.lang.RuntimeException: ja |
| 19:39 | kadaver | va.sql.SQLException: No suitable driver found for jdbc:derby:C:/clojure/progs/mp |
| 19:39 | kadaver | 3player/mp3.db |
| 19:39 | kadaver | http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4412 |
| 19:40 | kadaver | ^^ nyone can say how I need to pass around the database connection? |
| 19:53 | yonatan | technomancy: M-x install-clojure did the trick. Thanks! |
| 19:54 | technomancy | yonatan: cool! |
| 19:54 | technomancy | tell all your friensd! |
| 19:58 | kadaver_ | ^^ nyone can say how I need to pass around the database connection? |
| 19:58 | kadaver_ | http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4412 |
| 19:58 | kadaver_ | i missed if someone commented.... |
| 20:08 | replaca | cp2: I understood. I was just amusing myself :-) |
| 20:09 | cp2 | heh |
| 20:25 | ecyrb | hiredman: I figured it out. using something like (let [children nil, myProxy (proxy...), children (map myProxy childlist)] myProxy) |
| 20:26 | ecyrb | basically, in Java, you can recurse in a constructor passing "this" as a parameter to have your children know their parent |
| 20:27 | ecyrb | so in clojure I'm creating the chicken, the egg, and then the chicken where it came from. or something like that |
| 20:27 | hiredman | I am not sure what you are doing, but I feel confident that you are making a mistake |
| 20:28 | hiredman | easiest way is (defn make-some-proxy [arg] (proxy [SomethingProxied] [] (some-method [] arg))) |
| 20:29 | kadaver | http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4412 |
| 20:29 | kadaver | once again my internet... |
| 20:29 | hiredman | re-binding children like that will not change the value for children that your proxy form captures |
| 20:29 | ecyrb | yes, it does |
| 20:29 | hiredman | nah, it doesn't |
| 20:29 | ecyrb | just try (let [x 0 y x x y] [x y]) |
| 20:30 | hiredman | sure, but it does not change the value that (proxy ...) captures |
| 20:30 | hiredman | it is not assignment |
| 20:30 | cp2 | ,(let [x 0 y x x y] [x y]) |
| 20:30 | clojurebot | [0 0] |
| 20:31 | cp2 | well |
| 20:31 | ecyrb | well, it seems to be. where can I post a code snippet and get a tiny url? |
| 20:31 | cp2 | they will both be the same no matter what |
| 20:31 | cp2 | so.. |
| 20:31 | hiredman | ,(let [x 0 y (fn [] x) x 1] [(y) x]) |
| 20:31 | clojurebot | [0 1] |
| 20:31 | hiredman | lisppaste8: url |
| 20:31 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 20:32 | lisppaste8 | ecyrb pasted "build-tree" at http://paste.lisp.org/display/79434 |
| 20:32 | cp2 | hehe |
| 20:33 | cp2 | 'kids' |
| 20:33 | hiredman | that does not do what you want |
| 20:34 | hiredman | and don't use ArrayList |
| 20:34 | lisppaste8 | ecyrb annotated #79434 "untitled" at http://paste.lisp.org/display/79434#1 |
| 20:35 | ecyrb | you're right. It doesn't do what I want |
| 20:36 | hiredman | I know I am right |
| 20:36 | ecyrb | kids keeps its initial binding just like you said |
| 20:36 | hiredman | let is not assignment |
| 20:38 | lisppaste8 | hiredman annotated #79434 "using closures" at http://paste.lisp.org/display/79434#2 |
| 20:39 | hiredman | you could possibly use (binding ...) to do something structurally similar to what you had, but there is little point in doing it |
| 20:41 | ecyrb | I don't quite follow yours as myProxy isn't bound... |
| 20:42 | hiredman | so? |
| 20:42 | hiredman | oh |
| 20:42 | hiredman | I see |
| 20:42 | hiredman | you can rewrite kids as a function |
| 20:43 | hiredman | (doc proxy) |
| 20:43 | clojurebot | class-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:43 | ecyrb | actually, I think you might be right about binding. |
| 20:43 | hiredman | if you read the whole docstring (clojurebot's is truncated) this is bound to the object inside each method |
| 20:45 | hiredman | why are you using TreeNode? |
| 20:47 | ecyrb | I'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:48 | hiredman | I think the best idea would be to move the logic for producing kids into it's own function, then memoizing that function |
| 20:50 | ecyrb | Can I do that inside of the proxy expression? |
| 20:51 | hiredman | do it in the let |
| 20:51 | hiredman | (let [kids (memoize (fn [p] ...))] ...) |
| 20:52 | ecyrb | right... so how do the kids know who their parent is? |
| 20:52 | hiredman | (kids this) |
| 20:53 | hiredman | hmmm |
| 20:54 | cp2 | hiredman: whats a good/elegant way to expand nested lists |
| 20:54 | hiredman | ,(doc tree-seq) |
| 20:54 | clojurebot | "([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:54 | cp2 | as in ((:foo :bar) (:baz) :boof) |
| 20:55 | cp2 | oh nice |
| 20:55 | cp2 | well |
| 20:55 | cp2 | nvm |
| 21:06 | ecyrb | hiredman: Alrighty! I have something working now |
| 21:06 | ecyrb | Thanks for all of the help! |
| 21:09 | lisppaste8 | hiredman annotated #79434 "zipper->TreeNode" at http://paste.lisp.org/display/79434#3 |
| 21:10 | lisppaste8 | hiredman annotated #79434 "zip->treenode usage" at http://paste.lisp.org/display/79434#4 |
| 21:16 | kadaver | how come clojure-code looks much uglier than common lisp? |
| 21:29 | kadaver | http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4412#a4416 |
| 21:32 | kadaver | if i paste all the code,300loc ,ayone wanna look? |
| 21:35 | kadaver | why cant it find the driver? i psass the damn thing... |
| 21:35 | kadaver | sql/transaction should set up the connection right? |
| 21:51 | kadaver | bah im going crazy |
| 21:51 | kadaver | this language sucks |
| 21:51 | kadaver | was a mistake to write my player in it |
| 21:53 | Cark | sis you put the suitable jdbc driver in your class-path ? |
| 21:53 | Cark | did* |
| 21:54 | Cark | and can you instanciate it from the repl ? |
| 22:01 | cp2 | lisppaste8: url |
| 22:01 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 22:02 | lisppaste8 | cp2 pasted "*sizzle*" at http://paste.lisp.org/display/79441 |
| 22:02 | cp2 | im stuck :| |
| 22:02 | Cark | you're trying to flatten ? |
| 22:02 | cp2 | yes |
| 22:03 | Cark | there's an implementation of this by rickey somewhere |
| 22:03 | Cark | maybe in the controbs |
| 22:03 | Cark | contribs |
| 22:03 | cp2 | http://markmail.org/message/56r3eflx4a6tasoe |
| 22:03 | cp2 | ah |
| 22:04 | cp2 | (let [s? #(instance? clojure.lang.Sequential %)] |
| 22:04 | cp2 | weird |
| 22:04 | Cark | carefull that's pretty old and sequences changed a bit during the patch of doom |
| 22:04 | Cark | better check contrib |
| 22:04 | cp2 | yeah will do |
| 22:05 | Cark | ~def flatten |
| 22:05 | cp2 | http://www.google.com/codesearch/p?hl=en#oduOV9Ab97s/trunk/src/clojure/contrib/seq_utils.clj&q=flatten%20package:http://clojure-contrib\.googlecode\.com |
| 22:05 | cp2 | got it |
| 22:06 | Cark | ahyes there it is conveniently placed in seq-utils =P |
| 22:09 | kadaver | ah |
| 22:09 | kadaver | clojure doesnt suck anymore :P |
| 22:09 | Cark | that's you sucking less ! =) |
| 22:09 | gnuvince_ | *zing* |
| 22:10 | gnuvince_ | 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:11 | Cark | oh |
| 22:11 | Cark | i had a couple seconds better but that's it |
| 22:12 | Cark | still the same address ? |
| 22:12 | gnuvince_ | yes |
| 22:12 | Cark | i'm on a new project right now, but i'll have a look |
| 22:12 | gnuvince_ | no problem |
| 22:12 | gnuvince_ | If you think of something, let me know. |
| 22:12 | Cark | sure thing =) |
| 22:13 | gnuvince_ | -Xprof and -Xrunhprof:cpu=samples both seem to report that ByteBuffer.position and Cons.first are two of the biggest culprits. |
| 22:13 | Cark | that's pretty low level |
| 22:14 | gnuvince_ | yeah |
| 22:14 | gnuvince_ | 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:14 | Cark | exactly change the algorythm |
| 22:15 | Cark | but it's pretty simple as it is ... |
| 22:15 | gnuvince_ | I think it is |
| 22:15 | Cark | you have to consider that the garbage collector is under stress with this kind of tests |
| 22:15 | Cark | not as much using java is my guess |
| 22:16 | gnuvince_ | Well, I'm off to read about integrals and then sleep |
| 22:16 | gnuvince_ | See you later |
| 22:16 | Cark | i 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:16 | Cark | hehe gnight ! |
| 22:16 | Cark | i'm off to be too |
| 22:17 | Cark | to bed =/ |
| 22:24 | kadaver | woot |
| 22:24 | kadaver | anyone want an mp3player written in clojure? |
| 22:24 | Cark | post it on the mailing list =P |
| 22:24 | Cark | off to bed for real now ! |
| 22:24 | kadaver | i dont like the code personally. |
| 22:25 | kadaver | maybe it is just all the java interop that makes it look ugly |
| 22:25 | kadaver | and force it into non functional land |
| 22:28 | cp2 | they dont float down there |
| 22:55 | kadaver | my 300 LOC mp3player generates 2600 files... |
| 22:55 | kadaver | .class files |
| 23:02 | durka42 | one for each clojure function |
| 23:03 | hiredman | ,(doc subs) |
| 23:03 | clojurebot | "([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:07 | kadaver | is there no way to make an exe? right now I run a python script that passes everything on the command line |
| 23:22 | durka42 | kadaver: java doesn't do exes. you can make jars. |
| 23:31 | kadaver | but jars arent executable, you need java blah |
| 23:31 | kadaver | what i mean is really one click run |
| 23:31 | kadaver | not necessarily .exe |
| 23:32 | durka42 | windows is sometimes set up that way |
| 23:32 | durka42 | if .jar is associated to Jar Launcher or whatever |
| 23:34 | kadaver | how do I make a jar in clojure? |
| 23:46 | kadaver | how do I make a jar in clojure? |
| 23:47 | durka42 | i am not sure; you could look at somebody's build.xml? |
| 23:47 | durka42 | or even the one that comes with clojure |
| 23:57 | zakwilson | You 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:57 | hiredman | I've just been using make |
| 23:58 | zakwilson | Every 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. |