#clojure log - Apr 11 2010

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

0:51 Drakeson: After deftype'ing foo, how can I create an instance with named arguments? (deftype foo [a b]) (foo {:a 1 :b 2}) fails.

0:52 hiredman: (defn foo-named [& {:keys [a b]}] (foo a b))

0:55 Drakeson: hiredman: thanks. I was hoping for a deftypek or something like that

0:58 carkh: ,(let [a (fn [& {:keys [a b]}] [a b])] (a {:a 1 :b 2})

0:58 clojurebot: EOF while reading

0:58 carkh: ,(let [a (fn [& {:keys [a b]}] [a b])] (a {:a 1 :b 2}))

0:58 clojurebot: [nil nil]

0:58 carkh: ok the & was an error, right ?

0:58 i hoped for a new syntaw for named parameters

0:59 hiredman: right

0:59 if you are passing a map

0:59 ,(let [a (fn [& {:keys [a b]}] [a b])] (a :a 1 :b 2))

0:59 ,(let [a (fn [& {:keys [a b]}] [a b])] (a :a 1 :b 2))

0:59 clojurebot: [nil nil]

0:59 hiredman: bah

0:59 clojurebot isn't running a new enough clojure

0:59 carkh: ok so that's a new syntax ? cool !

1:00 beause defnk has the problem that it's not showing a very informative parameter list in slime

1:00 hiredman: clojurebot: git 277f0235c1387ddd6247a72857597814a3e10bc3

1:00 clojurebot: add &form and &env implicit args to macros

1:00 hiredman: bah

1:00 :D

1:01 clojurebot: git 5772be9fc5ac9ddf92b727908c20b9aab971224a

1:01 clojurebot: gitorious mirror is http://gitorious.org/clojure/clojure

1:01 Drakeson: it is a commit of march 23

1:01 hiredman: clojurebot: github 5772be9fc5ac9ddf92b727908c20b9aab971224a

1:01 clojurebot: http://github.com/richhickey/clojure/tree/master

1:01 hiredman: clojurebot: you suck

1:01 clojurebot: excusez-moi

1:01 hiredman: anyway, a patch of mine made it in

1:01 sweet

1:02 carkh: yay for you =)

1:03 i can't wait for 1.2

1:03 hiredman: http://github.com/richhickey/clojure/commit/5772be9fc5ac9ddf92b727908c20b9aab971224a

1:59 defn: how does one "turn on" the new {} = everything syntax?

2:00 {reduce + {1 2 3 4}}, etc.

2:00 chouser: ??

2:01 defn: I saw an example where there are no []s or ()s, just {}s

2:01 chouser: never heard of it

2:01 defn: huh, really?

2:02 hiredman: no such thing

2:02 defn: ill see if i can find the post that mentioned it

2:02 chouser: you're sure it was clojure and not some kind of scheme?

2:02 defn: i wonder if it was on april 1st

2:02 :)

2:03 TakeV: defn: That was April Fools, yeah. :P

2:04 defn: bahahaha i feel so silly

2:04 who wrote that?

2:04 i need to kill them...

2:06 ah yes, sean devlin

2:06 that monster...

2:08 TakeV: That was along with something like "Everything returns void now, so it's really easy to make all your function full of side effects. This is awesome."

2:09 defn: hahaha yes now that im watching it again i get the joke -- i was just listening along working on something else and looked over when he mentioned the "new" syntax

2:52 scottj: in joy of clojure they have (in C like languages), "a == b && b == c && a == c". Why do you need the last one? What would be a case where the first two tests being true wouldn't have the third be true?

3:01 gregh: perhaps the case where == is an overloaded operator that does not have the transitive property

3:01 == is transitive for usual data types like integers and strings

3:01 a non-transitive == operator would be highly unusual, actually :)

3:26 Raynes: ,(macroexpand '(doseq [x [1 2 3]] (println x))

3:26 clojurebot: EOF while reading

3:27 Raynes: ,(macroexpand '(doseq [x [1 2 3]] (println x)))

3:27 clojurebot: (loop* [seq_9167 (clojure.core/seq [1 2 3]) chunk_9168 nil count_9169 (clojure.core/int 0) i_9170 (clojure.core/int 0)] (if (clojure.core/< i_9170 count_9169) (clojure.core/let [x (.nth chunk_9168 i_9170)] (do (println x)) (recur seq_9167 chunk_9168 count_9169 (clojure.core/unchecked-inc i_9170))) (clojure.core/when-let [seq_9167 (clojure.core/seq seq_9167)] (if (clojure.core/chunked-seq? seq_9167) (clojure.core/let [c__52

3:27 Raynes: Oh boy.

3:30 chouser: you think that's bad, you should look at 'for'

3:30 Raynes: Licenser: ping.

3:31 chouser: For some reason, clj-sandbox isn't whitelisting that. That means that one of of the functions it uses isn't whitelisted, but it looks like everything but println is whitelisted, and println is whitelisted locally in sexpbot so I think it should be working.

3:32 This sucks.

3:33 $(for [x [1 2 3]] (+ x 3))

3:33 sexpbot: DENIED!

3:33 Raynes: Same problem there, looks like.

3:35 Macros are tricky little buggers.

3:38 chunk-buffer and chunk-append weren't whitelisted, so maybe I can get for to work. :O

3:43 Or not.

3:54 Oh no.

3:55 Well, we're screwed. doseq and for both use the '.' special form. It's what's causing the problem here.

3:56 Maybe this will be incentive to fix the . problem.

4:01 Crowbar7: time to invent a new key on the keyboard

4:10 Licenser: Raynes: pong

4:10 Raynes: Licenser: We has us a problem. :p

4:11 Looks like several useful macros can't be whitelisted unless '.' is whitelisted. :o

4:11 Licenser: Raynes: there are no prolems there are only challanges :P

4:11 Raynes: Indeed.

4:11 condp uses throw as well.

4:12 Licenser: hrm

4:12 heh

4:12 Raynes: It's not telling me why condp isn't working.

4:12 Just ().

4:12 But, it's obvious throw is probably part of that reason.

4:12 doseq and for both do (.nth ..)

4:13 Which is killing us.

4:13 Licenser: ,(condp = 1 1 "a" 2 "b")

4:13 clojurebot: "a"

4:13 Raynes: ,(throw (Exception. "Hai"))

4:13 clojurebot: java.lang.Exception: Hai

4:13 Licenser: hrm seems I've to make this . replacement soon :(

4:13 Raynes: The sooner the better. ;)

4:15 Well, I guess throw isn't the only problem in condp. Still didn't whitelist it.

4:15 Maybe it's because it mentions a Java class?

4:15 * Raynes isn't quite sure how things work.

4:17 Raynes: Licenser: I just pushed with some new chunk functions that I missed.

4:17 Licenser: neat

4:17 I've an 'simple' idea for . but I'll have to give that a look later got to go sadly

4:18 Raynes: Kay. Have fun. :)

4:18 Licenser: thanks see you later

4:24 defn: hello all

4:30 ls

6:02 imran_sr: Hi. I was wondering if there is an equivalent of pmap for filter? I see some references online to a clojure.parallel namespace, but I don't see that anywhere in clojure.core or clojure-contrib

6:07 Raynes: chouser: Which one of you wrote the self-licking lollipop bit in Joy?

6:11 imran_sr: Raynes: (intejecting, clojure newbie here), is there an equivalent to pmap for filter? I can't find the clojure.parallel namespace which is mentioned in Volkman's tutorial

6:11 Raynes: imran_sr: I'm not sure. :(

6:11 * defn can't wait to get home and enjoy some JoC

6:12 imran_sr: ok

6:13 patrkris: imran_sr: http://clojure.org/other_libraries - perhaps this is what you're looking for

6:13 at the top

6:13 but the library is deprecated

6:13 imran_sr: patrkris: thanks, I'll check that out

6:19 patrkris: imran_sr: perhaps you can do something with the partition function, pmap and filter - but maybe that'll add too much overhead

6:21 imran_sr: patrkris: you mean roll my own pfilter?

6:21 patrkris: imran_sr: yeah, sort of

6:22 imran_sr: patrkris: (strip-out-nulls (pmap my-filter-func? sequence))

6:22 kind of like that?

6:23 patrkris: yeah, or you could use partition to divide your sequence into pieces, and each piece can be handed to your filter function, which will then filter out some elements

6:23 Chousuke: That's only useful if the filter function is really slow

6:24 patrkris: Chousuke: because the partitioning will be too slow in most cases?

6:24 dcnstrct: hi. The "lein deps" command has never worked for me with any project. I'm having difficult time I must be missing something obvious.. could anyone take a look and give me a pointer ? thanks; http://gist.github.com/362636

6:24 Chousuke: and the overhead of threading

6:24 patrkris: ah

6:24 Chousuke: and it's not like it can divide the sequence in pieces. it still needs to go over it linearly

6:25 patrkris: Chousuke: yeah, that's what I meant by it being too slow

6:25 Chousuke: so the operations on individual items much take enough time for parallelisation to make sense at all

6:25 imran_sr: btw, does using pmap have any consequences for laziness (in other words, does it somehow make it un-lazy)?

6:25 Chousuke: yes

6:25 it stays ahead by a few items I think

6:26 but it's not completely strict

6:26 imran_sr: Chousuke: but only by a few?

6:26 patrkris: Chousuke: do you happen to know whether partition works more efficiently if it detects a vector being partitioned?

6:26 Chousuke: patrkris: no.

6:26 as in, no, it doesn't. :)

6:26 patrkris: ok

6:27 Chousuke: There is an experimental parallel library for reducing/mapping over vectors efficiently

6:27 in the par branch of the git repo.

6:28 it works by mapping/reducing in parallel over the chunks that a vector is made of

6:28 bsteuber: dcnstruct: could you also post you project.clj?

6:28 Chousuke: But it depends on a JDK7 feature (which is available as a jar for JDK6). I guess that's why it's not merged to master yet.

6:29 patrkris: Chousuke: so what would be the ideal way to parallelize on large sequences in clojure as of now?

6:30 Chousuke: patrkris: pmap

6:30 imran_sr: Gentlemen, I have a (overly verbose, fairly dumb and brute force) solution for project euler 5, which I wanted to use a base to try out simple parallelization. Mind if I post a pastebin of it? I'm not sure how I would roll my own pfilter that would work for that

6:30 Chousuke: patrkris: sequences are inherently non-parallelisable

6:30 patrkris: Chousuke: i see what you mean

6:30 Chousuke: patrkris: they are, after all, sequences. :)

6:31 dcnstrct: http://gist.github.com/362640 <--- project.clj thanks for taking a look. the proejc tI'm trying to build is here: http://github.com/ugglan/cljaws

6:31 patrkris: Chousuke: you are right, of course

6:31 Chousuke: Hm

6:31 Looks like some tickets in contrib assembla should be closed ;P

6:32 imran_sr: http://clojure.pastebin.com/cJLEu3et

6:34 patrkris: Chousuke: is there any way of efficiently partitioning a vector? Maybe there is something fundamental I don't understand :)

6:34 Chousuke: patrkris: that's what the par library does

6:35 patrkris: internally, vectors are trees so they are very amenable to parallel processing

6:35 patrkris: Chousuke: ah ok

6:35 Chousuke: patrkris: but that fact is not exposed via a public API

6:35 yet.

6:36 patrkris: Chousuke: but I guess one could use arrays as an alternative?

6:36 bsteuber: dcnstruct: lein deps for cljaws works on my machine

6:37 dcnstrct, I mean

6:37 Chousuke: patrkris: well, arrays are sequential too, but since they're indexed I suppose they can be partitioned easily

6:37 bsteuber: so it seems like something might be wrong with your lein / maven install

6:38 do you happen to use windoze?

6:38 dcnstrct: ubuntu 9.10

6:38 I installed lein with the install script

6:38 about 3 weeks ago

6:38 I can try removing it and doing that again I suppose

6:39 is that what you're using ? the stable lein

6:39 bsteuber: yes, same ubuntu, same lein

6:39 weird

6:40 dcnstrct: well thnx for the confirmation that it's a weird problem and I didn't miss anything really obvious.. that's good enough for now :)

6:41 bsteuber: :)

6:49 Chousuke: hm

6:50 assembla could use some "needs approval from Rich" toggle for tickets

6:51 There seem to be quite many tickets that float in a limbo because they have neither been accepted nor rejected :/

8:41 mikem: ~def to-byte-array

8:41 clojurebot: excusez-moi

8:59 defn: at clojure.core$seq__3538.invoke(core.clj:107) at clojure.core$map__4077$fn__4078.invoke(core.clj:1877)

8:59 how do you read that?

8:59 where is invoke called?

9:00 is there a good resource to trace the roots of invoke?

9:02 Chousuke: it's the step function of a map

9:02 -a

9:03 clojure.core/seq calls an anonymous function defined within clojure.core/map and that throws an exception

9:06 invoke is the java method that actually contains the code of a clojure function, so you can just ignore it and think "function call"

9:08 defn: Chousuke: by step function are you referring to something like (map #(+ % 4 2) [1 2 3 4])

9:08 Chousuke: where #(+ % 4 2) is the step function?

9:08 Chousuke: ~def map

9:09 eh, that's out of sync again

9:10 defn: Chousuke: im reading it -- a little thrown by the lazy-seq and chunked stuff still

9:10 Chousuke: lazy-seq might create a function too.

9:10 defn: could you clarify step function? is that a piece of the lazy seq?

9:10 Chousuke: ah

9:11 Chousuke: I mean just the function that gives the "rest" of the sequence

9:11 defn: Chousuke: but does not necessarily evaluate it?

9:12 Chousuke: well, of course not. except for its first element.

9:12 but the rest is only generated when the first element is needed so that's okay

9:12 defn: Chousuke: okay, i see, thanks

9:12 Chousuke: anyway, most likely something is wrong with the function you're passing to map

10:46 Licenser: defn: as a advice, if you encounter things like that name your anonymous functions

10:46 use (fn function-name [] ...) instead of #(...)

11:03 Raynes: I'm strongly against naming anonymous functions. Goes against everything they believe in. ;)

11:03 Licenser: What's your "simple idea" for '.'? :o

11:07 Ankou: hi, is there something like memfn for static methods?

11:08 Raynes: Ankou: You don't want to use memfn.

11:08 Use an anonymous function instead.

11:08 In both cases.

11:24 Ankou: why not memfn?

11:33 chouser: memfn predates the #() syntax -- since it's less general, it probably will be deprecated

11:35 Licenser: Raynes: beasically to alias a function to . in the namespace

11:36 Raynes: Licenser: Indeed. That would be dead simple.

11:36 Licenser: yea but I'm not sure if it works/how good it works :P

11:36 Raynes: Well, it's an idea. Ideas make me happy. :>

11:38 Licenser: ^^

11:40 hrm

11:40 but not working

11:41 Raynes: :(

11:41 Licenser: forms take priority over functions

11:42 so it actually is back to walking the entire form and replacing all . wiht dot or whatever

11:42 and keep . itself blacklisted

11:42 narf this will be horrible

11:42 I'm not sure if this is going to work

11:42 hmm I see a flaw here

11:43 is there a macro that runs stuff while being evaluated?

11:45 so defmacro is a way out

11:45 ,(defmacro x)

11:45 clojurebot: DENIED

11:45 Licenser: okay nice

11:51 hrm

11:53 Raynes: Is there some sort of tool to count the number of lines of every file in a directory and it's sub directories recursively?

11:53 :o

11:54 Licenser: Raynes: (for i in `find .`; do cat $i; end) | wc -l

11:54 or something along the line

11:55 StartsWithK: wc -l `find .`

11:55 ducki2p: find . -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'

11:55 Licenser: (for i in `find src`; do cat $i; done;) | wc -l

11:55 StartsWithK: wc -l `find . | grep .clj` for clj only

11:56 Raynes: :o

11:56 Thanks, everybody. :p

11:56 Licenser: heh there are so many ways

11:56 ducki2p: plenty of choice; pick one :)

11:56 Licenser: also you could write a clojure program to do that for you

11:56 Raynes: My bashfoo is weak.

11:56 Licenser: I love for :P

11:56 ducki2p: there is also a special tool for this class of problems

11:56 'google' :)

11:57 StartsWithK: Raynes, http://paste.pocoo.org/show/200415/

11:57 to count clojure files, no empty lines and no comments

11:57 Raynes: Sexpbot is 938 lines. O.O

11:57 StartsWithK: Cool. Thanks.

11:57 StartsWithK: .. so support for (comment ..)

11:58 so=no

11:59 Raynes: 884 lines. :D

11:59 Licenser: heh

11:59 Raynes: That makes it the largest project I've ever written in any language.

11:59 Licenser: I am urprised that find . -name *.clj does not go into sub directories o.O

12:00 Raynes: heh

12:00 ducki2p: Licenser: put quotes around *.clj, so your shell doesnt expand that

12:00 Licenser: ah darn it I feel stuid now thanks ducki2p

12:01 Raynes: Of course, you have to subtract around 40-50 lines for the bf interpreter, which I didn't have the heart and courage to write myself.

12:01 And around 20 for Rich's Norvig's spelling corrector. :>

12:01 Licenser: Raynes: it also counts newlines which are not LOC :P

12:02 ducki2p: another useful tool for this is sloccount; not sure if it natively recognizes Clojure

12:02 Raynes: ducki2p: It doesn't.

12:02 Licenser: clj-cat `find . -name "*.clj"` | grep -v "^$" | grep -v "^;" | wc -l

12:02 try this

12:02 ducki2p: darn

12:02 Licenser: coderay does that too, but also not for clojure

12:03 I think that is a pretty good aproximation

12:03 Raynes: 861

12:03 Licenser: clj-sandbox gets about 400 there

12:03 Also I'm not sure that many LOC are a good thing :P

12:03 asimjalis: Hi

12:04 Licenser: hi asimjalis

12:04 I personally would be glad of the sandbox code had less, well we could technically substract save-fn's since it is more a database then code

12:04 nearly 90 LOC in there

12:06 AsimJalis: I was checking to see if I could post to the channel. Now that I can I have nothing else to say. At least for now.

12:06 Licenser: heh

12:13 AsimJalis: Are there any examples of generating Java or some other language using Clojure?

12:13 I mean human-readable code rather than .class files.

12:13 Or just code -- it doesn't have to be human-readable. But still actual code.

12:15 Licenser: AsimJalis: there is something that generates JS from clojure

12:15 and it is pretty readable too

12:15 AsimJalis: Also I am not looking for a Clojure translator. I just want to define my own mini language inside Clojure and then have a translator that translates a sexp composed of this mini-language into the target language.

12:15 Licenser: What is it called?

12:15 Licenser: I don't remember :(

12:16 AsimJalis: Well, at least now it's no longer an unknown unknown. So thanks for that :-)

12:16 Licenser: scryptica and scrypticus

12:17 AsimJalis: now it's even a known to you :P

12:17 scryptica is the up to date one it seems

12:18 well I'm dead tired :( night people

12:18 (doc macroexpand)

12:18 clojurebot: "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms."

12:19 AsimJalis: Neat. Thanks!

12:33 Yeah, Scryptica looks more complete.

12:39 Raynes: AsimJalis: COBOL is for Cwitters!!!! :p

12:53 Drakeson: where are things like swank:pprint-eval defined? in slime or in swank-clojure?

12:57 chouser: I've got to shuffle network boxes around. Nobody say anything important... :-)

13:53 asimjalis: The recursive solution seems more flexible -- if I want to bite off different amounts each time.

13:54 kiras: When I have a line that starts with only one ; emacs indents it to column 40. This happens in elisp-mode and clojure-mode. I was told in #emacs that this is the convention in elisp and that those comments are typically used after other text and to use ;; otherwise. Is this the convention in clojure as well? In Programming Clojure, there are examples where ; is used and it's not indented in this way and at http://clojure.org/reader, it ju

13:54 Single-line comment, causes the reader to ignore everything from the semicolon to the end-of-line. with nothing about indentation.

13:55 kjellski: Hi there =)

13:56 Someone familiar with the labrepl arround?

13:58 asimjalis: What is labrepl?

13:58 kjellski: There was an example with a "data/words" file. I wanted to get the frequencies of characters in all the words and I´m struggling with the summing part...

13:58 zakwilson: If I have maps of keywords to ints and I want to speed up (merge-with + foo bar), can I do that with type hints? Unchecked math?

13:58 kjellski: labrepl is a project from stuart halloway... it´s ment to explain clojure...

13:58 asimjalis: I asked the same question when it was mentioned on HN -- the README does not say what it is, just how to get it.

13:59 kjellski: Basically it´s a local website with some stuff to play with for leaning and exploring clojure...

13:59 asimjalis: Ok.

14:00 kiras: In vim, the comments are indented as in Programming Clojure...

14:01 asimjalis: kjellski: Ok. Thanks. Your summary should be snuck in somewhere at http://github.com/relevance/labrepl

14:02 kjellski: Excuse me, what does snuck mean?

14:02 chouser: sneak

14:02 sneaked

14:03 asimjalis: Oh, sorry. It should be inserted somewhere at http://github.com/relevance/labrepl

14:03 kjellski: Okay... I´ll try to find a good solution first ;)

14:03 dcnstrct: ,(gen-and-load-class 'my.CoolException :extends Exception)

14:03 clojurebot: java.lang.Exception: Unable to resolve symbol: gen-and-load-class in this context

14:03 dcnstrct: hrmmm

14:04 chouser: gen-and-load-class is ancient -- been gone for ages

14:05 dcnstrct: ahhh damn ancient wikibook confused me http://en.wikibooks.org/wiki/Clojure_Programming/Concepts#User_Defined_Exceptions

14:05 what should I google then ?

14:05 asimjalis: is proxy the current way to do this?

14:05 chouser: proxy is okay except you can't really rely on the classname that it generates

14:06 gen-class is your best option, but it requires AOT compilation.

14:06 hoeck: kiras: when in doubt, consider looking at core.clj :)

14:06 kiras: hoeck: ah... i should have thought of that. ty

14:07 chouser: are you sure you need your own named exception class? I'd recommend looking at clojure.contrib.condition

14:08 hoeck: kiras: in core, I found both ; and ;; for whole-line comments

14:08 kiras: so it's being indented incorrectly in emacs?

14:09 The-Kenny: kiras: ;; is the correct comment for a whole-line comment in my and emacs' opinion

14:09 As far as I remember, ; gets indented wrong by emacs

14:09 (right-aligned)

14:09 dcnstrct: hrmmm now that I think about it there's no reason why I need singly-typed errors. thnx

14:10 kiras: The-Kenny: that's my experience too, but I'm wondering if emacs is right or wrong

14:10 The-Kenny: I think emacs is right. I read about this loose-convention somewhere on cliki.net

14:10 kiras: The-Kenny: since i've seen clojure ; comments formatted the other way too

14:11 The-Kenny: I was told it was correct for elisp, just would like to be sure that it's also correct for clojure

14:12 hoeck: kiras: I guess those are "standard" lisp comment conventions

14:12 The-Kenny: hoeck: I think so too. Saw it on cliki.net somewhere

14:12 asimjalis: I was reading the comments about jobs at the clojure site in a recent conversation here http://clojure-log.n01se.net/date/2009-12-14.html . . .

14:12 hoeck: kiras: eg, see http://norvig.com/luv-slides.ps p. 41

14:12 kiras: as hoeck pointed out, in core.clj ; is not indented to column 40

14:12 The-Kenny: It's also described here: http://www.labri.fr/perso/strandh/Teaching/Langages-Enchasses/Common/Strandh-Tutorial/indentation.html

14:12 kiras: for example:

14:12 ;during bootstrap we don't have destructuring let, loop or fn, will redefine later

14:12 (def

14:12 #^{:macro true}

14:12 let (fn* let [& decl] (cons 'let* decl)))

14:13 asimjalis: The clojure jobs I see here list it as something interesting to have with no expectation that it will be used at the job . . .

14:13 For example, "Interest/experience in interesting languages (Lisp, Scheme, Erlang, Scala, Smalltalk, Haskell, Forth, Clojure)"

14:13 This is from http://sfbay.craigslist.org/sfc/sof/1667187845.html

14:14 kiras: I was just wondering if the same conventions held in clojure... it seems kind of strange that it wouldn't be followed in core.clj of all places?

14:14 asimjalis: Are there companies using Clojure in production?

14:14 How does one find them?

14:16 dcnstrct: if you're good @ clojure and looking for a clojure job in the bay area check out this company

14:16 http://www.runa.com/company/careers/

14:16 they're running clojure in production

14:17 they're the guys who made this http://github.com/amitrathore/swarmiji

14:18 supposidly everything there is in clojure except one rails app.. they use swarmiji in front of hbase to power all their stuff

14:20 if you get the job paypal me 10% of your first 3 months salary for the recuritment fee

14:20 ;)

14:23 hoeck: asimjalis: http://www.infoq.com/articles/deadline-clojure-appengine

14:23 asimjalis: Ok.

14:23 Heh.

14:23 How about 20% -- you're selling yourself short.

14:24 dcnstrct: deal

14:24 * dcnstrct saves the logs

14:27 kjellski: asimjalis: This is my solution... could you have a look wethere there is a better way to do it? http://paste.lisp.org/display/97649

14:30 Blackfoot: is there a way to break out of loops? sometime the like (doseq [foo bar-seq] (if foo (println ok) (break))

14:30 Chousuke: throw an exception

14:31 dcnstrct: clojure.contrib.condition is your friend

14:31 Chousuke: of course, the better way is to filter your sequence so that it is not longer than you need it to be.

14:31 take-while is helpful

14:35 Blackfoot: ok, reading through those, thanks. It is not an exception in the logical sense, but it may work

14:35 lopex: (doseq [x '(1 2 3 4 5) :while (< x 3)] (println x))

14:38 Blackfoot: lopex: perfect! thank you

15:01 Hali_303: what do you use for debugging? nothing I've tried seems to be able to do single stepping or at least tracing

15:03 eg. cc.trace/dotrace is pretty limited (can only instrument functions which are in the form given, but not those which are called within deeper levels)

15:09 opqdonut: yeah

15:09 so I use prns and staring at code

15:13 Chousuke: Java debuggers should work on Clojure.

15:25 zkim: If you're adventurous there's hugo duncan's break stuff: http://hugoduncan.org/post/2010/swank_clojure_gets_a_break_with_the_local_environment.xhtml havn't tried it myself though

15:35 dcnstrct: if a certain function requires Ahead Of Time compilation what does that mean exactly ?

15:35 does it mean I can't start a normal clojure repl and use it ?

15:36 StartsWithK: dcnstrct, yes, you will need to compile the namespace where that function is declared

15:36 and then add compiled version to classpath

15:37 dcnstrct: argg

15:37 does anyone know of a way to work with user definied exceptions in clojure that does not require AOT compilation ?

15:37 asimjalis: What's the specific problem you are dealing with?

15:37 StartsWithK: but fns don't need aot, is there a gen-class in there?

15:37 dcnstrct: I have a function that needs to be able to throw a couple different kinds of exceptions as well as return a value

15:38 I have a gen-class yeah

15:38 asimjalis: Could you just throw Runtime exceptions? Or subclasses of some well-known exceptions?

15:39 dcnstrct: well my original approach was to subclass java.lang.Exception: (gen-and-load-class 'user.UserException :extends Exception)

15:39 but then I found out gen-and-load-class is gone

15:39 I could throw Runtime exceptions

15:40 thats a good idea

15:40 StartsWithK: define all your exceltions in one package, but as java files, and stick http://paste.pocoo.org/show/200563/ something like this in your build

15:40 and your done

15:41 dcnstrct: oh right.. just use java to define the exceptions.. good idea too

15:41 thnx people

15:41 asimjalis: Or you could use proxy and create subclasses of Exception or some special Java Exception that is already defined.

15:45 sattvik: dcnstrct: If you are using Clojure 1.1, proxy may be your best bet, although it is a bit limited. In one project I used both proxy and gen-class within the same namespace so that I could use proxy during development and gen-class for deployment. With Clojure 1.2, you get deftype which is fairly flexible given many of the advantages of proxy and gen-class all in one.

15:47 StartsWithK: but deftype can't extend Exception

15:47 or it can now?

15:49 sattvik: StartsWithK: Hmm.. not sure. I can give it a try.

15:50 StartsWithK: sattvik, i think it can only extend interfaces from java side

15:55 sattvik: StartsWithK: I think you are right.

16:11 TakeV: Hmm, so with Penumbra, is there a trick to making it be an executable jar? Using the standalone, but it still doesn't work.

16:13 StartsWithK: TakeV, not sure about Penumbra, but JLine keeps its native libs inside the jar and unpacks them to temp dir before executing rest of its code

16:13 other options is something like webstart (supports jogl)

16:14 TakeV: StartsWithK: It seems to not be able to find the main class. I didn't know that clojure had main classes. 0_o

16:14 Hali_303: zkim: does that work with swank-clojure in ELPA?

16:14 StartsWithK: TakeV, everything on java must have entry point

16:15 i guess, it is something you will define for your app and not something penumbra provides for you

16:15 TakeV: StartsWithK: How do I do that?

16:16 zkim: Hali_303: Not sure, I wouldn't think so unless the ELPA package is running off of swank-clojure's HEAD

16:16 It's on my list of things to look at though, I was really excited to see that post come across my reader

16:17 StartsWithK: TakeV, define one of your namespaces as (ns my.entrypoint (:gen-class :main true)) and create function named "-main" that takes no arguments in that namespace

16:17 Hali_303: zkim: I see. so println is the best thing I can have now, right?

16:17 StartsWithK: then compile that namespace with clojure.compile

16:17 TakeV: Huh, thanks.

16:17 zkim: Hali_303: AFAIK, yes. JSwat or YourKit might help also

16:18 StartsWithK: other options are, you use clojure.main -e "(require 'my.entrypoint) (-main)"

16:18 Hali_303: zkim: I tried JSwat without any luck a few months ago

16:18 StartsWithK: or custom java launcher

16:19 zkim: Hali_303: yeah, when I was starting out with clojure I was really aware of the lack of debugging tools, and as I've done more and more it hasn't been a big problem

16:19 asimjalis: Is there an easy way to deploy Clojure desktop apps? I created an app and I have it compiled into an uberjar, but my users might not have Java installed.

16:19 TakeV: Lein keeps throwing all kinds of errors now. Hmm...

16:19 zkim: Hali_303: although I'd qualify that with the fact that I havn't done anything really big with the language

16:19 dcnstrct: asimjalis, yes... use jaunch4j

16:20 err launch4j

16:20 StartsWithK: TakeV, can you paste what it is?

16:20 lisppaste8, help

16:20 zkim: Hali_303: off topic, but 303 as in Denver?

16:20 StartsWithK: http://paste.pocoo.org/

16:20 TakeV: Exception in thread "main" Java returned: 1 (NO_SOURCE_FILE:0)

16:21 asimjalis: dcnstrct: Thanks! For a second I thought jaunch4j was the Clojure version of launch4j. I'm looking at it right now.

16:21 TakeV: The rest of the error is quite long.

16:21 StartsWithK: use the paste.pocoo.org

16:22 Hali_303: zkim: no, it is just random string, so my name does not conflict with others

16:22 :D

16:22 TakeV: http://paste.pocoo.org/show/200581/

16:22 zkim: Hali_303: ah, got it :)

16:23 asimjalis: I am almost scared of asking questions because they all get answered -- do I really want to know in some cases?

16:23 zkim: Hali_303: but yeah, I mostly use println and c.c.pprint

16:23 Hali_303: zkim: hm I've not yet used pprint, but looks nice, thanks

16:23 zkim: Hali_303: np

16:25 TakeV: StartsWithK: Would you like me to post my code and project.clj?

16:26 StartsWithK: TakeV, sure, maybe some can spot the error

16:27 TakeV: http://paste.pocoo.org/show/200583/ --- Project.clj is on the top, the source file is on the bottom.

16:28 StartsWithK: what did you use as argument for -e option

16:29 it looks like eval throws the error

16:29 TakeV: -e option?

16:29 StartsWithK: uf, and, just to be safe, use two segment namespace names

16:29 wings.foo

16:30 TakeV: Ah.

16:31 Not sure what the -e option is. Trying to compile it with "lein compile", after running "lein deps" and "lein native-deps".

16:31 StartsWithK: one of the problems i see

16:31 is app/start

16:31 its outside any function

16:31 place that inside your new -main

16:31 as lein compiles the namespace, clojure will execute your code

16:34 TakeV: http://paste.pocoo.org/show/200586/ -- Result of running "java -jar wings-standalone.jar -Djava.library.path=native/linux/x86".

16:37 kzar: What's wrong with this? (for [[x y] (range 10)] [x y]) I'm trying to grab values out of the range in pairs

16:37 opqdonut: , (partition 2 (range 10))

16:37 clojurebot: ((0 1) (2 3) (4 5) (6 7) (8 9))

16:38 opqdonut: that tries to do a destructuring bind

16:38 StartsWithK: TakeV, when you type jar -tf wings-standalone.jar can you see "wings/core.class" file inside your jar?

16:38 opqdonut: , (let [thing [[1 2] [3 4] [5 6]]] (for [[x y] thing] y))

16:38 clojurebot: (2 4 6)

16:39 opqdonut: that's how destructuring works

16:40 TakeV: StartsWithK: No.

16:40 StartsWithK: TakeV, hmm.. did you update :main in your project.clj to wings.core?

16:41 TakeV: Yes. Hmm... let me clean and recompile.

16:42 Huh, still not appearing...

16:42 technomancy: dcnstrct: do you know about clojure.contrib.condition?

16:43 it's much nicer than defining your own Exception subclasses

16:43 StartsWithK: TakeV, same error? and no .class file in jar?

16:43 TakeV: Yes, to both.

16:43 StartsWithK: is there some kind od buld/classes dir in your project

16:43 can you see .class file in there

16:43 TakeV: Yes, there is a dir. But there are no files in there. 0_o

16:45 StartsWithK: TakeV, hmm

16:45 kzar: opqdonut: But what if the 'thing' isn't a vector of vectors, it's just a vector? (let [thing [1 2 3 4 5 6]] (for [[x y] thing] y))

16:45 opqdonut: kzar: then you get an error :)

16:45 kzar: heh

16:45 opqdonut: , (let [thing [1 2]] (for [[x y] thing] y))

16:45 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

16:46 opqdonut: because 1 is not a sequence

16:46 StartsWithK: TakeV, what is compile step saying?

16:46 do you see something like compiling wings.core

16:46 TakeV: The only thing it prints is "All :namespaces already compiled."

16:47 kzar: opqdonut: ah ok I see, but what if I want to take items from the front of a vector each time?

16:47 opqdonut: well one answer is partition

16:47 StartsWithK: TakeV, maybe you then need to add :namespaces [wings.core] to your project

16:48 kzar: opqdonut: Ah sweet I got it working thanks

16:48 StartsWithK: is there a lein user in the house? :)

16:49 it looks compile will search for :namespaces and then skip to some kind of namespace guessing

16:50 by matching file names

16:50 is your file in src/wings/core.clj

16:50 TakeV: No.

16:50 Fossi: yes

16:51 StartsWithK: TakeV, place the file in src/wings/core.clj

16:51 clean and recompile ad you did before

16:52 asimjalis: opqdonut: "for" expects thing to be a sequence of pairs. Try this instead:

16:53 ,(let [things [[1 2] [3 4]]] (for [[x y] things] y))

16:53 clojurebot: (2 4)

16:53 TakeV: Still just printing "all :namespaces already compiled". Also added :namespaces [wings.core] to the project.

16:53 StartsWithK: so you have wings/project.clj wings/src/wings/core.clj

16:53 in your project

16:54 TakeV: Ah, didn't rename it to core. One sec.

16:55 opqdonut: asimjalis: i was demonstrating that fact to kzar :)

16:55 LauJensen: Do we have some clojure wrapper for copying a file ?

16:55 clojurebot: clojurebot has a lot of features

16:55 asimjalis: ok

16:55 TakeV: Oh good, now it's throwing errors again. >_>

16:55 StartsWithK: TakeV, aha add :namespaces :all

16:56 that will search for namespaces by filename matching in your src dir

16:56 technomancy: LauJensen: give two File objects to the copy method in duck-streams

16:56 aka c.c.io

16:57 LauJensen: thanks phil

16:57 technomancy: good old duck-streams =)

16:59 TakeV: http://paste.pocoo.org/show/200598/

17:00 StartsWithK: TakeV, add another ) at the end of your -main

17:00 TakeV: -_-

17:01 StartsWithK: :)

17:01 asimjalis: opqdonut: How could this be done using destructuring recursively in a loop for example instead of using partition?

17:01 opqdonut: sure

17:01 StartsWithK: TakeV, also, its ok to place app/start inside the -main

17:01 opqdonut: there should be a higher-level construct for this

17:02 something like haskell's tails or common lisp's loop :on or mapcdr

17:03 TakeV: Still getting the same error. This is starting to become irritating. :P

17:04 StartsWithK: same error about missing paren?

17:04 TakeV: The EOF thing.

17:04 StartsWithK: TakeV, you are missing one ) at the end of ns too

17:04 TakeV: Oh. >_>

17:04 StartsWithK: :)

17:06 TakeV: http://paste.pocoo.org/show/200599/

17:07 StartsWithK: there is no jlwgl on classpat while you are compiling

17:07 try :native-dependencies [[lwjgl "2.2.2"]] adding lwjgl dep to :dependencies too

17:08 TakeV: In project?

17:08 StartsWithK: yes

17:08 add [lwjgl "2.2.2."] after penubra

17:19 hamza: ,(proxy [javax.swing.TransferHandler] [] (canImport [s] (println "s")) (canImport [c f] (println "c f")))

17:19 clojurebot: java.lang.IllegalStateException: Var null/null is unbound.

17:19 hamza: is it possible to somehow define two canImport calls?

17:20 Crowb4r: Speaking of proxy, is there a good example of using proxy around?

17:43 chouser: hamza: use (proxy [...] [] (canImport ([s] ...) ([c f] ...)))

17:43 StartsWithK: TakeV, any progress?

17:53 hamza: chouser: thanks that worked..

17:53 TakeV: StartsWithK: Not really. :\

17:54 StartsWithK: whats the current error?

17:55 TakeV: StartsWithK: Same as last time. Got some lunch and just got back. :P

17:55 StartsWithK: hehe

17:56 when you type jar -t wings-standalone.jar

17:57 do you see opengl jars inside?

17:58 TakeV: I can't build the jar, as it will not compile.

18:02 StartsWithK: ok, are the opengl libs in your lib/ directory?

18:03 TakeV: Er, it started randomly being able to compile.

18:03 StartsWithK: that is a good sign :)

18:05 danlarkin: I'm drawing a blank, what's the best way to subsection an array

18:05 like subs does to strings

18:05 TakeV: Ok, yeah, the lwjgl and all required libs are in lib.

18:05 danlarkin: Partition?

18:05 StartsWithK: ,(doc subvec)

18:05 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

18:06 StartsWithK: oh, array, System/arraycopy

18:06 danlarkin: ja but an array, not a seq or a vec

18:06 oh there we go

18:07 thanks StartsWithK

18:10 carkh:

18:12 TakeV: Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path (core.clj:1)

18:12 Er...

18:12 Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path (core.clj:1)

18:12 Exception in thread "main" java.lang.ExceptionInInitializerError

18:12 StartsWithK: is your lib path ok?

18:12 TakeV: I don't know. >_>

18:12 StartsWithK: what your lib path?

18:13 TakeV: wings/lib?

18:14 StartsWithK: can you paste "ls -R" from the root of your project

18:15 also, can you try with absolute path

18:16 TakeV: http://paste.pocoo.org/show/200632/

18:18 StartsWithK: TakeV, your java.library.path shoubl be native/<your-os-arch>/

18:20 TakeV: StartsWithK: That is what I am passing to java -jar wings-standalone.jar

18:20 StartsWithK: java -Djava.library.path=native/linux/x86_64 wing-standalone.jar

18:20 ?

18:21 s*

18:21 with the -D prefix and =

18:21 TakeV: Yeah, only x86. 32-bit for the fail. >_>

18:22 Ah, but not in that order.

18:22 Ok, that works!

18:22 StartsWithK: :)

18:23 TakeV: Thank you so very much. :)

18:23 StartsWithK: np

18:32 what is the name of text indexing project for clojure?

18:32 i remeber there was one

18:32 technomancy: lucene works fine

18:33 StartsWithK: caponia :)

18:35 lucene is ~1mb, thats not so bad

18:36 TakeV: Clojure is garbage collected, right? What exactly gets collected, since there are no real variables.

18:37 carkh: there are values anyways, and all the java stuff, and persostent data structures

18:38 hiredman: TakeV: gc doesn't have anything to do with variables

18:38 variables aren't gc, things that are referenced by variables are gc'ed

18:39 if I create a big map of stuff, but don't keep a reference to it, the map is garbage since I can never use it

18:41 asimjalis: You can prod the garbage collector with (System/gc) if you think it's not being aggressive enough.

18:41 rlb: TakeV: ...or if you create a big sequence, reduce it, etc. The gc will collect anything that's no longer reachable, and computations allocate things with limited lifespans all the time.

18:41 asimjalis: ,(System/gc)

18:41 clojurebot: nil

18:41 hiredman: asimjalis: :(

18:41 never do that

18:41 asimjalis: Why?

18:41 clojurebot: why not?

18:42 asimjalis: hiredman: Why not?

18:44 hiredman: it negates the purpose of having a gc

18:44 better to tune heap params

18:45 http://java-monitor.com/forum/showthread.php?t=188

18:45 hamza: AFAIK you can't force java gc to run it will only hint it.

18:45 hiredman: etc

18:54 TakeV: rlb: That makes sense.

18:56 asimjalis: I've found it useful in testing from the REPL to get some idea about the memory footprint of processes.

19:05 I am writing a Clojure library that lets me write Java as sexps and to use defmacro. Any good starting points?

19:06 Here is some code in Common Lisp I am using as a starting point: http://www.keyongtech.com/4689544-how-to-do-java-in#14

19:06 hiredman: why bother?

19:07 I would either just write clojure, or write clojure to generate jvm bytecode via one of the bytecode engineering libraries

19:07 asimjalis: I need to deliver Java for work.

19:07 hiredman: :(

19:08 asimjalis: I know where you are coming from. I might be taking an overly circuitous solution to this problem.

19:08 I could switch jobs. So that's another option.

19:08 carkh: what if someone in your team makes a change to the produced java code ?

19:09 asimjalis: I'll have to quickly backport it.

19:10 carkh: also you'll be debugging java code and correcting lisp code ... this will be annoying

19:10 asimjalis: Or maybe write a Java to Jaja translator that goes backwards (where Jaja is a tentative name for this Clojure-esque Java).

19:10 carkh: error at line 45 which is line 2 of your lisp code

19:11 hiredman: deliver java code that drives a "library" that you provide as a jar

19:11 you can call clojure's eval from java :)

19:12 asimjalis: So I own a whole module at work. No one else modifies it very much. Everyone lives in their own modules. So this kind of thing does not happen very much. Once in a while some small change bubbles across the whole system.

19:13 The problem is that this is a shipping product -- there is not much interest in management to add Clojure to the code-base.

19:13 hiredman: "I'd like to start replacing some of my java with a dsl"

19:13 you've asked?

19:13 asimjalis: Maybe I just suck at selling. Anyway, I made a case and it was politely declined.

19:13 Yes. I actually brought it up with my manager.

19:14 hiredman: :/

19:14 carkh: if yuou leave tha company they need to find someone that will be able to take ownership on your code

19:14 asimjalis: He did say though that if there was a compelling feature that could be done with Clojure that couldn't be done with Java or would be nearly impossible with Java then I'd have a stronger case.

19:15 Yeah. So I see his point. They don't want to turn the code base into a Tower of Babel.

19:15 carkh: well ...closures is one

19:15 and persistent data structures

19:15 asimjalis: What's a customer-facing feature that closures could enable?

19:15 carkh: less bugs =P

19:15 hiredman: "witing java makes work so horrible that I do additional unpaid work creating frameworks to generate java code from nicer languages"

19:16 writing

19:16 asimjalis: This captures my feelings.

19:16 carkh: what language could provide a customer-facing feature that unique to it ?

19:17 hiredman: anyway, java isn't that bad if you just ignore the type system

19:17 do everything via runnables and callables

19:17 asimjalis: He gave me the example of ActionScript which enabled some new flashy UI features that were not possible with JSPs and Javascript.

19:17 hiredman: lots of unsafe casts everwhere

19:18 asimjalis: carkh: He gave me the example of ActionScript which enabled some new flashy UI features that were not possible with JSPs and Javascript.

19:18 carkh: it's not the language but the platform

19:18 asimjalis: True.

19:18 carkh: but yes i see the point

19:20 asimjalis: carkh: So theoretically I don't see how Clojure could provide a concrete user-level feature that Java could not provide. Although I suspect that many features will just be very complicated and hard to write in Java and might be easier in Clojure.

19:20 carkh: So there is a stereotype that Lispy languages are better for AI. Is this really true? Theoretically you can make decision trees and prune them in any language.

19:20 hiredman: well, you'll end up reimplementing clojure

19:21 asimjalis: We are using a C library called SVM-Light for Machine Learning.

19:21 carkh: asimjalis: lisps where used for ai because of garbage collection and list processing ....every other language has that now

19:22 maybe macros played a role too i don't know

19:23 asimjalis: carkh: Yes, it seems like you can do it in Java if you wanted to. Although I still thing the fluidity of design that Clojure gives you will make it easier to converge to a good design and solution. So the development speed and product quality and flexibility might be higher

19:23 hiredman: clojurebot: the evolution of lisp?

19:23 clojurebot: my lisp machine is the jvm

19:23 hiredman: clojurebot: you suck

19:23 clojurebot: Titim gan éirí ort.

19:23 hamza: asimjalis: since in lisp code is data, it is really trivial for lisp programs to read and modify them selfs.

19:24 hiredman: I have a (pdf)copy of some memo from MIT where someone said "I ask for examples of real world uses of lisp, not ai since we all know ai isn't real, but got no responses, so obviously lisp has no real world applications"

19:25 carkh: symbols and keywords word decisive for ai too i think

19:25 word->were

19:25 asimjalis: But things like development-speed and flexibility are so fuzzy.

19:26 carkh: symbols and keyword enable the data is code counterpart to code is data

19:26 asimjalis: carkh: The data drives the code?

19:26 carkh: right

19:26 like hum ...in those html libraries for instance

19:27 asimjalis: hum? Is that a library?

19:27 carkh: you know type this : [:h1 "hello world"] and it gets transofrmed to html

19:27 asimjalis: Right.

19:27 carkh: that's a simplistic example i guess

19:28 asimjalis: Right. I know what you mean about [:html ...]. ("Hum" was just a sound.)

19:28 carkh: ah ...hehe sorry

19:29 asimjalis: The way libraries are being named right now every typo could potentially be a library or project name. Can't be too careful.

19:30 kiras: how do you know about project hum?

19:31 carkh: who doesn't ?

19:32 kiras: i see...

19:33 carkh: http://www.dcs.qmul.ac.uk/research/imc/hum/

19:33 =)

19:34 kiras: lol

19:35 asimjalis: Heh.

19:36 kiras: so is leiningen pretty much the standard build tool for clojure projects at this point?

19:36 The-Kenny: kiras: I think so

19:37 hiredman: there is a very vocal maven faction

19:38 carkh: so i'm the only one using ant i guess =/

19:38 glogic: carkh: i use ant

19:38 carkh: heh

19:38 kiras: heh

19:38 ok

19:38 good to know

19:38 glogic: kiras: ya file that away right

19:38 kiras: lol

19:38 kiras: lol

19:43 glogic: http://en.wikipedia.org/wiki/Cheney's_algorithm

19:43 cheney was a crazy kind of guy

19:44 my head hurts

19:45 asimjalis: I stopped using leiningen because it wouldn't let me easily include a local jar file that was not published on git -- for example see http://stackoverflow.com/questions/2404426/leiningen-how-to-add-dependencies-for-local-jars

19:45 I built using a straight bash script -- yeah it's very old-fashioned

19:47 tomoj: you can just install a jar into your local maven repo

19:47 of course, no one else will be able to build the project, then, unless they also install these jars

20:05 asimjalis: Is clojure being used for machine learning or document classification by anyone?

20:05 Any references would be great.

20:06 hiredman: the big one would be flightcaster

20:06 ~google flightcaster

20:06 clojurebot: First, out of 2160 results is:

20:06 FlightCaster

20:06 http://flightcaster.com/

20:08 tomoj: I heard some of their ml stuff was getting into incanter

20:28 the algorithm I'm implementing uses a global incrementing counter. I was thinking of just using gensym, as all that really matters is that the values are unique, but they need to be unique across jvm restarts

20:28 ideas?

20:29 fairly easy to do the same old incrementing counter with an atom, but you run into trouble across jvm restarts

20:29 carkh: store it in a file =P

20:29 hiredman: uuid

20:30 gensyms are really not that unique

20:30 carkh: tho how slow is it to make an uuid ?

20:31 hiredman: uh, why would it be slow?

20:31 uuidgen 0.00s user 0.00s system 67% cpu 0.006 total

20:31 carkh: i don't know never really looked intop it , surely needs a system call to get time, and maybe another to get mac address ?

20:31 tomoj: reading java.util.UUID

20:33 asimjalis: The mac address requires reading the network card.

20:33 So it is expensive.

20:34 But you could get the UUID once -- and then append your counter to it. So this way it's a one-time cost for the UUID call.

20:34 hiredman: why do you think a uuid includes a mac address?

20:34 tomoj: I can make 10000 UUIDs in 274ms

20:34 plenty quick enough for me

20:35 carkh: Version 1 (MAC address)

20:35 asimjalis: There are 4 classes of UUIDs. If you use the MAC address you guarantee uniqueness. Version 1 uses the MAC address. The others don't. http://en.wikipedia.org/wiki/Universally_Unique_Identifier

20:35 Wait 5, not 4.

20:36 hiredman: the javadocs don't mention mac addresses at all

20:36 carkh: looks like version 4 would be the fastest ?

20:36 asimjalis: This is what Windows does.

20:36 carkh: java's uuid aren't complete

20:36 hiredman: so?

20:36 asimjalis: But it might cache the MAC address so multiple UUIDs might not be that expensive.

20:36 I don't know how it's implemented.

20:36 tomoj: I'm using type 4 (pseudorandom), and I don't care :)

20:37 carkh: anyways, quick enough for tomoj =P

20:37 hiredman: I'm saying who cares about mac addresses if don't need to?

20:37 carkh: well i just discovered that not every uuid uses the mac address =P

20:38 that's why i said _maybe_

20:38 looks like not every uuid uses time either =P

20:38 asimjalis: Although the Wiki says that Java uses Versions 3 or 4: ``Java: The J2SE 5.0 release of Java provides a class that will produce 128-bit UUIDs, although it only implements version 3 and 4 generation methods, not the original method (due to lack of means to access MAC addresses using pure Java).''

20:39 carkh: anyways 10k uuids in 250ms is very slow

20:40 compared to incrementing an integer

20:40 tomoj: sure

20:40 carkh: so it all depends on the use case i guess

20:40 hiredman: persisting + incrementing an integer

20:40 tomoj: but it will allow me to focus on the important stuff for now

21:44 dcnstrct: I finally figured out the bizarre problem I had with lein that was making it never work..

21:44 it boils down to this: don't do sudo lein self-install

21:44 unless you intend on using lein as root

21:44 I don't know why I would have done that anyways... so insecure.. I guess I wasn't thinking

21:45 works great now though :)

21:54 tomoj: dcnstrct: what's wrong with lein self-install?

22:01 _ato: tomoj: he ran it with sudo, so presumably it either installed into /root or messed up the permissions on ~/.m2

22:02 tomoj: oh, I missed the sudo

22:02 of course

22:02 I've been wondering how you might set up a system-wide lein

22:02 Licenser: greetings

22:03 hey _ato I'd wanted to ask for another clojars featre :P

22:03 *feature

22:03 tomoj: lein always uses ~/.m2 ?

22:04 _ato: if you set M2_HOME it'll probably use somewhere else

22:04 Licenser: ok

22:04 Licenser: what's the feature?

22:04 Licenser: _ato: very simple thing, a hash of the current feed.clj.gz so people don't download it twice

22:04 it's more to save clojars bandwith then for compfort :P

22:05 _ato: ah, good idea, I'm surprised that didn't occur to me

22:05 just a sec

22:05 Licenser: well must not be a hash can be anything that identifies if the feed.clj changed

22:07 _ato: it didn't occured to you so it can be a team effort :P

22:08 _ato: http://clojars.org/repo/feed.clj.gz.md5 http://clojars.org/repo/feed.clj.gz.sha1

22:08 tomoj: etag?

22:08 Licenser: _ato: thank you :)

22:13 defn: http://floating-point-gui.de/

22:13 Licenser: _ato: with this I can make add and search automatically check for new versions and get them :)

22:14 greetings defn :)

22:14 defn: hello sir!

22:14 ,(+ 0.2 0.1)

22:14 clojurebot: 0.30000000000000004

22:14 defn: hehe, this is interesting...

22:15 Licenser: that is why floats are evil!

22:15 defn: are you using lein search already? :P I made it specially for you!

22:15 _ato: tomoj: yeah good point, I should make it only touch the file when it actually differs, then the etag and last modified will be correct as well

22:15 chouser: ,(+ 2/10 1/10)

22:15 clojurebot: 3/10

22:16 defn: chouser: oh of course! i didn't consider clojure's rationals.

22:16 chouser: either way i was interested as I didn't know about this problem tbqh

22:16 chouser: the latest edit of JoC looks great btw

22:16 clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

22:17 defn: Licenser: where do i go to get lein search?

22:17 is it in the main repo?

22:17 Licenser: defn: add [lein-search "0.2.0"] to your dev deps :)

22:17 defn: ooo!

22:17 Licenser: :)

22:17 chouser: defn: great, thanks. should be a substantial treatment of floating point numbers in there.

22:18 Licenser: JoC

22:18 defn: chouser: excellent. also i love your dr. seuss quote in there -- the one about beetle battle muddle...something like that

22:18 Licenser: ?

22:19 defn: Licenser: Joy of Clojure -- chouse and fogus' book

22:19 Licenser: oh

22:19 is it out?

22:19 defn: the first 5 chapters are so far

22:19 chouser: defn: yeah, fogus found that quote -- fit perfectly.

22:20 Licenser: it is open source or is there like a pre purchase preview?

22:21 defn: pre purchase preview

22:21 Licenser: can someone give me a link? I am curiose :P

22:21 defn: of course -- one second

22:22 http://www.manning.com/fogus/

22:22 chouser: Licenser: http://joyofclojure.com/

22:22 Licenser: I mean of the purchase page not the preview of caus

22:22 thanks mates

22:23 defn: chouser: im really excited for the types,protocols, and reify section, and the concurrency /mutation idioms section

22:23 the descriptions of "when to use..." make me most excited i think

22:24 Licenser: neat

22:24 chouser: defn: I'm working on the types,protocols, and reify right now. The hard part, as always, is coming up with good examples.

22:25 Licenser: Neat

22:26 defn: chouser: i hope i dont presume too much but i am somewhat curious about using examples from JoC in my walton project. Obviously, as you just said, finding good examples is incredibly time consuming. Are there restrictions that preclude my use of the examples in JoC or Stuart's book, for instance? Is it a matter of EPL? The publisher?

22:34 asimjalis: I am reading the first chapter (the free preview). Looks pretty interesting. Looking forward to it.

22:34 What is the Walton project?

22:35 Licenser: walton is an awsome project to let you find example code

22:35 defn: http://github.com/defn/walton , http://getclojure.org:8080/examples/let (replace let with whatever function you'd like examples for)

22:35 Licenser: you are too kind

22:35 :)

22:36 Licenser: and I didn't even start :P

22:38 chouser: defn: standard copyright rules, whatever that means in your case.

22:38 Licenser: defn: it gets cooler and cooler

22:40 chouser: defn: actually, I think the source snippets from Halloway's book are all open source on github

22:41 I don't think ours are yet, though that's something I suppose we should look into.

22:46 Licenser: neat neat!

22:47 is there something like tree-map I missed?

22:52 hmm is there a way to 'appy' things to a form

22:52 ?

22:54 I'd need to do something like (apply . object method args)

22:54 hmm defn I just had an idea for walton

22:55 since you use click to expand count the clicks on every string and sort them by the number of clicks :)

22:56 chouser: Licenser: if you don't know the number of args at compile time, you can use Reflector.

22:56 Licenser: with a special form?

22:57 chouser: no, for a method call

22:57 Licenser: or instead of .

22:57 chouser: right

22:57 Licenser: ah sneaky sneaky

22:57 thank you chouser

22:57 chouser: there's nothing like apply that would work for arbitrary special forms.

22:57 Licenser: geez clj-sandbox will be slow :P

22:57 hiredman: you can always use eval to generate a function that does what you want

22:58 chouser: yeah, that's a good idea too

22:58 Licenser: hmm true too and a very neat idea hiredman :)

22:58 sweet!

22:59 but is this save or am I opening up a hole *ponder*

23:00 hiredman: if you wanted to be safe you shouldn't have left home this morning

23:00 asimjalis: chouser: I tried (infix 1 + 2 + 3) and it didn't work. Where is this defined?

23:00 ,(infix 1 + 2 + 3)

23:00 clojurebot: java.lang.Exception: Unable to resolve symbol: infix in this context

23:01 chouser: asimjalis: infix is defined only in the book. It's just an example, not really meant to be used.

23:01 asimjalis: ok

23:02 Licenser: hiredman: I am sitting in my bed :P

23:02 asimjalis: Okay. I just saw that. It was on the next page.

23:03 chouser: asimjalis: ah. yeah, sometimes the example usage comes before the code.

23:04 defn: Licenser: lein search is awesome! thank you!

23:04 Licenser: defn: :) thank _ato too he's done a hell lot on the clojars side to make it happen

23:05 defn: _ato: thanks much for the work on lein search -- it's a very helpful utility

23:05 Licenser: defn: it makes it more gem like I feel :P at lest there is something neat as search and add now

23:20 well time to go to work see you alter people

23:20 *later

23:24 asimjalis: See ya.

23:25 Clojure is such a dangerous addiction. I almost wish there was a kind of warning label on it. You might not be able to go back to programming as usual after this.

23:25 It's too late for me now.

23:25 Also I am half-joking (obviously).

23:28 Maybe this is the difference: When I am programming in Java for a while now I have resigned myself to the realization that almost all code is one-off -- it doesn't matter how it's designed it won't be reused. But with Clojure I feel like the code is always so general that I can't imagine not reusing it again. It feels a lot more valuable somehow.

23:30 glogic: asimjalis: what's usual?

23:31 asimjalis: i'm concerned i can't go back to programming unusual

23:31 SirNick: Is there anyway to setup lein so that it works something like fsc, Scala's fast compiler, so the startup for the compiler doesn't take so long?

23:32 glogic: when people ask "what's your favorite compiler implementation" i'm going to jsut start saying "Eclipse!"

23:32 * glogic makes a bad pun

23:32 glogic: feel free to replace eclipse with whatever your favorite huge code generator / editor is

23:34 IDE etc..

23:35 asimjalis: The code bloat creates two problems: (a) it takes a lot of time to create it (b) it hides the essense of what's going on -- in Eclipse I constantly feel like I am looking for a lost child in a mall.

23:36 glogic: asimjalis: aren't you?

23:36 asimjalis: maybe, Eclipse makes you feel like you ARE the lost child in the mall

23:36 lol

23:36 asimjalis: Yes. The child is my train of thought. It's so interruptive.

23:37 albino: lost child looking for parentage?

23:37 glogic: this was pretty awesome btw: http://www.pidjin.net/2010/04/11/stop-me-if-i-can/

23:40 asimjalis: That's funny.

23:41 glogic: asimjalis: right

23:43 asimjalis: How to I mention on my resume that I only want to work with Clojure without sounding like some kind of a moron. What's a polite way to say this?

23:43 glogic: asimjalis: say you'er a java programmer, just fail to mention you program java by way of Clojure

23:44 asimjalis: It sounds kind of fanboy-ish and immature. I've always listed the languages I've programmed in.

23:44 I think it is fanboy-ish and immature if it was said about any other language. But Clojure needs to be an exception.

23:45 I realize this is all very inconsistent. Hence my dilemma.

23:46 glogic: i think the simplest thing is to do what you've always done, but add Clojure, then in interviews it will make an interesting conversation piece, which you might be able to convince new people to also use Clojure

23:46 adding it to your list ofp rogramming languags will make you sound interesting (as lame as that sounds)

23:47 tomoj: I happened to mention clojure only to discover that my CTO loves it and had done SICP in clojure

23:47 glogic: see there you go

Logging service provided by n01se.net