#clojure log - Jun 04 2009

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

0:00 durka42: i believe your paste but cannot duplicate the results

0:00 even running with -server

0:00 hiredman: that may just be how hotspot works

0:01 durka42: do you know what the command to run java is?

0:01 hotspot is spooky, by definition :)

0:01 stuhood: ~source time

0:02 arohner_: I'm calling just "java -cp ..."

0:02 I guess I should use -server

0:02 let's see if it still happens...

0:02 hiredman: arohner_: what is your java -version?

0:02 arohner_: llen@hydra:~$ java -version

0:02 java version "1.6.0_0"

0:02 OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu7)

0:02 OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)

0:02 ubuntu 9.04 64-bit

0:03 durka42: hmm, openjdk

0:03 hiredman: arohner_: looks like you are already running the server vm

0:04 arohner_: oh, right

0:04 durka42: i have b7, so maybe there's new stuff

0:05 er

0:05 build 1.6.0_07-b06

0:08 hiredman: those version numbers don't appear to be comparable

0:09 icey: not to change subjects or anything, but the dead tree version of programming clojure turned out REALLY nicely

0:16 arohner_: empirically, it takes the JVM about a second to throw away the optimizations

0:16 i.e. (do (dotimes [i 10] (perf-test) (Thread/sleep x) (dotimes [i 10] (perf-test)))

0:17 if x is less than 1000, there is no loss in performance

0:20 ezyang: Why does clojure have set/select instead of set/filter?

0:23 hiredman: hmmm

0:23 I have b10

0:25 * durka42 wonders if there are update packages for os x somewheres

0:25 hiredman: I just rebuilt openjdk using openjdk

0:27 arohner_: durka42: there is

0:27 they're behind the ADC login

0:27 kjata:~ arohner$ java -version

0:27 java version "1.6.0_13"

0:27 Java(TM) SE Runtime Environment (build 1.6.0_13-b03-206)

0:27 Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-82, mixed mode)

0:27 that's on my OSX box

0:32 durka42: arohner_: thanks, i'll check it out

0:32 tomorrow

0:32 * durka42 goes to bed

0:49 ataggart: ,(instance? Object "")

0:49 clojurebot: true

0:51 ataggart: (doc seq?)

0:51 clojurebot: "([x]); Return true if x implements ISeq"

0:55 ataggart: (doc sequential?)

0:55 clojurebot: "([coll]); Returns true if coll implements Sequential"

0:55 ataggart: (sequential? [])

0:55 ,(sequential? [])

0:55 clojurebot: true

0:55 ataggart: ,(sequential? "")

0:55 clojurebot: false

0:59 hiredman: strings are java strings so there is no way to open them up and have them implement clojure interfaces

1:00 ataggart: ya, but they're seqable, so I was just playing to see if sequential? applied

1:00 reading the google groups stuff

1:00 hiredman: they are sequable because seq knows how to make sequences from them

1:00 ataggart: yup

1:01 just seeing if that predicate applied or not

1:01 it doesn't. I have no opinion on it, just playing

1:01 hiredman: ,(ancestors String)

1:01 clojurebot: #{java.lang.CharSequence java.io.Serializable java.lang.Object java.lang.Comparable}

1:01 ataggart: oh wait

1:02 ,(map str "hello")

1:02 clojurebot: ("h" "e" "l" "l" "o")

1:02 ataggart: well

1:02 is that map being clever and I really do need to call (seq "foo") is I want to use a strign as a seq?

1:03 hiredman: most sequence functions call seq on their arguments

1:03 ,(first "hello")

1:03 clojurebot: \h

1:03 ataggart: ya, just looked at the source

1:03 that's probably a good habit to get into

1:03 instead of assuming one is being passed a seq

10:13 Chouser: ,(expression-info '(+ 5 (float 10)))

10:13 clojurebot: {:class java.lang.Number, :primitive? false}

10:13 Chouser: ,(expression-info '(+ (float 5) (float 10)))

10:13 clojurebot: {:class float, :primitive? true}

10:38 kefka: ,(+ 1 2 3)

10:38 clojurebot: 6

10:38 kefka: (Just making sure I'm connected.)

10:39 Chouser: kefka: Beware -- this may be just a halucination.

10:43 ozzilee: I'm trying to write a macro that outputs a (POST "url" ...) form inside of defroutes in Compojure, and I'm hitting a wall. The macro is trying to resolve "params" which is only bound inside POST, after the macro is expanded.

10:43 I'm not even sure where to go from here.

10:44 Chousuke: ozzilee: show what you have for now.

10:45 Chouser: ozzilee: http://clojure-log.n01se.net/macro.html

10:47 ozzilee: Ok, let me simpify it a bit first...

10:47 Chousuke: Chouser: maybe you should submit that thing to the lisppaste folks so they can add it to the site :D

10:59 lisppaste8: ozzilee pasted "resolution" at http://paste.lisp.org/display/81354

11:00 ozzilee: The macro itself is fine, except that params is a voodoo variable from compojure that I'm not sure how to deal with.

11:00 Chouser: ah! try ~'params instead of plain params

11:02 chillitom: guy's is there a way I can download the online documentation so I can work offline?

11:02 Chouser: chillitom: for api stuff, you can just use 'doc' and 'find-doc' in the repl. You want the other pages too?

11:05 chillitom: as much as I can get

11:05 any good pdf's or tutorials you can point me at would be great too

11:06 ozzilee: Chouser: No dice, it's still trying to resolve params somewhere.

11:06 Chouser: user/POST is a bit odd -- isn't POST a macro or something in a compojure namespace?

11:07 Chousuke: do you have it required? :)

11:09 ozzilee: Wait, nevermind that did work. I did '~params instead of ~'params.

11:09 I was using `~ somewhere else and didn't read your suggestion closely enough. That's something else entirely.

11:10 Chousuke: ~'foo is generally bad in macros but sometimes you need it.

11:10 clojurebot: 'Sea, mhuise.

11:10 Chousuke: oops

11:10 Chouser: heh

11:11 clojurebot: foo?

11:11 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

11:11 Chouser: oh, my.

11:11 clojurebot: ~'foo?

11:11 clojurebot: excusez-moi

11:11 Chouser: hm

11:11 Chousuke: ~'foo

11:11 clojurebot: 'foo is generally bad in macros but sometimes you need it.

11:11 Chousuke: clojurebot: forget 'foo

11:11 clojurebot: I forgot 'foo

11:12 Chousuke: it's good that it looks ugly so whenever you see ~'foo in a macro you know to stop and reconsider whether it's really needed.

11:13 ozzilee: It's basically a trick to stop Clojure from trying to resolve the symbol, yes?

11:13 Chousuke: yeah

11:13 thus causing the macro to be nonhygienic

11:13 or whatever the fancy word was.

11:15 * ozzilee has a short Scheme flashback and is once again thankful for Clojure's macro system.

11:15 Chousuke: anaphoric! that's it.

11:16 ozzilee: I don't think that's quite it. I'm not sure if it's nonhygenic either, but whatever it is is necessary for anaphoric macros, but not necessarily anaphoric myself. I think :-)

11:17 Chousuke: well, the macro "overrides" a name in the environment

11:18 which is difficult to do by accident thanks to syntax-quote resolving names by default and let refusing to bind to fully qualified names.

11:18 ozzilee: Yeah, variable capture. There might be a fancier word than that.

11:19 I think nonhygenic is probably it.

11:21 Chousuke: http://coding.derkeiler.com/Archive/Lisp/comp.lang.lisp/2005-05/msg00548.html this is informative

11:22 ozzilee: be sure to remember to document that "params" is bound to something within your macro.

11:22 * ozzilee feels informed now

11:23 ozzilee: Chousuke: Indeec.

11:24 *indeed.

11:28 ezyang: In the api docs, what does args* mean?

11:29 Also, what does the ampersand mean?

11:31 ozzilee: ampersand means "collect at the rest of the args in a seq and call them this"

11:32 ezyang: Ok, so it's sort of like Haskell's x:xs

11:32 ozzilee: (fn [x & ys]) will take any number of args, with everything after the first one collected in ys.

11:32 ezyang: Yeah.

11:32 ezyang: What about the asterisk

11:33 ozzilee: I think it means optional arguments, but it's not clojure syntax. Just a shorthand for the docs.

11:33 ezyang: Savvy.

11:35 If I have something like ([] (expr)), what does that do?

11:35 Chousuke: where is it? :)

11:35 ezyang: I don't understand how the vector can be applied

11:35 It's a defn named run-tests

11:35 Chousuke: it's an overload

11:35 you can have multiple arities with defn

11:36 Chouser: ah! the other place were the thing at the head of a list isn't called

11:36 ezyang: Why does clojure like calling its parameters "arities"? :-)

11:37 Chousuke: ezyang: because I didn't mean parameters

11:37 [x y z] <- x, y an z are parameters, the arity is 3

11:37 multiple parameters, one arity :)

11:37 ezyang: kk :-)

11:39 Chousuke: (defn foo ([x] x) ([x y] (+ x (inc y)))) <- multiple arities

11:39 Chouser: where's the other place? :/

11:39 ezyang: Ok, so what's confusig me, then, is that the first overload is [& namespaces]; doesn't the ampersand make namespaces optional?

11:39 Chousuke: yes.

11:40 it could be empty

11:40 ezyang: But then, I have another overload that is []

11:40 Chousuke: yeah, that's for the case when it IS empty.

11:40 ezyang: And it seems to me that the second one would never be seen

11:40 Chousuke: well, it's picked when you actually have a namespace :)

11:40 ezyang: Huh. Then wouldn't ([namespace] (expr)) work?

11:41 Chousuke: that would only allow one parameter.

11:41 ezyang: Oh... then I don't know what & means

11:41 Oh man, I thought it was [namespaces &], but it's actually [& namespaces]

11:41 Ok, makes perfect sense now

11:42 Chousuke: (let [[a b & xs] [1 2 3 4 5 6 7]] [a b xs])

11:42 ,(let [[a b & xs] [1 2 3 4 5 6 7]] [a b xs])

11:42 clojurebot: [1 2 (3 4 5 6 7)]

11:42 Chousuke: I always forget that

11:42 note that the & foo parameter is a *lazy* sequence

11:42 ezyang: Perfect.

11:43 I have another question, now: what's the difference between bindings and let?

11:43 s/bindings/binding/

11:43 Like, I understand that their method of operation is different, but I wonder if that results in a functional difference

11:43 (pun not intended)

11:44 Chousuke: let binds a name/var in the lexical context to a value. binding binds it in a thread-local dynamic context.

11:45 ezyang: Oh, and lexical context isn't necessarily equivalent to thread-local?

11:46 ozzilee: For example, you could re-bind println to do something else, and every call to println, even in code in another function, would use that new definition.

11:46 Chousuke: so if you have a global var x bound to 5, use it in a function foo, the (let [x 1] (foo)) will return whatever foo returns when x is 5, but (binding [x 1] (foo)) will return whatever foo returns when x is 1

11:47 yeah

11:47 hmm

11:47 ozzilee: let only binds things you can see, binding binds things everywhere.

11:47 ezyang: neat

11:47 Chousuke: binding has some gotchas with lazy evaluation though

11:48 ezyang: I can imgaine

11:48 *imagine

11:48 Monkeying around with global state, naughty naughty

11:48 Chousuke: ,(let [x 1] (binding [x 5] (map #(+ x %) [1 2 3 4 5])))

11:48 clojurebot: java.lang.Exception: Unable to resolve var: x in this context

11:48 Chousuke: hm

11:48 I guess it doesn't work with let-bound stuff

11:49 aravind: I'd like some general advise about clojure web frameworks. I know of compojure and webjure. Are there any other? I really, really don't like writing html or anything to do with html.. so I was wondering if there was anything similar to weblocks in clojure?

11:49 ezyang: That's... odd.

11:49 ozzilee: Chousuke: No, it has to be a top-level var, afaik.

11:49 ezyang: ,(binding [x 5] (map #(+ x %) [1 2 3 4]))

11:49 clojurebot: java.lang.Exception: Unable to resolve var: x in this context

11:49 ezyang: Ok.

11:49 Chousuke: ezyang: and it's thread-local monkeying, so it's fine.

11:50 ,(declare x)

11:50 clojurebot: DENIED

11:50 ezyang: Chousuke: heh

11:50 Chousuke: damn

11:50 ezyang: Cute. :-)

11:50 Chousuke: there are ways to circumvent it though.

11:50 ozzilee: aravind: I use compojure, I don't know of anything beside those two. There isn't anything as abstract as, say, Seaside. I haven't used weblocks.

11:50 Chousuke: ,(intern *ns* 'x 1)

11:50 clojurebot: DENIED

11:51 * ozzilee is pretty sure let vs binding is static scope vs dynamic scope, but he could be wrong.

11:51 aravind: ozzilee: weblocks has a bunch of cool features, but I'd willing to settle for anything that gets html away from me!

11:51 danlarkin: let is lexical scope

11:52 ozzilee: aravind: Yeah, there's no web ui library as far as I know. Compojure has an html macro: (html [:html [:head [:title "Title"]] [:body [:h1 "Hi"]]])

11:52 But it's still html, just a different syntax.

11:52 Chousuke: ~def intern

11:52 ozzilee: danlarkin: But is binding dynamic scope, or something else entirely?

11:53 danlarkin: ozzilee: yup, dynamic

11:53 aravind: ozzilee: yeah, I was afraid I'd end up having to write html :(

11:53 Chousuke: ,(clojure.lang.Var/intern (the-ns *ns*) 'x 1)

11:53 clojurebot: DENIED

11:54 Chousuke: I wonder if hiredman made it use a whitelist instead of a blacklist

11:54 danlarkin: aravind: there's my (very) immature web platform, madison... http://github.com/danlarkin/madison/tree/master

11:54 ozzilee: aravind: You could always look into one of the high-level javascript frameworks, not sure if you really gain a lot by going that way though. Still not pure clojure code.

11:56 aravind: danlarkin: do you have any example pages that show how I'd write code to say display a struct?

11:56 Chousuke: ,(binding [+ -] (map + [1 2 3 4 5]))

11:56 clojurebot: (-1 -2 -3 -4 -5)

11:56 ozzilee: SproutCore, Dojo, that's Cocoa-esque one that I forget the name of. Probably all more complex than you want.

11:57 aravind: ozzilee: so java should have some web frameworks to abstract away the html part, but I don't know enough about compojure to know if I can hammer those on top of it.

11:57 Chousuke: ,(let [a (binding [+ -] (map + [1 2 3 4 5]))] a)

11:58 clojurebot: (-1 -2 -3 -4 -5)

11:58 Chousuke: hmm. now I can't figure out the situation where that return just (1 2 3 4 5) :/

11:58 +s

11:59 aravind: ozzilee: I am really only beginning to think of the web frameworks to display my data, so I am still in the research phase :)

11:59 danlarkin: aravind: it's really light on documentation/examples ATM. It's pretty simple though... you won't really get to avoid HTML though... unless you want to return text/plain

11:59 Chousuke: ,(let [a (future (binding [+ -] (map + [1 2 3 4 5])))] @a)

11:59 clojurebot: (-1 -2 -3 -4 -5)

12:01 aravind: danlarkin: ah okay, my goal is to find out a way to have some java library or framework to display my data and take care of providing edit fields, submit button etc.. I really really liked weblocks for that, but its in cl.. so that killed it for me.

12:01 ozzilee: aravind: You should be able to get compojure to work with a java framework... or skip compojure and just wrap the java framework by itself.

12:02 aravind: ozzilee: wait.. are you saying I could use something like say spring, and make it play nice with clojure?

12:03 ozzilee: aravind: I don't see why not. Clojure's java-interop is pretty good.

12:04 aravind: hmm.. that's something I hadn't considered before..

12:06 ozzilee: aravind: I've never been happy with html-generators for very long. I always want to twist them in some way they weren't meant to be twisted :-) The html for forms and such should be pretty simple, unless you get into fancy javascript things.

12:08 aravind: ozzilee: I am very happy to use the stock stuff and leave the css, layouts, colours, etc.. for people with more skill than I have.

12:09 would you know if webjure is any more pliable than compojure for this sort of html-generator integration?

12:10 ozzilee: aravind: No, I haven't used webjure. Compojure should be fine, it can just serve up whatever html string/stream gets generated.

12:11 Actually, now that I think of it, compojure has some helpers that might do most of what you need.

12:11 Things like (unordered-list ["foo" "bar" "baz"]).

12:12 aravind: oh nice

12:12 Chouser: have you guys looked at enlive?

12:12 ozzilee: Chouser: Deeply :-)

12:12 Chouser: ok, good.

12:13 I haven't yet, but it sounds yummy.

12:13 as does lunch, come to think of it. bbl...

12:13 * aravind looks at it

12:13 ozzilee: Chouser: I'm still stumbling my way through the syntax a bit, but the idea seems sound.

12:14 aravind: It's probably not quite what you're looking for. It's for starting with hand-written html and transforming it in code.

12:14 The opposite of what you want, actually :-)

12:14 aravind: heh, thanks :)

12:15 ozzilee: aravind: Here you go, compojure's form helpers: http://github.com/weavejester/compojure/blob/551b30350ca741c8b53042fdc5de1c5231459251/src/compojure/html/form_helpers.clj

12:16 aravind: ozzilee: sweet.. I see the magic words "Functions for generating HTML forms" :)

12:16 ozzilee: aravind: Enlive would be nice if you had designers creating a template and you needed to stick some html into the middle of it. It won't help in generating the html for you, though. At least, afaik.

12:17 aravind: Good deal, and good luck. I haven't played with that yet.

12:17 aravind: ozzilee: very cool, thanks for the pointers.

12:18 * aravind would be content having folks run a shell script to look at the address book, but people want html for everything these days!

12:19 ozzilee: aravind: No problem, any time. I'm not on here nearly as much as I should be, but you can get me at ozzi@ozzilee.com if you want, I do a fair bit of web-related clojure stuff. So do a lot of other people in here, though :-)

12:19 aravind: thank you!

12:29 cemerick: isn't the real draw of enlive that you can use html emitted by e.g. dreamweaver, and just populate the data you need? It doesn't have to be 'hand written' by any stretch AFAIK.

12:44 ozzilee: cemerick: Yes, that too.

12:44 But it still won't help you generate a form from a map.

12:44 For example, afaik.

12:46 cemerick: huh, I thought you could inject arbitrary html if you so desired

12:46 ozzilee: I should have said pre-written instead of hand written.

12:46 cemerick: Right, but it doesn't create the html. It could inject "<ul><li>foo</li></ul>", but it wouldn't generate that from ["foo"].

12:47 aravind: cemerick: yup, it looks like thats what it does, lets you use pre-existing html with your code. I wanted something to generate all the html for me.

12:47 ozzilee: Unless he's added in some html generation capabilities that I don't know about, of course.

12:48 * ozzilee is off to lunch, back after.

13:18 cemerick: am I misreading things, or is there no sorted-set-by? The necessary constructor in PersistentTreeSet is package-private.

13:23 Chouser: cemerick: http://code.google.com/p/clojure/issues/detail?id=76

13:28 stuartsierra: Anyone feel excited about a new string library?

13:28 Chousuke: looks neat.

13:28 stuartsierra: Chousuke: thanks

13:30 Chousuke: it's a shame that the string-specific partition etc. can't be made transparent, though :/

13:30 stuartsierra: Yeah, but unless core goes heavy into multimethods, which would kill performance, that can't happen.

13:31 Chouser: what string library are we talking about?

13:31 stuartsierra: c.c.str-utils2

13:32 replaca: I'm excited that the autodoc picked it up right (which it didn't do for fnmap)

13:32 clojurebot: for is not used enough

13:33 replaca: stuartsierra: can you put arglist metadata on the multimethods when you get a chance? Clojure doesn't do that automatically.

13:33 stuartsierra: replaca: sure

13:34 replaca: autodoc only got about 1/4 of the definitions.

13:35 replaca: stuartsierra: really? thanks for pointing it out. There's something weird going on there. Time to debug! (But I can't do it right now.)

13:35 stuartsierra: no worries

13:35 replaca: Everyone, please let me know if you see the autodoc not working right! I promise I'll fix it :-)

13:36 * stuartsierra is stepping out for lunch

13:36 Chouser: the value of the replace multimethod over String.replace() is performance?

13:38 hiredman: uh, really?

13:39 Chouser: dunno, that's why I asked.

13:40 pragdave: Greetings. I was wondering if you folks would care to criticize my first foray into Clojure. I implemented Havil's analysis of The Impossible Problem (a math puzzle)

13:42 lisppaste8: pragdave pasted "First attempt at a solution to the "Impossible Problem"" at http://paste.lisp.org/display/81369

13:50 stuartsierra: Chouser: no, flexibility. the replace multimethod accepts a function for the replacement

13:53 ozzilee: pragdave: Looks pretty darn good to me. The code, anyway. I'll have to trust you on the math :-)

13:54 pragdave: ozzilee: thanks. I don't like the code that removes pairs with duplicae products and sums. I just know there has to be a better way

13:54 ozzilee: pragdave: You're talking about pairs-with-unique-result ?

13:54 pragdave: yes

13:55 ezyang: What does #^String at the beginning of an arguments list for a defn mean?

13:56 ozzilee: Hmm. The recursion could be an issue, as clojure doesn't optimize tail recursion. Let me take a crack at it.

13:56 stuartsierra: ezyang: type hint for the Clojure compiler, to prevent reflective calls

13:56 ezyang: Savvy.

14:02 ozzilee: pragdave: How about (values (zipmap (map function pairs) pairs))? Create a map with the results as the keys and the pairs as the values, which will necessarily only include unique keys (results), then take the values (pairs).

14:06 lisppaste8: Chousuke annotated #81369 "simplified and using recur" at http://paste.lisp.org/display/81369#1

14:06 Chousuke: I hope that works

14:07 mrsolo: M-x slime-edit-definition explodes on me..anybody else seen this?

14:09 lisppaste8: hiredman annotated #81369 "as long as everyone else is doing it" at http://paste.lisp.org/display/81369#2

14:10 hiredman: basically the same as Chousuke's

14:10 even the double ifs and the let

14:11 cemerick: Chouser: do you keep a stack of patches to clojure, etc. in git only locally, or do you also push those patches to some remote git repo as well?

14:13 Chouser: cemerick: I'm not currently maintaining a git branch. the patches that I've produced that aren't in the main svn are either attached to issues or (for clojurescript) checked (as a patch!) into contrib.

14:15 * ozzilee did not fully understand the problem. Hrm.

14:15 alrex021: (defn get-lower [s] (apply str [filter #(Character/isLowerCase %) s])) ... This function is suppose to return a string of all lower case characters in a given string. I get back "clojure.core$filter__4465@d5e6dauser$get_lower__1792$fn__1794@4a25abABCdef". What's missing, if anything? (Learning clojure :-))

14:15 cemerick: ah -- then perhaps what I'm trying to do isn't reasonable. I'd like to git-clone the clojure svn, push some changesets on top of the particular rev we want to track for a while, and then push the whole thing to our gitosis. Unfortunately, the svn info doesn't seem to get carried along when I push.

14:15 * cemerick looks for the "do what I want" button

14:16 pragdave: ozzilee: I think that returns the first pair for each distict (function a b), rather than pairs with unique values for (function a b)

14:17 Chouser: alrex021: use parens instead of square brackets around get-lower

14:17 sorry, around filter

14:18 lisppaste8: hiredman annotated #81369 "using reduce" at http://paste.lisp.org/display/81369#3

14:18 alrex021: Chouser: thank you

14:19 Chouser: alrex021: scheme background? square brackets in Clojure have very specific meaning that is different from parens.

14:20 pragdave: hiredman: Ithink your solution does the same thing--returns onr pair per unique result, rather than pairs that have a unique result

14:21 hiredman: pragdave: eh?

14:21 ozzilee: pragdave: Yup, we both got it wrong :-)

14:21 pragdave: (pairs-with-unique-result * [[1 2] [2 1] [3 4] [3 3] [2 6]])

14:21 should return ([3 3])

14:22 because no other pair has a unique result

14:22 alrex021: Chouser: "scheme background?" No, its actually an example that I saw but the example was in an low quality image.. so couldn't make out if it was square brackets or parens.

14:22 Chouser: alrex021: ah. I believe scheme (or some schemes, anyway?) allow parens and square brackets to be used interchangably.

14:23 alrex021: Chouser: ouch thats confusing (if interchangably)

14:24 Chouser: is parents though suppose to represent a list or a form of grouping blocks of code, or both?

14:24 ezyang: Does clojure do "The Right Thing" with decimal literals?

14:24 Chousuke: alrex021: parens always represent a list

14:25 alrex021: Chousuke: ok, I see. thx

14:26 Chouser: alrex021: a list can represent a function call, a block of code, or something along those lines ...when evaluated.

14:26 Chousuke: alrex021: in clojure, () means lists, [] represents a vector, {} a map, and #{} a set. Clojure code is made of these things :)

14:26 alrex021: the lists, vectors, maps and sets I mean, not the characters.

14:26 lisppaste8: hiredman annotated #81369 "corrected reduce" at http://paste.lisp.org/display/81369#4

14:27 alrex021: Chousuke: yup, it took me a few days to get my head around that concept that in Clojure...data sets rule :)

14:28 Chousuke: I wonder what clojure would look like with an xml-based syntax :/

14:28 hiredman: Chousuke: ssshh

14:28 ezyang: xslt?

14:28 alrex021: Chousuke: I read the Programming Clojure book... and will read it again as things are certainly making more sense now. Coming from an OOP background for many years with no exposer to FP, its mind blowing :)

14:29 Chousuke: <list><atom val="+" /><atom val="1"/> <atom val="2"/></list>

14:29 not nice.

14:29 hiredman: erm

14:29 Chouser: alrex021: welcome! it keeps being fun. :-)

14:29 hiredman: it'd be like <double val="">

14:29 Chousuke: oh, right.

14:30 <list><symbol val="+" /><number val="1"/> <number val="2"/></list> <- corrected

14:31 still, all you need is a reader for the xml-based syntax and you'd be able to write clojure in it ;/

14:32 rabidsnail: Here's a puzzler. If I have a clojure hashmap whose values are SoftReferences, and one of the values gets garbage collected, does contains? on its key return true or nil?

14:33 Chouser: true

14:33 * Chouser guesses

14:34 pragdave: hiredman: that's funny. My first solution used a hash, and I rejected it because I thought I was being too Ruby-like

14:36 Chousuke: purist lispers might disagree, but with clojure it's idiomatic to make full use of the available data structures ;)

14:37 ezyang: I come from scheme, and I like the fact that clojure has good data structures

14:37 No more cons'ing down the list :-)

14:41 hiredman: bah

14:41 alrex021: Enclojure or Emacs with Slime? I am trying to decide between the two, any bias opinions? :)

14:42 hiredman: Chouser: is there an easy way to check if an arbitrary symbol is bound to a var?

14:42 Chouser: ,(resolve 'map)

14:42 clojurebot: #'clojure.core/map

14:42 Chouser: easier than that?

14:42 Chousuke: ,(resolve 'asdfjasj)

14:42 clojurebot: nil

14:43 hiredman: oh

14:43 that's pretty easy

14:43 Chouser: yeah, I use it all the time. probably more than I should.

14:52 hiredman: replaca: it would be nice if the :vars bit in the contrib json also contained namespace information

14:52 like what namespace the var's symbol is in

14:53 (doc xml1->)

14:53 clojurebot: "[[loc & preds]]; Returns the first item from loc based on the query predicates given. See xml->"

14:58 replaca: hiredman: ok, i'll take a look

14:58 hiredman: shouldn't be a problem

15:03 ezyang: Clojure doesn't have pattern matching :-(

15:04 Chouser: ezyang: but it has macros, so you can add it yourself. :-)

15:04 ezyang: what's your use case?

15:05 hiredman: ezyang: http://www.thelastcitadel.com/blag/clojure_multi-method

15:05 I guess I should update that

15:06 ezyang: Chouser: It's just something I'm used to from Haskell

15:06 I'm not actually interested in hacking it on

15:07 ,(when 0 1)

15:07 clojurebot: 1

15:07 ezyang: Wait, what?

15:07 hiredman: ezyang: anything not nil is true

15:07 ezyang: Oh

15:07 ,(nil 0 1)

15:07 clojurebot: java.lang.IllegalArgumentException: Can't call nil

15:07 hiredman: (when nil 1)

15:07 ezyang: um.

15:08 hiredman: ,(when nil 1)

15:08 clojurebot: nil

15:08 ezyang: Savvy

15:08 hiredman: nil is not a function, so you cannot call it as a function

15:08 ezyang: That was a typo

15:28 tashafa: how do you take all but the last element in a seq?

15:29 gnuvince: ,(butlast [1,2,3,4,5])

15:29 clojurebot: (1 2 3 4)

15:29 tashafa: (doc butlast)

15:29 clojurebot: "([coll]); Return a seq of all but the last item in coll, in linear time"

15:30 hiredman: ~def butlast

15:30 tashafa: thanks gnuvince... i knew i had come accross it before

15:30 Chouser: or drop-last

15:30 hiredman: ~def drop-last

15:31 tashafa: (doc drop-last)

15:31 clojurebot: "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"

15:39 Chousuke: drop-last is pretty clever.

15:51 kefka: ,(defmacro q [x] `(if (nil? ~x) ~x (~x 4)))

15:51 clojurebot: DENIED

15:51 kefka: This raises an error ("can't call nil") but it shouldn't, right?

15:52 When x = nil, it'll expand into (if (nil? nil) nil (nil 4)), which should be harmless.

15:52 because the (nil 4) will never execute.

15:52 hiredman: damn

15:52 Chouser: hmph

15:52 hiredman: thats what I get for playing around in the clojurebot repl

15:53 gnuvince: (doc assert)

15:53 clojurebot: "([x]); Evaluates expr and throws an exception if it does not evaluate to logical true."

15:53 Chouser: but (let [y nil] (q y)) is fine

15:54 it's only when x is known to be nil at compile-time that it's a problem

15:54 (defmacro q [x] (when x `(if (nil? ~x) ~x (~x 4))))

16:57 lisppaste8: pragdave annotated #81369 "untitled" at http://paste.lisp.org/display/81369#5

16:59 hiredman: ah

16:59 of course

17:05 Chousuke: the q macro evaluates x too many times anyway :)

17:06 Chouser: so true

17:08 lisppaste8: hoeck annotated #81369 "using contrib" at http://paste.lisp.org/display/81369#6

17:21 kefka: I've noticed something interesting about STM Refs: if someone is reading it in a dosync block, and the ref changes, the reader may or may not receive the update.

17:22 My test has been to: 1. (def *r* (ref 0))

17:22 2. (with-new-thread (dotimes [i 100] (Thread/sleep 1000) (println @*r*)))

17:23 hiredman: kefka: a transaction is a snapshot in time

17:23 kefka: Ok.

17:23 So there's no guarantee that a reader in a transaction will recieve updates.

17:23 hiredman: what is the rest of your test?

17:23 kefka: On 2, the dotimes was in a dosync.

17:23 3. Repeatedly (dosync (alter *r* inc))

17:23 hiredman: kefka: the whole point is it should not

17:24 kefka: Ok. I know that if ensure, alter, et al are used, the variable is only modifiable by that transaction.

17:25 Chouser: if the value of *r* appears to change within a single transaction, that would be an error.

17:25 a bug, I should say

17:25 hiredman: wrapping that dotimes in a dosync makes the whole thing happen within one transaction

17:25 so it will only ever seen one value for r

17:26 kefka: Ok. Let me try that again.

17:26 Make sure I'm not doing something wrong.

17:27 hiredman: kefka: http://blip.tv/file/812787/ <-- have you seen this?

17:28 it's not that you are doing something wrong, you don't understand what a transaction is, so you cannot reason correctly about their behaviour

17:28 come to think of it, I may watch that video again

17:30 kefka: Yeah. I need to watch the vid again.

17:30 The value not changing makes sense to me. I was confused by the inconsistent behavior.

17:31 hiredman: ?

17:32 kefka: The value being printed by (2) changes.

17:32 Sometimes, but not always.

17:32 hiredman: kefka: because transactions get retried

17:32 that it is why side effects in a transaction are a bad idea

17:33 like printing or starting a new thread

17:33 kefka: Ah. This makes sense.

17:34 Chouser: you could print a marker inside the dosync but before the dotimes loop, to see when it gets restarted.

17:37 Chousuke: hmm

17:40 kefka: I think I figured out my problem. Thanks. I was abusing the STM because I thought readers in a dosync block had no effect on anything until ensure was called.

17:40 ,(doc ensure)

17:40 clojurebot: "([ref]); Must be called in a transaction. Protects the ref from modification by other transactions. Returns the in-transaction-value of ref. Allows for more concurrency than (ref-set ref @ref)"

17:40 hiredman: they don't have an effect

17:41 Chouser: but there is a consequence for being in a dosync

17:41 kefka: So ensure in transaction T1 means that some other transaction T2 can't alter the ref and force T1 to restart?

17:41 clojurebot: alter is always correct

17:43 kgrad5: How does Clojure's performance compare to Scala and Java? (sorry if this has been asked 9 million times before).

17:43 hiredman: kgrad5: if you do it right, on your performence sensitive inner loops you get the same jvm byte code as you do from java

17:44 technomancy: kgrad5: sometimes getting Java speed requires adding some additional type hints and other kinds of tweaks to your code, but AFAIK you can always get pretty close.

17:44 Chouser: * after HotSpot has had its way

17:45 hiredman: ?

17:45 kgrad5: Interesting, thanks

17:47 Chousuke: kgrad5: Rich is also working on some new stuff on trunk that might make it even easier to write performant clojure code :)

17:47 hiredman: rhickey is always cooking something

17:47 I am still waiting for scopes

17:47 Chousuke: kgrad5: most of clojure improvements are still architectural though.

17:48 kgrad5: the compiler itself doesn't bother with much optimisation :)

17:48 kgrad5: Cool, thanks Chousuke, I assume this is mostly due to how new Clojure is?

17:49 Chousuke: kgrad5: yeah, and the architectural stuff is where the real performance gains are, anyway.

17:49 kgrad5: I doubt I will be doing anything that requires supreme performance, but it's nice to know you can still optimize and get almost Java performance, looking forward to diving into my copy of Programming Clojure when it arrives.

17:49 Chousuke: no need to optimise existing solutions when you can provide new stuff that is *naturally* faster

17:50 kgrad5: in the worst case, you always have Java as a "low level langauge" if you just can't get enough performance out of clojure.

17:51 language*

17:51 but the goal is to make that a rare occurrence.

17:51 kgrad5: Chousuke: yeah exactly :D, is it really easy to use java libraries with Clojure and vice versa? (Clojure classes within java)

17:52 Chousuke: kgrad5: java from clojure is really easy. Clojure from java I've never tried, but it shouldn't be too difficult either.

17:52 hiredman: clojure doesn't have classes, there are only java classes

17:52 kgrad5: sorry i should have said clojure code

17:52 hiredman: I have done a very little of that

17:52 Chouser: Clojure from java isn't too bad.

17:52 hiredman: mostly the other way around, java from clojure

17:53 ,(import 'java.util.ArrayList)

17:53 clojurebot: java.util.ArrayList

17:53 hiredman: ,(ArrayList. '(1 2 3 4))

17:53 clojurebot: #<ArrayList [1, 2, 3, 4]>

17:53 hiredman: ,(import 'java.util.Collections)

17:53 technomancy: Clojure from Java seems very awkward to me, but I haven't done much Java to Java; it's probably about par for the course. =)

17:53 clojurebot: java.util.Collections

17:54 Chouser: I've got a lib that is 100% clojure code, but when compiled AOT provides a few Java classes such that users code (written in Java) can't tell it's not .java inside.

17:54 Chousuke: technomancy: I suppose it could be made easier with some utility classes

17:54 hiredman: ,(let [a (ArrayList. (range 10)] (Collections/shuffle a) (vec a))

17:54 clojurebot: Unmatched delimiter: ]

17:54 hiredman: ,(let [a (ArrayList. (range 10))] (Collections/shuffle a) (vec a))

17:54 clojurebot: [4 5 0 7 8 6 1 2 9 3]

17:55 Chousuke: :)

17:55 hiredman: but that is all mutable and icky

17:55 kgrad5: I could see that being very useful for integrating clojure with some existing java programs Chouser

17:56 ozzilee: Is there a function where (x "test") -> "test" and (x :test) -> "test" as well?

17:56 hiredman: ,(doc as-str)

17:56 Chouser: kgrad5: yep, that's what I'm doing. Setting up the build environment, figuring out gen-class, etc. is still a bit tricky and somewhat weakly documented, but it's doable and runs plenty fast.

17:56 clojurebot: "[[x]]; Returns the name or string representation of x"

17:57 ozzilee: hiredman: Ah, there it is. Thanks.

17:57 hiredman: ozzilee: that is in contrib somewhere

17:57 (not sure where)

17:57 technomancy: there's no way to alias namespaces, is there?

17:57 ozzilee: hiredman: So it is. I'll find it.

17:57 Chouser: technomancy: sure

17:57 Chousuke: (doc alias=

17:57 technomancy: I see people refer to contrib libraries as c.c.repl-utils etc, but that's just a shorthand convention, not recognized by clojure?

17:57 clojurebot: EOF while reading

17:57 Chousuke: (doc alias)

17:57 clojurebot: "([alias namespace-sym]); Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly."

17:57 technomancy: oh, nice

17:58 hiredman: yeah

17:58 technomancy: Chousuke: but that only applies on a per-namespace level

17:58 hiredman: use :as

17:58 durka42_: ,as-str

17:58 clojurebot: java.lang.Exception: Unable to resolve symbol: as-str in this context

17:59 hiredman: durka42: uses magic json replaca generates to lookup contrib stuff

17:59 Chousuke: technomancy: right. there could actually be a real c.c.repl-utils namespace :P

17:59 durka42: i see

17:59 technomancy: gotcha

18:00 well I don't use repl-utils anymore since I discovered the slime inspector works on classes, but I was still curious

18:00 kgrad5: Does Clojure do tail-call optimization?

18:00 hiredman: nope

18:00 technomancy: kgrad5: not implicitly

18:00 Chousuke: kgrad5: the JVM doesn't support it, so no.

18:01 dnolen: kgrad5: no, it has loop/recur and trampolines instead

18:01 hiredman: and lazy-seqs

18:02 kgrad5: Interesting, are there any benefits to using tail recursion then?

18:02 hiredman: looks cleaner?

18:02 Chousuke: kgrad5: sure, but you just do it explicitly with recur

18:02 until the JVM gets TCO at least. :)

18:03 kgrad5: I'll start the letter campaign to oracle ;)

18:03 * technomancy read somewhere that TCO was implemented in an experimental build of the openJDK

18:03 Chousuke: isn't it going to be in JDK7? or was it just escape analysis that's going there.

18:03 hiredman: ,(loop [i 0] (if (> i 5) (println "done") (recur (inc i))))

18:03 clojurebot: done

18:03 Chousuke: also works with functions.

18:03 hiredman: Chousuke: I think escape analysis was in the last java6 update

18:04 Chousuke: hiredman: but not enabled by default.

18:07 kgrad5: Chousuke, I don't think it's planned for jdk7

18:07 atleast, I couldn't find it while googling

18:18 Chousuke: invokedynamic is going into JDK7

18:18 I wonder if that implies TCO

18:18 hiredman: nope

18:25 dude: hmm, having trouble getting 'La Clojure' REPL to work in IntelliJ

18:34 aravind: I am trying to get the basic get compojure to work as a war example to run in my jetty setup, but so far I haven't had much luck. I keep getting the "java.lang.NoClassDefFoundError: clojure/lang/IFn" error whenever I hit the app. Other apps deployed in the same jetty instance work. Also, I have -Djetty.class.path pointing to clojure.jar.

18:35 technomancy: aravind: generally we are a pretty peaceful folk in here. I don't know if we can help you with your wars.

18:36 hiredman: har har har

18:36 aravind: hehe

18:37 * aravind tries enabling jetty debugging

18:37 hiredman: aravind: where did you get your clojure.jar?

18:37 aravind: hiredman: built it

18:37 hiredman: aravind: ant clean, then rebuild it

18:38 aravind: I did.

18:38 hiredman: Oh

18:38 aravind: rebuilt contribs, and compojure as well.

18:44 dude: looks like La Clojure is having trouble finding clojure: Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Repl

18:44 I thought clojure was bundled with the plugin?

18:57 * technomancy cheers for scgilardi and his tabs->spaces conversion

18:59 mrsolo: psft.. can't get :require to work...

19:00 hiredman: how are you trying to use it?

19:00 mrsolo: in ns

19:00 clj is in classpath

19:00 hiredman: ...

19:00 mrsolo: but repl keeps complaining

19:00 replaca: technomancy: I was sorry we didn't get to hang out some more last night :-(

19:00 technomancy: replaca: yeah, too much good stuff going on to take in at once!

19:01 mrsolo: hmm nopaste is gone? duh...

19:01 technomancy: mrsolo: lisppaste is better anyway.

19:02 replaca: technomancy: I know. I felt like a host at a party who never has time to talk with the guests!

19:02 dreish: gist has clojure color-coding.

19:02 technomancy: replaca: thanks a bunch for getting hosting for that. seemed like just about the perfect size.

19:02 replaca: technomancy: any bigger and it would have exploded. Very fun though!

19:03 mrsolo: ok http://paste.lisp.org/display/81384 is the code...pretty simple

19:03 repl complains it can't find zimbra.qa.util/unique

19:04 * aravind is getting somewhere... moved on from NoClassDefFoundError to nullPointerExceptions :)

19:04 mrsolo: util.clj is in zimbra/qa/util so... should have found it eh?

19:05 hiredman: mrsolo: you want something like (:require [zimbra.qa.util :as util])

19:05 then you call stuff as (util/whatever ...)

19:06 there is also :use

19:06 mrsolo: nice shortand

19:06 hiredman: which works more like what you are trying to do with :require

19:06 but :require is better

19:06 mrsolo: ya still doesn't work.. look like slime repl can't find it.. of course

19:07 if i manually load util.clj into repl it works...

19:07 technomancy: replaca: didn't match the face to the nick until you said something about the meeting in here and I did a whois. =)

19:07 mrsolo: i though :require is suppsoed to search through classpath?

19:07 technomancy: I'll be sure to bring a name tag next time.

19:07 replaca: technomancy: cool. I had matched all names for you cause I had to do the attendee list

19:08 now I gotta see if I can pull a video together

19:09 mrsolo: http://paste.lisp.org/display/81385 <-class path

19:10 technomancy: mrsolo: also nice: (System/getProperty "java.class.path")

19:11 mrsolo: very nice

19:19 ah found the user error :-)

19:23 dude: guess I'll go back to clo-jet for a bit; 'la clojure' REPL refusing to work

19:41 dnolen: anyone know a good image manipulation library for Java?

19:42 gnuvince_: JImageManipulationLibrary

19:42 (kidding, I don't know)

19:42 ataggart: lol

19:43 How do you guys pull down and include the clojure contrib stuff when working on a project?

19:45 technomancy: ataggart: I use Maven for all dependencies.

19:45 though that might be overkill if your only dep is contrib

19:45 hiredman: I don't use a contrib much

19:46 ataggart: I'm just starting to prototype something out in IDEA, and thought there might be a better way than just browsing to google code and downloading the file(s)

19:46 hiredman: oh

19:47 you do an svn checkout

19:47 build a jar

19:47 ataggart: ah ok. didnt occur to me that it was really just one but buildable project

19:47 *one big

20:04 tayssir: Hi! I just installed Clojure via emacs elpa. Does anyone know why (use 'clojure.contrib.pprint) throws ClassNotFoundException for clojure.contrib.pprint.PrettyWriter?

20:06 technomancy: tayssir: ah! it looks like pprint requires contrib to be AOT-compiled

20:06 currently M-x clojure-install doesn't do that

20:06 tayssir: Ah, thanks! I'll figure out how to do that...

20:07 technomancy: tayssir: I will fix that; in the mean time you can just run "ant -Dclojure.jar=<...path to clojure.jar..>" to do it manually

20:07 when I wrote it there were only one or two contrib libs that required AOT

20:09 tayssir: technomancy: Hmm, I ran ant that way, when I googled for a fix... Am I supposed to do something special afterwards?

20:10 technomancy: tayssir: ant needs the -Dclojure.jar= argument; did you use that?

20:10 tayssir: Yep... but in case I totally missed the point, let me try again... ;)

20:10 technomancy: tayssir: you could try M-x slime-restart-inferior-lisp, but that shouldn't be necessary.

20:12 tayssir: oh, of course... only contrib's src/ is on the classpath

20:12 will need to add its classes/ directory

20:13 tayssir: Aahhh... thanks, I'll add classes/ to the classpath.

20:13 technomancy: tayssir: or the contrib jar; either will do

20:19 tayssir: technomancy: Awesome, can't live without cl-format. ;)

20:20 technomancy: tayssir: is that the one that uses ~A as a placeholder?

20:21 tayssir: technomancy: Yep.

20:22 technomancy: no accounting for taste I guess. =)

20:27 tayssir: It's ugly, but I like its various tricks, and I'm not too familiar with what Java has. So, to get a comma-delimited string "1, 2, 3" you can do (cl-format true "~{~A~^, ~}~%" [1 2 3]).

20:27 This doesn't seem supported yet, but you should be able to get roman numerals like:

20:27 (cl-format true "~@r" 1234) ==> "MCCXXXIV"

20:27 and "old-style" roman numerals (where fours and nines are IIII and VIII):

20:27 (cl-format true "~:@r" 1234) ==> "MCCXXXIIII"

20:28 technomancy: ,(use 'clojure.contrib.str-utils)

20:28 clojurebot: nil

20:29 technomancy: ,(str-join ", " [1 2 3])

20:29 clojurebot: "1, 2, 3"

20:29 technomancy: bit more readable

20:32 tayssir: Hrmm, good point. I'm curious how I'll look back on cl-format after getting used to the idiomatic Java/Clojurey ways...

20:32 quidnunc: str-join join can't do something like 1, 2 and 3.

20:33 format can.

20:38 Chouser: it may be a question of whether it's worth learning another language or not. You get succinctness in exchange for a whole new vocabular, syntax and grammar.

20:39 ,(#(apply str (interpose ", " (concat (drop-last %) [(str "and " (last %))]))) [1 2 3])

20:39 clojurebot: "1, 2, and 3"

20:42 mrsolo: java -cp testme.jar zimbra.qa.hello.main <- this doesn;t work but

20:42 java -cp testme.jar clojure.main -i "@zimbra/qa/hello.clj" -e "(zimbra.qa.hello/main) <- this does... compiled wrong?

20:45 quidnunc: Chouser: Point taken. (And of course the example was only to illustrate that some things are "easier" to do with format. Two str-joins would have worked also).

20:49 tayssir: For anything more complex than I'm used to, I just look up cl-format at: http://gigamonkeys.com/book/a-few-format-recipes.html ;)

20:49 ,(use 'clojure.contrib.pprint)

20:49 clojurebot: nil

20:49 tayssir: ,(cl-format nil "This place houses ~r ~:*(~d) famil~:@p" 1)

20:49 clojurebot: "This place houses one (1) family"

20:49 tayssir: ,(cl-format nil "This place houses ~r ~:*(~d) famil~:@p" 2)

20:49 clojurebot: "This place houses two (2) families"

20:49 cp2: thats neat

20:50 dmiles_afk: i need something that will consify all the fields of an instance.. and store the type.. so later on i can restore teh object

20:51 listify i guess

20:51 ataggart: ,(doc bean)

20:51 clojurebot: "([x]); Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties."

20:51 dmiles_afk: i guess i can write two functions .. ToObject and FromObject

20:51 oh cool

21:01 ,(["i am a string"]);

21:01 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector

21:02 dmiles_afk: can you show me a little example in here?

21:03 ataggart: of?

21:03 dmiles_afk: beanifying an object (i icked string becaseu it wasnt primitive)

21:03 ataggart: you didn't use the bean function

21:03 dmiles_afk: oh oops i need the fn name ';P

21:03 ataggart: (bean "hello")

21:04 ,(bean "hello")

21:04 clojurebot: {:empty false, :class java.lang.String, :bytes #<byte[] [B@101d3e4>}

21:04 dmiles_afk: right on.. thanks

21:04 ataggart: the ([x]) notation means the function only has one arity

21:04 (doc +)

21:04 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."

21:05 ataggart: ~google arity

21:05 clojurebot: First, out of 99900 results is:

21:05 Arity - Wikipedia, the free encyclopedia

21:05 http://en.wikipedia.org/wiki/Arity

21:06 dmiles_afk: i see. i guess i am going to need something a little more agressive .. alsmost a serizatino format.. then convert to lists

21:06 almost a serialization

21:07 ataggart: what problem are you trying to solve?

21:07 dmiles_afk: but (bean ...) is still very nice

21:08 well i al writting a video game library that executes the scenes in secondlife.. intiallally you can capture a current simlatuator state.. i am wanting to print the simulator state into a format that i can instance offline

21:09 ataggart: anyone using intellij/La Clojure around that can tell me howto get clojure-contrib.jar to be picked up by the repl?

21:09 dmiles_afk: initially i capture the scene state.. and going to write out things in macros later like (make-prim... [the data format])

21:10 the prim object has about 200 properties

21:11 i run clojure in .NET thru IKVM .. most of the code impl is in C#

21:11 but amazingly it all works

21:12 ataggart: have you looked at the CLR port?

21:13 dmiles_afk: i am tepted to.. since the primitive typs are in java.lang.* namespace

21:13 tempted to

21:14 useing the IKVM version lnds to some confusions down the road.. so i might switch over.. but want sure how much attention the code was going to get

21:14 for the Clojure .NET

21:15 i been using DotLisp for a while and that was pretty neat

21:15 i think it was clojure's prototyp

21:23 i almost could go back and forth to object<->XML using a typical java file.. and make cljore call the To/From Object

21:24 i almost could go back and forth to object<->XML using a typical java lib

21:24 and still let clojure do the control logic i gaues ans at least do a (make-prim "<xml...>")

21:36 ataggart: how do we force AOT in contrib so that I stop getting "java.lang.ClassNotFoundException: clojure.contrib.pprint.PrettyWriter (pprint.clj:0)"

21:38 durka42: ant -Dclojure.jar=/path/to/clojure.jar

21:39 ataggart: k thx

22:01 so is anyone else not able to build contrib?

22:01 [java] Caused by: java.lang.Exception: Unable to resolve symbol: get-method in this context

22:02 durka42: is this the latest checkout?

22:02 mine built

22:02 ataggart: yup, just pulled from trunk

22:02 durka42: hmm...

22:02 try just doing an ant clean to clear it out?

22:03 get-method is in core though...

22:03 do you have the latest core?

22:03 ataggart: I'm pointing to 1.0.0

22:04 you mean clojrue core, right?

22:04 durka42: yes

22:04 ataggart: top of the stack trace:

22:04 [java] Compiling clojure.contrib.accumulators to /Users/ataggart/IdeaProjects/contrib/classes

22:04 [java] java.lang.Exception: Unable to resolve symbol: get-method in this context (accumulators.clj:60)

22:06 durka42: and what was the command?

22:06 ataggart: ant -Dclojure.jar="../proto/lib/clojure.jar"

22:07 builds the jars tho which I find odd

22:07 durka42: and that path is correct?

22:07 yes this should AOT compile everything and stuff it all in clojure-contrib.jar

22:07 ataggart: yup

22:07 path is correct otherwise we wouldnt see the clojure stuff in the stack

22:07 e.g. Compile

22:17 ok, so it turns out the "clojure.jar" that comes bundled with the IDEA plugin is not quite right

22:17 I pulled down the 1.0.0 jar from google code and everything works fine

22:28 dude: ataggart: thanks, that did it

22:28 ataggart: ?

22:29 dude: it's odd, they were the same size; I didn't check the CRC though

22:29 using the clojure-1.0.0.jar for IDEA

22:29 ataggart: ah

22:29 yeah, and I haven't figured out how to swap the jar out

22:30 I'm new to IDEA

22:30 can't figure out where the plugin is hiding

22:30 dude: I think I was complicating things in my case: I had clo-jet installed and a clojure facet already in my projct when I switched to 'la clojure'

22:31 hmm, on OS X it's in ~/Library/Application Support/IntelliJIDEA80/clojure-plugin/lib

22:32 ataggart: ah thanks

22:35 ok this is wierd

22:35 I just compiled contrib using the jar in the plugin, and it worked fine

22:35 but using the jar that was dropped in my lib dir when creating a project didnt

Logging service provided by n01se.net