#clojure logs

2009-02-19

00:00cooldude127/ that is
00:00cooldude127not //
00:02cooldude127wait a minute, (def /) actually works in the repl
00:02cooldude127kinda
00:02durka42i can unmap /, and (defn / [a b] (+ a b)), but then (/ a b) gives ExceptionInInitializerError which was Invalid Token Exception from the reader
00:03cooldude127fine, i'll cave and do div for now
00:03cooldude127but someone needs to get on this
00:03cooldude127*wink* *wink*
00:03hiredmanmaybe |
00:04cooldude127hiredman: you think so? i considered that
00:04cooldude127durka42: you seem involved, what's your opinion of |
00:04durka42too much like "or"...
00:04durka42got it
00:04durka42(ns-unmap 'clojure.core '/)
00:05durka42(ns-unmap 'user '/)
00:05durka42(in-ns 'clojure.core)
00:05durka42(def / +)
00:05durka42(in-ns 'user)
00:05durka42(use 'clojure.core)
00:05durka42user=> (/ 2 3)
00:05durka425
00:05cooldude127that's EVIL
00:05durka42that could be wrapped into a nice macro...
00:06durka42actually with-ns would be a useful macro, and not always for evil purposes
00:06hiredmansmells like a monkey patch
00:06cooldude127durka42: the problem is it affects everything else in the running instance of clojure
00:06durka42user// is an invalid token, but clojure.core// is treated specially by the reader?
00:06durka42yes, it would do that
00:06durka42well, maybe
00:06durka42it doesn't take effect in 'user until after user=> (use 'clojure.core)
00:07cooldude127durka42: i might do this still just because my new version of / should preserve the old behavior
00:07cooldude127just augment it
00:07durka42for your next challenge, redefine in-ns
00:07cooldude127one thing at a time
00:08durka42hmm, in-ns became slightly less magic since i last looked at it
00:08hiredman~def in-ns
00:09durka42you're right, it does affect other namespaces
00:12durka42http://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/LispReader.java#53
00:15hiredmanyou could do direct java class
00:15hiredmancalls
00:18cooldude127yeah this isn't working
00:18hiredmanfoo=> (clojure.lang.Symbol/create (str *ns*) "/")
00:18hiredmanfoo//
00:18cooldude127+ already refers to #'math.symbolic/+ ? wtf does + have to do with it
00:19hiredmanfoo=> (def / 1)
00:19hiredman#'foo//
00:19hiredmanfoo=> /
00:19hiredman1
00:19durka42,(symbol *ns* "/")
00:19clojurebotjava.lang.ClassCastException: clojure.lang.Namespace cannot be cast to java.lang.String
00:19durka42,(symbol (ns-name *ns*) "/")
00:19clojurebotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String
00:19durka42,(symbol "sandbox" "/")
00:19clojurebotsandbox//
00:20hiredman,`/
00:20clojurebotclojure.core//
00:21cooldude127apparently all the NS mucking is messing up other sane stuff. so i'm not gonna bother
00:21hiredman,(ns-unmap '/)
00:21clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$ns-unmap
00:21hiredman,(ns-unmap (symbol "/"))
00:21clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$ns-unmap
00:21hiredman,(ns-unmap *ns* (symbol "/"))
00:21clojurebotjava.lang.IllegalArgumentException: Can't unintern namespace-qualified symbol
00:23hiredman,(/ 1 2)
00:23clojurebotjava.lang.ExceptionInInitializerError
00:23cooldude127this is totally fucking evil and i refuse to be involved anymore
00:24cooldude127i await a time when / can be redefined at will
00:24cooldude127in the meantime, div it is
00:30durka42hey, that's simpler
00:30durka42(ns-unmap 'user '/)
00:30durka42(.refer (the-ns 'user) (symbol nil "/") #'+)
00:30durka42user=> (/ 2 3)
00:30durka425
00:31durka42does not affect other namespaces, either
00:32cooldude127durka42: hmm let's try that
00:32durka42the second argument must be a Var
00:34pjb3Is there a build in function better than this?
00:34pjb3,(seq (.split "foo=1" "="))
00:34clojurebot("foo" "1")
00:34cooldude127durka42: HOLY SHIT THAT WORKED
00:35durka42heh :)
00:35Chouserpjb3: what you've got looks good.
00:35hiredmanvoodoo
00:35pjb3Chouser: Yeah, I'm just not liking the extra (seq (.split
00:35pjb3(map #(seq (.split % "=")) (seq (.split "foo=1&bar=2" "&")))
00:35Chouserpjb3: There aren't many string functions built into Clojure because it's so easy just to use the Java methods.
00:35cooldude127durka42: wait a minute, we'll see
00:36durka42there is c.c.str-utils
00:36durka42with re-split
00:36Chouserpjb3: why do you need those seq's?
00:36pjb3Does it work on arrays?
00:36hiredmaneh?
00:36durka42Chouser: well, otherwise you get a #<Stringasdf;lkajdf;kajhfdg
00:36Chousermap calls seq on its collection for you
00:37pjb3yeah, but then I get an array of arrays
00:37Chouserand Java arrays works with seq
00:37hiredmanuh
00:37hiredmanno
00:37Chouserif you get rid of both, you'll have a seq of arrays
00:37cooldude127durka42: 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
00:37durka42well, you need the ns-unmap
00:38durka42or does ns-unmap not undo .refer
00:38Chouserpjb3: but then what are you doing with the inner arrays? Chances are 'seq' will be called for you then too.
00:38hiredmancooldude127: defonce
00:38pjb3Chouser: yeah, actually that ends up working for this
00:38cooldude127hiredman: i used that
00:38pjb3(map #(seq (.split % "=")) (seq (.split "foo=1&bar=2" "&")))
00:38cooldude127hiredman: but there's other stuff that's being done that can also only be done once
00:38pjb3whoops, copy FAIL
00:38pjb3(apply hash-map (mapcat #(.split % "=") (.split "foo=1&bar=2" "&")))
00:38durka42cooldude127: i can do (ns-unmap 'user '/) and then (.refer ...) again at the REPL
00:39Chouserpjb3: yep, looks good
00:39hiredmancooldude127: (defonce _ (do all kinds of stuff here))
00:39pjb3Chouser: thanks, did I heard something about a Clojure meet up in Indiana you were planning on going to?
00:39cooldude127hiredman: maybe that'd be better with a gensym?
00:40cooldude127hiredman: (defonce `x# ...)
00:40Chouserpjb3: yep, are you in the area?
00:40Chouser,(into {} (map #(vec (.split % "=")) (.split "foo=1&bar=2" "&")))
00:40clojurebot{"bar" "2", "foo" "1"}
00:40pjb3Chouser: nope, in Baltimore
00:40Chousereh, that's probably not any better.
00:41Chouserum, into I mean, not Baltimore.
00:41pjb3Just wanted to know what the interest was like out there
00:41ChouserI think it'll be mostly .Net guys, so we'll see...
00:41pjb3Chouser: Yeah, the into seems like 6 or .5 dozen
00:42cooldude127nvm that gensym won't work
00:43cooldude127and even the defonce didn't work
00:43durka42well if you gensym every time you defonce it will happen more than once, no?
00:43pjb3I'm head to NC tomorrow for RubyRX, stuarthalloway is giving 2 clojure talks, should be cool
00:43cooldude127durka42: not gensyming anymore
00:43cooldude127cuz you can't do that in that case anyway
00:44durka42user=> (defonce _ (prn "boo"))
00:44durka42"boo"
00:44durka42#'user/_
00:44durka42user=> (defonce _ (prn "boo"))
00:44durka42nil
00:44cooldude127it still throws up errors
00:44cooldude127OH I THINK I KNOW WHY
00:45Chouserpjb3: cool
00:45cooldude127it's the ns declaration
00:45pjb3Chouser: in your into one, how come vec works, but if I change that to seq, it doesn't?
00:45cooldude127it's pulling in the / from clojure.core, which i've now redefined
00:46Chouserinto really wants a seq of MapEntries
00:46Chouseryou're allowed to use a 2-element vector most places that want a MapEntry
00:46Chouseri've never looked into how that's allowed or why nothing else is.
00:46cooldude127durka42: OH HELL YEAH
00:47cooldude127durka42: once i excluded / from the :refer-clojure, i can recompile successfully, so now mission accomplished
00:47pjb3Chouser: yeah, interesting, that seems inconsistent
00:47cooldude127durka42: thank you for your insanely evil help
00:47cooldude127hiredman: you too
00:48durka42evil
00:48Chouserpjb3: hm, look at that -- a MapEntry is a Vector
00:48Chouser,(vector? (first {:a 1}))
00:48clojurebottrue
00:48Chouser,(class (first {:a 1}))
00:48clojurebotclojure.lang.MapEntry
00:49Chouseras shown on the graph: http://tinyurl.com/clojure-classes
00:49pjb3yeah, I guess that explains it
00:50pjb3,(into {} [(vec (.split "x=1" "="))])
00:50clojurebot{"x" "1"}
00:50lisppaste8cooldude127 pasted "how i'm thanking durka42" at http://paste.lisp.org/display/75763
00:50pjb3,(into {} [(seq (.split "x=1" "="))])
00:50clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry
00:50pjb3,[(seq (.split "x=1" "="))]
00:50clojurebot[("x" "1")]
00:53pjb3I'm sure there's some other internal reason for it, but it would make more sense if clojure.lang.MapEntry were a seq
00:55Chouserit takes longer to get to the second thing in a seq than to the first, which is not true of a vector
00:56ChouserTwo 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.
00:58durka42cooldude127: this may be one of the few legitimate uses of XML
00:58durka42to mark evil
00:58cooldude127lol
00:59yangsxJust 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?
01:00cooldude127yangsx: you can write your own functions to do tree recursion
01:01hiredmanyangsx: what do you mean by tree recursion?
01:02yangsxlike recursion over a tree structure
01:02hiredmanlike a depth first walk?
01:02yangsxhiredman: yes
01:03hiredmanclojure.zip
01:03hiredman,(doc clojure.zip/next)
01:03clojurebot"([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."
01:04hiredmancooldude127 was doing avl and redblack trees, but not with zippers
01:04cooldude127yes i was :)
01:04hiredmanzippers are cool
01:04cooldude127zippers are weird for binary trees
01:04hiredmanthey can be hard to navigate
01:04cooldude127cool for more freeform trees
01:05Chouseryangsx: you can absolutely do a depth-first walk over a tree
01:06Chouseryangsx: 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.
01:06hiredmanthe transform function my pl macor uses uses zip/next to walk through the s-expressions
01:07hiredman,(pl (map call � ?+ $ 5 range $ 5))
01:07clojurebot(5 6 7 8 9)
01:08durka42what are the precedence rules on that monstrosity?
01:09durka42,(macroexpand '(pl (map call � ?+ $ 5 range $ 5)))
01:09clojurebot(do (map (comp call ((uncurry +) 5)) (range 5)))
01:09hiredman$ � ? ?
01:10durka42as in flip happens first
01:10hiredmancall � ?+ is the same thing as (partial +
01:10hiredmanno
01:10hiredmanflip is last
01:10durka42but it looks like $ is after uncurry
01:11hiredmannope
01:11hiredman$ is first
01:14hiredman ?+ $ 5 turns into (?+ 5) which turns into ((uncurry +) 5)
01:14durka42oh oh i see
01:16durka42i thought we used s-expressions to avoid precedence rules...
01:18hiredman,(pl inc $ 3)
01:18clojurebot4
01:30slackoramaApologies for yet another slime question but I just did a pull from
01:30slackoramagit,cvs,svn of the needed libraries and when slime starts up I get this error:
01:30slackoramahttp://gist.github.com/66759. It seems to run fine after that though.
01:31slackoramaDurr,sorry about that. Had fill mode on.
01:32durka42heh, i was just thinking
01:33durka42when most people talk about "closure" they mean letting go of something
01:33durka42but when we say "closure" we mean hanging on to things
01:33durka42also, my fingers really want to type clojure instead of closure
01:34fynnwe're having a discussion in #python
01:34fynnwhy doesn't Clojure have tail-call-optimization?
01:34durka42because the JVM doesn't
01:34durka42(yet)
01:34albinobecause the jvm doesn't support it
01:34fynn"(yet)"?
01:34hiredmanclojure uses java style calls, which do not support tco
01:35albinoIs it proposed for jdk version 7?
01:35durka42there are a couple proposals floating around
01:35hiredmansun is not working on it
01:35hiredmanbut some grad student is
01:35hiredman*shrug*
01:35durka42basically
01:36albinosounds like a "don't bet on it" strategy
01:36albinoI'm still waiting for sun to include chdir()
01:37durka42why?
01:37fynnI brought Clojure up as an interesting new language, and it was criticized for not having TCO
01:37hiredman*snort*
01:38albinodurka42: because it's a processes basic right to change directories, and to do so is useful
01:38fynnas a supposedly major flaw in a Lisp variant and language aspiring to be functional.
01:38hiredmanobviously they have never used clojure
01:38fynnI don't think it's that big of a deal either, but having TCO would be nice.
01:38hiredmanclojure has several features that almost entirely get rid of the pain of not having it
01:38hiredmanrecur and trampoline
01:39durka42python doesn't have TCO either, does it?
01:39fynndurka42: nope, in fact it actively discourages recursive style.
01:39fynn(the Designer deems it less readable)
01:40fynnhiredman: cool, I linked recur in #python
01:40albinofynn: the Designer being BDFL guido?
01:40slashus2The stack isn't very large for recursion by default.
01:40fynnalbino: yeah
01:40hiredmanthe 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
01:40durka42a friend of mine learned haskell and it heavily influenced his python... others who had to read his code were not amused
01:41hiredman,(take 10 (iterate inc 0))
01:41clojurebot(0 1 2 3 4 5 6 7 8 9)
01:42fynnverte> fynn, so it only works for single recursives. ugh.
01:42fynnthat's wrt recur
01:42hiredmanself recursion
01:42hiredmannot single
01:42durka42i mentioned trampoline, which can do mutual recursion if you want to return functions
01:42hiredmanbut for mutual recursion there is trampoline
01:43hiredman,(doc trampoline)
01:43clojurebot"([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
01:44fynndurka42: yeah, I lined to the group
01:44fynn*linked
01:45hiredmanso, basically, #python is full of it
01:48fynnheh, not exactly, but some people are perfectionists.
01:48fynnit's still sort of reassuring to know that you have TCO at your disposal.
01:49hiredmanclojurebot: clojure is also far closer to perfection then python
01:49clojurebotIn Ordnung
01:49durka42~clojure
01:49clojurebotclojure is cheating
01:49hiredman~clojure
01:49clojurebotclojure is a very attractive hammer with a nice heft to it
01:50durka42clojurebot: how much do you know about clojure?
01:50clojurebotI know 203 things
01:52hiredman~perfection
01:52clojurebotI don't understand.
01:55fynnI still think Clojure is possibly the most interesting Lisp implementations.
01:55hiredmandefinetely the most modern
01:57fynnSBCL is pretty oldstyle iirc
01:57durka42if "old-style" means "standard-conforming"
01:58hiredmanclojurebot: clojure is also <reply>"[Clojure ...] feels like a general-purpose language beamed back from the near future."
01:58clojurebotOk.
01:58fynnCommon Lisp is a fairly broken standard :/
01:59hiredmandon't let AWizzArd hear you say that
01:59hiredmanhe is pretty into that hyperspec
01:59fynneven Lisp people tend to agree that CL is broken
01:59hiredmanuh
02:07slashus2fynn: Some are pretty stubborn, but that is an irrelevant point.
02:44fffejI 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 :(
04:11blbrown,(+ 1 "0")
04:11clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
04:11blbrown,(+ 1 (char "0"))
04:11clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
04:11hiredmanweird
04:12hiredman,(char "0")
04:12clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
04:12blbrownhiredman, ..I was having a little trouble with characters
04:12hiredman(+ 1 \0)
04:12hiredman,(+ 1 \0)
04:12clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
04:12blbrownright
04:13hiredman,(pl (+ 1 int $ \0))
04:13clojurebot49
04:13blbrownhehe
04:13blbrown,(doc pol)
04:13clojurebotjava.lang.Exception: Unable to resolve var: pol in this context
04:13blbrown,(doc pl)
04:13clojurebot"([& forms]); "
04:13eevar2(doc test)
04:13clojurebottest [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception; arglists ([v])
04:13hiredmanpl is magic
04:39rfgpfeiffer_,(source pl)
04:39clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
05:20Lau_of_DKHey guys
05:24cgrand1Hi Lau_of_DK!
05:25Lau_of_DKcgrand1: Hi - You working on anything interesting these days ?
05:27cgrand1Lau_of_DK: dabbling with a code specializer
05:28Lau_of_DKcgrand1: Google is blank on code specializers... what are they ?
05:28cgrand1partial evaluation
05:29cgrand1user=> (binding [*locals* {'x 'x}] (partial-eval '(let [y (* 4 5)] (+ x y))))
05:29cgrand1(clojure.core/+ x 20)
05:30Lau_of_DKWhere would you find use for that? :)
05:30blbrownLau_of_DK, heay
05:30Lau_of_DKhey :)
05:31cgrand1Lau_of_DK: it's could prove useful when optimizing the output of a dsl
05:32cgrand1Lau_of_DK: it could prove useful when optimizing the output of a dsl
05:32Lau_of_DKOk, cool, I'll look forward to seeing what comes out of it - Hopefully some blogposts :)
05:34cgrand1and you, what are you working on?
05:37Lau_of_DKWe 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)
05:38cgrand1cool, it explains you asking about jmonkey
05:38Lau_of_DKExactly right :)
05:40Lau_of_DKIts 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
06:10Bracki,(reduce conj '() '(1 2 3 4 5))
06:10clojurebot(5 4 3 2 1)
06:10Lau_of_DKHow do I add a type-hint to a javaclass?
06:11BrackiWhy does that reduce call invert the list?
06:11BrackiShouldn't it just copy it?
06:12djpowellif you are writing new code that works with sequences, should you typically use the new 'rest'?
06:15djpowellthe 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?
06:19Bracki(fn [x y] (+ x y)) Whats the form using #(..) for this?
06:20Bracki#(+ % %1)?
06:21cgrand1Lau_of_DK: code sample?
06:22cgrand1djpowell: it depends whether you want nil-punning (next) or not (rest)
06:22RaynesBracki: #(+ % %1)
06:24Lau_of_DK(defn -render
06:24Lau_of_DK [this interpolation]
06:24Lau_of_DK (.. ($get :display) (getRenderer) (clearBuffers))
06:24Lau_of_DK (.. ($get :display) (getRenderer) (.draw #^{:type com.jme.scene.Spatial} ($get :rootNode))))
06:24Lau_of_DK
06:24Lau_of_DK@ cgrand1
06:28cgrand1Lau_of_DK: what are these $getDisplay? your genclassed getters/setters?
06:28cgrand1the .draw looks suspect
06:28Lau_of_DKcgrand1: ($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
06:28Lau_of_DKcgrand1: Its just pulling objects out of a hash-map that I use for globals
06:29Lau_of_DKNode 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.
06:29hoeckBracki: conj uses cons to add something to a list, and cons applies the element always on top of the list
06:29hoeckBracki: for appending at the end use conj and a vector
06:29hoeck,(reduce conj [] '(1 2 3))
06:29clojurebot[1 2 3]
06:30cgrand1Lau_of_DK: is $get hinted? (can you paste with more context?)
06:39Lau_of_DKcgrand1: 2 secs
06:40lisppaste8Lau pasted "Typehints for Mr. Grande" at http://paste.lisp.org/display/75777
06:40Lau_of_DKThere u go - thats the relevant context
06:40Lau_of_DKBut its a pretty big problem, if Clojure doesnt recognize superclasses inheriances
06:46cgrand1Lau_of_DK: ($get XXX) can return anything, you have to hint each $get call
06:46cgrand1#^Node ($get :rootNode)
06:47Lau_of_DKYea, but lets say I want to hint it to a Spatial, shouldnt (class #^Spatial ($get :rootNode)) return Spatial ?
06:49Lau_of_DK@ cgrand1
06:50Lau_of_DK(defn -render
06:50Lau_of_DK [this interpolation]
06:50Lau_of_DK (.. ($get :display) (getRenderer) (clearBuffers))
06:50Lau_of_DK (.. ($get :display) (getRenderer) (.draw #^Spatial ($get :rootNode))))
06:50Lau_of_DK
06:50Lau_of_DKThis will fail, because .draw sill only sees a Node - and Clojure doesnt realize that Node is an extended Spatial.
06:50Lau_of_DKOh - And (.draw ) should be (draw)
06:54AWizzArdWhere again was this nice compilation that visualizes the differences between Agents, Atoms and Refs?
06:54AWizzArdit was a 2x2 table or something like that
06:58AWizzArdAh oki, that was it:
06:58AWizzArdhttp://groups.google.com/group/clojure/msg/fd0371eb7238e933
07:37BrackiRaynes: no that doesnt work
07:37RaynesHrm.
07:37Bracki,(reduce #(+ % %1) '(1 2 3))
07:37clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1574$fn
07:37RaynesWord for me.
07:38Raynesworks for me*
07:38Raynes,(do #(println % %1) "lol" "lol")
07:38clojurebot"lol"
07:38RaynesWell, close enough.
07:39Raynes,(do #(println (str % %1)) "lol" "lol")
07:39clojurebot"lol"
07:40jdzRaynes: that code does nothing actually
07:40jdzit only returns the last "lol"
07:40Raynesjdz: I gathered.
07:40Raynesjdz: I realized.
07:42Bracki,(reduce #(+ %1 %2) '(1 2 3))
07:42clojurebot6
07:42BrackiAh.
07:42Bracki% is a synonnym for %1
07:42RaynesOh.
07:43RaynesI was just reading that.
07:56danlarkin+ is already a function that takes two ( or more or less ) args, so no need to wrap it in a lambda there
07:56danlarkin,(reduce + '(1 2 3))
07:56clojurebot6
08:05AWizzArd,(apply + [1 2 3])
08:05clojurebot6
08:07Brackidanlarkin: yeah that was just an example for a more difficult lambda.
08:07Bracki,(doc apply)
08:07clojurebot"([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."
08:19AWizzArdBracki: 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)
08:20djpowellit only works for + because + supports var args, if the function only supports 2 arguments, then you'd need to use reduce as above
08:20Hun`one method to implement vararg-+ is in fact to use reduce with an initial arg of 0
08:23Lau_of_DKrhickey__: Can you please add some syntactic sugar for floats?
08:24djpowellLau_of_DK: what like?
08:24djpowellLau_of_DK: you mean for floats as opposed to doubles?
08:24djpowell,(class 1.0)
08:24clojurebotjava.lang.Double
08:24Lau_of_DK5.0 double
08:24Lau_of_DK5.0f float
08:24Lau_of_DKFor instance
08:25gnuvinceHey Guys
08:25gnuvinceI got to tell you about a dream I had of Rich
08:26djpowell,(class (float 1.0))
08:26clojurebotjava.lang.Float
08:26Lau_of_DKgnuvince: shoo :)
08:26Lau_of_DKt
08:27gnuvinceHe 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.
08:28Lau_of_DKSounds healthy enough :)
08:30gnuvinceIndeed
08:31gnuvinceIt's nice to know that even when he's head of the DNC, Clojure still has priority
08:32Lau_of_DKTrue
08:34cemerickfederal gravy train, here we come! :-P
08:35AWizzArdLau_of_DK: I would also like it if we could use the existing syntax for declaring types: (loop [#^java.util.Hashtable ht ...] ...)
08:36AWizzArdmaybe #^float, #^int, etc could be used. vs. #^Float #^Integer, ...
08:37AWizzArddjpowell:
08:37AWizzArd,(apply (fn [a b] (+ a b)) [10 20])
08:37clojurebot30
08:37AWizzArdthe use of apply has nothing to do with the function taking rest-args
08:37Lau_of_DKAWizzArd: Hinting is business as usual, but I just want shorthand for producing something of the actual type/class
08:38AWizzArdLau_of_DK: yes, would be cool. And on top of that I like consistency. #^int x vs (int x)
08:38AWizzArdas declarations for Java classes is typically done via #^
08:40AWizzArdis --> are
08:41jkantzgah do I really have to create a gensym for every lexically bound variable in a macro?
08:43Hun`you don't `have' to... but it helps
08:43cemerickjkantz: generally yes, but it's very easy with the reader syntax for gensyms
08:43Hun`there are macros to make that easier (iirc with-gensyms)
08:43Hun`oh. thought this was #lisp :)
08:44jkantzah reader syntax for gynsyms ... nice
08:46cemerickwhat 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)?
08:46cemerickmaybe it's just a style thing?
08:50ericthorsenVerifyError with genclass? http://paste.lisp.org/display/75781
08:50ericthorsenI'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.
08:51ericthorsenDo I need to do anything else besides what is in the paste?
08:52ericthorsenThe error is CLjTreeCellRenderer overrides final method
08:56cemerickericthorsen: a quick peek at the source makes me think that the docs are wrong -- that the mapping is actually {exposed-name super-method-name}
08:56cemerickor, that's what I get from the names of the destructuring bindings in the relevant section of genclass
09:00ericthorsencemerick: I'm wondering if it is because I'm not overriding the function in question? Trying to see if that makes a difference noe
09:00ericthorsennow
09:01cemerickericthorsen: not sure -- I've never used :expose-methods, so I'm groping in the dark there.
09:02ericthorsencemerick: That was it..I'll post it to the group. not a big deal and probably not a bug.
09:02ericthorsencemerick: thanks
09:03cemerickericthorsen: that being, the args were in the wrong order, or that you weren't overriding the function in question?
09:11ericthorsencemerick: I was not overriding the function in the new genned class.
09:18BigTom_hi
09:18BigTom_dumb question time
09:18BigTom_is there a logical XOR equivalent in clojure?
09:38tashafaquick question all
09:38tashafaim sure this is easy but its escaping me right now
09:39tashafahow do you find the index of a value in a seq
09:39ChouserBigTom_: I don't think so
09:41ChouserBigTom_: Jason Wolfe wrote this, though: (defn xor [& args] (odd? (count (filter identity args))))
09:41cooldude127tashafa: i had to write it myself. (indexed) in clojure.contrib.seq-utils helps
09:42cooldude127tashafa: i'll paste what i had
09:43lisppaste8cooldude127 pasted "position (index of an item)" at http://paste.lisp.org/display/75787
09:43tashafaoh thank you guys
09:44cooldude127no problem, i was just in here the other day asking the same damn question
09:44cooldude127the real one is why is it not built-in
09:45tashafayeah
09:45BigTom_Chouser: cheers, I think that'll do it
09:45tashafathats why I thought it was a simple built in function that i couldnt find in the api
09:46cooldude127tashafa: yeah i looked for it
09:48AWizzArdclojurebot: max people
09:48clojurebotmax people is 149
09:49Chouserindexes aren't used so much in Clojure.
09:49Chouserand a linear search to find the index will of course only be desirable on small lists
09:50shoover`desire is subjective. I plug in computers and run linear searches to warm my house.
09:51cooldude127lol
09:51BigTom_If you are after a heating system then totally pure Functional Programming is for you!
09:52jdzBigTom_: that would not be pure functional programming because heat is a side effect!
09:52shoover`BigTom_: ooh, rework that to fewer words, include "HVAC", and make another clojure t-shirt
09:52ozy`jdz: I dunno about clojure, but in haskell there's a Thermodynamics monad
09:53BigTom_jdz: I was just thinking that, refrigerated monads anyone?
09:54jdzwhat's more, you cannot run a purely functional program -- all the computation would be done in compilation step.
09:54jdzsince nobody said anything about running functional programs i'll intall latest software updates
09:56shoover`jdz: not running programs is kinda depressing. back to clojure I can run things :)
09:56BigTom_ozy: The clojure logo would make a nice button, shame zazzle doesn't do them
09:59ozy`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:00jdzbtw, what's the point of logical XOR?
10:02BigTom_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:03BigTom_well, thats why I want it
10:07jdznot=
10:07jdz?
10:07Chouseryeah, like (not= (= a b) (= c d))
10:09bstephensonwould that not return true if c=d but a not = b?
10:09BigTom_Ah well, that's what i was looking for
10:09Chouser,(not= (= 1 2) (= 3 3))
10:09clojurebottrue
10:12jdzisn't that what is required?
10:21cemerickI can't wait to see rhickey's response to not-empty? in the group :-P
10:23AWizzArdcemerick: what was the suggestion? To add some compiler magic to all functions that end with a "?" and begin with at "not-"? :)
10:24ChouserAWizzArd: http://groups.google.com/group/clojure/msg/f99178dd8c5fb85d
10:24cemerickAWizzArd: 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:25cemerickI've always preferred having the shortest clause first, so I pushed for if-not to make that cleaner.
10:26Chousercemerick: Since you brought that up I've experimented with that layout, and I can certainly see the appeal.
10:26cemerickChouser: IMO, it's far easier for later readers of code
10:27Chouserbut the double-negative of "not empty" is simply worse than the positive of "seq"
10:27Chousersame order of then/else
10:28cemerickthat, 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:28Chouserto reverse the order I've used (if (empty? ...))
10:29Chouserthat gets you out of the null-pun and a 'not' in a single intuitive word.
10:29cemerickChouser: 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:29cemerickyeah, 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:30Chousercemerick: but what if you have to reverse the order? Do you use (if-not (empty? coll) ...)?
10:31cemerickChouser: 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:31Chouserbut 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:31Chouserwill flog
10:32cemerickif-not is handy when there's some non-collection conditional you need to reverse
10:32Chouseryes
10:32cemerickChouser: good lord, neither will I :-)
10:33pilkarnDoes 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:34Chouserpilkarn: to work with android requires a patched clojure still, doesn't it?
10:34rhickeywhat's wrong with (seq x) ?
10:35rhickeythe 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:35rhickeybut they won't end in ?
10:35rhickeyall the auto-seqing is lulling people into believing everything is a seq - it's not
10:36ChouserI like (if (seq coll))
10:36cemerickChouser: :-P
10:36rhickeyif-let (s [(seq coll)] ...) is going to be an important idiom - seq is no longer free
10:37Chousertaking out auto-seq is a new desire, post lazy-seq?
10:37cemerickrhickey: 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:38rhickeycemerick: empty? is there
10:38rhickeybut loses information
10:38rhickeyseq will pull the inner seq out of a lazy seq
10:39cemerickit'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:39rhickeycemerick: that's what seq does
10:39cemerickrhickey: FWIW, I'm not advocating for *anything* right now. Just blowing hot air. :-)
10:40rhickeyChouser: I'm not seriously proposes removing auto-seq from first/rest
10:41ChouserI'm not surprised. But you didn't even want to pre-lazy-seq, did you?
10:42cemerickI 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:43ChouserI prefer (if (empty? coll)) over (if-not (seq coll))
10:44rhickeyChouser: 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:46rhickeyif you say (if (empty? coll) foo (do-something-with (first coll) ... (rest coll)) your code will be slow with lazy seqs
10:46Chouserhm, good point. That was a pattern I'd used when seq was cheap.
10:47cemerickrhickey: that's interesting.
10:47cemericksure to be a tripwire
10:47rhickeybetter (if you want empty?): (let [s (seq coll)] (if (empty? s) foo (do-something-with (first s) ... (rest s)))
10:47ChouserI do believe I've not used it at all in my lazy-seq conversions.
10:47rhickeyfirst and rest are a seq API after all
10:48rhickeycore provides idiomatic examples, people just resist the idioms rather than try to understand what is being accomplished by unifying lazy/eager sequences
10:49Chousershoover`: yes, so you can answer my questions tonight
10:49rhickeycemerick: the code will work, jut not as fast
10:49shoover`Chouser: about that... you're not allowed to ask questions
10:50cemerickrhickey: 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:50Chouser(if-let [[f && r] coll] (do (something f) (recur r)) done)
10:51rhickeyChouser: most recurs are better with & and next I think
10:51Chouserthat should be ok, right? an extra first/rest (and therefore extra seq) on the terminal case
10:51Chouserrhickey: hm.
10:52pilkarnChouser: didn't someone get a hello world running on the simulator?
10:52Chouserpilkarn: yes, with a (slightly) patched Clojure.
10:53Chouserpilkarn: 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:54cemerickthe "slight patch" is to remove the bytecode generating classloader, yes?
10:54Chousercemerick: I thought it was just to remove the 'bean' fn
10:54pilkarnChouser: 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:54Chouserpilkarn: sure
10:55cemerickoh, 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:55cemerick...and android, I assumed
10:56Chouserthat 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:58cemerickChouser: 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:01AWizzArdanyone here who has used JSwat+Clojure with success?
11:01Chousercemerick: yes, improved since then: http://code.google.com/p/clojure/source/detail?r=1201
11:02cemerickI'll catch up one of these days. :-)
11:03Chouserthat was one of those famous swank-breaking changes.
11:07cemerickthat there is a public service
11:09nrolingAnybody 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:09nrolingI need to translate the JSON to XML one way or another. Ideas?
11:10ChouserIf only there were a more convenient API for creating PDFs...
11:11nrolingChouser: I'm all ears
11:11nrolingJust don't say LaTeX :-)
11:15shoover`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:17pilkarnactually, 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:18Chousera class with a bunch of nested classes
11:18cooldude127does clojure generate java code or java byte-code?
11:19Chouserbyte code
11:19cooldude127that's what i thought
11:19cooldude127there's a difference
11:19nrolingshoover`: Looks like lazy-xml might work, thanks.
11:22rhickeyback 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:23gnuvinceDoes Mark Engelberg hang in this channel?
11:26nrolingIf I include clojure.contrib.jar on my classpath, shouldn't (all-ns) include the contrib namespaces?
11:26Chouserno, you still have to 'require' the ones you want.
11:27nrolingChouser: Got it, thanks.
11:46pilkarnso can someone post an example of how to remove the classloader?
11:47Chouserpilkarn: 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:49gnuvinceDoes test-is work with the new trunk?
11:49gnuvince(run-tests) seems to just be hung
12:01danlarkingnuvince: problem with your tests? Mine passed okay
12:04gnuvincedanlarkin: ah, I'd forgotten to recreate the clojure-contrib.jar
12:06wabashIm looking at Real World Haskell, and think it's a great book. Is there something similar for Clojure yet?
12:07gnuvincewabash: there's Programming Clojure (http://www.pragprog.com/titles/shcloj/programming-clojure) that's gonna be out soon
12:07gnuvinceThe beta PDF is already available
12:07albinohas he updted it to match the latest language changes?
12:09WizardofWestmarceverything except lazy
12:09WizardofWestmarcbut lazy is coming before the book goes paper supposedly
12:09wabashgnuvince: Awesome
12:09wabashthank you.
12:12drewrAWizzArd: "Success" is relative.
12:12drewrI got it to run and I poked around.
12:13technomancycooldude127: I found a problem in clojure-test-mode that I'm not sure how to deal with.
12:13jbondesonfinally found the form that swank-clojure is failing on.
12:13technomancyif you define a test and then remove it, clojure doesn't realize it's gone
12:13jbondesoncourse it happens to be swank/swank-require
12:13technomancyit will continue to highlight it
12:14technomancyjbondeson: did you see that jochu pushed something last night to swank-clojure?
12:14jbondesonyeah, he did the first part
12:14jbondesoni forked off of that, and changed rest to next
12:15jbondesonand am looking to fix this exception and the broken contrib packages
12:15technomancygreat
12:19jbondesonit's looking for a swank.commands.contrib.swank-presentations which isn't in contrib, any ideas?
12:20jbondesonhmmm...
12:20cooldude127technomancy: hmm that's strange
12:21jbondesonswank-presentations is in slime
12:22technomancycooldude127: no, it makes total sense.
12:23technomancywhen you remove a deftest from the file, it doesn't undefine it in clojure
12:24technomancyjbondeson: well not everything has been ported; that's always been the case. still strange why it wasn't complaining about missing that earlier
12:25cooldude127technomancy: what do we do about that then?
12:26technomancycooldude127: no idea. maybe undef everything in the namespace before we load the file
12:26nrolingDoes anyone know of a clojure lib with a more compact representation of xml? {:tag :attrs :content} gets ugly fast...
12:27jbondesontechnomancy: may be a red herring, i basically put print messages down the call stack to see where errors were being generated.
12:28cooldude127technomancy: that sounds like trouble tho
12:29technomancycooldude127: better then: we alter the metadata for every var to remove the :test entry. then we reload the file.
12:29technomancyI don't know how to undef vars anyway.
12:30technomancyjbondeson: 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:30AWizzArddrewr: yes, with JSwat you mean? Same here
12:30jbondesontechnomancy: not yet.
12:31technomancymight be worth a shot
12:31AWizzArdI 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:36technomancydanlarkin: hey, are you still looking for a name?
12:36danlarkintechnomancy: yes
12:36technomancyI came up with one yesterday that I don't think I'm going to use.
12:36technomancyhow about "calamity"?
12:36technomancyit has the c and l sounds
12:37technomancyand it also sounds dangerous
12:37silkarnChouser: where is the bean fn?
12:37danlarkinhahah
12:37technomancybut it does have negative connotations.
12:37danlarkin~source bean
12:37danlarkinsilkarn: ^
12:37danlarkintechnomancy: yeah I donno, is it too "bad news" sounding?
12:37technomancydanlarkin: you'd have to find a way to put some positive spin on it.
12:38technomancyI'm not sure how that would work. but the name has a ring to it.
12:38technomancytake it or leave it. =)
12:38danlarkinI appreciate you thinking of me :-o
12:39technomancyI 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:54cooldude127technomancy: any progress in the 20 minutes i've been gone?
12:54technomancynope, haven't touched it
12:54cooldude127boooo
12:55technomancywe've got some deadlines at work today; probably won't be able to hack on it much
12:55technomancyconsidering delegating it to you. =)
12:55cooldude127honestly it's not that big a deal to me, since it's rare that i completely remove a function
12:55cooldude127oh this is outside my knowledge
12:55technomancywhat about renaming though?
12:55technomancyit's the same thing
12:55cooldude127i'm so confused by all of this
12:56cooldude127technomancy: hmm, true, but the thing is, the old tests will still work with the old renamed function
12:56technomancycooldude127: yeah, but they'll have the line numbers of the old function
12:56technomancyso it will overlap with the new one
12:56cooldude127well, my overlays still aren't showing up, so i forgot about that
12:56technomancywait, they consistently don't show up?
12:56technomancyhmm... I guess that's more important to fix. =\
12:56cooldude127idk, haven't seen any today
12:57technomancyactually... I think I know the fix. just need to clear the test metadata in the same place as the status metadata
12:57cooldude127oh
12:57cooldude127but yeah, at the moment your package is doing nothing for me
12:57technomancybleh
12:58cooldude127all C-c C-, does that i can see is run the file
13:00technomancywell I guess that's more important
13:00cooldude127technomancy: yeah i just have no idea why
13:01technomancyoh... I think I know part of the problem.
13:01cooldude127do tell
13:01technomancyit's the async-ness
13:01cooldude127why?
13:01technomancyin run-tests, it calls clear
13:02technomancybut it sends that off and doesn't wait for it to return before loading the file
13:02technomancyand running the tests
13:02cooldude127are you saying it's a race condition?
13:02technomancyyeah
13:02technomancywe need to chain together callbacks, I guess
13:02cooldude127that sounds right
13:02technomancylemme check in what I've got, then I have to head into a meeting
13:03technomancypushed
13:04cooldude127lol i had literally just pulled when you updated it, so i had to do it again
13:32gnuvinceWhat's the procedure to submit a patch to clojure-contrib?
13:33technomancygnuvince: bring it up on the mailing list, then create a google code issue if it's deemed appropriate.
13:33gnuvinceok
13:33technomancyand make sure you've got a contribution agreement signed
13:33gnuvinceI don't
13:33gnuvinceRequired for clojure-contrib?
13:33technomancyyeah, it is
13:34gnuvinceok
13:38telol at the end of the SICP it says: "Start over again, this time with more information"
13:38cooldude127they aren't kidding, you get more out of it the more you know :)
13:38technomancyit's recursion in action!
13:39teYeah I'm actually taking the same tack with "Programming Clojure"
13:39teI am reading it front-to-back, then re-reading it
13:41pilkarnsicp is awesome i dont get how people cant like it if they are really interested in learning to program
13:41pilkarnthen they must have bought with the wish to learn to code a bad webapp in 3days
13:45pilkarnare refs slower than accessing a def-ed variable that isn inside a ref?
13:46technomancya little bit, since a call to deref is involved
13:46tehow do i make sure clojure-contrib is loaded?
13:46teit's not showing up in autocomplete in emacs
13:47technomancyte: did you set swank-clojure-extra-classpaths?
13:48teyes
13:48te(setq swank-clojure-extra-classpaths '("~/src/clojure-contrib/clojure-contrib.jar"))
13:48cooldude127te: try importing something :)
13:48cooldude127er...using something
13:48technomancyyeah, could be an autocomplete problem
13:51tepardon my ignorance
13:51tebut how do i do that
13:52technomancy(use 'clojure.contrib.duck-streams)
13:52tereturns nil
13:52tewhich is good, right?
13:53Chousukeyes
13:53tegod im such a noob
14:13stuhoodis there a way to recursively compile .clj files AOT?
14:14Chousercompile should follow :require and :use clauses, building things recursively that way
14:14stuhoodgotcha.
14:15stuhoodbut i have a compile ant task like the one defined in Clojure's build.xml
14:15stuhooddo i need to define all of the top-level libraries manually?
14:16kotarakstuhood: 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:16stuhoodso: clojure.lang.Compile com.example.util com.example.paths ...
14:17stuhoodkotarak: alright, thanks... i guess i'm just used to giving javac a source directory, and having it build everything it contains
14:38pilkarn(File. "C:/Users/saftarn/Desktop/mp3s/Timbuktu-Oberoendeframkallande/01-pretjafs-cta.mp3")
14:38pilkarn"))\n(File. "
14:38pilkarnuser=> java.lang.Exception: Invalid token: C:/Users/saftarn/Desktop/mp3s/Ti
14:38pilkarnmbuktu-Oberoendeframkallande/01-pretjafs-cta.mp3
14:38pilkarnwhy?
14:40kotarakpilkarn: there is a spurious " somewhere in the repl input.
14:40cooldude127is there a nice convenient way to call a function with a number of args, and let it just ignore any extra ones?
14:41danlarkinadd & _ to the end of your parameter list :)
14:41cooldude127danlarkin: is there a way that preserves the original function?
14:42tashafadunno if this is the right way of doing it but...
14:42danlarkinI guess you could write a wrapper that checks the arglists of the function it's wrapping
14:42Chouserthe arglists isn't guaranteed to be machine readable, I think.
14:43tashafasorry just aswred my own question
14:43cooldude127Chouser: looks like lisp structures
14:43tashafaby writing the question
14:44Chouser(,(:arglists ^#'defn)
14:44Chouser,(:arglists ^#'defn)
14:44clojurebot([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?])
14:44cooldude127Chouser: ok is it a bad sign when i have var that is a function that has no arglists key in its meta data
14:45cooldude127oh wait i know why, it's def'd to the symbol? function
14:45cooldude127this seems like a bad idea
14:46danlarkinyeahhh, it probably is
14:47cooldude127well 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:47danlarkinand you don't want to have them all take & _ ?
14:47cooldude127i'd prefer not to do that
14:48technomancyyay, jochu is back in action
14:48cooldude127sweet
14:52cooldude127alright i just created a function that makes a new fn that ignores the arg
14:52cooldude127got rid of the boilerplate
14:54pilkarn(throw java.lang.IllegalArgumentException) <- whats wrong with that syntax?
14:54gnuvincetechnomancy: I got an issue with clojure-mode: delete-trailing-whitespace kills the trailing commas too.
14:54Chouserpilkarn: you giving throw a class, and it wants an instance
14:54gnuvincepilkarn: (throw (IllegalArgumentException. "Hi"))
14:56technomancygnuvince: well, it works as advertised. =)
14:57gnuvincetechnomancy: is there something that can be done?
14:58gnuvinceOr is it too ingrained?
15:26pilkarnhow 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:32cooldude127pilkarn: where you play the mp3, pass a callback function, and after the mp3 finishes, call the function you passed
15:32cooldude127assuming the playing of the mp3 blocks
15:32technomancygnuvince: I'm not sure; I haven't looked into the details of the syntax table
15:33technomancygnuvince: the problem is that whitespace is whitespace
15:33technomancyyou don't want it treated as non-whitespace for other purposes, I think
15:33gnuvincetechnomancy: ok
15:34gnuvinceI was editing a file, and I noticed it was changed in places I didn't touch
15:36technomancythat happens all the time with delete-trailing-whitespace
15:37technomancyit's generally a bad idea to use it at the same time as you're editing
15:37technomancyyou want to separate out cleanup commits from functionality commits
15:44BrackiHow do you debug your clojure code?
15:44cooldude127Bracki: REPL
15:45technomancyBracki: test-is
15:45cooldude127Bracki: debuggers are fun, but i don't know to use one with clojure
15:45cooldude127Bracki: oh yeah, test-is also
15:45cooldude127very good stuff
15:45BrackiWell do you sprinkle echos everywhere?
15:46technomancyusing a debugger is a good sign that you either 0) need a better test suite or 1) are doing rhickey's job
15:46hiredmantechnomancy: that depends on the kind of code you are writing
15:47hiredmanthe code may do what you want fine
15:47hiredman(i.e. pass the tests)
15:47hiredmanbut is just too slow, so you want to see why
15:47hiredmanor uses to much heap, or whatever
15:48technomancythat's true; it can be helpful for optimization I guess.
15:49durka42http://www.qtsoftware.com/about/news/preview-of-final-qt-jambi-release-available
15:49cooldude127Bracki: usually you don't need a ton of echoes if you've broken your code down enough into smaller functions
15:49hiredmanactually in that case you'd want a profiler
15:49cooldude127Bracki: cuz then you can just test the results of each functions individually
15:49hiredmanwhich, uh, apparently a lot of people are using YourKit for profiling
15:50hiredmandurka42: brilliant
15:50durka42,(+ 2 (doto 3 prn))
15:50clojurebot5
15:50clojurebot3
15:51Chouserdurka42: that *is* brilliant
15:51lisppaste8bracki pasted "find-graph" at http://paste.lisp.org/display/75813
15:51durka42i think i stole it from rhickey :p
15:51durka42i had come up with (do (prn value) value)
15:51hiredmanplaying with zippers I use "->" so I always want to examine something from the middle of the pipe
15:52durka42apparently qt-jambi is going the way of the dodo
15:52BrackiThe find-graph function I pasted is obviousl broken. But no idea where.
15:52BrackiIt looks good to me.
15:52hiredman,(-> \a (doto prn) int)
15:52clojurebot97
15:52clojurebot\a
15:53cooldude127Bracki: that first (conj path start) doesn't do anything
15:53hiredmandatastructures in clojure are immutable
15:54Chouserdurka42: what's that about jambi?
15:54durka42see above link
15:54hiredmanso conj does not change a ds, it produces a new ds
15:54Chouseroh
15:54BrackiSo I need to let right.
15:54cooldude127Bracki: you need to rethink how to do this immutably
15:54Chouseryikes
15:55ChouserI wonder if a community will pick it up, or if it's all done.
15:55cooldude127for example, conj returns a new list instead of changing the old one
15:55BrackiI've tried that for the last two evenings and couldn't come up w/ anything usable.
15:55cooldude127or a new set or whatever
15:55ChouserWhen they announced jambi, I thought it was a weird choice and didn't have any reason to like Java. Sounded dumb.
15:55cooldude127Bracki: btw, why is your path a set? shouldn't the path be in order? i don't think sets preserve order
15:55ChouserNow I'm all about JVM and hate to see Qt walking away.
15:56cooldude127Bracki: you probably want a vector
15:56durka42well, they intend to release it... as you said remains to be seen if anyone will keep it alive
15:57WizardofWestmarcthat's kinda sad, I'd been looking at using Jambi as my UI lib for clojure
15:57Lau_of_DKGood evening gents
15:58technomancywell when I first read about jQuery I ignored it because I thought it was for Java.
15:58tashafatechnomancy: ha
15:58cooldude127haha
15:59WizardofWestmarctechnomancy: heh really?
15:59technomancywell I didn't exactly research the topic thoroughly
15:59WizardofWestmarcjavascript is actually next on my list of stuff to learn right now, because of jQuery
15:59technomancyjQuery is awesome
16:00WizardofWestmarctechnomancy: you listen to the interview with Resig on FLOSS weekly?
16:00technomancyjavascript is really close to being awesome... just enough warts to drive you crazy
16:00technomancyWizardofWestmarc: no, link?
16:00WizardofWestmarcsec
16:00durka42awesomeness seconded
16:00WizardofWestmarchttp://twit.tv/floss55
16:01WizardofWestmarcreally good stuff
16:01tashafaone of the best documented libraries out there
16:01WizardofWestmarcalso brings up processing.js
16:01WizardofWestmarc~an hour but interesting stuff I thought
16:01clojurebotGabh mo leithsc�al?
16:01WizardofWestmarcdoh forget the 'bot reacts to ~
16:02tashafaquestion...
16:03durka42yes?
16:03tashafaim trying to write a macro that defines a set of functions using a seq as the macro's argument
16:03tashafaso if the argument of the macro contains 3 items it would defn 3 different functions
16:03tashafais this possible?
16:04cooldude127tashafa: sounds simgle enough
16:04tashafaim almost there
16:04WizardofWestmarcremember you can execute code in the macro
16:04WizardofWestmarcso you'd just loop through your seq generating all the def/defns/etc
16:04tashafayup
16:05cooldude127tashafa: 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:05tashafaim using a doseq but and it return nil
16:05hiredmanerm
16:05tashafait works when I pass in an item
16:05tashafa(i.e I remove the doseq)
16:06cooldude127tashafa: if i were you i'd probably use something like map
16:06tashafabut when i add the doseq and pass a collection of items it return nil but the functions are not defined
16:06hiredmandoseq always returns nil
16:06durka42trying to map defn might not work so great
16:06cooldude127`(do ~@(map (fn [x] `(defn ~x ...))))
16:06hiredmanand returning nil from a macro is almost never what you want
16:07tashafayup i figured as much...
16:08tashafait returns the defined function when i pass in an item from the seq (removing the doseq in the macro)
16:08tashafabut i need it to work on a collection of items
16:08cooldude127tashafa: you see what i posted?
16:08tashafayup trying that right now
16:08cooldude127kk
16:08tashafawill get back to you
16:08cooldude127idk exactly what you're so it might not work perfectly, but that's the idea
16:10tashafaneed to go to a meeting right now
16:10tashafabut brb with the results
16:10cooldude127kk
16:21cemerickwow, that was a quick flash in the pan for jambi
16:21BrackiIs there a way to find out more about raised exceptions?
16:22durka42(use 'clojure.contrib.stacktrace)
16:22durka42(print-cause-trace (e))
16:22Brackican I do that in the repl
16:22hiredmanyou can do everything in the repl
16:22BrackiHow do I access the last thrown execption?
16:23technomancy*e
16:24hiredman,(pl inc $ inc $ inc $ 0)
16:24clojurebot3
16:25pilkarnmap+filter is lazy right? so it is 1*N not 2*N?
16:27pilkarncooldude127: 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:27pilkarn, (do (:import (haskell [ghc :as g])) (g/foldr (+) 0 [1 2 3]))
16:27clojurebotjava.lang.Exception: Unable to resolve symbol: haskell in this context
16:27cooldude127pilkarn: if it's async and has no facility to pass a callback then yes
16:28pilkarncooldude127: so can I force sync then?
16:28cooldude127i don't think so
16:28cooldude127if it doesn't block, i don't know how to make
16:28cooldude127it
16:29hiredmanif all the api you using provides is a poll, you are stuck polling
16:33Brackijava.lang.ClassCastException: clojure.lang.LazyCons cannot be cast to clojure.lang.IFn <- what does that tell me?
16:34cooldude127Bracki: you're treating a list as a function
16:34cooldude127or actually more like a seq as a function
16:34cooldude127but still bad
16:34cooldude127Bracki: care to share the code that causes it?
16:35hiredmanclojurebot: latest?
16:35clojurebotlatest is 1295
16:35lisppaste8bracki annotated #75813 "untitled" at http://paste.lisp.org/display/75813#1
16:35cooldude127extra paren around the (for)
16:36clojurebotsvn rev 1296; added clojure.core/*source-path*
16:36Brackicooldude127: More or less?
16:36cooldude127Bracki: you have an extra
16:36cooldude127Bracki: (for) creates a seq, that extra paren around it means you're trying to call that seq as a function
16:37cooldude127Bracki: btw, you're still gonna run into trouble here. those ifs at the beginning are pointless
16:37BrackiHm, no the code is back to just returning nil. I don't seem to understand the evaluation model.
16:37cooldude127Bracki: you have nil at the end
16:37cooldude127it returns the value of the last expression
16:37cooldude127always
16:38cooldude127you can't return early
16:38Brackihm.
16:38cooldude127give me a sec, let me try to sort of rewrite what you have in a more functional style
16:39cooldude127just to give you an idea of the way it should be
16:39BrackiIt's a port from here: http://www.python.org/doc/essays/graphs.html
16:39pilkarnis there a deep-flatten function in clojure already?
16:54Lau_of_DKAnybody here interested in the JMonkeyEngine?
16:55pilkarnis there a function for randin an int?
16:57leadnose_Lau_of_DK, what about it?
16:57leadnose_I've fiddled with it a bit
16:57leadnose_in java though
16:58Lau_of_DKleadnose_: I made a Clojure port, just wondering if anybody was interested
16:58leadnose_oh, cool, have a link for it?
16:59Lau_of_DKNo, 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:00danlarkina port? or a wrapper
17:00technomancyat the risk of stating the obvious: games are fun
17:00Lau_of_DKdanlarkin: Bindings would probably be the word
17:02lisppaste8cooldude127 annotated #75813 "functional and working find-path" at http://paste.lisp.org/display/75813#2
17:02cooldude127Bracki: there is the first working version
17:04cooldude127not ideal, but it works
17:05tashafacooldude127: you are a the coolest!
17:05cooldude127thank you
17:05tashafaworked on the first try
17:05cooldude127Bracki: this actually should probably be split up into two separate functions
17:06tashafacooldude127: no thank you
17:06tashafatime to drink
17:06cooldude127lol
17:06cooldude127tashafa: were you in need of this code or just applauding my work?
17:06Brackicooldude127: thx nice one.
17:07tashafaboth
17:07BrackiWould have never come up with this.
17:07tashafacooldude127: both
17:07cooldude127Bracki: let me give you a new version that does a better separation
17:07cooldude127this function has gotten too big
17:09BrackiI previously had a look at the documentation for loop, but that left me completely clueless.
17:09cooldude127Bracki: loop was important here because a for doesn't allow you to prematurely terminate
17:10Brackiand what's the [node & nodes] part?
17:11cooldude127Bracki: destructuring. binds node to the first element and nodes to the rest
17:13BrackiAight.
17:13cooldude127Bracki: and you understand that everytime you call recur, it rebinds node and nodes based on what you pass it?
17:14BrackiOk then nodes is restructed again etc.
17:15cooldude127yeah
17:15BrackiThe whole and not set part seems complicated.
17:15cooldude127Bracki: yeah i'm trying to find a nicer way to write that
17:16cooldude127Bracki: do you have clojure-contrib setup?
17:16BrackiYes.
17:17cooldude127Bracki: ok, then i will take advantage of something in there
17:18cooldude127Bracki: i'm about to go eat, but i'll be back on later with something even better for you
17:19Brackicooldude127: i'll be off to bet in an hour so.
17:20Brackibut i'll get your stuff somehow.
17:20Brackibed
17:20Brackii meant
17:20cooldude127Bracki: save the link to the paste, i'll annotate it
17:21Brackithx.
17:36lisppaste8bracki annotated #75813 "Now using (includes?)" at http://paste.lisp.org/display/75813#3
17:37jwinterLau_of_DK: I'd be interested in the clojure bindings for JMonkeyEngine
17:39Lau_of_DKk, gimme 10 minz, I'll GitHub and clean it up...tomorrow :)
17:39jwintercool, looking forward to it.
17:39durka42ooh, that looks interesting
17:39danlarkinLau_of_DK: tomorrow is a slippery slope :)
17:40Lau_of_DKdanlarkin: I know - But at least Im uploading today
17:40durka42at least Lau doesn't have to come up with a name ;)
17:40Lau_of_DKExactly right
17:40durka42cljME?
17:41technomancyhehe
17:41Lau_of_DKdurka42: This is called Sofiaba :)
17:41Lau_of_DKIts just a raw engine which renders a 3d sphere, which you can toggle between shaded and wireframed
17:41Lau_of_DKBut its enough to get someone going with JME in Clojure
17:41durka42cool cool
17:41durka42where did sofiaba come from?
17:42pilkarnyou can catch runtimeexceptions right?
17:43durka42sure
17:43Lau_of_DKdurka 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:43pilkarnLau_of_DK: what si the JMonkeyEngine? I'm doing opengl in scheme right now and im generally interested in game dev
17:43hiredmancatching exceptions is pretty much the whole point of exceptions
17:43durka42~google jmonkeyengine
17:43clojurebotFirst, out of 6910 results is:
17:43clojurebotjMonkeyEngine.com
17:43clojurebothttp://www.jmonkeyengine.com/
17:44Lau_of_DKpilkarn: 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:46technomancyyou can tell it's serious because they capitalize Gaming
17:46technomancy=)
17:46technomancyI like the logo. the monkey looks serious.
17:47technomancywow, that looks like fun
17:48Lau_of_DKYea
17:48Lau_of_DKOk, the code is ready, making repo on Github, hang on
17:50technomancygrrr... /me hates zip files that don't create a new subdir
17:51jwinteryea, always unarchive in /tmp/
17:51technomancywow, jME totally just crashed X
17:52technomancyhaven't seen that happen in a while
17:52Lau_of_DKhttp://github.com/Lau-of-DK/sofiaba/tree/master
17:52technomancygoing to try it again without going fullscreen
17:52Lau_of_DKjwinter: There you go - Have fun, that basically extends BaseGame so that you can run Clojurecode the rest of the way
17:53technomancyhuh; none of the demo stuff runs
17:53Lau_of_DKtechnomancy: Which demo stuff?
17:53technomancyLau_of_DK: the jMonkeyEngine demos
17:54jwinterLau_of_DK: thx, will take a look tonight
17:54Lau_of_DKtechnomancy: Have you got a renderer installed?
17:54technomancyLau_of_DK: no idea
17:55technomancyjust followed the README instructions
17:55Lau_of_DKGet LWJGL and put it in your Library path
17:55technomancyyou mean the classpath?
17:55Lau_of_DKno
17:55Lau_of_DKRead my README :)
17:56technomancyoh, I haven't got your stuff yet; just trying the straight jme stuff
17:57technomancyI don't have LWJGL in my package manager, but JOGL is there and is a much less horrible acronym...
17:57Lau_of_DKThats certainly true
17:57Lau_of_DKJOGL should work also though
17:58technomancyok, this has bit me before though... apparently for Java just installing a library via apt-get is not enough, right?
17:58technomancyyou need to add it to the classpath too?
17:59technomancyat which point you start to wonder why it's even in the package manager in the first place... ugh.
18:01Lau_of_DKYou need to set up some things yes, like
18:01Lau_of_DKexport LD_LIBRARY_PATH==/custom/path/to/dependencies
18:01technomancyeven if you installed via apt-get? that's terrible
18:02cooldude127Bracki: you still here?
18:02Lau_of_DKI 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:02technomancyheh
18:02Lau_of_DKtechnomancy: dunno - I didnt use apt-get for lwjgl
18:02technomancyhave fun
18:02technomancyoh, ok
18:02Lau_of_DKu 2
18:06jwintertechnomancy: for jogl, I ended up doing -Djava.library.path=/path/to/jni-files in my clojure bash script
18:07jwinterprobly not the cleanest way
18:07jwinterapt-get install on ubuntu didn't take care of that for me.
18:10p_ltechnomancy: Java spec guys missed the memo
18:10hiredmanI think maybe that memo should go to package managers
18:11p_lhiredman: Is there a common way to specify classpath for Java that really works?
18:11p_lExcept for modifying CLASSPATH ?
18:11jwinterat least for me, it wasn't the classpath, but whatever you'd call java.library.path
18:12durka42OS 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:12durka42...so i closed that window, and my screen went blank, flickered in and out a couple of times before coming back
18:12durka42interesting
18:12durka42SEVERE: Exception in game loop
18:12mattrepltechnomancy: interest in helping to keep up with an issue tracker for swank-clojure?
18:13technomancymattrepl: sure
18:14Brackicooldude127: yes
18:14technomancymattrepl: what are you thinking of?
18:14Brackitechnomancy: mire doesn't work on windows.
18:14Brackithe add-classpath stuff in mire.clj does not work.
18:14technomancyBracki: but... I was told I could write once and run anywhere!
18:14technomancyI've been LIED TO!
18:15technomancyBracki: oh yeah, I meant to fix that. how are you launching it?
18:15BrackiYeah the Java trap snapped shut.
18:16technomancyare you launching it via slime, the shell script, or what?
18:16Brackijava -cp ..\jars\clojure.jar;..\jars\clojure-contrib.jar clojure.main mire.clj
18:16mattreplthe 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:16technomancyBracki: you need src/ on the classpath too
18:16technomancyBracki: looks like I updated it on the branches but not on master yet
18:17technomancyjava -cp jars/clojure.jar:jars/clojure-contrib.jar:src/ clojure.main src/mire.clj # from the project root
18:17hiredmanwell, setting $CLASSPATH works fine
18:18technomancyhiredman: does -cp on the command line add to that or replace it?
18:19BrackiDoes not work on Windows because of the crappy backward slashes.
18:19hiredmanreplaces
18:19technomancyhiredman: well that's not a solution for a package manager then =\
18:20hiredmanthe other solution is to wrap java
18:20hiredman(which freebsd already does) in a shell script
18:20technomancyyeah, I've been playing with hashdot, which seems to be a step in the right direction
18:21technomancyit gets rid of the ridiculous ps output too
18:21hiredmanbut the freebsd script is only setup for switching between multiple versions of java
18:21hiredmannot managing the classpath
18:22technomancyit just pains me to see these things cause so many problems, because they have been solved well already.
18:24Brackitechnomancy: you shouldnt hardcode the slashes into the mire.clj use File.separator instead.
18:25technomancyBracki: that stuff doesn't get translated on the fly by the JVM?
18:25BrackiApparently not.
18:26technomancyBracki: ok, noted.
18:26pilkarnis there a way to flatten (1 2 3 4 5 6 (7 8 9) (10 11 12))
18:27pilkarnhow do you package for ubuntu? does it have to get approved?
18:27pilkarnis there a god mp3player coming with ubuntu?
18:27technomancynone of mp3 players on ubuntu are deities yet.
18:27pilkarni have made a really good one in clojure, can I make it available o download a s a apt-get-package?
18:28pilkarndeities == very good?
18:28technomancypilkarn: deities are gods or godlike beings
18:28technomancypilkarn: you probably couldn't get it packaged unless clojure is also packaged
18:28technomancywhich I suspect would need to wait for a 1.0 release, at least
18:29hiredmanthat doesn't stop you from making your own .deb
18:29hiredmanand distributing that
18:29technomancytrue, as long as you made it self-contained
18:29hiredmanerm
18:30pilkarnwell 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:30pilkarnwhat about videoplayers?
18:30technomancybut at that point you might as well put out a tarball I think
18:30technomancythe whole point of making a deb is to handle dependencies and be stored in a repository
18:30hiredman~google banshee
18:30clojurebotFirst, out of 5010000 results is:
18:31clojurebotBanshee
18:31clojurebothttp://banshee-project.org/
18:31zakwilsonpilkarn: 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:31hiredmanI don't use ubuntu, but I would be surprised if it did not come with some kind of media player
18:31zakwilsonI can think of no technical you couldn't bundle Clojure with it and get the whole thing packaged as a .deb with Ubuntu.
18:32BrackiHow do I access static members of Java classes?
18:32hiredmanI mean, it has gnome, and gnome comes with totem
18:32cooldude127Bracki: System/out
18:32hiredmanClass/member
18:32zakwilsonUbuntu does come with a media player or three, and many more available in the repositories.
18:34technomancyyeah, getting included in the base distribution is virtually out of the question, but you could get it included in the "universe" repository
18:36danlarkintechnomancy: duck-streams has a file function that will convert unix or windows style paths into a java.io.File object correctly
18:37technomancycool
18:37Bracki,(.java.io.File separator)
18:37clojurebotjava.lang.Exception: Unable to resolve symbol: separator in this context
18:37BrackiWhat's wrong there?
18:37hiredman,java.io.File/separator
18:37clojurebot"/"
18:37technomancy,java.io.File/separator
18:37clojurebot"/"
18:37hiredmanmany things
18:37technomancyoh snap
18:38hiredman,(. java.io.File separator)
18:38clojurebot"/"
18:38hiredmansymbols starting with a . are interpreted as method calls
18:39hiredmanusing . directly like (. java.io.File separator) is a very archaic style
18:39Brackiok.
18:40hiredmanthere are different kinds of syntactic sugar for it
18:40slashus2What do you all think about complex number support in a language?
18:40BrackiWell off to bed. good night
18:41hiredmanslashus2: I don't use complex numbers...
18:42slashus2I don't really either, but I am sure there are some mathematicians that use them quite often.
18:43hiredmanlet them who are concerned address those concerns
18:43technomancyrule 1 of programming: don't write code that you aren't going to use.
18:43technomancy~yagni
18:43clojurebotHuh?
18:44technomancyclojurebot: yagni is You Aren't Going to Need It
18:44clojurebotOk.
18:50ataggart~~
18:50clojurebotNo entiendo
18:59pilkarnwhat 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:04technomancythe killer feature for the one I use is being able to be remotely controlled by external clients
19:05technomancyhttp://musicpd.org
19:05technomancyyou need a huge external database to recommend new music based on listening habits
19:06hiredmantechnomancy: well, you connect to some kind of external service
19:06hiredmanbanshee has some kind of plugin for it
19:06technomancyright, yeah. it can be a 3rd-party service
19:06technomancylast.fm, ilike, and pandora come to mind
19:11lisppaste8pilkarn pasted "playbacklistener, for acllbacks?" at http://paste.lisp.org/display/75827
19:11pilkarn^^ is that what I could use for the callback-function?
19:32stuhoodif there an equivalent of import java.io.* for the :import directive?
19:32danlarkinheyyyy finally got this stupid project AOT compiling
19:32cooldude127stuhood: pretty sure that's a no
19:32danlarkinstuhood: no
19:33danlarkinjava packages aren't enumerable
19:34stuhoodbummer. thanks gang
19:36stuhoodactually, Scala does it... it's got to be possible
19:44danlarkinstuhood: please figure out how and post to the group :)
19:49technomancyif you were trying to get someone to try clojure, but they insisted on using an IDE, which would you suggest?
19:49technomancywhich has the most mature clojure support?
19:51Raynestechnomancy: Netbeans.
19:51RaynesI use it full time.
19:51technomancyenclojure certainly has a better web site than clojure-dev. =)
19:51RaynesIt's fine for development right now.
19:51technomancyRaynes: have you tried the Eclipse one too?
19:51hiredmanwoa, that looks all zoomie and high tech
19:51RaynesLittle rough around the edges but it has build and run support which is why I use it.
19:51technomancyok, thanks
19:51Raynestechnomancy: The Eclipse one, dare I say isn't all that great.
19:52RaynesI use Netbeans because of that pretty little "build" button.
19:52RaynesI hate trying to build executable .jars :|
19:52technomancyI haven't gotten that far yet. not looking forward to it.
19:52RaynesBut enclojure isn't all that buggy, so it's not going to crash on him or anything.
19:52technomancyseems like a tarball with a shell script can get you a long way though.
19:53technomancyholy crap netbeans has a lot of dependencies
19:54blbrownis (let [] ...) equivalent call to the common lisp (progn ...)
19:54technomancyoh crap; the version with ubuntu looks like it's too old. =\
19:54technomancyblbrown: CL's progn is clojure's do
19:55technomancylet is let
19:55blbrowncrap
19:55Raynestechnomancy: It's mostly the Java stuff.
19:55hiredmanactually, I hear let is let*
19:55technomancyah, right
19:56blbrownI guess let in common lisp is a little pointless
19:56blbrownas opposed to just let*
19:57technomancywow. this is... not fast.
19:57Raynestechnomancy: Netbeans is slow as /shit/
19:57RaynesAlways has been always will be.
19:58RaynesI just live with it.
19:58Raynes:|
19:58danlarkinpoor java developers don't know what poor tools they're dealing with :-/
19:58RaynesEclipse is a bit faster, but not significantly unless you are on rather nice hardware.
19:58RaynesI find them both to be bearable.
19:59technomancyRaynes: there's like seven different versions. which is the smallest that will work for clojure?
19:59RaynesAny.
19:59RaynesClojure will download it's own dependencys.
19:59technomancycool
19:59RaynesI used the PHP version.
19:59RaynesDependencies*
19:59RaynesEnclojure*
20:00RaynesBah I need sleep.
20:02RaynesIt'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:02RaynesEspecially on windows with no other option.
20:02pilkarnis there some good program to draw how a program works, ie execution flow, dependencies etc?
20:02technomancyRaynes: because you're writing a significant amount of Java?
20:02cooldude127Raynes: i don't have the patience to use Emacs with Java, but for clojure it's the bomb
20:02Raynestechnomancy: Zero Java.
20:03Raynescooldude127: It's my opinion, please people don't start this again. :|
20:03pilkarngod i cant stand eclipse and netbeans, how did they manage to make soemthing so bloated? oh yeah thats right...they used java
20:03RaynesI 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:03technomancyat least the splash screen is nice
20:04gnuvince_What's the problem with Emacs and JVM languages?
20:04Raynespilkarn: I agree for Emacs, but I have to say that Eclipse is pretty darn neat.
20:04RaynesI mean.
20:04gnuvince_I quite like the Clojure integration.
20:04RaynesNetbeans.
20:04Raynesnetbeans not emacs, damn I need sleep!
20:04Raynesgnuvince_: Stop it.
20:04gnuvince_Raynes: I'm seriously asking, I don't want to dissuade you or anything, I'm geniuinely curious
20:05technomancyat least NB 6.5 is not as slow as 6.1
20:05Raynes"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:06gnuvince_ah, so the integration with ant and stuff?
20:06RaynesAnd 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:06RaynesYes.
20:06gnuvince_kk
20:06gnuvince_Emacs on Windows wasn't too shabby last time I tried (EmacsW32 22.something)
20:07Raynesgnuvince_: 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:07RaynesEmacs on windows is fine, it's the command line stuff I don't care for.
20:07gnuvince_Raynes: I like to suggest it, but I frankly don't care what you use
20:07gnuvince_(unless it's notepad)
20:07gnuvince_I personally use both vim and Emacs for different tasks
20:07technomancyhow do you open a project in netbeans?
20:08Raynesgnuvince_: Understood, Lau_Of_DK almost called me stupid when I first mentioned it.
20:08gnuvince_Emacs for Clojure and Haskell, Vim for Django and small edits.
20:08RaynesI use Emacs for Haskell.
20:08gnuvince_Raynes: Lau_of_DK seems pretty zealous about his tools
20:08Raynesgnuvince_: Top left corner, open project.
20:08gnuvince_He's on rhickey's case all the time to switch to git
20:08technomancyRaynes: yeah, it just lets me browse through directories, but doesn't let me choose one
20:08RaynesLau_Of_DK is an asshole quite frankly, I don't like his attitude too much.
20:08gnuvince_Raynes: you probably meant technomancy
20:08RaynesYeah, sorry.
20:09gnuvince_(about the open project thing, not the asshole thing)
20:09gnuvince_I love you technomancy
20:09gnuvince_Please keep clojure-mode alive
20:09gnuvince_kthxbye
20:09gnuvince_:)
20:09technomancyhehe
20:09Raynestechnomancy: File -> new project -> Clojure -> Clojure application.
20:09technomancyRaynes: I tried that too, but I'll try it again I guess.
20:10technomancyRaynes: is there a special trick to opening projects that aren't created in NB?
20:10Raynestechnomancy: When you create a project, make the namespace as follows (anything.filename)
20:10technomancyah, when I tried to pick my own project name and location it was a no-op.
20:10technomancybut using the defaults it worked
20:11technomancyand people complain that Emacs is hard. =)
20:11RaynesFor 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:12RaynesWow.
20:12RaynesWhy am I even talking. I'm so tired most of what I say seems like nonsense.
20:12technomancyheh
20:12technomancyyeah, I tried to enter a root namespace that didn't have a dot in it
20:12technomancylegal in clojure, but not in NB I guess
20:13technomancywhatever; I don't have to use it, I just have to try it out so I know what I'm suggesting to others.
20:13RaynesIt isn't because the last part of the file name, weird.
20:13RaynesI'll have to talk with Eric about it.
20:13RaynesHe can fix it. Yes he can!
20:13RaynesI'd use Eclipse if Laurent would put in somekind of build mech to build an executable .jar.
20:14RaynesIt wouldn't be hard at all, but I guess he doesn't see it as important.
20:14RaynesJust a simple Ant script.
20:14technomancywell thanks for the tips
20:14RaynesNo problem.
20:14Raynes<3
20:14technomancyhaven't used one since VC6 in university
20:14technomancy*visual studio
20:14technomancywhatever
20:14technomancyit was horrible
20:15RaynesVisual Studio is neat for C++ thanks to it's exceptional debugger.
20:16RaynesI despise C++ and everything it stands for, but still.
20:16technomancyyeah, hard to say how much of the pain was due to the language vs due to the UI
20:17technomancyif 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:17technomancylater
20:29pilkarnisn't the browser hopelessly imperfect for making advanced stuff? look! its a gui in a gui
20:54pilkarnis there some good program to draw how a program works, ie execution flow, dependencies etc?
20:54pilkarnanyone 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:54pilkarnare Listener used for callbacks?
20:56cooldude127pilkarn: looks like it
20:56cooldude127it has a playbackFinished method
21:01pilkarnit justs seems circular, advancedplayer has PlayBackListener, PlaybAckLisetner has event, PlayBackEvent has AdvancedPlayer. has as in has a sa parameter to their constructor
21:02cooldude127pilkarn: it's fine
21:03cooldude127playback event wants to know what player it's associated with
21:03cooldude127which player fired that even
21:03cooldude127but the player also has listeners that get called with those events
21:03cooldude127circular references only matter when you try to traverse the trail
21:11pilkarnbut hmm
21:13pilkarnI dont' get the structure, the whole anthropomorphism of Java just bugs me.
21:14pilkarnits a thing that has a thing that does athing class here and there
21:15danlarkinHeyooo! executable jar
21:15pilkarni dont get how to construct a on-event method
21:15hiredman,(doc pl)
21:15clojurebot"([& 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:15pilkarndanlarkin: how?
21:15danlarkinpilkarn: a lot of trial and error, ha!
21:16cooldude127pilkarn: in java or clojure?
21:20pilkarncooldude127: to create an on-event in Clojure, but i wouldnt get it in java either, i dont get the principle
21:20cooldude127pilkarn: you need a proxy i believe
21:20cooldude127,(doc proxy)
21:20clojurebot"([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:21cooldude127but if you don't get the java principle, you might have trouble
21:21pilkarnits not really that(i think), i dont get hwta to pass to execute something when it finishes
21:22pilkarndo you know JLayer?
21:22pilkarnor have the docs?
21:31danlarkinhttps://twitter.com/gvanrossum/status/1228991275
21:34pilkarnalso a listner seems to be for when a user does something rather than when a task finsihes
21:34hiredmanhttp://twitter.com/disturbyte/statuses/1228998632
21:34pilkarnisnt twitter just the biggest timewaster ever?
21:36cooldude127YES
21:38matthew`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:39hiredmanSuperCSV is a pretty nice java lib for csv files
21:39hiredmanI have used it with clojure in the past
21:40danlarkinyeah, CSVs can be a total PITA, I would wrap a well-tested java lib if you can
21:40hiredmanit doesn't take much wrapping
21:41matthew`Thanks
21:42matthew`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:43matthew`But if the library is already there it why re-invent the wheel.
21:43hiredmanjava interop is a win, never forget it
21:43matthew`Thanks again.
21:43pilkarnuh ok. somehow i got something tht seems to work by pure guessing lol.
21:44pilkarnmatthew`: (defn split [string delim] (seq (.split string delim))) , (split (slurp filename) ",")
21:46hiredmanpilkarn: that is a very naive way to do it
21:47danlarkinthat'll never work for real data
21:47hiredmanreal data is really dirty
21:47hiredmanand I hate it
21:47matthew`pilkarn: That is more of what I was expecting. Although it looks like it will pull in the entire file at once.
21:47danlarkinmotion seconded
21:54pilkarni was just showing a simple way of reading a file and splitting, didnt mean it would work perfectly for his example
22:00matthew`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:02danlarkinso what's the clojure equivalent of argv[0]?
22:03danlarkinit's not *file*
22:12pilkarn(proxy [ActionListener] []
22:12pilkarn (actionPerformed [ev
22:12pilkarnam i supposed t do soemthing like that for the PlaybackListener for example?
22:19hiredmanyes
22:19pilkarnhow would I improt this
22:19pilkarnjavazoom.jl.player.advanced.jlap.InfoListener
22:20pilkarnConstructor Summary
22:20pilkarnjlap.InfoListener()
22:22arohneris anyone familiar with an embeddable wiki engine? I've looked at a few but they all suck.
22:25cooldude127arohner: define embeddable
22:26arohnera wiki library that only deals with the back end objects
22:27cooldude127not sure i understand
22:27arohneri.e. programatic access only
22:27cooldude127oh
22:27arohnerall 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:27arohnerI want to control all of the UI
22:28arohnerand 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:36blbrownI 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:40arohnerblbrown: if there weren't any matches found, wouldn't m.find return false?
22:41blbrownarohner, 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:45arohnerwhy do you need to be able to tell the difference?
22:45technomancyso is it true that if you take a map and use a lazy function on it that you can no longer "call" it?
22:45arohnerif it returns false, there are no more matches, right?
22:47blbrownarohner, 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:49arohnerblbrown: I assume you're saving the state because this is a time-intensive operation?
22:50blbrownarohner, I got it, I just reset the matcher after a a "Not Found". that seems to work
22:51arohnercool
23:03technomancyit seems like calling seq on a map causes it to lose its "mappiness", and I'm not sure how to get it back
23:03cooldude127technomancy: what about (into {} (seq {blah}))
23:04cooldude127technomancy: yeah i know that works
23:04technomancycooldude127: aha! that's certainly better than (apply hash-map (flatten (seq {1 1 2 2}))) ... =)
23:05cooldude127technomancy: yeah i was asking the same question the other day
23:05technomancyit'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:05blbrownhmm, lazier version of clojure...is that good
23:06technomancycooldude127: unfortunately this means rewriting a serious portion of my peepcode, because I was using map inappropriately =\
23:07cooldude127technomancy: how?
23:08technomancyhttp://github.com/technomancy/mire/blob/2c65943e7b158c50a42d9e31f3be525dec0c0683/src/mire/rooms.clj
23:09technomancythere 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:09cooldude127oh lol
23:09technomancyI 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:09cooldude127oh
23:10technomancyso 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:10technomancyrock and a hard place
23:11cooldude127technomancy: yeah that's unfortunate
23:11cooldude127this doesn't look like a great place for it
23:13technomancyI *already* have a great example for getting tripped up by laziness where you don't expect it. =)
23:13technomancydon't need another
23:13cooldude127lol
23:14technomancyplus using into feels like introducing too much stuff at once.
23:18technomancymapcat almost looks like it could do it
23:18technomancymaybe I'm just not fitting the pieces together
23:19pilkarnJLayer 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:19defn'lo all
23:20danlarkintechnomancy: jochu merged your branch! hooray
23:20technomancyhmm... I may be able to pull something off with reduce and conj. let's see
23:20technomancydanlarkin: indeed; he has emerged from his silence!
23:20defnI'm trying to explain Clojure to a friend who doesn't have any experience with lisp, etc.
23:21defnI was trying to kind of give him lecture 1 of SICP, but he's not really getting what I'm saying
23:21defnAny analogies or ways you can think of putting it simply, or a way to illustrate it that would demonstrate the power?
23:23pilkarndefn: do you have a codeexample of a whatever language he uses and one of the ame program in a lisp?
23:23defnpilkarn: im pretty new to this whole boat myself, but ive had glimpses of the awesomeness of lisp, et al
23:23hiredmanwhat exactly doesn't he get?
23:24hiredmanyou could have him watch the actual sicp video
23:24defnwell 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:24hiredman~google sicp videos
23:24clojurebotFirst, out of 16200 results is:
23:24clojurebotStructure and Interpretation of Computer Programs, Video Lectures
23:24clojurebothttp://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
23:25defnhiredman: yeah -- although i dont want to scare him away
23:25hiredmanheh
23:25defnim trying to kind of give him the elevator pitch if only for my own understanding
23:25jhawk28there is the beta Programming Clojure book
23:26technomancycool; it works with reduce at the expense of laziness
23:26defnjhawk28: I have it and am reading it, although it is still a challenge to get one's mind around the ideas from Lisp
23:26hiredmanI would start off just talking functions, and leave code as data stuff for later
23:26defnhiredman: like functions as types?
23:26hiredmannow
23:26hiredmanno
23:27hiredmanfunctions as a means of abstraction
23:29defnso i should explain to him lambda calculus?
23:29defnim trying to not scare him away ;)
23:29hiredmanyou don't say "lambda calculus"
23:30slashus2Is 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:30hiredmanand I would go with combinatory logic :P
23:31jhawk28anything with the word calculus is scary :)
23:31hiredmanthe sicp vidoes are great
23:32defnyeah anyone with even a vague interest in sicp should draw something from those i think
23:33technomancyslashus2: mostly just reading code. trying to apply design patterns from other languages to lisp is a recipe for overcomplicated code, especially with Clojure.
23:34slashus2That is what I was afraid of.
23:35technomancyslashus2: on the bright side, there's a lot of code out there to learn from.
23:35technomancywell, a lot more than you could ever read all the way through, anyway.
23:37hiredmanthe problem is exstracting the algorithm from the mechanics of state manipulation
23:39slashus2So the "try to make each function do one thing (doesn't include using other functions of course)" applies?
23:40hiredmanthat is what makes for good functions
23:41hiredmanand good functions can be used in more then one place
23:41hiredmanare easily composed
23:43slashus2I 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:44slashus2Used to classes helping to organize.
23:45danlarkinnamespaces are the new classes
23:46jhawk28is first and rest similar to the tail in ML?
23:47hiredmanwell, what is tail in ML?
23:47cooldude127jhawk28: rest = tail
23:47cooldude127first = head
23:47jhawk28does it have similar performance?
23:48cooldude127jhawk28: no idea
23:49hiredmanuh
23:57danlarkinhow would it not have O(1) complexity?
23:58danlarkinwell, 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:58danlarkinbut clojure doesn't do that