#clojure log - Apr 24 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:06 eee: reading a paper now that says to do exactly what you guys are saying to do. separate the item from it's priority. actually a function that returns the priority verses the value

0:38 durka42: ,(seq? 'a-symbol)

0:38 clojurebot: false

0:38 durka42: ,(seq? '[1 2])

0:38 clojurebot: false

0:38 durka42: ,(seq? '#(prn %))

0:38 clojurebot: true

0:38 durka42: ^ ??

0:39 i suppose this explains it

0:39 ,(macroexpand '#(prn %))

0:39 clojurebot: (fn* [p1__2351] (prn p1__2351))

0:40 durka42: am i being dense, or does this make -> unusable with anonymous fns?

0:40 Cark: ,'#(prn %)

0:40 clojurebot: (fn* [p1__2355] (prn p1__2355))

0:40 Cark: (-> 1 (#(prn %)))

0:40 ,(-> 1 (#(prn %)))

0:40 clojurebot: 1

0:41 durka42: er

0:41 clojurebot: atacontrol cap ad0 | grep serial | awk '{print $3}'

0:41 durka42: right i was being dense

0:41 Cark: not too pretty but it works

0:48 hiredman: clojurebot: thanks, I was wondering how to get the serial number of my drive

0:48 clojurebot: atacontrol cap ad0 | grep serial | awk '{print $3}'

0:49 Cark: i think clojurebot eventually lost it

0:53 hiredman: I have had two friends that have started following clojurebot on twitter, because I guess they have mistaken incesent rambling about svn commits for me

0:53 clojurebot: svn is http://clojure.googlecode.com/svn/trunk/

0:53 hiredman: stow it

1:02 durka42: anyone know anything about the dict protocol?

2:31 Cark: ,(prn {1 2 3})

2:31 clojurebot: 3

3:01 hiredman: ,{1 2 3}

3:01 clojurebot: java.lang.ArrayIndexOutOfBoundsException: 3

3:03 replaca: a lot more autodoc than contrib tonight!

3:04 Cark: that's a bug isn't it ?

3:07 hiredman: it's undefined behavior

3:07 replaca: Cark: no, that's me debugging

3:07 Cark: heh sorry i was asking about the (prn {1 2 3})

3:07 replaca: or do you mean {1 2 3}?

3:07 felzix: it should probably raise a more meaningful exception

3:08 replaca: there are a lot of places in clojure we could get better error reporting

3:08 Cark: hiredman : i'll never get to accept this

3:08 felzix: heh, true

3:09 hiredman: Cark: ?

3:09 Cark: how are you supposed to print data structures ?

3:09 the default clojure core ones

3:09 hiredman: Cark: well, for starts you use the same number of keys and values in the map

3:09 Cark: ah right =/

3:09 hiredman: ,(prn {1 2 3 4})

3:09 replaca: yeah, print's not the problem, the map is

3:09 clojurebot: {1 2, 3 4}

3:09 Cark: i was thinking sets

3:10 my bad

3:10 hiredman: ,(prn #{1 2 3})

3:10 clojurebot: #{1 2 3}

3:10 replaca: but I don't really understand what's happening there

3:10 Cark: right sorry

3:10 replaca: what is the (prn {1 2 3}) doing that makes it think 3 is a good answer?

3:11 hiredman: replaca: you don't specify the correct number of values per the number of keys, behavior is undefined

3:11 so you get random weird things

3:12 ,(str {1 2 3})

3:12 Cark: though i was on the wrong track, there is still a problem

3:12 clojurebot: 3

3:12 hiredman: it's undefined

3:12 Cark: where?

3:12 replaca: makes me wonder about the internals though...

3:13 Cark: well between you and me , both humans (i hope) it's an arror to specify a map with 3 forms ibetween the {}

3:13 replaca: in any case, I'm off to bed

3:13 goodnight folks

3:13 Cark: so ignight replaca

3:13 so i think it should be an error

3:13 time to go to bed too look at my writing ...�

3:13 hiredman: ,(macroexpand '{1 2 3})

3:13 clojurebot: 3

3:14 hiredman: that is an odd failure mode though

3:14 ,(macroexpand '{1 2 1})

3:14 clojurebot: 3

3:14 Chousuke: (macroexpand '{1 2 3 4})

3:14 ,(macroexpand '{1 2 3 4})

3:14 clojurebot: {1 2, 3 4}

3:14 hiredman: ,(macroexpand '{1 2 1 2 1})

3:14 clojurebot: 5

3:14 hiredman: *giggles*

3:14 Cark: hehe =)

3:44 AWizzArd: Moin moin

4:19 unlink: OK, so I understand what lazy-seq *does*. How does it *work*?

4:23 liwp: you mean how it defers evaluating rest?

4:25 unlink: What does it evaluate to? A opaque object which when iterated produces the next element and the functor to produce the rest of the list?

4:25 liwp: yeah, conceptually you get a pair (first, deferred rest)

4:25 first is available immediately

4:26 and rest must be forced, which is done automatically for you

4:26 usually deferred rest is implemented as a function that is evaluated when it is forced

4:26 in addition to that the evaluated rest results get memoized so that they will be evaluated only once

4:26 unlink: k

4:27 Oh, you mean a pointer to the head of the list is kept?

4:27 liwp: only if you hold on to it

4:27 unlink: ok

4:27 What is memoized?

4:27 liwp: so if you say (def *l* (foo)) to generate a lazy-seq, it will never be garbage collected

4:28 but if you consume the list as it is generate, i.e. you do not hold on to the head, then it gets collected as you process it

4:29 memoization means that you cache the result for a given argument so that the next time the function gets called with that same argument you can return the cached value without having to evaluate the function again

4:30 unlink: I meant "what gets memoized?"

4:30 liwp: ahh, the rest of a pair in the seq

4:30 but only if it does not get GC'd

4:30 does that make sense?-)

4:31 unlink: oh right ok

4:31 yeah, got it

4:31 Another question, what's the difference between for and map?

4:31 (besides the syntax)

4:32 liwp: for is used for side effects, whereas map is used for the resulting seq

4:32 jdz_: not really

4:32 liwp: otherwise they do the same thing

4:32 jdz_: doseq is used for side effects

4:32 for i s a kind of list comprehension

4:33 s/i s/is

4:33 liwp: ahh, sorry, that's right

4:33 unlink: map accomplishes the same thing, right?

4:34 liwp: sort of

4:35 for is a more elegant way to say some things, they are more declarative

4:35 unlink: It seems that for is plain a nicer syntax

4:36 I guess if you're passed a function object, map is more natural.

4:36 liwp: map also works well when you want to apply a function a pre-existing seq

4:37 so you can say (map f seq)

4:37 rather than (for [x seq] [(f x)])

4:38 AWizzArd: map should be the tool of choice for.. mapping

4:38 It documents the code.

4:39 btw, do Refs, Atoms, Agents and Futures have a common superclass which has no other derived classes (but those 4)?

4:39 unlink: Is there a nice syntax for take . drop?

4:42 Like slicing in python.

4:44 liwp: AWizzArd: dunno

4:44 unlink: I don't think so

4:53 unlink: What's a good body of clojure to read? I'm still trying to figure out what's idiomatic--clojure is often very different from SML and Scheme.

6:06 AWizzArd: unlink: read the .clj files that you can find here: http://code.google.com/p/clojure/source/browse/#svn/trunk/src/clj/clojure

8:00 Lau_of_DK: Does anybody here know how JLine or JCurses react when run through slime in Emacs ?

8:21 gnuvince: Hi

8:21 cgrand: hi!

8:21 gnuvince: What's up Christophe?

8:23 cgrand: haven't had time to look more closely at your perf problems you hade some time agao. Did you find a solution?

8:25 AWizzArd: When I have something like (def x (ref {:a 1, :b 2, :c {:x 10, :y 20, :z {5 6, 7 8}}})), is there then an easy way to (state) change the innermost hashmap? For example setting the value 8 of key 7 to 1000.

8:28 cgrand: (commute x assoc-in [:c :z 7] 1000)

8:29 AWizzArd: oh nice :)

8:33 gnuvince: cgrand: Cark helped me; I "compiled" the record definitions to lambdas to avoid some reprocessing. That brought down the execution time for 1050 files from 120 seconds to 82 seconds on my machine at home (versus 12 seconds for the same files with Java).

8:34 And since I don't seem too alert today (I poured my coffee cream in the trash can this morning. Twice in a row), I think I'll stay away from any important project and look if I can make some further improvements.

8:34 cgrand: not good enough I guess

8:34 gnuvince: cgrand: not good enough, but a very encouraging step in the right direction.

8:55 lisppaste8: cgrand pasted "diagnostic options" at http://paste.lisp.org/display/79132

9:01 Lau_of_DK: haha - gnuvince twice? :D

9:02 gnuvince: Lau_of_DK: yeah

9:03 Does java -server work on Windows?

9:05 cgrand: gnuvince: yes

9:06 gnuvince: I guess I don't have the JDK then...

9:13 Hmmm

9:14 still the same error: Error: no 'server' JVM

9:16 Ah

9:17 nevermind

9:17 cgrand: gnuvince: check your path you must have a jre and a jdk

9:17 gnuvince: %PATH% problem on Windows

9:17 cgrand: exactly

9:22 Lau_of_DK: As I understand, if I want to launch a clojure-script with a shebang, I just add #!/usr/bin/java -cp .:/clojure.jar clojure.lang.Script $1 -- Can I make my Clojure program aware that its being run from commandline?

9:31 huh? clojure.lang.Script has been removed?

9:31 clojurebot: clojure is the bestest programming language available.

9:33 hiredman: Lau_of_DK: clojure.main

9:35 Lau_of_DK: Could not find the main class: clojure.main.Script. Program will exit.

9:38 hiredman: Lau_of_DK: if I meant clojure.main.Script I would have typed clojure.main.Script

9:39 Lau_of_DK: Good to know

10:00 Somebody got a good example of a build.xml which I can loot for a simple project?

10:04 dliebke: Lau_of_DK: I based mine on the one clojure uses, then just simplified it: http://github.com/liebke/incanter/blob/e6d34d1d50ee7356735f217e38425b1410a72ce2/build.xml

10:06 Lau_of_DK: kthx

10:22 http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Distributing_application_as_self_contained_.jar

10:22 Is this horribly outdated?

10:24 cemerick: Lau_of_DK: if you're using ant, what's presented there is incredibly over-complicated.

10:25 Lau_of_DK: I was using ant - but had a little trouble pulling in clojure.jar + contrib as dependencies

10:25 cemerick: you just need to add the fileset of the jar's contents as another source for your destination jar...

10:27 lisppaste8: cemerick pasted "Lau_of_DK: adding clojure and contrib to existing jar" at http://paste.lisp.org/display/79134

10:27 Lau_of_DK: Thanks alot

10:28 cemerick: Every now and then, I think about putting together an ant plugin for building clojure stuffs, but that keeps settling to the bottom of the todo list.

10:28 Lau_of_DK: I know the feeling

10:33 user=> (System/getProperty "java.class.path")

10:33 "./classes:./:./src:./src/:.:/home/lau/coding/lisp/clojure/libs/jline-0.9.94.jar:/home/lau/coding/clojure-root/clojure//clojure.jar"

10:33 user=> (compile 'dk.bestinclass.stress-test)

10:33 java.io.FileNotFoundException: Could not locate dk/bestinclass/stress_test__init.class or dk/bestinclass/stress_test.clj on classpath: (NO_SOURCE_FILE:0)

10:33 user=> lau@lau-laptop:~/coding/lisp/projects/stress-test$ ls src/dk/bestinclass/stress-test.clj

10:34 Sorry that was a bit more than what it looked like in the terminal - but doesnt that seem a bit odd cemerick ?

10:35 cemerick: I'm afraid I can't say -- I've literally never used the compile fn. Compiling interactively never made sense to me, so I just went straight to ant.

10:35 I suppose I could put together a blog post and just brain-dump the script we use for building clojure stuff.

10:37 Lau_of_DK: That would be sweet

10:37 But I only went to compile, because you said that the above build.xml stuff required me to precompile?

10:38 cemerick: right, but using clojure.lang.Compile, not the compile fn -- I really have no idea what that fn does (although I know many people do use it very successfully)

10:39 Lau_of_DK: [java] Could not find clojure.lang.Compile. Make sure you have it in your classpath

10:39 It doesnt seem to accept my $CLASSPATH var - Where do I manually set it ?

10:40 lisppaste8: cemerick annotated #79134 "our clojure-compile ant macro" at http://paste.lisp.org/display/79134#1

10:41 cemerick: Lau_of_DK: that should get you started. I'll try to do a writeup on it this weekend.

10:41 Lau_of_DK: Thanks alot friend, that seems like the exact thing I need

10:41 I gotta jet

11:00 chrnybo: Hello, I'm new to clojure (and Java, it seems). (new Socket "" 80) gives "java.lang.IllegalArgumentException: Unable to resolve classname: Socket". Should I start clojure with particular args to get access to Java libraries or something?

11:01 cemerick: chrnybo: you need to import the Socket class into your current namespace. If you're in a REPL, (import 'java.net.Socket) should do it.

11:02 Note that the ns macro (which defines a new namespace) is the canonical way to import java classes and refer to other clojure namespaces -- the import function is really just a convenience for REPL usage.

11:07 chrnybo: cemerick: So if i wanted a namespace chrnybo.webclient and I wanted the symbols of the Socket class available there, I would say something akin to (ns chrnybo.webclient :import [java.net.Socket]) ?

11:08 cemerick: chrnybo: yes, although the ns macro is almost always used in an actual source file (which you can easily load into a REPL assuming you're in a sane editor/environment).

11:09 hiredman: erm

11:09 cemerick: you mean "no"

11:09 chrnybo: hiredman: huh?

11:09 cemerick: that would actually be :import (java.net Socket) though -- or :import java.net.Socket (if you only want one class from java.net

11:10 chrnybo: cemerick: But java.net is not a function call. In parens all the same?

11:11 cemerick: chrnybo: ns is a macro, so it's free to interpret parenthesized symbols however it wants

11:12 FWIW, that degree of variance from "normal" clojure syntax is very rare in the core lib, etc.

11:25 tashafa: hi all... question: is there a quick way to find an element that isnt distinct in a seq without looping

11:25 ?

11:27 rhickey_: any here ever tried GridGain?

11:28 cgrand: tashafa: example?

11:30 tashafa: cgrand: (<fn> '(0 1 2 3 4 5 1)) => 1

11:31 cgrand: (<fn> '(0 1 2 3 4 5 1)) => [1]

11:32 cgrand: (<fn> '(0 1 2 3 4 5 1 4)) => [1 4]

11:32 gnuvince: rhickey_: I haven't.

11:33 acieroid: it'll be hard without loops tashafa

11:33 tashafa: yeah i thought so

11:35 i just thought there would bbe a more clojurey way to do it

11:36 cgrand: (defn find-repeated [coll] (remove nil? (map #(%1 %2) (seq-utils/reductions conj #{} coll) coll)))

11:37 tashafa: cgrand: you are on some other ish...thanks man

11:38 back to the repl

11:38 ... with my new toy

11:44 AWizzArd: rhickey_: btw, I managed to print refs, atoms and agents in a "nearly duplicatable way". When I read them back in they are not =, but if there would be an equalp as in (= (ref 0) (ref 0)), then they would be. It's nice for an in-ram db which wants to read data back into memory.

11:44 uhm (equalp (ref 0) (ref 0)) ==> true

11:46 Chousuke: that's pretty easy to define

11:46 AWizzArd: yes

11:49 The interesting case (which also work for me now) are circular refs.

11:56 replaca: AWizzArd_: but the key question is: if I modify the first ref in a "deserialized" object, does the other one change too?

11:57 AWizzArd_: because if they're really dups, that would be the expected behavior

12:00 Anyone planning on coming to SF for JavaOne in June?

12:08 cemerick: rhickey_: my only awareness of GridGain comes from a dustup between some of their people and Terracotta last year. So, no. :-)

12:08 replaca: Oh, it looks like Rich is up for a talk and a panel

12:09 rhickey_: shall we do an SF clojure-focused event while you're here?

12:26 AWizzArd: replaca: what I made is good for writing a snapshot. I serialize an object as backup from time to time, and for planned restarts.

12:28 replaca: AWizzArd: Yeah, but if you restart and one ref turns into two, don't you get different semantics?

12:29 ior3k: errr

12:30 I'm probably doing something really stupid

12:30 but I keep getting ClassNotFoundException while trying to do a gen-class

12:30 the class not found has the same name of the fn I'm trying to define

12:30 replaca: ior3k: did you add the classes/ output directory to your classpath?

12:31 ior3k: that's a common reason for that

12:33 ior3k: replaca: ahh, that was it

12:33 replaca: thanks, I'm still getting used to this whole new world :)

12:34 replaca: ior3k: glad to help. We all seem to have a little trouble getting going with gen-class

12:36 AWizzArd: replaca: I get the same semantics that I had before saving

12:39 replaca: AWizzArd: ok, as long as it works for you :-) Doesn't seem right to me.

12:41 rhickey_: replaca: what did you have in mind?

12:42 replaca: rhickey_: Handn't thought about it too hard yet. Maybe a presentation session followed by drinking. :-)

12:43 rhickey_: There are a bunch of clojurians here in the bay area and if more were coming in (esp. you) it seemed like a good time for a get together

12:43 rhickey_: well, I'll be at Java One, as you saw, two talks

12:44 gnuvince: Is it expected in a hash-map/struct heavy program that java.lang.Integer.hashCode takes more than 50% of the processing time or might my profiling numbers be off?

12:44 rhickey_: heads up everyone, one will be the 'script bowl', a friendly competition where we'll have to implement the same task in each of our langs (beforehand), then demonstrate. Community participation is welcome/expected

12:45 gnuvince: rhickey_: is there a description of the problem somewhere?

12:45 rhickey_: gnuvince: not yet

12:45 replaca: rhickey_: cool, we could build around your schedule. I can provide a meetup place (our corporate classroom) about three blocks from the convention center. And drinks are easy to find in this town

12:46 gnuvince: rhickey_: ok. Can you announce it in the discussion group when it is?

12:46 rhickey_: replaca: definitely interesting in meeting Clojurians

12:46 gnuvince: certainly

12:46 interested

12:47 gnuvince: I am, although I should warn that I am probably not who you want on that team

12:47 replaca: rhickey_: cool, we can organize in the group. We'll drag in the bay area group too. They've been meeting down in Palo Alto/Mtn View, but I bet we could drag a bunch of theem up to the city.

12:47 gnuvince: If it's a JavaOne thing, it'll certainly involve knowledge of the Java platform, which I still lack

12:48 replaca: also, happy to help out/participate in script bowl, though I'm not (currently) planning to attend JavaOne for any other reasons

12:50 hey folks, check out the new contrib function/var index at http://code.google.com/p/clojure-contrib/wiki/ApiDocIndex

12:50 rhickey_: replaca: nice!

12:50 replaca: still some stuff to do, but we're getting close

12:51 rhickey_: replaca: you could probably also generate a link into the source on google code

12:52 replaca: rhickey_: Yeah, I was thinking that, but I think I can only do that at the file level

12:53 hiredman: well

12:53 replaca: the whole way google wiki does anchor tags is kind of a mess, though it's trying to be helpful

12:53 hiredman: the vars all have line number + filename information

12:54 replaca: hiredman: is there a way I can generate a URL to get there?

12:54 hiredman: sure

12:54 replaca: w/o copying the data into the wiki?

12:54 hiredman: show me!

12:54 hiredman: erm

12:54 rhickey_: http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/probabilities/finite_distributions.clj#118

12:54 replaca: hiredman: and I'll do it

12:54 hiredman: what do you mean "copying the data into the wiki"

12:55 replaca: rhickey_: awesome. Consider it added

12:55 hiredman: http://github.com/hiredman/clojurebot/blob/9216e6b2f6c5402be06d093d01590a7dd33131c3/hiredman/clojurebot/code_lookup.clj

12:56 rhickey_: replaca: a search might be more useful, returning source and usage:

12:56 http://www.google.com/codesearch?q=cond-prob+package%3Ahttp%3A%2F%2Fclojure-contrib%5C.googlecode%5C.com&origq=cond-prob&btnG=Search+Trunk

12:56 replaca: hiredman: I meant copying the source code. I didn't realize that google code tagged the lines

12:56 hiredman: ~def max

12:58 replaca: rhickey_: the search is cool, but doesn't always return what you want. (e.g. "add")

12:59 gnuvince: Can macros be recursive?

12:59 replaca: so I'd put both

13:07 Chousuke: gnuvince: yes

13:07 ~def ->

13:12 replaca: Adding a source link would be easy if it weren't for that numbskull who wrote pprint. He loads his files from a sub-directory so the filenames don't fit namespace/filename.

13:19 gnuvince: Chousuke: thanks

14:16 Well Google Code added support for Mercurial... :)

14:17 stuhood: google has spoken! mercurial is better than git!

14:17 bitbckt: bah

14:17 gnuvince: The git people are going to go batshit insane now :)

14:17 * bitbckt froths

14:18 gnuvince: bitbckt: you're a git user?

14:18 bitbckt: Very much so.

14:18 gnuvince: bitbckt: that's a very unfortunate nickname then :)

14:18 bitbckt: I use hg, too.

14:18 Heh. I had it first. :P

14:18 Filthy mongrels.

14:20 I suspect the influence of He Who Shall Not Be Named(TM) on this Google Code nonsense.

14:21 gnuvince: Voldemort?

14:21 bitbckt: Close.

14:21 >_>

14:21 <_<

14:21 * bitbckt whispers

14:21 bitbckt: Wguido

14:21 gnuvince: Ha

14:22 bitbckt: I can't even type it..

14:22 gnuvince: He Who Doesn't Like Tail Recursion (TM)

14:22 * bitbckt nods

14:22 gnuvince: Actually, this explains the reasons: http://code.google.com/p/support/wiki/DVCSAnalysis

14:22 bitbckt: Steeper learning curve. Excrement.

14:24 Also, msysgit has come a long way, I hear.

14:25 Sorry. I'll restore the channel to it's normal operating conditions. :-!

14:26 stuhood: could've been worse: you don't have to set off the fire suppression system

14:26 p_l: well, I do consider mercurial to be easier. But I'm the kind of guy who uses both equally :D

14:27 gnuvince: p_l: so you're really well placed to make such a statement :)

14:28 p_l: gnuvince: Well, my older projects mainly used mercurial, now with some of the stuff I'm using git. I hate to go back to SVN or CVS :)

14:28 bitbckt: stuhood: A light switch is a better analogy. I haven't donned my asbestos suit, yet.

14:28 p_l: Completely agreed.

14:28 gnuvince: p_l: we use SVN at work. Makes me sad, but I'm leaving soon hopefully, so I don't care.

14:28 bitbckt: I use hg only when integrating with other devs. Internally I/we are all git.

14:28 gnuvince: Personally, I like Mercurial

14:29 Chousuke: well, mercurial is better than SVN

14:29 bitbckt: The Big Three all are.

14:29 * Chousuke has never actually used mercurial, but since it's being compared to SVN, it must be better.

14:30 p_l: I recall someone doing a rather objective analysis, and claiming that he found mercurial easier to start using, while git was the more powerful but more rocket-science brother :)

14:30 bitbckt: bzr, git, hg... if that wasn't obvious enough

14:30 cemerick: isn't it really trivial to use hg through git? If it can usefully "proxy" svn, then hg should be cake....

14:30 Chousuke: probably.

14:31 though there's no git hg yet :P

14:31 bitbckt: I use git svn regularly. That's part of why we chose it.

14:31 It's Subversion integration is top notch.

14:31 And there are other parts of our corporation that are still svn users.

14:32 Its. *ahem*

14:33 gnuvince: I found it funny that one of the Mercurial summer of code project was not to make Mercurial a client for SVN repos, but for Git repos :)

14:36 bitbckt: My bias is clear, but I'd attribute that partly to the perceived/real ease of migration svn -> git.

14:36 And the obvious "threat" git presents to hg's adoption.

14:37 Easy migration *off* git could be a huge advantage for hg.

14:37 Chousuke: I'm not so sure about that.

14:37 bitbckt: Chousuke: Elaborate.

14:37 cemerick: I figured the battle was essentially over given github's massive superiority over bitbucket. Now GC goes and knocks things askew again. :-/

14:38 Chousuke: there's little to gain from migrating from git to hg, so migration would have to be *really* easy to be worthwhile.

14:38 bitbckt: I think that's the point.

14:38 If hg wants to continue presenting itself as the "easier" git, then it should permit extremely "easy" migration.

14:39 gnuvince: It does

14:39 hg convert path/to/gitproject hgproject

14:39 bitbckt: So that those that prefer hg could use their preferred tool to interface with the rest of the DVCS world.

14:39 gnuvince: same with svn, cvs

14:40 bitbckt: gnuvince: I mean as an interface to git, not as a complete conversion.

14:40 ala git-svn

14:41 gnuvince: yeah, I wish it had something like git-svn

14:42 bitbckt: Migration was the wrong word. Integration with git.

14:43 gnuvince: Integration with git is what one of the GSoC project is about

14:43 bitbckt: Right.

14:44 * Chousuke wonders why the "--rev" option in hg commands is not simply --revision

14:44 Chousuke: seems kind of pointless to abbreviate a long option :/

14:45 (there's a -r short option counterpart)

14:45 gnuvince: I don't know, I don't think I've ever used --rev

14:48 Chousuke: I guess it's due to the tendency to want to abbreviate things for convenience, even when it might not make sense.

14:48 someone was too lazy to type revision, and rev stuck :/

14:50 * Chousuke is skimming the hg book

14:52 p_l: btw, since som

14:52 *some people here might be using java

14:52 is there anyone who can point me to some good documentation about JDEE? (Emacs)

14:56 cemerick: p_l: last I knew, it didn't have much of a following.

14:56 Chousuke: hg seems to have a different idea of branches than git. the basics section makes new clones of repositories for things you'd just use a branch for in git. :/

14:56 cemerick: does anyone here use straszheimjeffrey's graph lib in contrib?

14:57 Chousuke: that was probably the #1 reason why we went with git

14:57 p_l: cemerick: pity, java-based IDEs are too much PITA for me, while I need completion due to not remembering all those long names

14:58 Chousuke: the way git handles branches together with the idea of "remotes" is awesome.

14:59 cemerick: p_l: A friend of mine got JDE working at some point about a year ago, and found it *really* lacking vis � vis eclipse and netbeans. *shrug*

14:59 Chousuke: trivial to track and interact with multiple remote repositories through a single local one.

14:59 cemerick: if you're going to be doing anything that involves Java in clojure, I'd strongly recommend trying netbeans + enclojure. NB has improved in leaps and bounds over the past year or so -- pretty "lightweight" as IDEs go.

15:01 p_l: cemerick: I know, I'm using Netbeans. The problem is that anything that uses Java libraries for GUI is a PITA on my system :)

15:02 cemerick: PITA in what way?

15:02 p_l: cemerick: not working

15:02 cemerick: heh

15:02 p_l: I have to run them under separate X server

15:03 * cemerick shudders thinking about running linux as a desktop environment

15:03 p_l: cemerick: it's due to bugs in Java libs, actually.

15:04 * Chousuke notes that git pull = hg fetch, and hg pull = git fetch ;P

15:11 unlink: How do you shadow symbols exported by clojure.core?

15:12 dnolen: brain freeze today, how do you split a string in Clojure?

15:13 Chousuke: use the java String .split method

15:14 unlink: what kind of shadowing do you mean?

15:16 unlink: Like, clojure.core exports something like "val" or "map" and I want to bind to that symbol in a let or something.

15:21 cemerick: unlink: use (:refer-clojure :exclude [ancestors printf]) in your ns decl

15:22 with whatever defs you want to 'shadow', rather than ancestors + printf

15:22 unlink: Right, but what if clojure introduces new exports from core in future versions?

15:23 Chousuke: you can use (binding [map mymap] somecode), and somecode will run as of map were mymap instead

15:24 stuhood: Chousuke: but only if the var already existed

15:24 cemerick: unlink: oh, I didn't fully read your question...that "just works":

15:24 ,(let [+ 5] +)

15:24 clojurebot: 5

15:24 stuhood: oh... yea... let

15:25 cemerick: using refer-clojure is only necessary when you want to def something in your ns that is already in core

15:25 unlink: oh

15:45 arohner: java question: can I stick jars in a jar, and then if I do, are the sub-jars part of my classpath?

15:45 dysinger: no

15:46 you can make uber-jars (with the contents of other jars)

15:46 or you can setup your jars to automatically expect other jars to be sitting next to them (classpath)

15:46 with the manifest

15:47 arohner: hmm, ok

15:47 thanks

15:47 dysinger: maven -> http://blog.jayway.com/2009/03/22/executable-jar-with-onejar-maven-plugin/

15:48 maven probably has 3 ways to do a "one big jar"

15:48 built from your code + dependencies

15:49 http://blog.taragana.com/index.php/archive/apache-ant-how-to-include-multiple-jar-files-in-a-single-jar-file/

15:49 ant probably has just as many ways to do "one jar to rule them all"

15:50 arohner: cool, thanks

15:51 dysinger: http://timshadel.com/2006/08/28/building-a-megajar-with-maven2-the-right-way/

16:15 baetis-fly: Q: What's the difference between ({:key "value"} :key) and (:key {:key "value"}) and which should I usually use?

16:17 arohner: baetis-fly: no difference

16:17 devinus: how fast is clojure?

16:17 arohner: you can use both

16:17 baetis-fly: arohner: have people adopted one or the other?

16:17 arohner: I like to use the first when looking up a single element, but the second when using, say, map

16:18 i.e. ({:key "value} :key) by itself, but (map :key [ {:key "value"} {:key "value2"} {:key "value3"}])

16:18 devinus: depends

16:18 baetis-fly: arohner: that makes sense. Many thanks.

16:18 arohner: if you're very careful, it can be about as fast as java. typical usage is somewhat slower, but IME faster than python or ruby

16:21 danlarkin: "fast enough"

16:50 cemerick: wasn't there a variation on assert that took an optional exception message?

17:14 hiredman: whats that hack to get access to private vars?

17:17 AWizzArd: What privat vars?

17:18 hiredman: it's privated :P

17:18 arohner: is metadata mutable? could you just strip the metadata off?

17:18 dysinger: no it's not

17:19 AWizzArd: ,(doc alter-meta!)

17:19 clojurebot: "([iref f & args]); Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects"

17:19 dysinger: AWizzArd http://www.onjava.com/pub/a/onjava/2003/11/12/reflection.html

17:20 AWizzArd private means private unless you disregard and hack

17:20 at least in java

17:20 arohner: hiredman: oh, another way might be to just jump into the ns of the private var

17:20 dysinger: AWizzArd - ohh I didn't know you could atomically alter metadata

17:21 arohner: (in-ns 'foo) (println private-var)

17:21 stuhood: dysinger, AWizzard: only when it is attached to a mutable object

17:21 Lau_of_DK: So - Ive compiled my little app into a jar, which can now be run with java -jar, but is there anyway to automate javas start up params? I need to fix the GC to concurrent mode...

17:24 AWizzArd: Lau_of_DK: put the parames into your startup script, or into the link that you set up under Windows.

17:24 Lau_of_DK: I dont want to distribute a start-up script, just the jar

17:26 technomancy: hey folks! just released the PeepCode screencast on Clojure: http://peepcode.com/products/functional-programming-with-clojure

17:26 Lau_of_DK: Sweet

17:27 technomancy: clojurebot: ping

17:27 clojurebot: PONG!

17:28 technomancy: clojurebot: peepcode is a professionally-recorded hour-long tutorial video at http://peepcode.com/products/functional-programming-with-clojure

17:28 clojurebot: 'Sea, mhuise.

17:30 technomancy: clojurebot: botsnack

17:30 clojurebot: thanks; that was delicious. (nom nom nom)

17:34 Lau_of_DK: Man that look pro technomancy

17:34 gnuvince_: technomancy: did you send Rich a free copy?

17:37 hiredman: someone want to tweet at clojurebot (prn "Hello World")

17:37 ?

17:37 stuhood: sure

17:37 hiredman: Excellent

17:37 stuhood: @clojurebot (prn "Hello World")

17:37 ?

17:37 hiredman: yeah

17:38 arohner: I just did that

17:40 hiredman: I think clojurebot only does a tweet every ten minutes, the last tweet was four minutes ago

17:40 so now we wait

17:41 stuhood: gotcha

17:42 technomancy: gnuvince_: yeah, he did the technical editing for it. =)

17:42 Lau_of_DK: Is there a java thingey for doing something like (+ (Date/now) "00:10:00") to get a Datetime thats 10 minz from now ?

17:43 technomancy: Lau_of_DK: Joda time can do that.

17:43 Lau_of_DK: cool

17:43 technomancy: Lau_of_DK: if you don't care about timezones (only using UTC, no daylight savings) you can use chrono, which is a clj wrapper around the built-in JDK stuff

17:45 Lau_of_DK: Joda time looks hot though

17:45 hiredman: http://twitter.com/clojurebot/status/1607756949

17:46 something isn't right

17:46 arohner: Lau_of_DK: it is

17:46 hiredman: ah

17:47 eval-in-box returns a vector of [stdout stder result]

17:56 Lau_of_DK: technomancy: Are you aware of any 'pretty printing' capabilities in Joda?

17:56 Im looking for something like (DateTime/toString "hh:mm:ss")

17:56 technomancy: Lau_of_DK: I haven't used it myself; just heard about it.

17:56 chrono has that, but it's no good if you need DST-awareness

17:57 Lau_of_DK: haha

17:57 I just followed my intution, and it worked straight off, just couldnt find it in the javadocs

17:57 user> (.toString (.plusMinutes m 8) "hh:mm:ss")

17:58 "11:59:37"

18:28 replaca: Auto-doc: now with source links

19:05 uninverted: What's clojure's equivalent to scheme and cl's append function?

19:05 dnolen: uninverted: like for vectors?

19:05 uninverted: Yes

19:05 dnolen: ,(conj [1 2 3] 4)

19:05 clojurebot: [1 2 3 4]

19:05 technomancy: uninverted: probably conj if it adds to the head of lists

19:06 dnolen: uninverted conj does different stuff for different data structures.

19:06 uninverted: No, I mean this: (append [1 2 3] [4 5 6]) => [1 2 3 4 5 6]

19:06 dnolen: ,(conj '(1 2 3) 4)

19:06 clojurebot: (4 1 2 3)

19:06 dnolen: ,(concat [1 2 3] [4 5 6])

19:06 clojurebot: (1 2 3 4 5 6)

19:06 uninverted: Ah, that's what I needed. Thanks!

19:06 dnolen: note that the type gets lost tho.

19:06 you might want

19:07 ,(vec (concat [1 2 3] [4 5 6]))

19:07 clojurebot: [1 2 3 4 5 6]

19:08 Cark: ,(type [1 2 3])

19:08 clojurebot: clojure.lang.LazilyPersistentVector

19:08 hiredman: ,(into [1 2 3] [4 5 6])

19:08 clojurebot: [1 2 3 4 5 6]

19:09 Cark: i wonder why the lazy in there

19:09 if i do (vec (concat [1 2 3] [4 5 6])) ... is the vector lazily created as i read it ?

19:10 technomancy: Cark: pretty sure calling vec forces the seq to be realized

19:10 Cark: it would make sense ... but why lazy in the class name then ?

19:10 hiredman: ,(first (vec (concat [1 2 3] [(print :foo) 5 6])))

19:10 clojurebot: 1

19:10 :foo

19:11 Cark: ~def c.c.LazilyPersistentVector

19:11 ~def c.l.LazilyPersistentVector

19:12 uninverted: Cark: The tail (i. e. everthing but the first element) isn't computed until it is needed.

19:13 Cark: hiredman's example shows this is'nt true

19:15 uninverted: Being printed forces it to be computed.

19:16 Cark: ,(take 1 (map identity '(1 2 3 (print "hello"))))

19:16 clojurebot: (1)

19:16 Cark: err

19:17 not a good example !

19:17 uninverted: Why not?

19:17 Cark: my example, because the list is quoted

19:18 uninverted: ,(take 1 (map identity [1 2 3 (print "hello")]))

19:18 clojurebot: (1)

19:18 hello

19:18 uninverted: Ha! I guess I'm thinking of something else.

19:19 chessguy: so lists aren't lazy by default?

19:19 ,(take 1 [1 2 3 (print "hi")])

19:19 clojurebot: (1)

19:19 hi

19:20 chessguy: ,(type [1 2 3 (print "hi")])

19:20 clojurebot: clojure.lang.LazilyPersistentVector

19:20 hi

19:20 chessguy: heh

19:21 that does seem like a strange name then

19:22 ctdean: I think that lazy-cat is for being lazy, and concat is more immediate

19:22 Will defn work in the clojurebot?

19:23 chessguy: i don't think so

19:23 ctdean: I'll try

19:23 ,(defn my-list [name]

19:23 (printf "Making %s list\n" name )

19:23 (list 1 name))

19:23 clojurebot: EOF while reading

19:23 ctdean: ,(defn my-list [name] (printf "Making %s list\n" name ) (list 1 name))

19:23 clojurebot: DENIED

19:23 uninverted: ,(defn foo [bar] bar)

19:23 clojurebot: DENIED

19:23 uninverted: Aww...

19:24 Cark: ,(take 1 (map #(print %) '(1 2 3)))

19:24 clojurebot: (nil)

19:24 uninverted: Well, just use anonymous functions, I guess.

19:24 chessguy: ,(type (print 3))

19:24 clojurebot: 3

19:25 chessguy: ,(type '(print 3))

19:25 clojurebot: clojure.lang.PersistentList

19:25 ctdean: Concat is not lazy

19:25 (let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))]

19:25 (take 1 (concat (my-list "red") (my-list "blue"))))

19:25 ,(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))]

19:25 (take 1 (concat (my-list "red") (my-list "blue"))))

19:25 clojurebot: EOF while reading

19:25 ctdean: ,(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))] (take 1 (concat (my-list "red") (my-list "blue"))))

19:25 clojurebot: (1)

19:25 Making red list Making blue list

19:25 ctdean: but lazy-cat is lazy

19:25 ,(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))] (take 1 (lazy-cat (my-list "red") (my-list "blue"))))

19:25 clojurebot: (1)

19:26 ctdean: On my repl it also prints making red list

19:28 Cark: lazy-cat is a macro

19:28 ctdean: well, sure

19:28 Cark: concat is not, so the parameters are evaluated

19:29 hiredman: ctdean: concast is somewhat lazy

19:29 concat

19:30 if I recall the first 3 or 4 elements of each seq are evaluated

19:31 ctdean: I see, good to know about the first N seqs

20:43 chessguy: the preview of the peepcode screencast that was announced today mentioned a free screencast on setting up clojure. anybody know where that is?

21:30 dnolen: is there a good example in contrib of updating a tree?

22:56 jmaness: does anyone know if there is a already a function similar to range that accepts an inclusive end? I find myself writing: (range (inc x)), but I was wondering if there is already something else that is better.

23:03 replaca: jmaness: I don't think so, but not hard to write if you need it. I find I'm doing that a lot too

23:50 unlink: What's the idiomatic way of writing helper functions? The letfn syntax seems to encourage never writing helpers

23:54 replaca: I just use defn- to create a root level private function in my namespace

Logging service provided by n01se.net