#clojure log - Feb 19 2009

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

0:00 cooldude127: / that is

0:00 not //

0:02 wait a minute, (def /) actually works in the repl

0:02 kinda

0:02 durka42: i can unmap /, and (defn / [a b] (+ a b)), but then (/ a b) gives ExceptionInInitializerError which was Invalid Token Exception from the reader

0:03 cooldude127: fine, i'll cave and do div for now

0:03 but someone needs to get on this

0:03 *wink* *wink*

0:03 hiredman: maybe |

0:04 cooldude127: hiredman: you think so? i considered that

0:04 durka42: you seem involved, what's your opinion of |

0:04 durka42: too much like "or"...

0:04 got it

0:04 (ns-unmap 'clojure.core '/)

0:05 (ns-unmap 'user '/)

0:05 (in-ns 'clojure.core)

0:05 (def / +)

0:05 (in-ns 'user)

0:05 (use 'clojure.core)

0:05 user=> (/ 2 3)

0:05 5

0:05 cooldude127: that's EVIL

0:05 durka42: that could be wrapped into a nice macro...

0:06 actually with-ns would be a useful macro, and not always for evil purposes

0:06 hiredman: smells like a monkey patch

0:06 cooldude127: durka42: the problem is it affects everything else in the running instance of clojure

0:06 durka42: user// is an invalid token, but clojure.core// is treated specially by the reader?

0:06 yes, it would do that

0:06 well, maybe

0:06 it doesn't take effect in 'user until after user=> (use 'clojure.core)

0:07 cooldude127: durka42: i might do this still just because my new version of / should preserve the old behavior

0:07 just augment it

0:07 durka42: for your next challenge, redefine in-ns

0:07 cooldude127: one thing at a time

0:08 durka42: hmm, in-ns became slightly less magic since i last looked at it

0:08 hiredman: ~def in-ns

0:09 durka42: you're right, it does affect other namespaces

0:12 http://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/LispReader.java#53

0:15 hiredman: you could do direct java class

0:15 calls

0:18 cooldude127: yeah this isn't working

0:18 hiredman: foo=> (clojure.lang.Symbol/create (str *ns*) "/")

0:18 foo//

0:18 cooldude127: + already refers to #'math.symbolic/+ ? wtf does + have to do with it

0:19 hiredman: foo=> (def / 1)

0:19 #'foo//

0:19 foo=> /

0:19 1

0:19 durka42: ,(symbol *ns* "/")

0:19 clojurebot: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to java.lang.String

0:19 durka42: ,(symbol (ns-name *ns*) "/")

0:19 clojurebot: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String

0:19 durka42: ,(symbol "sandbox" "/")

0:19 clojurebot: sandbox//

0:20 hiredman: ,`/

0:20 clojurebot: clojure.core//

0:21 cooldude127: apparently all the NS mucking is messing up other sane stuff. so i'm not gonna bother

0:21 hiredman: ,(ns-unmap '/)

0:21 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$ns-unmap

0:21 hiredman: ,(ns-unmap (symbol "/"))

0:21 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$ns-unmap

0:21 hiredman: ,(ns-unmap *ns* (symbol "/"))

0:21 clojurebot: java.lang.IllegalArgumentException: Can't unintern namespace-qualified symbol

0:23 hiredman: ,(/ 1 2)

0:23 clojurebot: java.lang.ExceptionInInitializerError

0:23 cooldude127: this is totally fucking evil and i refuse to be involved anymore

0:24 i await a time when / can be redefined at will

0:24 in the meantime, div it is

0:30 durka42: hey, that's simpler

0:30 (ns-unmap 'user '/)

0:30 (.refer (the-ns 'user) (symbol nil "/") #'+)

0:30 user=> (/ 2 3)

0:30 5

0:31 does not affect other namespaces, either

0:32 cooldude127: durka42: hmm let's try that

0:32 durka42: the second argument must be a Var

0:34 pjb3: Is there a build in function better than this?

0:34 ,(seq (.split "foo=1" "="))

0:34 clojurebot: ("foo" "1")

0:34 cooldude127: durka42: HOLY SHIT THAT WORKED

0:35 durka42: heh :)

0:35 Chouser: pjb3: what you've got looks good.

0:35 hiredman: voodoo

0:35 pjb3: Chouser: Yeah, I'm just not liking the extra (seq (.split

0:35 (map #(seq (.split % "=")) (seq (.split "foo=1&bar=2" "&")))

0:35 Chouser: pjb3: There aren't many string functions built into Clojure because it's so easy just to use the Java methods.

0:35 cooldude127: durka42: wait a minute, we'll see

0:36 durka42: there is c.c.str-utils

0:36 with re-split

0:36 Chouser: pjb3: why do you need those seq's?

0:36 pjb3: Does it work on arrays?

0:36 hiredman: eh?

0:36 durka42: Chouser: well, otherwise you get a #<Stringasdf;lkajdf;kajhfdg

0:36 Chouser: map calls seq on its collection for you

0:37 pjb3: yeah, but then I get an array of arrays

0:37 Chouser: and Java arrays works with seq

0:37 hiredman: uh

0:37 no

0:37 Chouser: if you get rid of both, you'll have a seq of arrays

0:37 cooldude127: durka42: it works once! then if i try to recompile the file, i'm fucked. so i need to wrap it in something that makes it only happen once

0:37 durka42: well, you need the ns-unmap

0:38 or does ns-unmap not undo .refer

0:38 Chouser: pjb3: but then what are you doing with the inner arrays? Chances are 'seq' will be called for you then too.

0:38 hiredman: cooldude127: defonce

0:38 pjb3: Chouser: yeah, actually that ends up working for this

0:38 cooldude127: hiredman: i used that

0:38 pjb3: (map #(seq (.split % "=")) (seq (.split "foo=1&bar=2" "&")))

0:38 cooldude127: hiredman: but there's other stuff that's being done that can also only be done once

0:38 pjb3: whoops, copy FAIL

0:38 (apply hash-map (mapcat #(.split % "=") (.split "foo=1&bar=2" "&")))

0:38 durka42: cooldude127: i can do (ns-unmap 'user '/) and then (.refer ...) again at the REPL

0:39 Chouser: pjb3: yep, looks good

0:39 hiredman: cooldude127: (defonce _ (do all kinds of stuff here))

0:39 pjb3: Chouser: thanks, did I heard something about a Clojure meet up in Indiana you were planning on going to?

0:39 cooldude127: hiredman: maybe that'd be better with a gensym?

0:40 hiredman: (defonce `x# ...)

0:40 Chouser: pjb3: yep, are you in the area?

0:40 ,(into {} (map #(vec (.split % "=")) (.split "foo=1&bar=2" "&")))

0:40 clojurebot: {"bar" "2", "foo" "1"}

0:40 pjb3: Chouser: nope, in Baltimore

0:40 Chouser: eh, that's probably not any better.

0:41 um, into I mean, not Baltimore.

0:41 pjb3: Just wanted to know what the interest was like out there

0:41 Chouser: I think it'll be mostly .Net guys, so we'll see...

0:41 pjb3: Chouser: Yeah, the into seems like 6 or .5 dozen

0:42 cooldude127: nvm that gensym won't work

0:43 and even the defonce didn't work

0:43 durka42: well if you gensym every time you defonce it will happen more than once, no?

0:43 pjb3: I'm head to NC tomorrow for RubyRX, stuarthalloway is giving 2 clojure talks, should be cool

0:43 cooldude127: durka42: not gensyming anymore

0:43 cuz you can't do that in that case anyway

0:44 durka42: user=> (defonce _ (prn "boo"))

0:44 "boo"

0:44 #'user/_

0:44 user=> (defonce _ (prn "boo"))

0:44 nil

0:44 cooldude127: it still throws up errors

0:44 OH I THINK I KNOW WHY

0:45 Chouser: pjb3: cool

0:45 cooldude127: it's the ns declaration

0:45 pjb3: Chouser: in your into one, how come vec works, but if I change that to seq, it doesn't?

0:45 cooldude127: it's pulling in the / from clojure.core, which i've now redefined

0:46 Chouser: into really wants a seq of MapEntries

0:46 you're allowed to use a 2-element vector most places that want a MapEntry

0:46 i've never looked into how that's allowed or why nothing else is.

0:46 cooldude127: durka42: OH HELL YEAH

0:47 durka42: once i excluded / from the :refer-clojure, i can recompile successfully, so now mission accomplished

0:47 pjb3: Chouser: yeah, interesting, that seems inconsistent

0:47 cooldude127: durka42: thank you for your insanely evil help

0:47 hiredman: you too

0:48 durka42: evil

0:48 Chouser: pjb3: hm, look at that -- a MapEntry is a Vector

0:48 ,(vector? (first {:a 1}))

0:48 clojurebot: true

0:48 Chouser: ,(class (first {:a 1}))

0:48 clojurebot: clojure.lang.MapEntry

0:49 Chouser: as shown on the graph: http://tinyurl.com/clojure-classes

0:49 pjb3: yeah, I guess that explains it

0:50 ,(into {} [(vec (.split "x=1" "="))])

0:50 clojurebot: {"x" "1"}

0:50 lisppaste8: cooldude127 pasted "how i'm thanking durka42" at http://paste.lisp.org/display/75763

0:50 pjb3: ,(into {} [(seq (.split "x=1" "="))])

0:50 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry

0:50 pjb3: ,[(seq (.split "x=1" "="))]

0:50 clojurebot: [("x" "1")]

0:53 pjb3: I'm sure there's some other internal reason for it, but it would make more sense if clojure.lang.MapEntry were a seq

0:55 Chouser: it takes longer to get to the second thing in a seq than to the first, which is not true of a vector

0:56 Two elements means it's probably a LazilyPersistentVector, which is a thin wrapper around an array -- no new object required to represent the second item like in a seq.

0:56 * Chouser shrugs.

0:58 durka42: cooldude127: this may be one of the few legitimate uses of XML

0:58 to mark evil

0:58 cooldude127: lol

0:59 yangsx: Just a quick check of my understanding, tree recursion is not possible with Clojure and I have to flatten the data structures first. Is that true?

1:00 cooldude127: yangsx: you can write your own functions to do tree recursion

1:01 hiredman: yangsx: what do you mean by tree recursion?

1:02 yangsx: like recursion over a tree structure

1:02 hiredman: like a depth first walk?

1:02 yangsx: hiredman: yes

1:03 hiredman: clojure.zip

1:03 ,(doc clojure.zip/next)

1:03 clojurebot: "([loc]); Moves to the next loc in the hierarchy, depth-first. When reaching the end, returns a distinguished loc detectable via end?. If already at the end, stays there."

1:04 hiredman: cooldude127 was doing avl and redblack trees, but not with zippers

1:04 cooldude127: yes i was :)

1:04 hiredman: zippers are cool

1:04 cooldude127: zippers are weird for binary trees

1:04 hiredman: they can be hard to navigate

1:04 cooldude127: cool for more freeform trees

1:05 Chouser: yangsx: you can absolutely do a depth-first walk over a tree

1:06 yangsx: the most natural way will consume as many stack frames as the depth of your walk, but you'd have to have a very big tree for that to be a problem.

1:06 hiredman: the transform function my pl macor uses uses zip/next to walk through the s-expressions

1:07 ,(pl (map call � ?+ $ 5 range $ 5))

1:07 clojurebot: (5 6 7 8 9)

1:08 durka42: what are the precedence rules on that monstrosity?

1:09 ,(macroexpand '(pl (map call � ?+ $ 5 range $ 5)))

1:09 clojurebot: (do (map (comp call ((uncurry +) 5)) (range 5)))

1:09 hiredman: $ � ? ?

1:10 durka42: as in flip happens first

1:10 hiredman: call � ?+ is the same thing as (partial +

1:10 no

1:10 flip is last

1:10 durka42: but it looks like $ is after uncurry

1:11 hiredman: nope

1:11 $ is first

1:14 ?+ $ 5 turns into (?+ 5) which turns into ((uncurry +) 5)

1:14 durka42: oh oh i see

1:16 i thought we used s-expressions to avoid precedence rules...

1:18 hiredman: ,(pl inc $ 3)

1:18 clojurebot: 4

1:30 slackorama: Apologies for yet another slime question but I just did a pull from

1:30 git,cvs,svn of the needed libraries and when slime starts up I get this error:

1:30 http://gist.github.com/66759. It seems to run fine after that though.

1:31 Durr,sorry about that. Had fill mode on.

1:32 durka42: heh, i was just thinking

1:33 when most people talk about "closure" they mean letting go of something

1:33 but when we say "closure" we mean hanging on to things

1:33 also, my fingers really want to type clojure instead of closure

1:34 fynn: we're having a discussion in #python

1:34 why doesn't Clojure have tail-call-optimization?

1:34 durka42: because the JVM doesn't

1:34 (yet)

1:34 albino: because the jvm doesn't support it

1:34 fynn: "(yet)"?

1:34 hiredman: clojure uses java style calls, which do not support tco

1:35 albino: Is it proposed for jdk version 7?

1:35 durka42: there are a couple proposals floating around

1:35 hiredman: sun is not working on it

1:35 but some grad student is

1:35 *shrug*

1:35 durka42: basically

1:36 albino: sounds like a "don't bet on it" strategy

1:36 I'm still waiting for sun to include chdir()

1:37 durka42: why?

1:37 fynn: I brought Clojure up as an interesting new language, and it was criticized for not having TCO

1:37 hiredman: *snort*

1:38 albino: durka42: because it's a processes basic right to change directories, and to do so is useful

1:38 fynn: as a supposedly major flaw in a Lisp variant and language aspiring to be functional.

1:38 hiredman: obviously they have never used clojure

1:38 fynn: I don't think it's that big of a deal either, but having TCO would be nice.

1:38 hiredman: clojure has several features that almost entirely get rid of the pain of not having it

1:38 recur and trampoline

1:39 durka42: python doesn't have TCO either, does it?

1:39 fynn: durka42: nope, in fact it actively discourages recursive style.

1:39 (the Designer deems it less readable)

1:40 hiredman: cool, I linked recur in #python

1:40 albino: fynn: the Designer being BDFL guido?

1:40 slashus2: The stack isn't very large for recursion by default.

1:40 fynn: albino: yeah

1:40 hiredman: the other thing is clojure's heavy use of sequences means a lot of things that would be some kind of recursive function are just sequences

1:40 durka42: a friend of mine learned haskell and it heavily influenced his python... others who had to read his code were not amused

1:41 hiredman: ,(take 10 (iterate inc 0))

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

1:42 fynn: verte> fynn, so it only works for single recursives. ugh.

1:42 that's wrt recur

1:42 hiredman: self recursion

1:42 not single

1:42 durka42: i mentioned trampoline, which can do mutual recursion if you want to return functions

1:42 hiredman: but for mutual recursion there is trampoline

1:43 ,(doc trampoline)

1:43 clojurebot: "([f] [f & args]); trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if any. If f returns a fn, calls that fn with no arguments, and continues to repeat, until the return value is not a fn, then returns that non-fn value. Note that if you want to return a fn as a final value, you must wrap it in some data structure and unpack it after trampoline

1:44 fynn: durka42: yeah, I lined to the group

1:44 *linked

1:45 hiredman: so, basically, #python is full of it

1:48 fynn: heh, not exactly, but some people are perfectionists.

1:48 it's still sort of reassuring to know that you have TCO at your disposal.

1:49 hiredman: clojurebot: clojure is also far closer to perfection then python

1:49 clojurebot: In Ordnung

1:49 durka42: ~clojure

1:49 clojurebot: clojure is cheating

1:49 hiredman: ~clojure

1:49 clojurebot: clojure is a very attractive hammer with a nice heft to it

1:50 durka42: clojurebot: how much do you know about clojure?

1:50 clojurebot: I know 203 things

1:52 hiredman: ~perfection

1:52 clojurebot: I don't understand.

1:55 fynn: I still think Clojure is possibly the most interesting Lisp implementations.

1:55 hiredman: definetely the most modern

1:57 fynn: SBCL is pretty oldstyle iirc

1:57 durka42: if "old-style" means "standard-conforming"

1:58 hiredman: clojurebot: clojure is also <reply>"[Clojure ...] feels like a general-purpose language beamed back from the near future."

1:58 clojurebot: Ok.

1:58 fynn: Common Lisp is a fairly broken standard :/

1:59 hiredman: don't let AWizzArd hear you say that

1:59 he is pretty into that hyperspec

1:59 fynn: even Lisp people tend to agree that CL is broken

1:59 hiredman: uh

2:07 slashus2: fynn: Some are pretty stubborn, but that is an irrelevant point.

2:44 fffej: I don't suppose anyone has ported swank-clojure over to use the latest lazy branch? I'm following the recipe on the Clojure page to port, but not getting very far :(

4:11 blbrown: ,(+ 1 "0")

4:11 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

4:11 blbrown: ,(+ 1 (char "0"))

4:11 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

4:11 hiredman: weird

4:12 ,(char "0")

4:12 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

4:12 blbrown: hiredman, ..I was having a little trouble with characters

4:12 hiredman: (+ 1 \0)

4:12 ,(+ 1 \0)

4:12 clojurebot: java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number

4:12 blbrown: right

4:13 hiredman: ,(pl (+ 1 int $ \0))

4:13 clojurebot: 49

4:13 blbrown: hehe

4:13 ,(doc pol)

4:13 clojurebot: java.lang.Exception: Unable to resolve var: pol in this context

4:13 blbrown: ,(doc pl)

4:13 clojurebot: "([& forms]); "

4:13 eevar2: (doc test)

4:13 clojurebot: test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception; arglists ([v])

4:13 hiredman: pl is magic

4:39 rfgpfeiffer_: ,(source pl)

4:39 clojurebot: java.lang.Exception: Unable to resolve symbol: source in this context

5:20 Lau_of_DK: Hey guys

5:24 cgrand1: Hi Lau_of_DK!

5:25 Lau_of_DK: cgrand1: Hi - You working on anything interesting these days ?

5:27 cgrand1: Lau_of_DK: dabbling with a code specializer

5:28 Lau_of_DK: cgrand1: Google is blank on code specializers... what are they ?

5:28 cgrand1: partial evaluation

5:29 user=> (binding [*locals* {'x 'x}] (partial-eval '(let [y (* 4 5)] (+ x y))))

5:29 (clojure.core/+ x 20)

5:30 Lau_of_DK: Where would you find use for that? :)

5:30 blbrown: Lau_of_DK, heay

5:30 Lau_of_DK: hey :)

5:31 cgrand1: Lau_of_DK: it's could prove useful when optimizing the output of a dsl

5:32 Lau_of_DK: it could prove useful when optimizing the output of a dsl

5:32 Lau_of_DK: Ok, cool, I'll look forward to seeing what comes out of it - Hopefully some blogposts :)

5:34 cgrand1: and you, what are you working on?

5:37 Lau_of_DK: We are the final steps in getting clojureQL to version1, which I'll hopefully get done within a small month, but as a side project, I've decided to extend af 3d gaming engine and kick it off with a game for 2-3 year olds, just some fun with colors, music and rotating objects responding to keyboard input (Read: a kid slamming the keyboard)

5:38 cgrand1: cool, it explains you asking about jmonkey

5:38 Lau_of_DK: Exactly right :)

5:40 Its actually running now, in so far that you can build the class from Clojure and pop a settings dialog, choosing resolution, driver, and fullscreen yes/no. Then that'll start the main window and main loop, which responds to keyboard input. All that is working, now I just need to get the scene set up

6:10 Bracki: ,(reduce conj '() '(1 2 3 4 5))

6:10 clojurebot: (5 4 3 2 1)

6:10 Lau_of_DK: How do I add a type-hint to a javaclass?

6:11 Bracki: Why does that reduce call invert the list?

6:11 Shouldn't it just copy it?

6:12 djpowell: if you are writing new code that works with sequences, should you typically use the new 'rest'?

6:15 the porting instructions say to replace 'next' with 'rest', but is that just for easy porting? The name 'rest' seems the most obvious friend of 'first', so I'm hoping that it is what you are supposed to use?

6:19 Bracki: (fn [x y] (+ x y)) Whats the form using #(..) for this?

6:20 #(+ % %1)?

6:21 cgrand1: Lau_of_DK: code sample?

6:22 djpowell: it depends whether you want nil-punning (next) or not (rest)

6:22 Raynes: Bracki: #(+ % %1)

6:24 Lau_of_DK: (defn -render

6:24 [this interpolation]

6:24 (.. ($get :display) (getRenderer) (clearBuffers))

6:24 (.. ($get :display) (getRenderer) (.draw #^{:type com.jme.scene.Spatial} ($get :rootNode))))

6:24

6:24 @ cgrand1

6:28 cgrand1: Lau_of_DK: what are these $getDisplay? your genclassed getters/setters?

6:28 the .draw looks suspect

6:28 Lau_of_DK: cgrand1: ($get :rootNode) returns a Node. I need to cast that to a special, _because_ Clojure it self doesnt resolve it through reflection, no idea why

6:28 cgrand1: Its just pulling objects out of a hash-map that I use for globals

6:29 Node is inherited from Spatial - In my head, Clojure should work this out on its own, when it sees that draw has no method for Node.

6:29 hoeck: Bracki: conj uses cons to add something to a list, and cons applies the element always on top of the list

6:29 Bracki: for appending at the end use conj and a vector

6:29 ,(reduce conj [] '(1 2 3))

6:29 clojurebot: [1 2 3]

6:30 cgrand1: Lau_of_DK: is $get hinted? (can you paste with more context?)

6:39 Lau_of_DK: cgrand1: 2 secs

6:40 lisppaste8: Lau pasted "Typehints for Mr. Grande" at http://paste.lisp.org/display/75777

6:40 Lau_of_DK: There u go - thats the relevant context

6:40 But its a pretty big problem, if Clojure doesnt recognize superclasses inheriances

6:46 cgrand1: Lau_of_DK: ($get XXX) can return anything, you have to hint each $get call

6:46 #^Node ($get :rootNode)

6:47 Lau_of_DK: Yea, but lets say I want to hint it to a Spatial, shouldnt (class #^Spatial ($get :rootNode)) return Spatial ?

6:49 @ cgrand1

6:50 (defn -render

6:50 [this interpolation]

6:50 (.. ($get :display) (getRenderer) (clearBuffers))

6:50 (.. ($get :display) (getRenderer) (.draw #^Spatial ($get :rootNode))))

6:50

6:50 This will fail, because .draw sill only sees a Node - and Clojure doesnt realize that Node is an extended Spatial.

6:50 Oh - And (.draw ) should be (draw)

6:54 AWizzArd: Where again was this nice compilation that visualizes the differences between Agents, Atoms and Refs?

6:54 it was a 2x2 table or something like that

6:58 Ah oki, that was it:

6:58 http://groups.google.com/group/clojure/msg/fd0371eb7238e933

7:37 Bracki: Raynes: no that doesnt work

7:37 Raynes: Hrm.

7:37 Bracki: ,(reduce #(+ % %1) '(1 2 3))

7:37 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1574$fn

7:37 Raynes: Word for me.

7:38 works for me*

7:38 ,(do #(println % %1) "lol" "lol")

7:38 clojurebot: "lol"

7:38 Raynes: Well, close enough.

7:39 ,(do #(println (str % %1)) "lol" "lol")

7:39 clojurebot: "lol"

7:40 jdz: Raynes: that code does nothing actually

7:40 it only returns the last "lol"

7:40 Raynes: jdz: I gathered.

7:40 jdz: I realized.

7:42 Bracki: ,(reduce #(+ %1 %2) '(1 2 3))

7:42 clojurebot: 6

7:42 Bracki: Ah.

7:42 % is a synonnym for %1

7:42 Raynes: Oh.

7:43 I was just reading that.

7:56 danlarkin: + is already a function that takes two ( or more or less ) args, so no need to wrap it in a lambda there

7:56 ,(reduce + '(1 2 3))

7:56 clojurebot: 6

8:05 AWizzArd: ,(apply + [1 2 3])

8:05 clojurebot: 6

8:07 Bracki: danlarkin: yeah that was just an example for a more difficult lambda.

8:07 ,(doc apply)

8:07 clojurebot: "([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."

8:19 AWizzArd: Bracki: you can think of apply as removing the parens/brackets of its last argument: (apply + [1 2 3]) ==> (apply + 1 2 3). After that step apply removes itself. So this all becomes: (+ 1 2 3)

8:20 djpowell: it only works for + because + supports var args, if the function only supports 2 arguments, then you'd need to use reduce as above

8:20 Hun`: one method to implement vararg-+ is in fact to use reduce with an initial arg of 0

8:23 Lau_of_DK: rhickey__: Can you please add some syntactic sugar for floats?

8:24 djpowell: Lau_of_DK: what like?

8:24 Lau_of_DK: you mean for floats as opposed to doubles?

8:24 ,(class 1.0)

8:24 clojurebot: java.lang.Double

8:24 Lau_of_DK: 5.0 double

8:24 5.0f float

8:24 For instance

8:25 gnuvince: Hey Guys

8:25 I got to tell you about a dream I had of Rich

8:26 djpowell: ,(class (float 1.0))

8:26 clojurebot: java.lang.Float

8:26 Lau_of_DK: gnuvince: shoo :)

8:26 t

8:27 gnuvince: He was showing me his Jor-El impersonnation, while sticking a fiber optics cable into his arm, after which he put on his Superman suit, flew a couple times around the Earth and came back with George W. Bush's face. That's when he was chosen as the DNC's chairman and he refused to meet with Gerald Ford because he had a bug in Clojure.

8:28 Lau_of_DK: Sounds healthy enough :)

8:30 gnuvince: Indeed

8:31 It's nice to know that even when he's head of the DNC, Clojure still has priority

8:32 Lau_of_DK: True

8:34 cemerick: federal gravy train, here we come! :-P

8:35 AWizzArd: Lau_of_DK: I would also like it if we could use the existing syntax for declaring types: (loop [#^java.util.Hashtable ht ...] ...)

8:36 maybe #^float, #^int, etc could be used. vs. #^Float #^Integer, ...

8:37 djpowell:

8:37 ,(apply (fn [a b] (+ a b)) [10 20])

8:37 clojurebot: 30

8:37 AWizzArd: the use of apply has nothing to do with the function taking rest-args

8:37 Lau_of_DK: AWizzArd: Hinting is business as usual, but I just want shorthand for producing something of the actual type/class

8:38 AWizzArd: Lau_of_DK: yes, would be cool. And on top of that I like consistency. #^int x vs (int x)

8:38 as declarations for Java classes is typically done via #^

8:40 is --> are

8:41 jkantz: gah do I really have to create a gensym for every lexically bound variable in a macro?

8:43 Hun`: you don't `have' to... but it helps

8:43 cemerick: jkantz: generally yes, but it's very easy with the reader syntax for gensyms

8:43 Hun`: there are macros to make that easier (iirc with-gensyms)

8:43 oh. thought this was #lisp :)

8:44 jkantz: ah reader syntax for gynsyms ... nice

8:46 cemerick: what is the use case for :factory in gen-class? i.e. why are static factory fns desirable in addition to constructors (since the latter are always available as well with the current gen-class impl)?

8:46 maybe it's just a style thing?

8:50 ericthorsen: VerifyError with genclass? http://paste.lisp.org/display/75781

8:50 I'm trying to expose a method of the super class so I can derive from this clojure generated class and forward calls to a multimethod.

8:51 Do I need to do anything else besides what is in the paste?

8:52 The error is CLjTreeCellRenderer overrides final method

8:56 cemerick: ericthorsen: a quick peek at the source makes me think that the docs are wrong -- that the mapping is actually {exposed-name super-method-name}

8:56 or, that's what I get from the names of the destructuring bindings in the relevant section of genclass

9:00 ericthorsen: cemerick: I'm wondering if it is because I'm not overriding the function in question? Trying to see if that makes a difference noe

9:00 now

9:01 cemerick: ericthorsen: not sure -- I've never used :expose-methods, so I'm groping in the dark there.

9:02 ericthorsen: cemerick: That was it..I'll post it to the group. not a big deal and probably not a bug.

9:02 cemerick: thanks

9:03 cemerick: ericthorsen: that being, the args were in the wrong order, or that you weren't overriding the function in question?

9:11 ericthorsen: cemerick: I was not overriding the function in the new genned class.

9:18 BigTom_: hi

9:18 dumb question time

9:18 is there a logical XOR equivalent in clojure?

9:38 tashafa: quick question all

9:38 im sure this is easy but its escaping me right now

9:39 how do you find the index of a value in a seq

9:39 Chouser: BigTom_: I don't think so

9:41 BigTom_: Jason Wolfe wrote this, though: (defn xor [& args] (odd? (count (filter identity args))))

9:41 cooldude127: tashafa: i had to write it myself. (indexed) in clojure.contrib.seq-utils helps

9:42 tashafa: i'll paste what i had

9:43 lisppaste8: cooldude127 pasted "position (index of an item)" at http://paste.lisp.org/display/75787

9:43 tashafa: oh thank you guys

9:44 cooldude127: no problem, i was just in here the other day asking the same damn question

9:44 the real one is why is it not built-in

9:45 tashafa: yeah

9:45 BigTom_: Chouser: cheers, I think that'll do it

9:45 tashafa: thats why I thought it was a simple built in function that i couldnt find in the api

9:46 cooldude127: tashafa: yeah i looked for it

9:48 AWizzArd: clojurebot: max people

9:48 clojurebot: max people is 149

9:49 Chouser: indexes aren't used so much in Clojure.

9:49 and a linear search to find the index will of course only be desirable on small lists

9:50 shoover`: desire is subjective. I plug in computers and run linear searches to warm my house.

9:51 cooldude127: lol

9:51 BigTom_: If you are after a heating system then totally pure Functional Programming is for you!

9:52 jdz: BigTom_: that would not be pure functional programming because heat is a side effect!

9:52 shoover`: BigTom_: ooh, rework that to fewer words, include "HVAC", and make another clojure t-shirt

9:52 ozy`: jdz: I dunno about clojure, but in haskell there's a Thermodynamics monad

9:53 BigTom_: jdz: I was just thinking that, refrigerated monads anyone?

9:54 jdz: what's more, you cannot run a purely functional program -- all the computation would be done in compilation step.

9:54 since nobody said anything about running functional programs i'll intall latest software updates

9:56 shoover`: jdz: not running programs is kinda depressing. back to clojure I can run things :)

9:56 BigTom_: ozy: The clojure logo would make a nice button, shame zazzle doesn't do them

9:58 * drewr smiles at his clojure button on his desk

9:59 ozy`: BigTom_: I'd rather have an ominous-looking button with that Illuminati logo on it. but the haskell people don't want to pick that logo....

10:00 jdz: btw, what's the point of logical XOR?

10:02 BigTom_: jdz: I have two pairs of thngs and I am interested when the first pair is the same but the second different (and vice versa)

10:03 well, thats why I want it

10:05 * BigTom_ waits for explanation on better way...

10:07 jdz: not=

10:07 ?

10:07 Chouser: yeah, like (not= (= a b) (= c d))

10:09 bstephenson: would that not return true if c=d but a not = b?

10:09 BigTom_: Ah well, that's what i was looking for

10:09 Chouser: ,(not= (= 1 2) (= 3 3))

10:09 clojurebot: true

10:12 jdz: isn't that what is required?

10:21 cemerick: I can't wait to see rhickey's response to not-empty? in the group :-P

10:23 AWizzArd: cemerick: what was the suggestion? To add some compiler magic to all functions that end with a "?" and begin with at "not-"? :)

10:24 Chouser: AWizzArd: http://groups.google.com/group/clojure/msg/f99178dd8c5fb85d

10:24 cemerick: AWizzArd: No, a request for a separate not-empty? fn -- similar to if => if-not, at least in terms of order of the conditional branches. I know rhickey strongly prefers affirmative clauses to come first (probably didn't get that terminology right).

10:25 I've always preferred having the shortest clause first, so I pushed for if-not to make that cleaner.

10:26 Chouser: cemerick: Since you brought that up I've experimented with that layout, and I can certainly see the appeal.

10:26 cemerick: Chouser: IMO, it's far easier for later readers of code

10:27 Chouser: but the double-negative of "not empty" is simply worse than the positive of "seq"

10:27 same order of then/else

10:28 cemerick: that, and in a lot of algorithms, the shorter clause is often just a single value, so it's nice to "get that out of the way" and concentrate on the real hunk of code.

10:28 Chouser: to reverse the order I've used (if (empty? ...))

10:29 that gets you out of the null-pun and a 'not' in a single intuitive word.

10:29 cemerick: Chouser: I strongly dislike using (if (seq ...)) -- I always use (if (empty? coll) ...) -- again, makes it easier for readers who may not have internalized the meaning of the former as a conditional

10:29 yeah, I haven't looked at the lazy stuff at all yet, so we'll see where I settle after I've understood the implications there

10:30 Chouser: cemerick: but what if you have to reverse the order? Do you use (if-not (empty? coll) ...)?

10:31 cemerick: Chouser: I can't say I've ever written that -- looks hairy to me. Chances are, the shorter clause is always needed first when the coll in question is empty.

10:31 Chouser: but as for you original point, I'm not about to suggest (if-not (empty? coll) ...) to the poor soul who's asking for 'not-empty?' for fear Rich flog me.

10:31 will flog

10:32 cemerick: if-not is handy when there's some non-collection conditional you need to reverse

10:32 Chouser: yes

10:32 cemerick: Chouser: good lord, neither will I :-)

10:32 * cemerick knows well the sting of rhickey's whip ;-)

10:33 pilkarn: Does anyone know for sure, is it ok to release applications written in Clojure on the paid Android-market? Or is there a rule that it has to be written in Java and not only compiled to Dalvik bytecode?

10:34 Chouser: pilkarn: to work with android requires a patched clojure still, doesn't it?

10:34 rhickey: what's wrong with (seq x) ?

10:35 the whole point of allowing an open set of values for truth is to allow for functions with a boolean nature to return something more useful than 'true'

10:35 but they won't end in ?

10:35 all the auto-seqing is lulling people into believing everything is a seq - it's not

10:36 * rhickey would take auto-seq out of first/rest if I had my druthers

10:36 Chouser: I like (if (seq coll))

10:36 * Chouser shoves cemerick in front of the whip.

10:36 cemerick: Chouser: :-P

10:36 rhickey: if-let (s [(seq coll)] ...) is going to be an important idiom - seq is no longer free

10:37 Chouser: taking out auto-seq is a new desire, post lazy-seq?

10:37 cemerick: rhickey: nothing's wrong with (seq x), but if you're really checking for whether a collection is empty or not, then it's far more readable (IMO) to use empty?, as it's explicit in its purpose

10:38 rhickey: cemerick: empty? is there

10:38 but loses information

10:38 seq will pull the inner seq out of a lazy seq

10:39 cemerick: it's not like I'm doing stuff like (if (nil? (some-fn ..))) or somesuch. Returning useful values from fns which can also double as a boolean indication is obviously a Good Thing.

10:39 rhickey: cemerick: that's what seq does

10:39 cemerick: rhickey: FWIW, I'm not advocating for *anything* right now. Just blowing hot air. :-)

10:40 rhickey: Chouser: I'm not seriously proposes removing auto-seq from first/rest

10:40 * rhickey tried it and found it breaks too much

10:41 Chouser: I'm not surprised. But you didn't even want to pre-lazy-seq, did you?

10:42 cemerick: I guess I don't have a coherent argument as to where and when I use empty? vs. (seq x). e.g. I know that I often use a bare (if some-seq ...) if I know that some-seq is a seq already

10:43 Chouser: I prefer (if (empty? coll)) over (if-not (seq coll))

10:44 rhickey: Chouser: there's a lot of convenience to auto-seq, but I'm not confused about seqs, nor do I want to try to make them fit into some preconceived notion of collection APIs. I really like (seq x), it says and does a lot compactly, but yes, you have to learn what it means

10:46 if you say (if (empty? coll) foo (do-something-with (first coll) ... (rest coll)) your code will be slow with lazy seqs

10:46 Chouser: hm, good point. That was a pattern I'd used when seq was cheap.

10:47 cemerick: rhickey: that's interesting.

10:47 sure to be a tripwire

10:47 rhickey: better (if you want empty?): (let [s (seq coll)] (if (empty? s) foo (do-something-with (first s) ... (rest s)))

10:47 Chouser: I do believe I've not used it at all in my lazy-seq conversions.

10:47 rhickey: first and rest are a seq API after all

10:48 core provides idiomatic examples, people just resist the idioms rather than try to understand what is being accomplished by unifying lazy/eager sequences

10:48 * shoover` thinks it might be time to read clojure.org/lazy

10:49 Chouser: shoover`: yes, so you can answer my questions tonight

10:49 rhickey: cemerick: the code will work, jut not as fast

10:49 shoover`: Chouser: about that... you're not allowed to ask questions

10:50 cemerick: rhickey: sure -- in a twisted sort of way, that's worse though. Nothing to be done about it, we'll just have to keep learning.

10:50 Chouser: (if-let [[f && r] coll] (do (something f) (recur r)) done)

10:51 * cemerick adds "write clj-lint" to his never-going-to-get-done todo list

10:51 rhickey: Chouser: most recurs are better with & and next I think

10:51 Chouser: that should be ok, right? an extra first/rest (and therefore extra seq) on the terminal case

10:51 rhickey: hm.

10:52 pilkarn: Chouser: didn't someone get a hello world running on the simulator?

10:52 Chouser: pilkarn: yes, with a (slightly) patched Clojure.

10:53 pilkarn: I mention that because i think (though IANAL) that any *changes* to clojure would have to be released open source. But you could then build that changed version and your own code into a binary-only android app and sell it.

10:54 cemerick: the "slight patch" is to remove the bytecode generating classloader, yes?

10:54 Chouser: cemerick: I thought it was just to remove the 'bean' fn

10:54 pilkarn: Chouser: ok but making the surce code available I don't think is a problem for Andrid apps, users probably wn't know or bother compiling their own apps.

10:54 Chouser: pilkarn: sure

10:55 cemerick: oh, is that all? I thought rhickey said that although AOT compiled clojure doesn't generate bytecode at runtime, it still somehow depends on that classloader, which causes issues (in osgi, for example)?

10:55 ...and android, I assumed

10:56 Chouser: that classloader is instantiated on demand, so as long as none of your compiled code demands it you're ok at least for applets, and I think android as well.

10:58 cemerick: Chouser: OK, then I must be misreading this from last December (or maybe things have improved since then): http://groups.google.com/group/clojure/browse_frm/thread/d8a73d4c124bc8f6/935a9d0ab98e3541

11:01 AWizzArd: anyone here who has used JSwat+Clojure with success?

11:01 Chouser: cemerick: yes, improved since then: http://code.google.com/p/clojure/source/detail?r=1201

11:02 cemerick: I'll catch up one of these days. :-)

11:03 Chouser: that was one of those famous swank-breaking changes.

11:07 cemerick: that there is a public service

11:07 * cemerick ducks

11:09 nroling: Anybody have any ideas on the best way to do the following? I'm using CouchDB to store documents as JSON, and Apache FOP to create PDFs from XML.

11:09 I need to translate the JSON to XML one way or another. Ideas?

11:10 Chouser: If only there were a more convenient API for creating PDFs...

11:11 nroling: Chouser: I'm all ears

11:11 Just don't say LaTeX :-)

11:15 shoover`: nroling: you could use clojure-json to parse the documents into clojure data structures and then some libraries from clojure.contrib to generate xml

11:17 * nroling is looking through contrib

11:17 pilkarn: actually, since Clojure generates Java-code, it couldn't be a problem right? How does Clojure-generated Java-code look? A cllass with a bunch of static methods?

11:18 Chouser: a class with a bunch of nested classes

11:18 cooldude127: does clojure generate java code or java byte-code?

11:19 Chouser: byte code

11:19 cooldude127: that's what i thought

11:19 there's a difference

11:19 nroling: shoover`: Looks like lazy-xml might work, thanks.

11:22 rhickey: back to (not-)empty?, I think it would be best, if you want the terminal test first, to come up with a macro that: binds a local to (seq coll) and does the inverted if: (let-seq-and-test-empty [s coll] (empty-case) (something-case s)), name needs work obviously :)

11:23 gnuvince: Does Mark Engelberg hang in this channel?

11:25 * nroling has been away from Clojure too long

11:26 nroling: If I include clojure.contrib.jar on my classpath, shouldn't (all-ns) include the contrib namespaces?

11:26 Chouser: no, you still have to 'require' the ones you want.

11:27 nroling: Chouser: Got it, thanks.

11:40 * danlarkin seconds the motion for clojure-json

11:46 pilkarn: so can someone post an example of how to remove the classloader?

11:47 Chouser: pilkarn: I don't think it needs to be removed. If you search the google group I believe you can find a description of commenting out the bean defn to get android working.

11:49 gnuvince: Does test-is work with the new trunk?

11:49 (run-tests) seems to just be hung

12:01 danlarkin: gnuvince: problem with your tests? Mine passed okay

12:04 gnuvince: danlarkin: ah, I'd forgotten to recreate the clojure-contrib.jar

12:05 * danlarkin slaps his forehead

12:06 wabash: Im looking at Real World Haskell, and think it's a great book. Is there something similar for Clojure yet?

12:07 gnuvince: wabash: there's Programming Clojure (http://www.pragprog.com/titles/shcloj/programming-clojure) that's gonna be out soon

12:07 The beta PDF is already available

12:07 albino: has he updted it to match the latest language changes?

12:09 WizardofWestmarc: everything except lazy

12:09 but lazy is coming before the book goes paper supposedly

12:09 wabash: gnuvince: Awesome

12:09 thank you.

12:12 drewr: AWizzArd: "Success" is relative.

12:12 I got it to run and I poked around.

12:13 technomancy: cooldude127: I found a problem in clojure-test-mode that I'm not sure how to deal with.

12:13 jbondeson: finally found the form that swank-clojure is failing on.

12:13 technomancy: if you define a test and then remove it, clojure doesn't realize it's gone

12:13 jbondeson: course it happens to be swank/swank-require

12:13 technomancy: it will continue to highlight it

12:14 jbondeson: did you see that jochu pushed something last night to swank-clojure?

12:14 jbondeson: yeah, he did the first part

12:14 i forked off of that, and changed rest to next

12:15 and am looking to fix this exception and the broken contrib packages

12:15 technomancy: great

12:19 jbondeson: it's looking for a swank.commands.contrib.swank-presentations which isn't in contrib, any ideas?

12:20 hmmm...

12:20 cooldude127: technomancy: hmm that's strange

12:21 jbondeson: swank-presentations is in slime

12:22 technomancy: cooldude127: no, it makes total sense.

12:23 when you remove a deftest from the file, it doesn't undefine it in clojure

12:24 jbondeson: well not everything has been ported; that's always been the case. still strange why it wasn't complaining about missing that earlier

12:25 cooldude127: technomancy: what do we do about that then?

12:26 technomancy: cooldude127: no idea. maybe undef everything in the namespace before we load the file

12:26 nroling: Does anyone know of a clojure lib with a more compact representation of xml? {:tag :attrs :content} gets ugly fast...

12:27 jbondeson: technomancy: may be a red herring, i basically put print messages down the call stack to see where errors were being generated.

12:28 cooldude127: technomancy: that sounds like trouble tho

12:29 technomancy: cooldude127: better then: we alter the metadata for every var to remove the :test entry. then we reload the file.

12:29 I don't know how to undef vars anyway.

12:30 jbondeson: right; it's entirely possible that error wasn't affecting usage before. have you tried rolling back and comparing your results to pre-lazy results?

12:30 AWizzArd: drewr: yes, with JSwat you mean? Same here

12:30 jbondeson: technomancy: not yet.

12:31 technomancy: might be worth a shot

12:31 AWizzArd: I set some breakpoints in loaded code files after attaching a session, and sometimes they do work, sometimes not. The won't work for example when I put them on a defn or on the doc string.

12:36 technomancy: danlarkin: hey, are you still looking for a name?

12:36 danlarkin: technomancy: yes

12:36 technomancy: I came up with one yesterday that I don't think I'm going to use.

12:36 how about "calamity"?

12:36 it has the c and l sounds

12:37 and it also sounds dangerous

12:37 silkarn: Chouser: where is the bean fn?

12:37 danlarkin: hahah

12:37 technomancy: but it does have negative connotations.

12:37 danlarkin: ~source bean

12:37 silkarn: ^

12:37 technomancy: yeah I donno, is it too "bad news" sounding?

12:37 technomancy: danlarkin: you'd have to find a way to put some positive spin on it.

12:38 I'm not sure how that would work. but the name has a ring to it.

12:38 take it or leave it. =)

12:38 danlarkin: I appreciate you thinking of me :-o

12:39 technomancy: I think naming your project in a self-deprecating way subverts people making fun of it. For instance, with git, when people say "git is so stupid!" it's like, "well, yeah... that's what it's called."

12:54 cooldude127: technomancy: any progress in the 20 minutes i've been gone?

12:54 technomancy: nope, haven't touched it

12:54 cooldude127: boooo

12:55 technomancy: we've got some deadlines at work today; probably won't be able to hack on it much

12:55 considering delegating it to you. =)

12:55 cooldude127: honestly it's not that big a deal to me, since it's rare that i completely remove a function

12:55 oh this is outside my knowledge

12:55 technomancy: what about renaming though?

12:55 it's the same thing

12:55 cooldude127: i'm so confused by all of this

12:56 technomancy: hmm, true, but the thing is, the old tests will still work with the old renamed function

12:56 technomancy: cooldude127: yeah, but they'll have the line numbers of the old function

12:56 so it will overlap with the new one

12:56 cooldude127: well, my overlays still aren't showing up, so i forgot about that

12:56 technomancy: wait, they consistently don't show up?

12:56 hmm... I guess that's more important to fix. =\

12:56 cooldude127: idk, haven't seen any today

12:57 technomancy: actually... I think I know the fix. just need to clear the test metadata in the same place as the status metadata

12:57 cooldude127: oh

12:57 but yeah, at the moment your package is doing nothing for me

12:57 technomancy: bleh

12:58 cooldude127: all C-c C-, does that i can see is run the file

13:00 technomancy: well I guess that's more important

13:00 cooldude127: technomancy: yeah i just have no idea why

13:01 technomancy: oh... I think I know part of the problem.

13:01 cooldude127: do tell

13:01 technomancy: it's the async-ness

13:01 cooldude127: why?

13:01 technomancy: in run-tests, it calls clear

13:02 but it sends that off and doesn't wait for it to return before loading the file

13:02 and running the tests

13:02 cooldude127: are you saying it's a race condition?

13:02 technomancy: yeah

13:02 we need to chain together callbacks, I guess

13:02 cooldude127: that sounds right

13:02 technomancy: lemme check in what I've got, then I have to head into a meeting

13:03 pushed

13:04 cooldude127: lol i had literally just pulled when you updated it, so i had to do it again

13:32 gnuvince: What's the procedure to submit a patch to clojure-contrib?

13:33 technomancy: gnuvince: bring it up on the mailing list, then create a google code issue if it's deemed appropriate.

13:33 gnuvince: ok

13:33 technomancy: and make sure you've got a contribution agreement signed

13:33 gnuvince: I don't

13:33 Required for clojure-contrib?

13:33 technomancy: yeah, it is

13:34 gnuvince: ok

13:38 te: lol at the end of the SICP it says: "Start over again, this time with more information"

13:38 cooldude127: they aren't kidding, you get more out of it the more you know :)

13:38 technomancy: it's recursion in action!

13:39 te: Yeah I'm actually taking the same tack with "Programming Clojure"

13:39 I am reading it front-to-back, then re-reading it

13:41 pilkarn: sicp is awesome i dont get how people cant like it if they are really interested in learning to program

13:41 then they must have bought with the wish to learn to code a bad webapp in 3days

13:45 are refs slower than accessing a def-ed variable that isn inside a ref?

13:46 technomancy: a little bit, since a call to deref is involved

13:46 te: how do i make sure clojure-contrib is loaded?

13:46 it's not showing up in autocomplete in emacs

13:47 technomancy: te: did you set swank-clojure-extra-classpaths?

13:48 te: yes

13:48 (setq swank-clojure-extra-classpaths '("~/src/clojure-contrib/clojure-contrib.jar"))

13:48 cooldude127: te: try importing something :)

13:48 er...using something

13:48 technomancy: yeah, could be an autocomplete problem

13:51 te: pardon my ignorance

13:51 but how do i do that

13:52 technomancy: (use 'clojure.contrib.duck-streams)

13:52 te: returns nil

13:52 which is good, right?

13:53 Chousuke: yes

13:53 te: god im such a noob

14:13 stuhood: is there a way to recursively compile .clj files AOT?

14:14 Chouser: compile should follow :require and :use clauses, building things recursively that way

14:14 stuhood: gotcha.

14:15 but i have a compile ant task like the one defined in Clojure's build.xml

14:15 do i need to define all of the top-level libraries manually?

14:16 kotarak: stuhood: If the .class is newer than the .clj, it is not recompiled. I would specify all namespaces in the compile task. More robust against changes....

14:16 stuhood: so: clojure.lang.Compile com.example.util com.example.paths ...

14:17 kotarak: alright, thanks... i guess i'm just used to giving javac a source directory, and having it build everything it contains

14:38 pilkarn: (File. "C:/Users/saftarn/Desktop/mp3s/Timbuktu-Oberoendeframkallande/01-pretjafs-cta.mp3")

14:38 "))\n(File. "

14:38 user=> java.lang.Exception: Invalid token: C:/Users/saftarn/Desktop/mp3s/Ti

14:38 mbuktu-Oberoendeframkallande/01-pretjafs-cta.mp3

14:38 why?

14:40 kotarak: pilkarn: there is a spurious " somewhere in the repl input.

14:40 cooldude127: is there a nice convenient way to call a function with a number of args, and let it just ignore any extra ones?

14:41 danlarkin: add & _ to the end of your parameter list :)

14:41 cooldude127: danlarkin: is there a way that preserves the original function?

14:42 tashafa: dunno if this is the right way of doing it but...

14:42 danlarkin: I guess you could write a wrapper that checks the arglists of the function it's wrapping

14:42 Chouser: the arglists isn't guaranteed to be machine readable, I think.

14:43 tashafa: sorry just aswred my own question

14:43 cooldude127: Chouser: looks like lisp structures

14:43 tashafa: by writing the question

14:44 Chouser: (,(:arglists ^#'defn)

14:44 ,(:arglists ^#'defn)

14:44 clojurebot: ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?])

14:44 cooldude127: Chouser: ok is it a bad sign when i have var that is a function that has no arglists key in its meta data

14:45 oh wait i know why, it's def'd to the symbol? function

14:45 this seems like a bad idea

14:46 danlarkin: yeahhh, it probably is

14:47 cooldude127: well it looks disgusting to have all these function wrappers cuz some of them need the extra arg, but a lot of them don't and are used in other places

14:47 danlarkin: and you don't want to have them all take & _ ?

14:47 cooldude127: i'd prefer not to do that

14:48 technomancy: yay, jochu is back in action

14:48 cooldude127: sweet

14:52 alright i just created a function that makes a new fn that ignores the arg

14:52 got rid of the boilerplate

14:54 pilkarn: (throw java.lang.IllegalArgumentException) <- whats wrong with that syntax?

14:54 gnuvince: technomancy: I got an issue with clojure-mode: delete-trailing-whitespace kills the trailing commas too.

14:54 Chouser: pilkarn: you giving throw a class, and it wants an instance

14:54 gnuvince: pilkarn: (throw (IllegalArgumentException. "Hi"))

14:56 technomancy: gnuvince: well, it works as advertised. =)

14:57 gnuvince: technomancy: is there something that can be done?

14:58 Or is it too ingrained?

15:26 pilkarn: how do I create an event-function? Like I play an mp3 in a separate thread and when it finishes I want to do something. Right now I'm using polling which works fine but isn't very elegant. Can I use an event-based action somehow?

15:32 cooldude127: pilkarn: where you play the mp3, pass a callback function, and after the mp3 finishes, call the function you passed

15:32 assuming the playing of the mp3 blocks

15:32 technomancy: gnuvince: I'm not sure; I haven't looked into the details of the syntax table

15:33 gnuvince: the problem is that whitespace is whitespace

15:33 you don't want it treated as non-whitespace for other purposes, I think

15:33 gnuvince: technomancy: ok

15:34 I was editing a file, and I noticed it was changed in places I didn't touch

15:36 technomancy: that happens all the time with delete-trailing-whitespace

15:37 it's generally a bad idea to use it at the same time as you're editing

15:37 you want to separate out cleanup commits from functionality commits

15:44 Bracki: How do you debug your clojure code?

15:44 cooldude127: Bracki: REPL

15:45 technomancy: Bracki: test-is

15:45 cooldude127: Bracki: debuggers are fun, but i don't know to use one with clojure

15:45 Bracki: oh yeah, test-is also

15:45 very good stuff

15:45 Bracki: Well do you sprinkle echos everywhere?

15:46 technomancy: using a debugger is a good sign that you either 0) need a better test suite or 1) are doing rhickey's job

15:46 hiredman: technomancy: that depends on the kind of code you are writing

15:47 the code may do what you want fine

15:47 (i.e. pass the tests)

15:47 but is just too slow, so you want to see why

15:47 or uses to much heap, or whatever

15:48 technomancy: that's true; it can be helpful for optimization I guess.

15:49 durka42: http://www.qtsoftware.com/about/news/preview-of-final-qt-jambi-release-available

15:49 cooldude127: Bracki: usually you don't need a ton of echoes if you've broken your code down enough into smaller functions

15:49 hiredman: actually in that case you'd want a profiler

15:49 cooldude127: Bracki: cuz then you can just test the results of each functions individually

15:49 hiredman: which, uh, apparently a lot of people are using YourKit for profiling

15:49 * durka42 likes to replace values with (doto value prn)

15:50 hiredman: durka42: brilliant

15:50 * hiredman forgot all about doto

15:50 durka42: ,(+ 2 (doto 3 prn))

15:50 clojurebot: 5

15:50 3

15:51 Chouser: durka42: that *is* brilliant

15:51 lisppaste8: bracki pasted "find-graph" at http://paste.lisp.org/display/75813

15:51 durka42: i think i stole it from rhickey :p

15:51 i had come up with (do (prn value) value)

15:51 hiredman: playing with zippers I use "->" so I always want to examine something from the middle of the pipe

15:52 durka42: apparently qt-jambi is going the way of the dodo

15:52 Bracki: The find-graph function I pasted is obviousl broken. But no idea where.

15:52 It looks good to me.

15:52 hiredman: ,(-> \a (doto prn) int)

15:52 clojurebot: 97

15:52 \a

15:53 cooldude127: Bracki: that first (conj path start) doesn't do anything

15:53 hiredman: datastructures in clojure are immutable

15:54 Chouser: durka42: what's that about jambi?

15:54 durka42: see above link

15:54 hiredman: so conj does not change a ds, it produces a new ds

15:54 Chouser: oh

15:54 Bracki: So I need to let right.

15:54 cooldude127: Bracki: you need to rethink how to do this immutably

15:54 Chouser: yikes

15:55 I wonder if a community will pick it up, or if it's all done.

15:55 cooldude127: for example, conj returns a new list instead of changing the old one

15:55 Bracki: I've tried that for the last two evenings and couldn't come up w/ anything usable.

15:55 cooldude127: or a new set or whatever

15:55 Chouser: When they announced jambi, I thought it was a weird choice and didn't have any reason to like Java. Sounded dumb.

15:55 cooldude127: Bracki: btw, why is your path a set? shouldn't the path be in order? i don't think sets preserve order

15:55 Chouser: Now I'm all about JVM and hate to see Qt walking away.

15:56 cooldude127: Bracki: you probably want a vector

15:56 durka42: well, they intend to release it... as you said remains to be seen if anyone will keep it alive

15:57 WizardofWestmarc: that's kinda sad, I'd been looking at using Jambi as my UI lib for clojure

15:57 Lau_of_DK: Good evening gents

15:58 technomancy: well when I first read about jQuery I ignored it because I thought it was for Java.

15:58 tashafa: technomancy: ha

15:58 cooldude127: haha

15:59 WizardofWestmarc: technomancy: heh really?

15:59 technomancy: well I didn't exactly research the topic thoroughly

15:59 WizardofWestmarc: javascript is actually next on my list of stuff to learn right now, because of jQuery

15:59 technomancy: jQuery is awesome

16:00 WizardofWestmarc: technomancy: you listen to the interview with Resig on FLOSS weekly?

16:00 technomancy: javascript is really close to being awesome... just enough warts to drive you crazy

16:00 WizardofWestmarc: no, link?

16:00 WizardofWestmarc: sec

16:00 durka42: awesomeness seconded

16:00 WizardofWestmarc: http://twit.tv/floss55

16:01 really good stuff

16:01 tashafa: one of the best documented libraries out there

16:01 WizardofWestmarc: also brings up processing.js

16:01 ~an hour but interesting stuff I thought

16:01 clojurebot: Gabh mo leithsc�al?

16:01 * Chouser packs up for Indy.

16:01 WizardofWestmarc: doh forget the 'bot reacts to ~

16:02 tashafa: question...

16:03 durka42: yes?

16:03 tashafa: im trying to write a macro that defines a set of functions using a seq as the macro's argument

16:03 so if the argument of the macro contains 3 items it would defn 3 different functions

16:03 is this possible?

16:04 cooldude127: tashafa: sounds simgle enough

16:04 tashafa: im almost there

16:04 WizardofWestmarc: remember you can execute code in the macro

16:04 so you'd just loop through your seq generating all the def/defns/etc

16:04 tashafa: yup

16:05 cooldude127: tashafa: macro writing tip: first write what the macro should look like when you call it (an example use), then write what code that should turn into

16:05 tashafa: im using a doseq but and it return nil

16:05 hiredman: erm

16:05 tashafa: it works when I pass in an item

16:05 (i.e I remove the doseq)

16:06 cooldude127: tashafa: if i were you i'd probably use something like map

16:06 tashafa: but when i add the doseq and pass a collection of items it return nil but the functions are not defined

16:06 hiredman: doseq always returns nil

16:06 durka42: trying to map defn might not work so great

16:06 cooldude127: `(do ~@(map (fn [x] `(defn ~x ...))))

16:06 hiredman: and returning nil from a macro is almost never what you want

16:07 tashafa: yup i figured as much...

16:08 it returns the defined function when i pass in an item from the seq (removing the doseq in the macro)

16:08 but i need it to work on a collection of items

16:08 cooldude127: tashafa: you see what i posted?

16:08 tashafa: yup trying that right now

16:08 cooldude127: kk

16:08 tashafa: will get back to you

16:08 cooldude127: idk exactly what you're so it might not work perfectly, but that's the idea

16:10 tashafa: need to go to a meeting right now

16:10 but brb with the results

16:10 cooldude127: kk

16:17 * shoover` hopes Chouser's not wasting his gas

16:21 cemerick: wow, that was a quick flash in the pan for jambi

16:21 Bracki: Is there a way to find out more about raised exceptions?

16:22 durka42: (use 'clojure.contrib.stacktrace)

16:22 (print-cause-trace (e))

16:22 Bracki: can I do that in the repl

16:22 hiredman: you can do everything in the repl

16:22 Bracki: How do I access the last thrown execption?

16:23 technomancy: *e

16:23 * cooldude127 didn't know that

16:24 hiredman: ,(pl inc $ inc $ inc $ 0)

16:24 clojurebot: 3

16:25 pilkarn: map+filter is lazy right? so it is 1*N not 2*N?

16:27 cooldude127: the problem is it seems from prior expreicences the callback will be called immediately and not after the song is finsihed. to find out when it is finsihed id still need a pollingthread then no?

16:27 , (do (:import (haskell [ghc :as g])) (g/foldr (+) 0 [1 2 3]))

16:27 clojurebot: java.lang.Exception: Unable to resolve symbol: haskell in this context

16:27 cooldude127: pilkarn: if it's async and has no facility to pass a callback then yes

16:28 pilkarn: cooldude127: so can I force sync then?

16:28 cooldude127: i don't think so

16:28 if it doesn't block, i don't know how to make

16:28 it

16:29 hiredman: if all the api you using provides is a poll, you are stuck polling

16:33 Bracki: java.lang.ClassCastException: clojure.lang.LazyCons cannot be cast to clojure.lang.IFn <- what does that tell me?

16:34 cooldude127: Bracki: you're treating a list as a function

16:34 or actually more like a seq as a function

16:34 but still bad

16:34 Bracki: care to share the code that causes it?

16:35 hiredman: clojurebot: latest?

16:35 clojurebot: latest is 1295

16:35 lisppaste8: bracki annotated #75813 "untitled" at http://paste.lisp.org/display/75813#1

16:35 cooldude127: extra paren around the (for)

16:36 clojurebot: svn rev 1296; added clojure.core/*source-path*

16:36 Bracki: cooldude127: More or less?

16:36 cooldude127: Bracki: you have an extra

16:36 Bracki: (for) creates a seq, that extra paren around it means you're trying to call that seq as a function

16:37 Bracki: btw, you're still gonna run into trouble here. those ifs at the beginning are pointless

16:37 Bracki: Hm, no the code is back to just returning nil. I don't seem to understand the evaluation model.

16:37 cooldude127: Bracki: you have nil at the end

16:37 it returns the value of the last expression

16:37 always

16:38 you can't return early

16:38 Bracki: hm.

16:38 cooldude127: give me a sec, let me try to sort of rewrite what you have in a more functional style

16:39 just to give you an idea of the way it should be

16:39 Bracki: It's a port from here: http://www.python.org/doc/essays/graphs.html

16:39 pilkarn: is there a deep-flatten function in clojure already?

16:54 Lau_of_DK: Anybody here interested in the JMonkeyEngine?

16:55 pilkarn: is there a function for randin an int?

16:57 leadnose_: Lau_of_DK, what about it?

16:57 I've fiddled with it a bit

16:57 in java though

16:58 Lau_of_DK: leadnose_: I made a Clojure port, just wondering if anybody was interested

16:58 leadnose_: oh, cool, have a link for it?

16:59 Lau_of_DK: No, I didnt upload it yet, because I didnt know if it had any interest - Ive only recently been attracted to game development because my 2-year-old had a blast changing screensavers on my laptop, but I realize that its an unique experience :)

17:00 danlarkin: a port? or a wrapper

17:00 technomancy: at the risk of stating the obvious: games are fun

17:00 Lau_of_DK: danlarkin: Bindings would probably be the word

17:02 lisppaste8: cooldude127 annotated #75813 "functional and working find-path" at http://paste.lisp.org/display/75813#2

17:02 cooldude127: Bracki: there is the first working version

17:04 not ideal, but it works

17:05 tashafa: cooldude127: you are a the coolest!

17:05 cooldude127: thank you

17:05 tashafa: worked on the first try

17:05 cooldude127: Bracki: this actually should probably be split up into two separate functions

17:06 tashafa: cooldude127: no thank you

17:06 time to drink

17:06 cooldude127: lol

17:06 tashafa: were you in need of this code or just applauding my work?

17:06 Bracki: cooldude127: thx nice one.

17:07 tashafa: both

17:07 Bracki: Would have never come up with this.

17:07 tashafa: cooldude127: both

17:07 cooldude127: Bracki: let me give you a new version that does a better separation

17:07 this function has gotten too big

17:09 Bracki: I previously had a look at the documentation for loop, but that left me completely clueless.

17:09 cooldude127: Bracki: loop was important here because a for doesn't allow you to prematurely terminate

17:10 Bracki: and what's the [node & nodes] part?

17:11 cooldude127: Bracki: destructuring. binds node to the first element and nodes to the rest

17:13 Bracki: Aight.

17:13 cooldude127: Bracki: and you understand that everytime you call recur, it rebinds node and nodes based on what you pass it?

17:14 Bracki: Ok then nodes is restructed again etc.

17:15 cooldude127: yeah

17:15 Bracki: The whole and not set part seems complicated.

17:15 cooldude127: Bracki: yeah i'm trying to find a nicer way to write that

17:16 Bracki: do you have clojure-contrib setup?

17:16 Bracki: Yes.

17:17 cooldude127: Bracki: ok, then i will take advantage of something in there

17:18 Bracki: i'm about to go eat, but i'll be back on later with something even better for you

17:19 * cooldude127 likes showing newbies the functional way

17:19 Bracki: cooldude127: i'll be off to bet in an hour so.

17:20 but i'll get your stuff somehow.

17:20 bed

17:20 i meant

17:20 cooldude127: Bracki: save the link to the paste, i'll annotate it

17:21 Bracki: thx.

17:36 lisppaste8: bracki annotated #75813 "Now using (includes?)" at http://paste.lisp.org/display/75813#3

17:37 jwinter: Lau_of_DK: I'd be interested in the clojure bindings for JMonkeyEngine

17:39 Lau_of_DK: k, gimme 10 minz, I'll GitHub and clean it up...tomorrow :)

17:39 jwinter: cool, looking forward to it.

17:39 durka42: ooh, that looks interesting

17:39 danlarkin: Lau_of_DK: tomorrow is a slippery slope :)

17:40 Lau_of_DK: danlarkin: I know - But at least Im uploading today

17:40 durka42: at least Lau doesn't have to come up with a name ;)

17:40 Lau_of_DK: Exactly right

17:40 durka42: cljME?

17:41 technomancy: hehe

17:41 Lau_of_DK: durka42: This is called Sofiaba :)

17:41 Its just a raw engine which renders a 3d sphere, which you can toggle between shaded and wireframed

17:41 But its enough to get someone going with JME in Clojure

17:41 durka42: cool cool

17:41 where did sofiaba come from?

17:42 pilkarn: you can catch runtimeexceptions right?

17:43 durka42: sure

17:43 Lau_of_DK: durka durka: My 2-year-old is called Sofia, she's the one who got me interested in making a game for small kids, like 2 -3, 4-5, 6+. And one of here many nicknames is Sofiaba :)

17:43 pilkarn: Lau_of_DK: what si the JMonkeyEngine? I'm doing opengl in scheme right now and im generally interested in game dev

17:43 hiredman: catching exceptions is pretty much the whole point of exceptions

17:43 durka42: ~google jmonkeyengine

17:43 clojurebot: First, out of 6910 results is:

17:43 jMonkeyEngine.com

17:43 http://www.jmonkeyengine.com/

17:44 Lau_of_DK: pilkarn: http://www.jmonkeyengine.com/ , its a very serious Gaming engine, already used in several impressive productions - It has good performance and is well made, check out the demos/screenshots

17:46 technomancy: you can tell it's serious because they capitalize Gaming

17:46 =)

17:46 I like the logo. the monkey looks serious.

17:47 wow, that looks like fun

17:48 Lau_of_DK: Yea

17:48 Ok, the code is ready, making repo on Github, hang on

17:50 technomancy: grrr... /me hates zip files that don't create a new subdir

17:51 jwinter: yea, always unarchive in /tmp/

17:51 technomancy: wow, jME totally just crashed X

17:52 haven't seen that happen in a while

17:52 Lau_of_DK: http://github.com/Lau-of-DK/sofiaba/tree/master

17:52 technomancy: going to try it again without going fullscreen

17:52 Lau_of_DK: jwinter: There you go - Have fun, that basically extends BaseGame so that you can run Clojurecode the rest of the way

17:53 technomancy: huh; none of the demo stuff runs

17:53 Lau_of_DK: technomancy: Which demo stuff?

17:53 technomancy: Lau_of_DK: the jMonkeyEngine demos

17:54 jwinter: Lau_of_DK: thx, will take a look tonight

17:54 Lau_of_DK: technomancy: Have you got a renderer installed?

17:54 technomancy: Lau_of_DK: no idea

17:55 just followed the README instructions

17:55 Lau_of_DK: Get LWJGL and put it in your Library path

17:55 technomancy: you mean the classpath?

17:55 Lau_of_DK: no

17:55 Read my README :)

17:56 technomancy: oh, I haven't got your stuff yet; just trying the straight jme stuff

17:57 I don't have LWJGL in my package manager, but JOGL is there and is a much less horrible acronym...

17:57 Lau_of_DK: Thats certainly true

17:57 JOGL should work also though

17:58 technomancy: ok, this has bit me before though... apparently for Java just installing a library via apt-get is not enough, right?

17:58 you need to add it to the classpath too?

17:59 at which point you start to wonder why it's even in the package manager in the first place... ugh.

18:01 Lau_of_DK: You need to set up some things yes, like

18:01 export LD_LIBRARY_PATH==/custom/path/to/dependencies

18:01 technomancy: even if you installed via apt-get? that's terrible

18:02 cooldude127: Bracki: you still here?

18:02 Lau_of_DK: I need to hit the sack, input on Sofiaba is most welcome. I hope that over 1 - 2 months, it'll be a fantastically thrilling game for both 2 - 3 year olds, and technomancy :)

18:02 technomancy: heh

18:02 Lau_of_DK: technomancy: dunno - I didnt use apt-get for lwjgl

18:02 technomancy: have fun

18:02 oh, ok

18:02 Lau_of_DK: u 2

18:06 jwinter: technomancy: for jogl, I ended up doing -Djava.library.path=/path/to/jni-files in my clojure bash script

18:07 probly not the cleanest way

18:07 apt-get install on ubuntu didn't take care of that for me.

18:08 * technomancy grumbles... dear JVM: people invented package managers for a reason!

18:10 p_l: technomancy: Java spec guys missed the memo

18:10 hiredman: I think maybe that memo should go to package managers

18:11 p_l: hiredman: Is there a common way to specify classpath for Java that really works?

18:11 Except for modifying CLASSPATH ?

18:11 jwinter: at least for me, it wasn't the classpath, but whatever you'd call java.library.path

18:12 durka42: OS X incantation: java -cp $CLASSPATH:build:/Users/alex/Downloads/lwjgl-2.0.1/jar/lwjgl.jar -Djava.library.path=/Users/alex/Downloads/lwjgl-2.0.1/native/macosx jmetest.TestChooser

18:12 ...so i closed that window, and my screen went blank, flickered in and out a couple of times before coming back

18:12 interesting

18:12 SEVERE: Exception in game loop

18:12 mattrepl: technomancy: interest in helping to keep up with an issue tracker for swank-clojure?

18:13 technomancy: mattrepl: sure

18:14 Bracki: cooldude127: yes

18:14 technomancy: mattrepl: what are you thinking of?

18:14 Bracki: technomancy: mire doesn't work on windows.

18:14 the add-classpath stuff in mire.clj does not work.

18:14 technomancy: Bracki: but... I was told I could write once and run anywhere!

18:14 I've been LIED TO!

18:15 Bracki: oh yeah, I meant to fix that. how are you launching it?

18:15 Bracki: Yeah the Java trap snapped shut.

18:16 technomancy: are you launching it via slime, the shell script, or what?

18:16 Bracki: java -cp ..\jars\clojure.jar;..\jars\clojure-contrib.jar clojure.main mire.clj

18:16 mattrepl: the simplest possible for letting anyone submit bugs/feature requests. lighthouse would be nice, but think we'd need a paid account if there are more than 2 people working on it. so google code it is unless you have any ideas

18:16 technomancy: Bracki: you need src/ on the classpath too

18:16 Bracki: looks like I updated it on the branches but not on master yet

18:17 java -cp jars/clojure.jar:jars/clojure-contrib.jar:src/ clojure.main src/mire.clj # from the project root

18:17 hiredman: well, setting $CLASSPATH works fine

18:18 technomancy: hiredman: does -cp on the command line add to that or replace it?

18:19 Bracki: Does not work on Windows because of the crappy backward slashes.

18:19 hiredman: replaces

18:19 technomancy: hiredman: well that's not a solution for a package manager then =\

18:20 hiredman: the other solution is to wrap java

18:20 (which freebsd already does) in a shell script

18:20 technomancy: yeah, I've been playing with hashdot, which seems to be a step in the right direction

18:21 it gets rid of the ridiculous ps output too

18:21 hiredman: but the freebsd script is only setup for switching between multiple versions of java

18:21 not managing the classpath

18:22 technomancy: it just pains me to see these things cause so many problems, because they have been solved well already.

18:24 Bracki: technomancy: you shouldnt hardcode the slashes into the mire.clj use File.separator instead.

18:25 technomancy: Bracki: that stuff doesn't get translated on the fly by the JVM?

18:25 Bracki: Apparently not.

18:26 technomancy: Bracki: ok, noted.

18:26 pilkarn: is there a way to flatten (1 2 3 4 5 6 (7 8 9) (10 11 12))

18:27 how do you package for ubuntu? does it have to get approved?

18:27 is there a god mp3player coming with ubuntu?

18:27 technomancy: none of mp3 players on ubuntu are deities yet.

18:27 pilkarn: i have made a really good one in clojure, can I make it available o download a s a apt-get-package?

18:28 deities == very good?

18:28 technomancy: pilkarn: deities are gods or godlike beings

18:28 pilkarn: you probably couldn't get it packaged unless clojure is also packaged

18:28 which I suspect would need to wait for a 1.0 release, at least

18:29 hiredman: that doesn't stop you from making your own .deb

18:29 and distributing that

18:29 technomancy: true, as long as you made it self-contained

18:29 hiredman: erm

18:30 pilkarn: well i did mine to learn clojure and a little java and it can do most what youw ant, save lplaylists, create random playlists, im currently adding trackening listening habits etc

18:30 what about videoplayers?

18:30 technomancy: but at that point you might as well put out a tarball I think

18:30 the whole point of making a deb is to handle dependencies and be stored in a repository

18:30 hiredman: ~google banshee

18:30 clojurebot: First, out of 5010000 results is:

18:31 Banshee

18:31 http://banshee-project.org/

18:31 zakwilson: pilkarn: I think getting something distributed with Ubuntu would be easier if it starts to get some popularity... so, convince some people to use it.

18:31 hiredman: I don't use ubuntu, but I would be surprised if it did not come with some kind of media player

18:31 zakwilson: I can think of no technical you couldn't bundle Clojure with it and get the whole thing packaged as a .deb with Ubuntu.

18:32 Bracki: How do I access static members of Java classes?

18:32 hiredman: I mean, it has gnome, and gnome comes with totem

18:32 cooldude127: Bracki: System/out

18:32 hiredman: Class/member

18:32 zakwilson: Ubuntu does come with a media player or three, and many more available in the repositories.

18:34 technomancy: yeah, getting included in the base distribution is virtually out of the question, but you could get it included in the "universe" repository

18:36 danlarkin: technomancy: duck-streams has a file function that will convert unix or windows style paths into a java.io.File object correctly

18:37 technomancy: cool

18:37 Bracki: ,(.java.io.File separator)

18:37 clojurebot: java.lang.Exception: Unable to resolve symbol: separator in this context

18:37 Bracki: What's wrong there?

18:37 hiredman: ,java.io.File/separator

18:37 clojurebot: "/"

18:37 technomancy: ,java.io.File/separator

18:37 clojurebot: "/"

18:37 hiredman: many things

18:37 technomancy: oh snap

18:38 hiredman: ,(. java.io.File separator)

18:38 clojurebot: "/"

18:38 hiredman: symbols starting with a . are interpreted as method calls

18:39 using . directly like (. java.io.File separator) is a very archaic style

18:39 Bracki: ok.

18:40 hiredman: there are different kinds of syntactic sugar for it

18:40 slashus2: What do you all think about complex number support in a language?

18:40 Bracki: Well off to bed. good night

18:41 hiredman: slashus2: I don't use complex numbers...

18:42 slashus2: I don't really either, but I am sure there are some mathematicians that use them quite often.

18:43 hiredman: let them who are concerned address those concerns

18:43 technomancy: rule 1 of programming: don't write code that you aren't going to use.

18:43 ~yagni

18:43 clojurebot: Huh?

18:44 technomancy: clojurebot: yagni is You Aren't Going to Need It

18:44 clojurebot: Ok.

18:50 ataggart: ~~

18:50 clojurebot: No entiendo

18:59 pilkarn: what kind of features do existing player's have? can they create playlists for you based on your listening habits? can they recommend music for you given what you listen to?

19:04 technomancy: the killer feature for the one I use is being able to be remotely controlled by external clients

19:05 http://musicpd.org

19:05 you need a huge external database to recommend new music based on listening habits

19:06 hiredman: technomancy: well, you connect to some kind of external service

19:06 banshee has some kind of plugin for it

19:06 technomancy: right, yeah. it can be a 3rd-party service

19:06 last.fm, ilike, and pandora come to mind

19:11 lisppaste8: pilkarn pasted "playbacklistener, for acllbacks?" at http://paste.lisp.org/display/75827

19:11 pilkarn: ^^ is that what I could use for the callback-function?

19:32 stuhood: if there an equivalent of import java.io.* for the :import directive?

19:32 danlarkin: heyyyy finally got this stupid project AOT compiling

19:32 cooldude127: stuhood: pretty sure that's a no

19:32 danlarkin: stuhood: no

19:33 java packages aren't enumerable

19:34 stuhood: bummer. thanks gang

19:36 actually, Scala does it... it's got to be possible

19:44 danlarkin: stuhood: please figure out how and post to the group :)

19:49 technomancy: if you were trying to get someone to try clojure, but they insisted on using an IDE, which would you suggest?

19:49 which has the most mature clojure support?

19:51 Raynes: technomancy: Netbeans.

19:51 I use it full time.

19:51 technomancy: enclojure certainly has a better web site than clojure-dev. =)

19:51 Raynes: It's fine for development right now.

19:51 technomancy: Raynes: have you tried the Eclipse one too?

19:51 hiredman: woa, that looks all zoomie and high tech

19:51 Raynes: Little rough around the edges but it has build and run support which is why I use it.

19:51 technomancy: ok, thanks

19:51 Raynes: technomancy: The Eclipse one, dare I say isn't all that great.

19:52 I use Netbeans because of that pretty little "build" button.

19:52 I hate trying to build executable .jars :|

19:52 technomancy: I haven't gotten that far yet. not looking forward to it.

19:52 Raynes: But enclojure isn't all that buggy, so it's not going to crash on him or anything.

19:52 technomancy: seems like a tarball with a shell script can get you a long way though.

19:53 holy crap netbeans has a lot of dependencies

19:54 blbrown: is (let [] ...) equivalent call to the common lisp (progn ...)

19:54 technomancy: oh crap; the version with ubuntu looks like it's too old. =\

19:54 blbrown: CL's progn is clojure's do

19:55 let is let

19:55 blbrown: crap

19:55 Raynes: technomancy: It's mostly the Java stuff.

19:55 hiredman: actually, I hear let is let*

19:55 technomancy: ah, right

19:56 * hiredman has never touched common lisp

19:56 blbrown: I guess let in common lisp is a little pointless

19:56 as opposed to just let*

19:57 technomancy: wow. this is... not fast.

19:57 Raynes: technomancy: Netbeans is slow as /shit/

19:57 Always has been always will be.

19:58 I just live with it.

19:58 :|

19:58 danlarkin: poor java developers don't know what poor tools they're dealing with :-/

19:58 Raynes: Eclipse is a bit faster, but not significantly unless you are on rather nice hardware.

19:58 I find them both to be bearable.

19:58 * technomancy tries again with 6.5

19:59 technomancy: Raynes: there's like seven different versions. which is the smallest that will work for clojure?

19:59 Raynes: Any.

19:59 Clojure will download it's own dependencys.

19:59 technomancy: cool

19:59 Raynes: I used the PHP version.

19:59 Dependencies*

19:59 Enclojure*

20:00 Bah I need sleep.

20:02 It's not going to be as "powerful" as emacs and all that noise but it works great and it's all I need. I just don't have the patience to use Emacs with a JVM language.

20:02 Especially on windows with no other option.

20:02 pilkarn: is there some good program to draw how a program works, ie execution flow, dependencies etc?

20:02 technomancy: Raynes: because you're writing a significant amount of Java?

20:02 cooldude127: Raynes: i don't have the patience to use Emacs with Java, but for clojure it's the bomb

20:02 Raynes: technomancy: Zero Java.

20:03 cooldude127: It's my opinion, please people don't start this again. :|

20:03 pilkarn: god i cant stand eclipse and netbeans, how did they manage to make soemthing so bloated? oh yeah thats right...they used java

20:03 Raynes: I don't like to use Emacs for any JVM language period, Emacs is fine for those who do, and I use emacs for almost everything else including simple text editing.

20:03 technomancy: at least the splash screen is nice

20:04 gnuvince_: What's the problem with Emacs and JVM languages?

20:04 Raynes: pilkarn: I agree for Emacs, but I have to say that Eclipse is pretty darn neat.

20:04 I mean.

20:04 gnuvince_: I quite like the Clojure integration.

20:04 Raynes: Netbeans.

20:04 netbeans not emacs, damn I need sleep!

20:04 gnuvince_: Stop it.

20:04 gnuvince_: Raynes: I'm seriously asking, I don't want to dissuade you or anything, I'm geniuinely curious

20:05 technomancy: at least NB 6.5 is not as slow as 6.1

20:05 Raynes: "I don't like to use Emacs for any JVM language period, Emacs is fine for those who do, and I use emacs for almost everything else including simple text editing." It's my opinion because I have very esoteric wants and needs. I just don't like using emacs for JVM languages. I like having an IDE so command-line use is kept at a minimum.

20:06 gnuvince_: ah, so the integration with ant and stuff?

20:06 Raynes: And second of all, I'm on windows. That's just too much to bear. I think emacs is the greatest bit of software since Clojure was developed.

20:06 Yes.

20:06 gnuvince_: kk

20:06 Emacs on Windows wasn't too shabby last time I tried (EmacsW32 22.something)

20:07 Raynes: gnuvince_: Sorry for being so insulting, it's just I tend to be chased after with torches and pitchforks in here when I mention I don't like emacs for JVM languages.

20:07 Emacs on windows is fine, it's the command line stuff I don't care for.

20:07 gnuvince_: Raynes: I like to suggest it, but I frankly don't care what you use

20:07 (unless it's notepad)

20:07 I personally use both vim and Emacs for different tasks

20:07 technomancy: how do you open a project in netbeans?

20:08 Raynes: gnuvince_: Understood, Lau_Of_DK almost called me stupid when I first mentioned it.

20:08 gnuvince_: Emacs for Clojure and Haskell, Vim for Django and small edits.

20:08 Raynes: I use Emacs for Haskell.

20:08 gnuvince_: Raynes: Lau_of_DK seems pretty zealous about his tools

20:08 Raynes: gnuvince_: Top left corner, open project.

20:08 gnuvince_: He's on rhickey's case all the time to switch to git

20:08 technomancy: Raynes: yeah, it just lets me browse through directories, but doesn't let me choose one

20:08 Raynes: Lau_Of_DK is an asshole quite frankly, I don't like his attitude too much.

20:08 gnuvince_: Raynes: you probably meant technomancy

20:08 Raynes: Yeah, sorry.

20:09 gnuvince_: (about the open project thing, not the asshole thing)

20:09 I love you technomancy

20:09 Please keep clojure-mode alive

20:09 kthxbye

20:09 :)

20:09 technomancy: hehe

20:09 Raynes: technomancy: File -> new project -> Clojure -> Clojure application.

20:09 technomancy: Raynes: I tried that too, but I'll try it again I guess.

20:10 Raynes: is there a special trick to opening projects that aren't created in NB?

20:10 Raynes: technomancy: When you create a project, make the namespace as follows (anything.filename)

20:10 technomancy: ah, when I tried to pick my own project name and location it was a no-op.

20:10 but using the defaults it worked

20:11 and people complain that Emacs is hard. =)

20:11 Raynes: For some reason, if you don't make the namespace at least 2 directories it wont work because it takes a directory the last statement after the last . will be the file name.

20:12 Wow.

20:12 Why am I even talking. I'm so tired most of what I say seems like nonsense.

20:12 technomancy: heh

20:12 yeah, I tried to enter a root namespace that didn't have a dot in it

20:12 legal in clojure, but not in NB I guess

20:13 whatever; I don't have to use it, I just have to try it out so I know what I'm suggesting to others.

20:13 Raynes: It isn't because the last part of the file name, weird.

20:13 I'll have to talk with Eric about it.

20:13 He can fix it. Yes he can!

20:13 I'd use Eclipse if Laurent would put in somekind of build mech to build an executable .jar.

20:14 It wouldn't be hard at all, but I guess he doesn't see it as important.

20:14 Just a simple Ant script.

20:14 technomancy: well thanks for the tips

20:14 Raynes: No problem.

20:14 * technomancy is at least marginally educated about "modern IDEs" now.

20:14 Raynes: <3

20:14 technomancy: haven't used one since VC6 in university

20:14 *visual studio

20:14 whatever

20:14 it was horrible

20:15 Raynes: Visual Studio is neat for C++ thanks to it's exceptional debugger.

20:16 I despise C++ and everything it stands for, but still.

20:16 technomancy: yeah, hard to say how much of the pain was due to the language vs due to the UI

20:16 * Raynes goes to sleep

20:17 * Raynes waves to technomancy

20:17 technomancy: if I had a time machine, slapping some sense into my freshman self would be on my list right after inflicting pain on the people who told brendan eich to make JS look like java

20:17 later

20:29 pilkarn: isn't the browser hopelessly imperfect for making advanced stuff? look! its a gui in a gui

20:54 is there some good program to draw how a program works, ie execution flow, dependencies etc?

20:54 anyone use JLayer to play mp3s? a class called PlayBackListener is that for creating a callback function so I can use that to somethin when finished rather than do polling every 10K ms?

20:54 are Listener used for callbacks?

20:56 cooldude127: pilkarn: looks like it

20:56 it has a playbackFinished method

21:01 pilkarn: it justs seems circular, advancedplayer has PlayBackListener, PlaybAckLisetner has event, PlayBackEvent has AdvancedPlayer. has as in has a sa parameter to their constructor

21:02 cooldude127: pilkarn: it's fine

21:03 playback event wants to know what player it's associated with

21:03 which player fired that even

21:03 but the player also has listeners that get called with those events

21:03 circular references only matter when you try to traverse the trail

21:11 pilkarn: but hmm

21:13 I dont' get the structure, the whole anthropomorphism of Java just bugs me.

21:14 its a thing that has a thing that does athing class here and there

21:15 danlarkin: Heyooo! executable jar

21:15 pilkarn: i dont get how to construct a on-event method

21:15 hiredman: ,(doc pl)

21:15 clojurebot: "([& forms]); replaces a $ b with (a b) walking right to left replaces a � b with (comp a b) left to right ?a with (uncurry a) left to right ?a with (flip a) left to right"

21:15 pilkarn: danlarkin: how?

21:15 danlarkin: pilkarn: a lot of trial and error, ha!

21:16 cooldude127: pilkarn: in java or clojure?

21:20 pilkarn: cooldude127: to create an on-event in Clojure, but i wouldnt get it in java either, i dont get the principle

21:20 cooldude127: pilkarn: you need a proxy i believe

21:20 ,(doc proxy)

21:20 clojurebot: "([class-and-interfaces args & fs]); class-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, must be first. If not provid

21:21 cooldude127: but if you don't get the java principle, you might have trouble

21:21 pilkarn: its not really that(i think), i dont get hwta to pass to execute something when it finishes

21:22 do you know JLayer?

21:22 or have the docs?

21:31 danlarkin: https://twitter.com/gvanrossum/status/1228991275

21:34 pilkarn: also a listner seems to be for when a user does something rather than when a task finsihes

21:34 hiredman: http://twitter.com/disturbyte/statuses/1228998632

21:34 pilkarn: isnt twitter just the biggest timewaster ever?

21:36 cooldude127: YES

21:38 matthew`: Hi everyone. I want to read in some data from a file that is comma separated. I was wondering what the "Clojure" way of doing this? Some pointers to the functions I might call would be handy. Thanks

21:39 hiredman: SuperCSV is a pretty nice java lib for csv files

21:39 I have used it with clojure in the past

21:40 danlarkin: yeah, CSVs can be a total PITA, I would wrap a well-tested java lib if you can

21:40 hiredman: it doesn't take much wrapping

21:41 matthew`: Thanks

21:42 I'll give it a look. Its just that when you start using Lisp you are encouraged to start thinking in Lisp. For me that usually entailed a completely different way of dealing with the problem.

21:43 But if the library is already there it why re-invent the wheel.

21:43 hiredman: java interop is a win, never forget it

21:43 matthew`: Thanks again.

21:43 pilkarn: uh ok. somehow i got something tht seems to work by pure guessing lol.

21:44 matthew`: (defn split [string delim] (seq (.split string delim))) , (split (slurp filename) ",")

21:46 hiredman: pilkarn: that is a very naive way to do it

21:47 danlarkin: that'll never work for real data

21:47 hiredman: real data is really dirty

21:47 and I hate it

21:47 matthew`: pilkarn: That is more of what I was expecting. Although it looks like it will pull in the entire file at once.

21:47 danlarkin: motion seconded

21:54 pilkarn: i was just showing a simple way of reading a file and splitting, didnt mean it would work perfectly for his example

22:00 matthew`: pilkarn: Thanks for the example. It helps to see examples so I can start to get the feel for how things are meant to be done in the language. Cheers.

22:02 danlarkin: so what's the clojure equivalent of argv[0]?

22:03 it's not *file*

22:12 pilkarn: (proxy [ActionListener] []

22:12 (actionPerformed [ev

22:12 am i supposed t do soemthing like that for the PlaybackListener for example?

22:19 hiredman: yes

22:19 pilkarn: how would I improt this

22:19 javazoom.jl.player.advanced.jlap.InfoListener

22:20 Constructor Summary

22:20 jlap.InfoListener()

22:22 arohner: is anyone familiar with an embeddable wiki engine? I've looked at a few but they all suck.

22:25 cooldude127: arohner: define embeddable

22:26 arohner: a wiki library that only deals with the back end objects

22:27 cooldude127: not sure i understand

22:27 arohner: i.e. programatic access only

22:27 cooldude127: oh

22:27 arohner: all of the wiki engines I've seen only deploy as WARs, and have their own servlets. They draw their own menus and controls, etc

22:27 I want to control all of the UI

22:28 and it seems like this is a problem that should already be solved. I can write my own but it seems like it should be out there already

22:36 blbrown: I have an gui app. I am basically saving a the state of a regex matcher (with 'ref') and to call m.find from anywhere in the app. But I can't tell with m.find the difference between 'has a match but at the end' or 'doesn't have any matchs found'

22:40 arohner: blbrown: if there weren't any matches found, wouldn't m.find return false?

22:41 blbrown: arohner, exactly, it will return false for when no matches are found and when match is at the end of scanning. I was trying to distinguish between the two. and I don't think m.hitEnd is helping either

22:45 arohner: why do you need to be able to tell the difference?

22:45 technomancy: so is it true that if you take a map and use a lazy function on it that you can no longer "call" it?

22:45 arohner: if it returns false, there are no more matches, right?

22:47 blbrown: arohner, well there is a difference. If you are at the end of the search, "Do you want to search again at the beginning" and the "There aren't any matches" I guess I could reset after a not found

22:49 arohner: blbrown: I assume you're saving the state because this is a time-intensive operation?

22:50 blbrown: arohner, I got it, I just reset the matcher after a a "Not Found". that seems to work

22:51 arohner: cool

23:03 technomancy: it seems like calling seq on a map causes it to lose its "mappiness", and I'm not sure how to get it back

23:03 cooldude127: technomancy: what about (into {} (seq {blah}))

23:04 technomancy: yeah i know that works

23:04 technomancy: cooldude127: aha! that's certainly better than (apply hash-map (flatten (seq {1 1 2 2}))) ... =)

23:05 cooldude127: technomancy: yeah i was asking the same question the other day

23:05 technomancy: it's just a shame that laziness and associativity can't really co-exist. I understand why now that I think about it, but for some reason I thought it would Just Work.

23:05 blbrown: hmm, lazier version of clojure...is that good

23:06 technomancy: cooldude127: unfortunately this means rewriting a serious portion of my peepcode, because I was using map inappropriately =\

23:07 cooldude127: technomancy: how?

23:08 technomancy: http://github.com/technomancy/mire/blob/2c65943e7b158c50a42d9e31f3be525dec0c0683/src/mire/rooms.clj

23:09 there are a number of things wrong with this. first is that I was putting a transaction inside a call to map, which meant it didn't happen unless it was realized, which it wasn't

23:09 cooldude127: oh lol

23:09 technomancy: I switched it to use the return value of map instead of altering a ref, but then I lose the "mappiness" of the rooms var

23:09 cooldude127: oh

23:10 technomancy: so I have to chose between laziness or associativity. the code base requires associativity in a number of places, but I really need an example of laziness. =\

23:10 rock and a hard place

23:11 cooldude127: technomancy: yeah that's unfortunate

23:11 this doesn't look like a great place for it

23:13 technomancy: I *already* have a great example for getting tripped up by laziness where you don't expect it. =)

23:13 don't need another

23:13 cooldude127: lol

23:14 technomancy: plus using into feels like introducing too much stuff at once.

23:18 mapcat almost looks like it could do it

23:18 maybe I'm just not fitting the pieces together

23:19 pilkarn: JLayer is pretty fucing bad, it is like they haven't thought at all when they made it, they have several different playes that dont share the same method even if they are basic

23:19 defn: 'lo all

23:20 danlarkin: technomancy: jochu merged your branch! hooray

23:20 technomancy: hmm... I may be able to pull something off with reduce and conj. let's see

23:20 danlarkin: indeed; he has emerged from his silence!

23:20 defn: I'm trying to explain Clojure to a friend who doesn't have any experience with lisp, etc.

23:21 I was trying to kind of give him lecture 1 of SICP, but he's not really getting what I'm saying

23:21 Any analogies or ways you can think of putting it simply, or a way to illustrate it that would demonstrate the power?

23:23 pilkarn: defn: do you have a codeexample of a whatever language he uses and one of the ame program in a lisp?

23:23 defn: pilkarn: im pretty new to this whole boat myself, but ive had glimpses of the awesomeness of lisp, et al

23:23 hiredman: what exactly doesn't he get?

23:24 you could have him watch the actual sicp video

23:24 defn: well i was trying to explain how there are forms, and you combine these forms in interesting ways to do just about anything you can imagine

23:24 hiredman: ~google sicp videos

23:24 clojurebot: First, out of 16200 results is:

23:24 Structure and Interpretation of Computer Programs, Video Lectures

23:24 http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/

23:25 defn: hiredman: yeah -- although i dont want to scare him away

23:25 hiredman: heh

23:25 defn: im trying to kind of give him the elevator pitch if only for my own understanding

23:25 jhawk28: there is the beta Programming Clojure book

23:26 technomancy: cool; it works with reduce at the expense of laziness

23:26 defn: jhawk28: I have it and am reading it, although it is still a challenge to get one's mind around the ideas from Lisp

23:26 hiredman: I would start off just talking functions, and leave code as data stuff for later

23:26 defn: hiredman: like functions as types?

23:26 hiredman: now

23:26 no

23:27 functions as a means of abstraction

23:29 defn: so i should explain to him lambda calculus?

23:29 im trying to not scare him away ;)

23:29 hiredman: you don't say "lambda calculus"

23:30 slashus2: Is there a good reference to design patterns for programming in languages such as Clojure? I am use to modeling problems in an object oriented fashion.

23:30 hiredman: and I would go with combinatory logic :P

23:31 jhawk28: anything with the word calculus is scary :)

23:31 hiredman: the sicp vidoes are great

23:32 defn: yeah anyone with even a vague interest in sicp should draw something from those i think

23:33 technomancy: slashus2: mostly just reading code. trying to apply design patterns from other languages to lisp is a recipe for overcomplicated code, especially with Clojure.

23:34 slashus2: That is what I was afraid of.

23:35 technomancy: slashus2: on the bright side, there's a lot of code out there to learn from.

23:35 well, a lot more than you could ever read all the way through, anyway.

23:37 hiredman: the problem is exstracting the algorithm from the mechanics of state manipulation

23:39 slashus2: So the "try to make each function do one thing (doesn't include using other functions of course)" applies?

23:40 hiredman: that is what makes for good functions

23:41 and good functions can be used in more then one place

23:41 are easily composed

23:43 slashus2: I don't know why it feels dirty, but when I was writing a genetic algorithm, it felt dirty making a bunch of utility functions in one file. I am still learning about the modularization aspect of it.

23:44 Used to classes helping to organize.

23:45 danlarkin: namespaces are the new classes

23:46 jhawk28: is first and rest similar to the tail in ML?

23:47 hiredman: well, what is tail in ML?

23:47 cooldude127: jhawk28: rest = tail

23:47 first = head

23:47 jhawk28: does it have similar performance?

23:48 cooldude127: jhawk28: no idea

23:49 hiredman: uh

23:57 danlarkin: how would it not have O(1) complexity?

23:58 well, strike that question, I guess I can imagine situations where it wouldn't... I guess if you for some reason copied the list every time you did a call to tail...

23:58 but clojure doesn't do that

Logging service provided by n01se.net