#clojure logs

2010-02-02

00:10qedtechnomancy|away: Woohoo! So happy to see a formatted project.clj in 1.1.0-SNAPSHOT of leiningen
00:11technomancyqed: oh, from lein new?
00:11technomancyyeah, we ended up just doing it with strings instead of serializing a list since pretty-printing wasn't exactly ... pretty for that case
00:18qedtechnomancy: is autodoc broken right now?
00:18qed(from HEAD)
00:19qedtechnomancy: [null] #<CompilerException java.lang.ExceptionInInitializerError (json.clj:15)>
00:19qed [null] Make sure autodoc is added as a dev-dependency in your project.clj.
00:34qedtechnomancy: do you now need to specify :namespaces -- before I just left it out and it seemed to pick up on what I wanted to AOT without it
00:37hiredmanlein used to AOT everything, now it doesn't
00:43qedhiredman: k thanks
00:44qedhiredman: do you know when all the contrib changes are going to go into effect?
00:44qed1.1.2?
00:44clojurebot5 (for large values of 2)
00:44qedk thanks
00:46qedhiredman: one more question: is (:gen-class) a requirement (in general) for AOT compiled nses?
00:47technomancyqed: autodoc works for me
00:47technomancydid you run lein deps after adding it to project.clj
00:48technomancyqed: :gen-class is required for some AOT uses, but not all
00:49qedtechnomancy: yes i ran lein deps
00:49qedim using autodoc from clojars
00:50qed:dev-dependencies [[swank-clojure "1.1.0"] [autodoc "0.7.0"]]
00:54technomancyqed: odd... can't reproduce here
00:54technomancywhy's the stack trace mention json.clj:15 though? looks suspicious
00:55qedtechnomancy: im...not sure
00:58qedtechnomancy: could this have anything to do with needing to explicitly AOT namespaces now whereas before i didnt need to?
01:00technomancyqed: no, autodoc doesn't need any compilation
01:00replacaqed: do you use json in your code?
01:03qedreplaca: no, none
01:04qed(ns blah.core (:gen-class) (:use clojure.contrib.duck-streams)) (defn -main "Moving on up..." [& args] (println "to the east side..."))
01:04qedthen in project.clj :namespaces [blah.core], :main "blah.core"
01:05qedthe rest is boilerplate
01:05qedoh and i have [autodoc "0.7.0"]
01:06replacaqed: does removing either ":namespaces" or ":gen-class" help?
01:08qedreplaca: no
01:08qedreplaca: keep in mind this is the HEAD of the git repo
01:09replacaqed: for autodoc, leiningen, contrib or clojure?
01:09qedsorry -- leiningen
01:10replacaahh, interesting
01:10replacalet me test that here
01:10qedfor some odd reason i just ran lein deps and hadn't changed a thing and it pulled down enlive
01:10replacawell, autodoc requires enlive
01:11replacawhat TZ are you in?
01:11qedCST
01:11qedwhy do you ask?
01:11replacayup, maven (and thus leiningen) gets new stuff at midnight
01:11qedmidnight CST? PST?
01:11replacamaybe cristophe updated something on clojars yesterday
01:12replacamidnight local
01:12replacawhich was 11 minutes ago for you
01:12qedwhat would he have touched?
01:12qedreplaca: this was broken like an hour ago
01:12replacaI have no idea
01:12qedbut the enlive popping up makes sense
01:12replacadid the enlive pull seem to fix it?
01:12qedno :\
01:12vu3rddI am trying to create a debian package of clojure-contrib
01:13replacaqed: ok, i'll have a go
01:13qedthanks replaca
01:13vu3rddI need to use a locally built copy of clojure.jar instead of the one from build server.
01:14replacaqed: so your running leiningen against lein-1.1.0-RC1?
01:14replaca*you're
01:14qedvu3rdd: pull the repo and ant build -Dclojure.jar=path/to/clojure.jar
01:14qedreplaca: no i pulled the git repo
01:14qederr well yes and no
01:14qedim under the impression they're practically the same thing
01:14replacaright, but when I do lein install on the latest, that's what I get
01:15qedtechnomancy didnt seem to mind when i said that
01:15replacaok
01:15vu3rddqed: I tried that, but it always seem to pull the jar from the repositories
01:15qedLeiningen 1.1.0-SNAPSHOT on Java 1.6.0_17 Java HotSpot(TM) 64-Bit Server VM
01:15vu3rddmvn -o -e -Dclojure.jar package is what I used
01:16qedmaybe i should blow away .m2 and see what happens?
01:16replacadunno
01:16qedill try it
01:16qedcant hurt i guess
01:17replacadid you run it as "lein autodoc"?
01:17qedyes
01:17vu3rddqed: yes, that's what I also did
01:17vu3rddhere is the log
01:17vu3rddhttp://paste.lisp.org/display/94239
01:18qedvu3rdd: i dont think you want 1.2.0 do you?
01:18replacavu3rdd: did you add build.clojure.org to your maven sources?
01:19vu3rddqed: I am trying to build clojure and clojure-contrib from the master
01:19vu3rddI really don't need them.
01:19qedreplaca: what's your lein-stable version
01:19qedim 1.0.1
01:20vu3rddreplaca: No, I didn't. I just downloaded the sources from git, installed maven2 (apt-get install maven2) and ran the maven with -o and -Dclojure.jar
01:21replacaqed: what's lein-stable?
01:21vu3rddmy intension is to package clojure-contrib for debian and debian strictly requires that all the dependencies are resolved within debian itself
01:21qedwhen you use bleeding edge lein you're supposed to symlink to the checkout's bin/lein
01:21vu3rddhttp://wiki.debian.org/Java/MavenRepoSpec
01:21qedand use lein-stable deps on the checkout
01:22replacaqed: ahh
01:22qedsee Hacking
01:22qedin the leiningen readme
01:22qed(at the bottom)
01:22replacamine was 1.0, I think
01:25qedreplaca: i did a complete rebuild
01:25qedim still getting the same issue
01:25qedoh well it can wait for now
01:27replacaqed: ok, I've gotta walk the dog anyway, i'll keep poking and see if I can reproduce
01:30vu3rddqed: if you get time, would you mind hosing your ~/.m2 and trying a local build with the -o option (or without it) and see if it still downloads the clojure-XXX.jar file?
01:31replacaqed: what versions of clojure and contrib do you have in your project.clj
01:31replaca?
01:38qedorg.clojure/clojure "1.1.0" and org.clojure/clojure-contrib "1.1.0"
01:40qedreplaca: this is probably something so stupid
01:49replacaqed: hmm, looks like it works for me too, trying your exact recipe
01:49qedweird.
01:49qedi just removed my .swank-clojure directory
01:49qednow how do i get that back
01:50qedM-x clojure-install just tells me to see swank-clojure
01:53qedthere we go -- just needed an emacs restart it looks like -- also reinstalled slime-repl and slime through ELPA
03:07LauJensenMorning crew
03:11vu3rddLauJensen: Good morning
03:12LauJensenMorning
04:06eevar2could someone ban the zombie?
04:13LauJensenWhich zombie?
04:14RaynesLauJensen: The ugly one.
04:14LauJensenGet a grib redneck
04:14LauJensens/b/p
04:14Raynes:p
04:14eevar2dmiles_afk (~dmiles@c-24-16-245-211.hsd1.wa.comcast.net) -- zombie as in compromised
04:15eevar2*box
04:15LauJensenHow do you know?
04:16eevar2* dmiles_afk has quit (Excess Flood) * 10+ during the short time i've been in here
04:16LauJensenOh - Please alert the Freenod staff
04:16LauJensens/nod/node
04:17eevar2did the same thing all yesterday as well, with a different nice. but he seems to be gone now
04:17eevar2*nick
04:18Rayneseevar2: You're either observant, or very board like all the time.
04:18LauJenseneevar2: Raynes recommends burning a few tires in the backyard to pass time
04:20RaynesI think I scared him away.
04:24eevar2Raynes: hard to miss the channel containing nothing but joins/parts from a single person if you have those messages enabled
04:24RaynesFair enough.
04:28RaynesToday's my birthday. :D
04:29eevar2congrats
04:30Raynes<3
04:36esjHappy Birthday Raynes
04:36Raynesesj: Thanks. <3
04:43esjyour 18th ?
04:44esjcan't be - but its your birthday and you're apparently taking a drivers license test
04:45Raynesesj: 16.
04:46esjcongrats - 16 is nice.
04:47unfo-(self (feel "really old"))
04:47Raynesesj: Indeed, if only because I can get a standard license this year.
04:47esjunfo-: you and me both :)
04:56zaphyrhmm, can i destructure a deftype in an argument list?
04:59AWizzArdzaphyr: rhickey explained this to me a few days ago, so I remember: if you add the clojure.lang.IPersistentMap interface you can call keys on your instance.
04:59AWizzArdOtherwise you can use Java reflection (look at the class “Class”).
05:00AWizzArdBut it would be nice if rhickey would add (maybe in the upcoming clojure-in-clojure compile) some Clojure specific reflection.
05:00a_strange_guyzaphyr: it works flawlessly even without IPersistentMap
05:00AWizzArdBecause using Class to get all fields will result in a lot more info than we are interested.
05:01zaphyrAhh, both answers are extremely useful in my situation, so thanks guys :)
05:02zaphyrhm, is deftype definately going to be in 1.2?
05:02zaphyrbecause it's really really handy :)
05:03AWizzArda_strange_guy: you mean (deftype Foo [a b c]), (keys (Foo 10 20 30)) ==> (:a :b :c)? I get a “Don't know how to create ISeq from: user.Foo__1907”.
05:03zaphyrAWizzArd: yeah, that's what I ran into
05:03AWizzArdzaphyr: I think it is very likely to stay in Clojure. Rich put lots of work into it and it is very useful. No reason to not include it.
05:04a_strange_guywell but (let [{x :x y :y z z:} (Foo 1 2 3)] .... ) works fine
05:04AWizzArdyes, a_strange_guy, this is correct
05:04AWizzArdI just understood that zaphyr did not know which slots are in his objects.
05:05a_strange_guyAWizzArd: I probably missed the first part of the question ;-)
05:05zaphyrxD
05:05zaphyri am completely new to clojure. things explode for me in strange ways
05:06zaphyrdo I get the guarantee that if i say (:x myType) that with the right hints it will expand to a direct member access in the jvm?
05:06AWizzArda_strange_guy: it’s also possible that because I had the question (which I just answered) myself some days ago, and thus perhaps preferred an interpretation which makes it seem that I was not the only one with that challenge ;)
05:07zaphyr(and by extension within destructuring)
05:07a_strange_guyzaphyr: I think that it will be JITed to tirect access
05:08zaphyrokay, thanks
05:08a_strange_guyzaphyr: destructuring uses clojure.core/get, so that may be slower
05:09zaphyrhmm, right. well, one day, when i've spent less than 2 days playing with clojure I'll dig deeper into the compiler :)
05:09a_strange_guyHowever with the new Direct binding this probably is faster than before
05:09zaphyrDirect binding? is that an exposed interface, or going on underneath in the compiler?
05:10a_strange_guyzaphyr: this means, that functions from clojure.core/ are faster
05:10zaphyrhehe, that sounds lovely :)
05:11a_strange_guybut you cannot rebind them dynamically (the 'binding special form)
05:12zaphyrahh, but that's still a sound design I'd say
05:12zaphyrI'm extremely impressed with clojure so far, considering its relatively new age, it's definately going places. ty rhicky :)
05:13zaphyrand. generally thanks for all the help and patience i've recieved here over the past couple of days, without which I'd still be floundering
05:21a_strange_guydoes anyone know how to revent Functions from core to be bound directly?
05:21a_strange_guy^prevent
05:23somejanI've been struggling with that also, but (:refer-clojure :exclude [short-array test partition]) in my ns does the job for me
05:23somejanmaybe (:refer-clojure :only []) (untested)
05:23somejan,(set! *warn-on-reflection* true)
05:23clojurebotjava.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set
05:24a_strange_guyno, I dont mean how to prevent them to be referred into the current ns
05:25hiredmanoh
05:25a_strange_guyI kinda miss doing evil stuff like (binding [println (constantly nil)] ...)
05:25hiredmanyou can set :private to true in the var metadate
05:26a_strange_guyto supress output in my own code as an example
05:26hiredmanoh
05:26hiredman"dont"
05:30Chousukea_strange_guy: I think that's still an open question
05:31a_strange_guythe current behaviour seems to be prematurely optimized
05:31Chousukea_strange_guy: as far as I know, direct binding is enabled so that people will complain if something breaks :)
05:31Chousukein order to know what needs to be done
05:32a_strange_guyit does certanly break my "evil" rebinding magic XD
05:35a_strange_guyhow about something like #^{:direct true} (any call in lexical scope in this form is bound directly)
05:35a_strange_guythen you could "annotate" the speed critical parts of your code
05:36ChousukeI think it's better to have it be opt-out instead
05:36a_strange_guyjust like typehints work already
05:37ChousukeI suppose the problem is that you can't affect already compiled code. :/
05:38hiredmanright, without putting costly checks in the bytecode :(
05:40a_strange_guyI just dont see direct binding a sane default
05:40a_strange_guybecause mutually recursive functions (or declared functions) cannot be directly bound
05:42hiredmanit is currently only the default for clojure.*
05:43hiredmanbut yes, I would prefer opt-in too
05:45a_strange_guythe current situation is that I cannot tell how my own code is compiled without looking at my dependencies in core
05:45a_strange_guyso functions from core are compiled with fast calls
05:46Chousukecalls TO functions in core are statically bound
05:46a_strange_guyand my functions that use them as well
05:46Chousukeno.
05:46Chousukecalls to your own functions are still dynamically bound
05:48hiredmanChousuke: directly bound?
05:48a_strange_guythat is true, but i meant that if my own Function uses c.core/print i cannot override the use of print
05:49Chousukehiredman: same thing
05:49Chousukea_strange_guy: indeed.
05:49Chousukea_strange_guy: but you can easily work around that by using your own print function
05:49AWizzArdhiredman: you are still awake :)
05:49hiredmanAWizzArd: :P
05:50LauJensenRaynes: Congratz :)
05:50hiredmanChousuke: I'd prefer we pick one terminology and stick with it
05:50AWizzArdhiredman: btw, one possible solution for the challenge I stated yesterday, about a lock around a dosync:
05:50Chousukehiredman: I'm not even completely sure what the terminology is
05:50hiredmanChousuke: *shrug* make something up, just be consistent
05:51AWizzArdinstead of locking it this dosync could go into an agent. And all threads add their transaction job to the agents queue, which will work off the dosyncs. They can never collide this way and block each other out.
05:51spariev__Raynes: my congratulations :) have you finally got the joy Of Clojure book :) ?
05:51Raynesspariev__: I didn't get a chance to order it last night. I'll be getting it when I get home later.
05:51ChousukeAWizzArd: why would you need dosyncs then though?
05:51RaynesAnd thank you. LauJensen, as well.
05:51ChousukeAWizzArd: if all transactions are serialised
05:52hiredmanAWizzArd: I can't say why, but I find that unsatisfactory, something is just not right
05:52AWizzArdChousuke: interesting point.
05:53AWizzArdhiredman: it would be nice of course if dosync offered some hooks.
05:53hiredmanI think you are making it too complicated
05:54hiredmanhmm
05:54AWizzArdWhen I’ll release the code in some weeks we can see if things can be improved.
05:55AWizzArdbut it is worth to think about what Chousuke innocently mentioned :)
05:57caljunior,(let [(symbol "foo") "bar"])
05:57clojurebotjava.lang.Exception: Unsupported binding form: (symbol "foo")
05:58AWizzArd,(class (symbol "foo"))
05:58clojurebotclojure.lang.Symbol
05:58caljunioris there a way to bind dynamically created sybols?
05:58AWizzArdlet expects a Var
05:58caljuniorsymbols
05:58AWizzArdcaljunior: macros
05:58ChousukeAWizzArd: it expects a symbol :P
05:59Chousukebut (symbol "foo") is not a symbol :)
05:59AWizzArdyes, you are right
05:59AWizzArdlet is a special form of course
05:59caljunior,(symbol? (symbol "foo"))
05:59clojurebottrue
05:59caljunioryes it is a symbol
05:59AWizzArdcaljunior: let does not evaluate its argument
05:59AWizzArdlet is a special symbol
05:59AWizzArdit is a list
05:59Chousukecaljunior: you're confusing some things here
05:59AWizzArd,(class '(symbol "foo"))
05:59clojurebotclojure.lang.PersistentList
05:59Chousukecaljunior: (symbol "foo") is a list
06:00Chousukecaljunior: foo is a symbol
06:00caljuniorright
06:00Chousukewhen *evaluated*, (symbol "foo") produces foo
06:00AWizzArdChousuke: your performance to day is particular good :-)
06:00caljuniorcan I force it to evalute with something like eval?
06:00Chousukecaljunior: in a way, yes.
06:00AWizzArdcaljunior: you can use a macro
06:01Chousukecaljunior: you need to dynamically construct a data structure representing the let form and then eval that
06:01caljunior,(let [(eval (symbol "foo")) 2])
06:01clojurebotjava.lang.Exception: Unsupported binding form: (eval (symbol "foo"))
06:01AWizzArdagain you put a list where a symbol was expected
06:01Chousuke,(list 'let [(symbol "foo") 3] 'code-here)
06:01clojurebot(let [foo 3] code-here)
06:02AWizzArdas a special operator let has its own syntax. It does not evaluate forms in the position in which you tried to have it evaled.
06:02Chousuke,(eval (list 'let [(symbol "foo") 3] 'code-here)) will fail, but that's what you want, in essence
06:02clojurebotDENIED
06:02AWizzArdthough this is not desirable in most cases, and often better handled by a macro
06:02Chousukeeval should not be used unless it's necessary though. in this case, you most likely want a macro
06:02caljunioryes
06:03caljuniorthanks
06:03caljunior*dives into macro tutorials*
06:05Chousukeeg, something like (defmacro with-foo-bound-to-5 [foo & code] (list* 'let [(symbol foo) 5] code))... or using syntax-quote `(let [~(symbol foo) 5] ~@code)
06:06Chousukewriting macros without syntax-quote is good practice for understanding the whole code=data thing
06:06Chousukebackquote forms often look like they're some magical macro syntax :/
06:06ChousukeAt least that's what I thought when I first learned about macros
06:08caljuniorthanks, this is very helpful.
06:09ChousukeI wonder if there exist macro tutorials that tell you to rewrite some existing macro without using backquotes :)
06:10AWizzArdChousuke: yes, in „Practical Common Lisp” this happens.
06:10AWizzArdbut only a small fraction of the chapters talk about this
06:14caljuniorsounds like an idea for the "Joy of Closure" chapter 8
06:14caljuniorClojure "ouch"
06:21caljuniorsucces!
07:07AWizzArdHallo chouser
07:29zaphyris bit-shift-right equivalent to >>? what is the equivalent to >>>?
07:33AWizzArdzaphyr: to which >>> are you referring? The one in C?
07:35zaphyrah, java's, iushr
07:35zaphyrlike x >> y but copies the high bit into the top y bits
07:36zaphyroops
07:36zaphyri mean clears the top y bits xD
07:37zaphyri don't actually need it, but thought i'd ask since i can't find it
07:38hiredmanunsigned right shift
07:38hiredmandunno if clojure has a fn for it
07:38zaphyrah, right, okay
07:38zaphyrnot a massive problem for me, but would be nice to have
07:39zaphyr(seems a bit silly to have to implement it given there's jvm instructions for it)
07:40unfo-you can always call the java funciton
07:40unfo-(.>>> 6)
07:41unfo-or what?
07:41hiredmanunfo-: no
07:41hiredman>>> is not a method
07:42unfo-ok
07:42unfo-oh right.. it's an oper
07:44zaphyrwhat's an oper?
07:45unfo-operator? like + - /
07:45zaphyrah, does that go down to jvm instructions?
07:45unfo-altho in clojure-land they are functions i believe
07:46zaphyrhmm, is there a link for documentation on that?
07:46hiredman,(doc +)
07:46clojurebot"([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."
07:47zaphyr,(doc .>>>)
07:47clojurebotHuh?
07:47zaphyr:S
07:47unfo-so if >>> was a method on Number you could call (.>>> 6) but since, as hiredman pointed out, it is not a method you can't
07:47zaphyrahhh, right okay
07:47zaphyrof course the . should have clued me there
07:48zaphyrheh, in the lisp world functions and operators all fuse into one for me :)
07:48unfo-yeah
07:51zaphyrhmm, i seem to remember somewhere you can't type hint primitive values in defn, at least conventionally?
07:59rhickeyzaphyr: right, because fns can't take primitives
07:59rhickeyif you want to use a fn arg as a primitive, re-let it in the body (defn foo [x] (let [x (int x)] ...
08:00zaphyrRight okay. I will argue this one later but I'm going to have to learn clojure more or you'll shoot me out of the sky in seconds :)
08:00zaphyrtyvm though, I am liking clojure a lot :)
08:01jcromartieWhat's the best way to have my web app reload a namespace when the file changes?
08:01jcromartieOr any Clojure program in general?
08:02esjemploy an intern :P ?
08:05zaphyrhmm, actually the fns not taking primitives issue will completely go away if I can force inlining of functions and ensure i'm only doing unboxed arithmetic on floats, is this possible?
08:13LauJensenBlizzard in Denmark! :)
08:14AWizzArdNew WoW servers?
08:14unfo-lol. prolly an actual blizzard ;)
08:14LauJensenhehe
08:14unfo-but that was my first association too ;)
08:14AWizzArd*g*
08:15zaphyraha! definline! rhicky i take it all back :)
08:15LauJensenYou guys are sick, but anyway - Yes, road home was almost impassble - I flew threw a drive which sent snow flying up both sides of the car, blinding the windows - lots of fun
08:15LauJensens/threw/through
08:16LauJensenAnybody here familiar with Jerry Pournelle ?
08:17rsynnottthe science fiction writer?
08:18esjhe looks like an interesting guy
08:25LauJensenhttp://www.jerrypournelle.com/mail/2010/Q1/mail608.html <-- I'm getting a lot of traffic from there
08:28esjrandom, but every hit is sacred.
08:29LauJensenhuh?
08:30esjwell, its seems like a strange place to be slashdotting you. However, every hit you get is a good thing.
08:31jcromartiehttp://github.com/mmcgrana/ring/blob/master/src/ring/middleware/reload.clj
08:31jcromartieseems reasonable
08:35LauJensenhehe, esj - Hope you get well soon
08:35esjLauJensen: much obliged kind sir.
08:40yasonDoes a future need to be dereffed before it is scheduled for execution?
08:43zaphyrextreme performance win! I am now hooked :D
08:43chouseryason: no, it starts going immediately
08:44chouseryason: no, it starts going immediately
08:46yasonchouser: that's what I thought, too. Hmmm.
08:47cemerickyason: that is, it's *scheduled* to be executed immediately. If you've got a pile of them, they won't all start "simultaneously"
08:47LauJensensucks a little that we dont have language level support for ai yet
08:47AWizzArdcemerick: what for?
08:48esjI'm hoping to get time to wrap Weka at some point.
08:48yasoncemerick: yeah, I know. I just sent off a small task that does little side-effects but that won't happen
08:48unfo-http://narf-archive.com/pix/c7b313f1e76ec4a6558d690b907c996951762119.jpeg hahah ;D
08:52LauJensenhaha
08:53LauJensenyason: Also - Sometimes, especially if you're in SLIME, futures will fail silently, thus appear to never start
08:53cemerickAWizzArd: I need to improve detection of columnated text. Our existing approach is pretty good, but it's *really* old and hard to change at this point.
08:53zaphyrunfo: xD
08:53cemerickBuilt before I knew what 'bayesian' was :-/
08:54esjcemerick - choose door 3, its a 2/3 probability the car is behind it.
08:54cemerickheh
08:56yasonLauJensen: I'm in Slime...
08:58AWizzArdcemerick: without knowing more about this I would say that the bayseian route is good to go.
08:59cemerickyeah, probably. We already have a pretty solid bayesian toolkit, it's just that I don't understand it (whereas NN are my bag from years ago).
09:02AWizzArdjust blindly use it and trust in its magic :)
09:03cemerickeh, they're both 'close your eyes and pull' sort of tools. I mean, I understand the mechanics, but every time either of them work, I'm amazed.
09:04AWizzArdThey know how to keep track of a good statistic.
09:10LauJensenyason: Then make provision for silent failures, otherwise they'll drive you nuts
09:12yasonLauJensen: Is this an intermittent issue in Slime or something I should expect to live with for now_
09:12yason?
09:13LauJensenI think its here to stay - I dont think there's a quickfix for it
09:13LauJensenGenerally, when you're doing stuff with threads, always test outside of slime before deploying - SLIME sometimes forces evaluation where Clojure doesnt - Can cause hangs in your program etc
09:14yasonLauJensen: well, what can you expect when you're knee-deep in sloshing slime already :)
09:15rsynnottthis makes me sad: http://java.sun.com/
09:15LauJensenrsynnott: i'm just wondering how the whole thing will effect Clojure
09:19Fossihuh? i don't get it? what part makes you sad?
09:19rsynnottFossi: the sudden elimination of sun from that page
09:19cemerickraek: you'll likely discover enlive soon, which uses both :-)
09:20rsynnottOracle tend to do this
09:20rsynnottthey also killed the (very cute) sleepycat (bdb developers) website very quickly when they bought them
09:20Fossiah, well, happens
09:22cemerickthat's what should happen in a merger. One company, one banner, etc.
09:23yasonrsynnott: when you switch off Sun it'll be an eternal night :)
09:23yasonrsynnott: Sun Microsystems logo was cooler.
09:23raekcemerick: :O
09:23raeknice!
09:24cemerickraek: uh huh :-D
09:25rsynnottGoogle are lazier about it
09:25rsynnottthey STILL haven't finished rebranding feedburner, or blogger
09:26Fossiit's indeed funny that the main focus about sun seems to be solaris, sparc and mysql
09:26cemerickThat's because they have a single actual business. Anything they pull in that is ad-related is consumed entirely and leaves not a trace.
09:29fro0gI'm curious what will happen to virtualbox
09:30LauJensenfro0g: Its be joined to some of their existing Hypervisor software
09:30LauJensens/its/it'll
09:33fro0gLauJensen: sounds difficult
09:33cemerickLauJensen: orcale has a hypervisor?
09:33fro0gI think they use xen
09:33cemerickwhat I read said that VB was a big deal for them, along with the VDI stuff
09:38angermandoes leiningen support java classes?
09:39HDurerangerman: maybe http://github.com/antoniogarrote/lein-javac ? Haven't looked at it but was mentioned on the #leiningen channel
09:40angermanHDurer: thanks
09:47cemerickoh, that's unfortunate
10:09jjames#mindhed
10:10jjamessorry.. erg mistype
10:11bobo_hm, my leinigen just gets NoClassDefFoundError nomather what command i use after self-install. any clues? using cygwin in windows
10:15LauJensenbobo_: I couldn't help but notice that you had both "error" and "windows" in the same sentence - Do you need to me explain it more carefully? :)
10:16bobo_:-)
10:17bobo_they force me at work :-(
10:21LauJensenMy Global Warming post has been linked on HN, Dzone, ClimateAudit, Jerrypournelle.com, whatsupwiththat.com and a few other places - its a amazing the interest the weather gets now a days - It used to be what we talked about when all other topics were drained
10:23rsynnottugh, you don't want to be linked to by Pournelle
10:23rsynnotthe's a bit of a loon
10:25LauJensenrsynnott: I cant do much about the people who link me, but generally I try to stay detached from everybody :)
10:27jkdufairwhat is your global warming post?
10:30LauJensenjkdufair: Just a blogpost which shows how to run 50 Gigs of NOAA weather data in parallel using Clojure
10:31jkdufairoh cool! link?
10:31jkdufaircouldn't find it on pournelle. went blind trying
10:31LauJensenhttp://www.bestinclass.dk
10:32LauJensenclick blog (right side), top post
10:51jkdufairwow. nice clojure hacking. interesting conclusion. i wonder how to explain the icecaps.
10:51jkdufairtoo OT, sorry
10:52LauJensenWhich icecaps ?
10:54neotyk,(take 2 (for [a [{:a 1 :b 1} {:a 2 :b 2}] :while (= 2 (a :a))] [a]))
10:54clojurebot()
10:54jkdufairpolar? conventional wisdom says they are receeding.
10:54neotykhow would I filter only for elements that have :a = 2
10:55esjevery?
10:55LauJensenreplace :while with :when
10:56LauJensenor just add a :when clause, depending on what you want
10:56esj,(filter :a [{:a 2 :b 3} {:b 9 :c 3} {:a 3 :dh 3}])
10:56clojurebot({:a 2, :b 3} {:a 3, :dh 3})
10:56neotykesj: that's what I was looking for
10:57neotykLauJensen: I'm preparing for "for" makes sense ;)
10:57LauJensenuuuuh
10:57esjsomebody showed me that technique a couple of days ago.
10:57neotyk~filter
10:57clojurebotfilter doesn't stop
10:58neotyk(doc filter)
10:58clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
10:59LauJensenjkdufair: They might be decreasing in size - I don't know. All the data shows is that globally on average, the Globe is cooling
11:00neotyk,(filter #(= 2 (:a %)) [{:a 1 :b 1} {:a 2 :b 2}])
11:00clojurebot({:a 2, :b 2})
11:01jkdufair,(filter #(= 2 (:a %)) [{:a 1 :b 1} {:a 2 :b 2} {:foo 3}])
11:01clojurebot({:a 2, :b 2})
11:01jkdufairjust curious
11:02LauJensen,(for [item [{:a 2 :b 5} {:a 5 :b 10} {:c 3 :a 2 :b 7}] :when (= (:a item) 2)] item)
11:02clojurebot({:a 2, :b 5} {:c 3, :a 2, :b 7})
11:03neotykclojurebot: what is short for ,(doc ...)
11:03clojurebotRoger.
11:03neotyk~what
11:03clojurebotwhat is wrong with you
11:03neotyk,(doc for)
11:03clojurebot"([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when test. (
11:04neotykahhh, so while is until test is true
11:04LauJensenwhile is as long as test is true
11:04LauJensenor until test is false
11:06neotyk,(for [i [{:a 2} {:a 1}] :when (= 1 (:a i)] i)
11:06clojurebotUnmatched delimiter: ]
11:06neotyk(for [i [{:a 2} {:a 1}]] :when (= 1 (:a i)] i)
11:06neotyk,(for [i [{:a 2} {:a 1}]] :when (= 1 (:a i)] i)
11:06clojurebotUnmatched delimiter: ]
11:06LauJensenlooks like a Vim user is in our midsts :)
11:07LauJensenShame on you Fred Flintstone
11:07zaphyr=]
11:07esjNow Lau, just because he's a beginner doesn't mean he's using vim ;)
11:07LauJensenActually I think per definition thats exactly what it means :)
11:08neotyk,(for [i [{:a 2} {:a 1}] :when (= (i :a) 1)] [i])
11:08clojurebot([{:a 1}])
11:09LauJensen(look, he was away firing up Emacs)
11:09neotykwhile
11:09neotyk,(for [i [{:a 2} {:a 1}] :while (= (i :a) 1)] [i])
11:09clojurebot()
11:12zaphyrhmm. (dotimes [x 1000000] (JavaDot/dot x x x x x x)) is running at least two orders of magnitude slower than a java for loop calling the same function, is there a way to make this less embarassing?
11:12LauJensen,(for [x [2 4 6 8 9 10] :while (even? x)] x)
11:12clojurebot(2 4 6 8)
11:12LauJensen,(for [x [2 4 6 8 9 10] :when (even? x)] x)
11:12clojurebot(2 4 6 8 10)
11:12LauJensenzaphyr: Type hint it ?
11:13zaphyrLau: i tried, but I am failing :(
11:13LauJensenWhy ?
11:13chouserJavaDot/dot takes all ints?
11:13zaphyrfloats
11:14zaphyrhmm. let me try (dotimes [x 1000000] (let [x (float x)] ...))
11:14LauJensen(set! *warn-on-reflection* true)
11:15LauJensenthen compile the function, and fix whatever the compiler recommends
11:15zaphyrahhhh
11:15zaphyrthanks
11:15zaphyrand i was also being an idiot- after adding that type hint i'm now just 1/2 java's performance, which is much more acceptable :)
11:16Chousuke~def dotimes
11:16LauJensenzaphyr: For a direct java-call you should be as fast as Java
11:17LauJensendotimes automatically hints to an int, so no slowdown
11:17zaphyrright, i wonder why i was receiving such a hit? :/
11:17LauJensenmeaning, (doseq [x (range 10)] is slower than (dotimes [i 10])
11:17zaphyrthat's an int- primitive int?
11:17LauJensenyes
11:18LauJensenClojure supports java primitives
11:18LauJensenor should I say, Oracle primitives :)
11:19zaphyrSHHH
11:19zaphyrdo not speak it's name :(
11:19zaphyrthanks though :)
11:19LauJensennp
11:21zaphyrthe ultimate plan is to try and implement carmack's invsqrt in clojure to perform the same as my java version, so expect more tears before the day is through... :)
11:21LauJensenFun exercise
11:22zaphyrIf i can get java numerical performance out of clojure, i really see no reason to use any other language :)
11:22rhickeyhow does one get paredit action for {}'s?
11:23Chousukerhickey: works for me, using paredit 22
11:23LauJensenwell... If I make a development contract with a customer, where we agree that pre-deployment I'll fix bugs on a 200$ per bug fixed rate, you can be sure I'll argue for C++ or Scala :)
11:23noidirhickey, I've heard that it's fixed in the 22beta
11:23noidiwhile the version in elpa is 20
11:23rhickeyah, used elpa, so now what?
11:24rhickeywhere deos elpa put things?
11:24rhickeydoes
11:24LauJensen~/.emacs.d
11:24clojurebotIt's greek to me.
11:24freddy_drhickey: thank you! for Clojure. it is awesome. I've always wanted to combine FP with JVM.
11:25rhickeyfreddy_d: you're welcome!
11:25noidiapparently uninstalling works like M-x package-list-packages, C-s paredit, d, x
11:26noidi(I finally decided to take the plunge and upgrade paredit, too :)
11:26freddy_drhickey: I haven't been this excited about a new language since 1996 (and I've tried quite a few along the years) :-)
11:26Chousukerhickey: it might be enough to replace your paredit.el with http://mumble.net/~campbell/emacs/paredit-beta.el (renamed to paredit.el) in the ~/.emacs.d/elpa/pareditwhatever dir (assuming your elpa is configured similarly to mine)
11:27zaphyrrhicky: i concur with freddy_d, great stuff :)
11:27dnolenrhickey: if you don't want mess with installing paredit 22, http://paste.lisp.org/display/94251
11:28noidiI removed the package from elpa and saved that paredit-beta.el as ~/.emacs.d/paredit.el and everything just worked
11:28tomojanyone using lein-swank successfully?
11:28noidifdaoud, I've had that feeling about Clojure for about a year now :)
11:29noidithe more I use it, the more amazed I am by how well all the pieces fit together and complement each other
11:29tomojI saw some posts on the mailing list about my classpath problem, but I built lein-swank.jar from master and it still didn't work :(
11:29AWizzArddnolen: does rhickey want to try out emacs?
11:29fdaoudnoidi: great, can you tell a bit more about what you've used it for?
11:29dnolenAWizzard: he was asking about paredit.
11:30jkdufairjava is the matrix and clojure is the red pill
11:30rsynnottwhere does Oracle fit in? :)
11:30ChousukeOracle are the machines? :P
11:31noidifdaoud, right now I'm using Clojure to write a 3D game with OpenGL
11:31LauJensenI've seen some stunning results from Zach Tellman who has moved computations onto the GPU using Clojure
11:31fdaoudnoidi: impressive
11:32fr0ogpenumbra?
11:32LauJensenExactly
11:32fdaoudnoidi: I'm doing webapp development with Compojure, Enlive, and contrib.sql. So much leaner than my previous stack.
11:32LauJensenfdaoud: contrib.sql ?! :)
11:32noidiI've only looked briefly at enlive, but it seemed awesome :)
11:33fdaoudLauJensen: is that wrong?
11:33LauJensenfdaoud: Yes - Use ClojureQL :)
11:33noidiLauJensen, that's your project, isn't it? ;)
11:33rsynnottah, clojureql is another one of these things that lives only in many forks on github :P
11:34LauJensenWell, you decide what to use, but we hope to have 1.0 done my February/Early march, and you'll then have a sweet Lisp frontend, and several modules for backends, mysql, postgresql, fleetdb, derby etc
11:34fdaoudLauJensen: in this particular case, I have a bunch of ready-to-use, tried-tested-and-true, SQL, including DDLs and all the queries I need. So ClojureQL doesn't seem necessary.
11:34rsynnottthis is the problem with github; you never know what the authoritive version is these days
11:34LauJensenTarget whatever you want, dont change your code
11:34fr0ogrsynnott: i think it's on gitorious
11:34LauJensenrsynnott: ClojureQL lives only on Gitorious
11:34LauJensen~clojureql
11:34clojurebotclojureql is http://gitorious.org/clojureql
11:35rsynnottah :)
11:36fr0ogany plans for an h2 backend for it?
11:37LauJensenNope - But you can write a module for it pretty easily - The great thing about ClojureQL is that its very extendable, even moreso with the new frontend which is being put in as we speak
11:37LauJensenSo both SQL type systems, but also Mongo, Fleet etc will work with the same code
11:37fdaoudnoidi: so far so good with enlive. I'm already using CSS and jQuery, so it's great to be able to use CSS-style selectors.
11:38zaphyrhmm, is there a clojure pastebin?
11:38dnolenzaphyr: most people use paste.lisp.org
11:39zaphyrta :)
11:41tomojgist has basic clojure syntax highlighting
11:41zaphyrHere's my current failed attempt at getting performance: http://paste.lisp.org/display/94252
11:44jkdufairso if sql (the language) access to my data isn't a requirement, what's the simplest, most idiomatic way to add durability to clojure's STM?
11:44Chousukezaphyr: + is only inlined for two arguments
11:44tomojzaphyr: what's the let for?
11:45rhickeyis paredit-22-beta stable?
11:45zaphyrChousuke: ah, that might seriously be an issue :)
11:45tomojevaluation order?
11:45zaphyrtomoj: casting the dotimes argument to an int, speeds things up by about 5x
11:45Chousukerhickey: I have been using it for quite a while without problems, but my paredit use is not very advanced :/
11:45zaphyrtomoj: it's a let* because i was doing the dotimes in the let* earlier and didn't change it :)
11:45rhickeyChousuke: mine won't be advanced either :)
11:46tomojzaphyr: I meant the let in the macro
11:46tomojin dot-m, that is
11:46zaphyrtomoj: oh, that makes sure each argument is only evaluated once
11:46tomojah, yeah
11:46arohnerjkdufair: there currently aren't any options. Fixing that would probably require integrating JTA into the STM, not easy work
11:46Chousukezaphyr: it's unnecessary in this case though since you're evaluating them only once in any case. :)
11:48zaphyrChousuke: imagine it was maybe going to be used one day :)
11:48zaphyrOH! that's faster :D
11:48zaphyrthanks Chousuke :)
11:48jkdufairarohner: interesting. thx. right now STM pretty much stands alone on top of the JVM, yes?
11:49jkdufairtransparent durability would be kickass
11:49jkdufairwithout resorting to image files and other abominations
11:49arohnerjkdufair: yes it would
11:50zaphyrin fact, great news! it's as fast as java :)
11:52mabessince watchers on agents are called synchronously does that mean if an agent isn't sent a function that will block but if the watcher may then send-off should be used for that agent w/the blocking watcher?
11:52mabesdoes that make sense?
11:55rhickeyhmm, with paredit 22 beta entering an opening curly { doesn't create a closing curly }
11:58tomojdid you have paredit 21 or greater when clojure-mode loaded?
11:58a_strange_guyrhickey: what does M-x paredit-open-curly doo?
11:58a_strange_guythat is mapped to the '{' key
11:58tomojfor me, clojure-mode adds that mapping when it sees paredit
11:59tomojbut I had to add M-{ and M-[ for paredit-wrap-curly and paredit-wrap-square myself
11:59rhickeya_strange_guy: that works, but { is not bound to it
12:01tomojhuh, lein-swank suddenly works now
13:00qed=[˻user˼]= (+ 1 2)
13:00qed^Is this an incredibly annoying slime repl prompt?
13:00qedheh
13:00zaphyrmy eyes
13:01dakroneis the unicode in there?
13:01dakrone*that
13:02hiredmansounds like a yes
13:03rysLooks good to me
13:03dakroneso it's only annoying if you have to paste it into something that doesn't support unicode
13:04hiredmanI don't see why you need all that stuff to separate the prompt from code
13:05AWizzArdhiredman: *g*
13:09danlarkinya it's not your $PS1 :)
13:21itistodayjoin #node.js
13:21itistodayforgot the slash apparently
13:34jweiss any compojure people here? looking at these session functions, i just don't get it. why does session-assoc seem to return a function that should take a request as the argument, and then all it returns is a map with nothing in it but the session? shouldn't it keep the rest of the request, and just add to the session?
13:35jweissmaybe i'm using this wrong.
13:35jweissi want to add something to the session after a user logs in, to indicate the username of the currently logged in user
13:36dakronejweiss: you can't do (session-assoc :username username) ?
13:37jweissdakrone: i don't think so, session-assoc returns a function, not a map
13:38jweissthe function it returns apparently is expecting the request as its argument
13:38jweisssee alter-session
13:41dakronejweiss: according to the docs on compojure.org, session-assoc takes & keyvals and associates key-value pairs with the session, doesn't mention anything about what it returns
13:42dakroneit's assoc-session that has request response]
13:42jweissdakrone: yeah i know, not very good doc :)
13:42dakroneas its arguments
13:42jcromartieassoc-session is middleware
13:42dakroneso it sounds like you want session-assoc instead of assoc-session, right?
13:42jcromartiemiddleware take handler functions and return new handlers
13:42LauJensenjweiss: Did you see my blogpost where I show how to use sessions?
13:43jweissLauJensen: hm, maybe, what's the link
13:43LauJensenhttp://www.bestinclass.dk/index.php/2009/12/beating-the-arc-challenge-in-clojure/
13:44jweissLauJensen: hm ok that helps, thanks
13:45jcromartieremember, jweiss, all of the functions that "change" the session just return the new value
13:45jweissjcromartie: yeah i understand it's functional
13:45jcromartiek
13:53AWizzArdOho, Suns “Project Kenai” is closing down (Orcale descision).
13:53mebaran151I never much saw what it was good for...
13:53cemerickYeah, that was announced last week, I think.
13:54AWizzArdcemerick: and today an email was sent out to the project owners
13:54AWizzArdmebaran151: Kenai offered Jira and support for git and hg.
13:54cemerickI think the big deal was that builds could be done "in the cloud"
13:54cemerick...or maybe that was forthcoming.
13:54AWizzArdi liked the jira most
14:21jkdufairLauJensen: Liked your beating the arc challenge, but I like paul graham's solution of representing program flow as closures.
14:21jkdufairpresumably we can do that too somehow?
14:21jkdufairi was a big fan of smalltalk's seaside for a long time
14:23chouserarc's web stuff actually uses continuations, doesn't it? We can't do that as cleanly in Clojure, though closures do work fine.
14:23jkdufairyes, continuations
14:24jkdufairdo we have some sort of call/cc?
14:24AWizzArdno, but threads
14:24jkdufairis that a jvm limitation?
14:24AWizzArdis there anything specific you want to do with continuations of which you think it can't be done (easily) with threads?
14:25chouserjkdufair: yes, jvm limitation
14:25jkdufairnothing specific. i like the model - i think it's does a great job of masking the statelessness of http
14:25jkdufairbeating the arc challenge got me thinking about it
14:25chouserjkdufair: I'd be afraid it masks real issues that ought to be addressed -- client disconnects, code updates while user is "logged in", etc.
14:26chouserBut then I've never used a continuations-based web framework, so I may not know what I'm talking about. :-)
14:26jkdufairyeah, seaside addresses some of that and it's not super pretty but it's as elegant as any web framework i've seen
14:26AWizzArdcontinuations don't do any magic, and you can do all you want with threads
14:27LauJensenI think continuations are great - Lets wait until PG finishes his work, and then we'll port it
14:27chousera thread is normally much heavier than a continuation
14:28jkdufairi like that you can basically map the back button to the stack with a continuation
14:28AWizzArdthe os/vm could offer extremly leightweight threads
14:28chouseresp. a blocking thread compared to a stored continuation. esp. if the continuation is serializable. :-)
14:29AWizzArdIt could be interesting to have a webserver running with my db. It can also support the back button easily. Maybe this will also be very nice.
14:29jkdufairit appears that there is at least one continuations library for java: RIFE/Continuations
14:29jkdufairhttp://lambda-the-ultimate.org/node/1002
14:30AWizzArdA year ago I talked with the author of rife. The project was pretty unmaintained back then.
14:30jkdufairof course with ajax, continuation-based web frameworks aren't quite the silver bullet they once seemed
14:31AWizzArdright
14:31jkdufairand i suppose the semantics of "back" aren't quite as simple as "the previous state"
14:31jkdufairwhere did i put that blue pill
14:32jkdufairotoh, i do like paul graham's little /said/ example
14:32chousernot even close. people rarely mean "undo" when they click "back"
14:42chouserhiredman: do you read the clojure-dev group?
14:51hiredmanchouser: uh, I think so, I have both groups with the same tag in gmail, so it's hard to distinguish
14:52chouserah. I add a 'dev' tag to that one. Anyway, just saw your wall-hack method nominated for an rename.
14:52hiredman:/
14:52hiredmanthats fine, I guess
14:54hiredmanI thought the name was cute, but I guess that could be an argument against
14:58neotykHi clojure gurus
14:59AWizzArdhallo neo
15:01neotykit's neotyk mister AWizzArd
15:02ordnungswidrighi all
15:02LauJensenHi
15:02AWizzArdAh, hello ordnungs
15:03neotykhi
15:06neotykis there any nice async http client clojure lib somewhere already?
15:07cemerickordnungswidrig: I saw that the other day. I'm looking forward to using it :-)
15:07ordnungswidrigI'm looking forward to make it leave the alpha state :-)
15:08chouserI thought I saw somewhere that the servlette api is strictly synchronous (one thread per connection). would be a shame if true.
15:08chouserIt wouldn't be hard to extend something like ring to use CPS, which would be lovely.
15:08cemerickordnungswidrig: yeah, I'll be looking to pull it in once we finish an initial spike of the project using handlers directly (in part to fully understand how compojure works)
15:08AWizzArdchouser: you are in love with continuations today :-)
15:09chouserCPS is closures thank goodness
15:09neotykservlet 2.5 os like you say chouser
15:09cemerickI was under the impression that the servlet spec specifically doesn't talk about impl details like that.
15:09neotyk3.0 supports async
15:10drewrneotyk: clojure.contrib.http.agent is async
15:10neotykchouser: check atmosphere project
15:10chousercemerick: all it has to do is say "return the result" and you're stuck holding one thread per connection.
15:11AWizzArdmaybe this thread is of interest: http://groups.google.com/group/compojure/browse_frm/thread/887cdaef8800d2b/5656cbdbcdf439c2?tvc=1#5656cbdbcdf439c2
15:11neotykdrewr: so I can do c10k with it?
15:11cemerickchouser: it doesn't -- Servlet.service returns void -- you can write to the response with however many threads you want to coordinate.
15:11drewrneotyk: c10k is the other direction :-)
15:12neotyk:-/
15:13neotykso issuing 10k req is what?
15:13drewrI'd just use ab(8)
15:13drewrbut you could use c.c.http.agent I suppose
15:13AWizzArdhttp://www.jboss.org/netty was linked in that discussion.
15:14neotykAWizzArd: very nice thread
15:14hiredman"Lisp will be in the top 10 most popular programming languages by 2010."
15:14chouseroh, so it's only the containers like jetty that impose the restriction?
15:15AWizzArdhiredman: didn't you want to sleep? ;)
15:15hiredmanwant time is it?
15:15hiredmanwhat
15:15clojurebotWhat is meta
15:15AWizzArd21:15 o'clock
15:15ordnungswidrigcps sounds fun.
15:16ordnungswidrigcompojure-rest shall be able to abstract this pain away. as it's a chain of decisions / functions I see the possibility to use a message passing style as well.
15:16ordnungswidrigis cps and message passing "congruent" in some way?
15:17neotykwhat is cps?
15:17hiredmanyes
15:17dnolencps: continuation-passing-style
15:17ordnungswidrighiredman: yes to me?
15:17hiredmanyes
15:18chouserin this case, all I really mean is for ring to pass a "callback" to the handlers, so they can call it from whatever thread they want later.
15:18neotykdnolen: suspending response in general, right?
15:19hiredmanscheme original had another greek letter operator to create things you would send messages to, but the code paths for it and λ were found to be essentially the same
15:22dnolenneotyk: cps is way of structuring the code to make it easy to go back to any point in a computation. entirely unnecessary if the language has native continuation support. I wrote a port of a CL library cl-cont called clj-cont if you want to see how it works in Clojure. it's fun, tho not very efficient.
15:25hiredmanoh
15:25hiredmanouch
15:25hiredman"Unroll optional arguments."
15:26ordnungswidrigunroll optional arguments? what will this tell me?
15:27neotykthat it makest hiredman crying ;)
15:27hiredmanoh, it's in the proposed coding guidelines for clojure.lib
15:30hiredman,(doc io!)
15:30clojurebot"([& body]); If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message."
15:33LauJensenNew blogpost: http://www.bestinclass.dk/index.php/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure/
15:38abrenkLauJensen: Yeah, something to read tomorrow! Thanks. By the way, the link "Git Repo" under "Deployment" is defunct.
15:40LauJensenoh
15:40LauJensenright, thanks
15:40abrenkLauJensen: and it would be better to run "git clone git://github.com/LauJensen/cloneit.git" I guess
15:41LauJensenFantastic catch
15:41LauJensenThanks - I went a little too fast
15:44abrenkLauJensen: Thats the stuff I already grok... let's see how many more weeks pass until I can at least read your Clojure code like I write Java...
15:45LauJensenThis one should be quite easy. There was a similar project done in Common Lisp recently and I wanted to do a Clojure port 1) Just to show our colors and 2) Show off our cool infrastructure toys
15:54drewranyone tried using moustache?
15:56ordnungswidrigdoes anybody have a pointer for a sha1 digest in clojure?
15:56chouseryes, just a sec.
15:57LauJensenAlready #5 on HN - Keep the love coming :)
15:57cemerickordnungswidrig: I could paste one if you like. It's pretty simple.
15:57chouserLauJensen: hate to break it to you, but attention is not the same as love. :-)
15:57LauJensenhaha
15:58neotykLauJensen: s/Sorting my date/Sorting by date/
15:58ordnungswidrigcemerick: I'd appreciate it
15:58cemerickordnungswidrig: hrm, although our version uses a byte[] -> hex string routine I wrote in Java eons ago.
15:58cemericklisppaste8: url?
15:59cemerickjeez, still down
15:59cemerickclojurebot needs to grow a pastebin I guess
15:59hiredmanyou could always just use whatever from apache commons
15:59neotykLauJensen: also would like to see a bit more on let part in rendering links
16:00LauJensenmore explanation ?
16:00cemerickordnungswidrig: yeah, commons-codec is comprehensive
16:00ordnungswidriguhm, wouldn't java ship a digest in the jdk?
16:00neotykLauJensen: I'm dumb ;-)
16:00hiredmancemerick: clojurebot recognizes and tags urls from a few difference pastebins
16:01cemerickordnungswidrig: it does, commons-codec wraps those and implements others via a std api
16:01LauJensenneotyk: No you're probably just putting into words what most people think, and also what I'll think reading that 6 months from now perhaps :)
16:01cemerickordnungswidrig: but anyway: http://dpaste.com/153869/
16:01neotykLauJensen: it's first time I see destructuring like that
16:01chouserordnungswidrig: http://paste.lisp.org/display/94267
16:01hiredmanhttp://delicious.com/clojurebot/pastbin
16:02neotykanyway, I'll keep reading
16:02hiredmanclojurebot recognizes dpaste.de but not .com :(
16:03neotykLauJensen: you got me confused by this data structure, now I see its set of elemeny and map
16:03LauJensenIts all key/val, the key is the url, the value is another hashmap
16:03neotyks/elemeny/element/
16:04neotykcongrats you got me square confused :)
16:04LauJensenso (let [[k v] data], puts the url in k and the properties in v., since v is a hash-map, you can pull the same trick on that (let [[k {:keys [a b c]}]] {:a {:a 2 :b 3 : c 3}
16:04LauJensenOk - Lemme see if I can add it to the post :)
16:06neotykbut this destructyring with {:keys would use more explaining for me :-p
16:06ordnungswidrigchouser: thanks!
16:06ordnungswidrigcemerick: thanks as well
16:06LauJensen,(let [{:keys [a b]} {:a 2 :b 3 :c }] b)
16:06clojurebot5
16:06LauJensencouldn't be simpler right? O_o
16:07LauJensen,(let [{:keys [a b]} {:a 2 :b 3 :c 9}] b)
16:07clojurebot3
16:07LauJensenSo {:keys ks} makes named variables of the values in the map
16:08DeusExPikachuis there a time/timer lib in clojure or you guys just use java.util.Date?
16:08LauJensenDeusExPikachu: In that blogpost I linked above I show off Joda Time
16:08DeusExPikachunot for timing functions
16:10neotykLauJensen: I still don't get it, will try after reading
16:11LauJensenWe'll go 1on1
16:11herdrickhi, i'm looking for the pointfree predicate negation function. i.e. instead of this: #(not (even? %)) i want to do something like this: (negator even?)
16:11herdrickdoes it exist?
16:11neotykok
16:12neotykso this works as I would expect
16:12hiredman,(comp not even?)
16:12clojurebot#<core$comp__4952$fn__4955 clojure.core$comp__4952$fn__4955@d650da>
16:12rhickey,(doc complement)
16:12neotyk,(let [{:keys [a b]} {:a 2 :b 3 :c 9}] b)
16:12clojurebot"([f]); Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value."
16:12clojurebot3
16:12hiredman(count "complement")
16:12hiredman,(count "complement")
16:12clojurebot10
16:12hiredman,(count "comp not")
16:12clojurebot8
16:12hiredman:D
16:12neotykbut second one not at all
16:13neotyk,(let [{:keys [a b]} {:a 2 :b 3 :c }] b)
16:13clojurebot5
16:13neotykwher dit it got this 5 from?
16:13hiredmanneotyk: it is eating an exception
16:13hiredmanyou are missing a value in your map
16:13LauJensenYea sorry, that caused confusion
16:13LauJensenForget you ever saw that
16:14herdrickhiredman: ok, thanks. that is pretty short ;)
16:14neotyksure, what about trauma it caused ?
16:14hiredman~ticket #87
16:14clojurebot{:url http://tinyurl.com/y92lmv8, :summary "GC Issue 83: PersistentArrayMap trust the reader (map literals) too much", :status :test, :priority :low, :created-on "2009-06-17T20:36:09+00:00"}
16:14neotykthanks LauJensen hiredman :)
16:15neotykhiredman: are you suggesting tp fix it ? ;-)
16:15LauJensennp
16:16hiredmanneotyk: there a patch on the ticket
16:17neotykhiredman: very nice of you
16:18hiredmanscopes!!
16:30cemerick,(instance? Byte/TYPE (make-array Byte/TYPE 0))
16:30clojurebotfalse
16:30cemerickthoughts on that? ^^
16:30cemerickoh jeez, nevermind
16:30cemerickfacepalms*
16:31hiredman,(instance? (Class/forName "[B") (make-array Byte/TYPE 0))
16:31clojurebottrue
16:31cemerickyeah. I know. I can't believe I got so far as to hit enter on that one. Screwy day.
16:32abrenkLauJensen: you could use clojure 1.1.0 (without -new-SNAPSHOT) in your project.clj
16:32hiredmanI just saying, [B? who decided to use that?
16:33cemerickin a bandwidth-constricted environment, seems reasonable
16:34cemerickstuff like that was determined back in 1993-ish
16:34abrenkIt's a pity that clojure-contrib 1.1.0-RC1 is not in the http://build.clojure.org/snapshots repository so that it can be used from leiningen.
16:41abrenkOkay, there's a http://build.clojure.org/releases repository which Phil added to leiningen two days ago.
16:45tomojwow, compojure's refactor branch only has one source file
16:45tomojawesome
16:51jfkwnoob question: starting java clojure.main with -cp or CLASSPATH set to /path/to/clojure.jar:/path/to/clojure-contrib.jar, can't (use 'clojure.contrib.foo).
16:53tomojwhat's foo?
16:53dakroneand what error are you getting?
16:53tomojcan't use anything? or just stuff like pprint
16:53jfkwclojure.contrib.logging, clojure.contrib.duck-streams
16:54tomojduck-streams should surely work, at least
16:54AWizzArdjfkw: (System/getProperty "java.class.path")
16:54jfkw"/home/jtk/src/clojure/clojure.jar:/home/jtk/src/clojure-contrib/clojure-contrib.jar"
16:55chouserwhat's the actual exception?
16:55AWizzArdand this file certainly exists?
16:55jfkwuser=> (use 'clojure.contrib.duck-streams) \n java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (NO_SOURCE_FILE:0)
16:55AWizzArdah
16:55chouser:-)
16:55AWizzArdthat one
16:55hiredman~clojure.lang.RestFn
16:55clojurebotant clean and rebuild contrib
16:55tomojhmm, contrib is no longer built with 'ant', is it?
16:55chouseror if you didn't build it yourself, make sure your clojure and contrib versions match
16:56abrenkLauJensen: when adding a link the home page reads "example.com Posted ago. 1 points" without a date.
16:56AWizzArdjfkw: you can simply download clojure and contrib from here: http://build.clojure.org/
16:56hiredmantomoj: sshh
16:56LauJensenabrenk: refresh, youre too fast
16:56jfkwI used the ELPA swank-clojure install, saw the git repositories in ~/src, pulled on branch master, ran ant on clojure, mvn package on clojure-contrib.
16:57abrenkLauJensen: after a refresh everything is fine, I know. But how come my browser's "too fast"?
16:57dakronetomoj: should be able to use maven to build it
16:57LauJensenI didn't implement a 0 second print
16:58abrenkI see!
17:01neotykabrenk: what browser you use, I also want too fast browser :)
17:02abrenkneotyk: see uzbl.org
17:02Raynesofftopic: I passed my road test! :D
17:02LauJensenCongratz!
17:03Raynes<3
17:03abrenkneotyk: but I guess any browser should handle a redirect on localhost in under a second...
17:03LauJensenIs it true you took it in a pick-up truck ?
17:03RaynesLauJensen: Untrue. Chevy Lumina. ;)
17:03LauJensenDont even know what this is - get a european model! :)
17:03Raynes:)
17:04neotykabrenk: still I'm always under impression that my browser is slow
17:04abrenkAlthough if the snow in germany continues a pick-up truck would come in handy...
17:06neotykabrenk: is uzbl in workable state?
17:09abrenkneotyk: I'd say "yes", enough to give it a try if you agree with its principles
17:11neotykcool
17:18fr0ogis uzbl like conkeror, but for the vi crowd?
17:21dakroneuzbl is a set of processes for web browsing that allow the user to hook them up however they want, customizing the experience
17:22fr0ogI guess I just have to try it sometime
17:24abrenkfr0og: yeah, you could say that, I guess. Its WebKit based, conkeror based on Mozilla IIRC.
17:29fr0ogI prefer how mozilla renders fonts. Webkit looks to fuzzy for my taste
17:30abrenktechnomancy: keybindings are customizable, so that shouldn't be a problem. the default is somewhat vi like.
17:31technomancyabrenk: I'll put it on my list of things to take a look at
17:31technomancythough I prefer JS to Python as an extension language
17:51IntertricityI'm moving to clojure from python, I know nothing about java but I read I should probably get familiar with the api. Is there any api reference written for clojure users, or a good reference in general?
17:52hiredmanjust get familiar with reading javadocs
17:53nDuffIntertricity, IMHO the Clojure sequence library is a much higher priority than the Java API; the latter is mostly pretty well-structured, and consists of things that are easy to find (and pretty obvious when you need them), whereas with the sequence library it's easy when starting out to not expect that the thing that's the right tool for your job exists.
17:53hiredman~jdoc String
17:54Intertricityso worry more about the sequence library?
17:54hiredmanis worry the right word?
17:55Intertricitywell, learn first
17:55hiredmanhttp://clojure.org/sequences
17:55Intertricitythanks for the links hiredman :)
17:55hiredmanthe main functions are reduce, filter, and map
17:56neotykwhich if you come from python should be no rocket science :)
17:58Intertricityhehe yeah
17:59Intertricityvaguely familiar, was just getting into them when I realized I wanted to start moving over
18:01IntertricityThanks a bunch for the help guys!
18:02abrenkIntertricity: and if you don't want to read but rather watch, see http://clojure.blip.tv or search on vimeo.
18:03Intertricity:o
18:03Intertricitywow, most of the things you can learn via video these days :P
18:03Intertricityagain, thanks :3
18:04herdrickhello - i have another question. if i have a recursive function that I want to memoize, is the normal way to do this just to do like this: (def foo (memoize (fn [x] ...
18:04herdrick?
18:05hiredmanherdrick: no
18:05hiredmanwell
18:05hiredmanactually
18:05hiredmansure
18:05herdrickah, thanks hiredman ... then what is?
18:06herdrickright, the "recursive" part is key :)
18:06hiredmandepends how you are recursing
18:06hiredmanrecur will not let you use memoize
18:06herdrickok
18:07hiredmanif you recur via something like (fn f [a] (f (dec a)))
18:07herdrickno, i'm just doing a good old, problematic in a non- tail optimizing JVM recursion
18:07herdrick:)
18:07hiredmanthat will also not use memoize
18:07herdrickactually, that does work
18:07hiredmanherdrick: then you should be fine
18:08hiredmanherdrick: it won't use the memoized version of the functio
18:08arohnerit depends
18:08hiredmanuh
18:09hiredmanit doesn't
18:09arohner(def foo [x] ...)
18:09arohner(def foo (memoize foo))
18:09hiredman(fn f [a] (f (dec a))) is calling itself via an internal name
18:09hiredmanarohner: excuse me, that is not the case I was adressing
18:10herdrickwell, this memoizes properly: http://paste.lisp.org/display/94271
18:10hiredmanyou can't rebind f in (fn f [a] (f (dec a))) to refer to the memoized version of the function
18:10herdrickdo you mean something different?
18:10hiredmanyes
18:10hiredmando you see a def in (fn f [a] (f (dec a))) ?
18:10herdrickoh
18:11herdricksure, i've got you
18:11herdricki wasn't aware of that way of using fn
18:11herdrickthanks
18:11hiredmanit's not that common because of recur
18:15herdrickit's not obvious to me *why* within a def form you can refer to the name being defined.
18:15herdrickwhere do i go to read up on that
18:15arohnerherdrick: http://clojure.org/special_forms
18:16herdrickarohner: thanks
18:17hiredmanI'm not 100% on that, but I think def must make a place holder before evaluating the form, and then swap the result in
18:18arohnerhrm, special forms just tells you can create a fn with a name. I don't see a place where it specifies you can refer to it by name inside the definition function
18:18arohnernm, the first example does it
18:19hiredman,(macroexpand-1 '(defn foo [] 1))
18:19clojurebotDENIED
18:19hiredmanbah
18:19hiredmananyway
18:19hiredmandefn is not giving a fn a name
18:19hiredmandefn expands to (def something (fn ...))
18:20hiredmanit is binding a name to a value, the value happens to be a fn
18:20dreish,(#'defn 'foo [] 1)
18:20clojurebot(def foo (clojure.core/fn ([] 1)))
18:22hiredmanthe var acts as a layer of indirection between the names and values
18:22herdrickhiredman: right, that's what i'd expect
18:23herdrick"it is binding a name to a value, the value happens to be a fn" i mean
18:23herdrickthanks hiredman:
18:56herdrickquestion about plans for clojure:
18:56herdrickare there plans to make error messages better?
18:56herdrickfor example, i just got this:
18:56herdrickjava.lang.IllegalArgumentException: Wrong number of args passed to: user$score-pair
18:56herdrick [Thrown class java.lang.RuntimeException]
18:57herdrickwith of course no mention as to what args were passed
18:57technomancyherdrick: I think it will wait until the Clojure-in-Clojure compiler.
18:57herdricki find this slows me down a lot
18:57herdricktechnomancy: ok
18:58technomancyherdrick: the clj-stacktrace library looks great for just making things more readable though
18:58technomancyit's on my to-investigate list
18:58herdricktechnomancy: making the stack trace more readable? so it doesn't add any more info, right?
18:59technomancyherdrick: right
18:59herdricki can deal with messy messages
18:59herdrickit's the lack of info that kills
19:13chouserherdrick: by looking at the stack trace as is, you should be able to see the line where score-pair was called
19:15herdrickchouser: thanks. well, i get something like this in stack trace: user$score__6568.invoke(NO_SOURCE_FILE:5)
19:15herdricki'm running this in a SLIME repl
19:16chouserkeep backing up
19:16chouser"before" that on the stack should be the actual fn and line that calls score-pair
19:17herdrickchouser: that line *is* where i call score-pair
19:17herdrickthe number that comes after NO_SOURCE_FILE: is curious
19:18technomancyherdrick: if you use C-c C-k to compile your files you'll get better line numbers in your stack traces
19:18chouseroh, I see
19:18technomancyNO_SOURCE_FILE:5 means the fifth line of an anonymous region that was eval'd without filename data
19:18herdricktechnomancy: really? trying that...
19:19herdricktechnomancy: oh, that's great. thanks a ton.
19:20ambientto build vimclojure i have to install Gradle?
19:20herdricktechnomancy: regarding the NO_SOURCE_FILE thing: it always seems like its incremented one line too many - still useful tho, thanks
19:21herdrickchouser: thanks for the help, too
19:39herdrickhi, i have another question for the helpful people of #clojure :)
19:39herdrickany ideas about how to print out a tree of sequences in a sort of tree-like way?
19:40herdricki have nested seqs and i'd like to view them in a tree-like format
19:59herdricksay, is there a way to enter a private irc channel where clojurebot is present?
19:59Chousukeherdrick: there's a pretty-printer in contrib
19:59Chousukeyou might be able to use that.
19:59herdrick ok, i saw that
20:00Chousukedoesn't clojurebot work in query?
20:00herdrickquery? i don't know much about IRC
20:01Chousukeprivate chat. /query clojurebot
20:01ChousukeI'm not sure if it'll respond though
20:01herdrickas for pprint in contrib, unfortunately i'm a little leery of getting the newest code from github as i'm a little afraid of it breaking my current setup... for example incanter now ships with a a version of clojure jar-ed up, apparently
20:01herdrickok, thanks Chousuke
20:02Chousukeherdrick: there are actually releases of contrib now
20:02herdrickyep, it works, thanks Chousuke
20:02Chousukefor 1.0.0 and 1.1.0
20:02herdrickok, Chousuke, i'll look at that
20:02herdrickthanks
21:07a_strange_guyhi, i noticed that the clauses in the 'case special form aren't tailcontexts
21:08a_strange_guythat should be a bug, shouldn't it?
21:11a_strange_guy,(loop [c 0] (case 0 (recur 1) :foo))
21:11clojurebotjava.lang.Exception: Unable to resolve symbol: case in this context
21:12a_strange_guy'(clojure-version)
21:12a_strange_guy,(clojure-version)
21:12clojurebot"1.1.0-master-SNAPSHOT"
21:13hiredmanuh
21:13hiredmanpretty sure you are missing part of that case
21:14a_strange_guystupid mistake, but clojurebot isn't 1.2.0-master anyway
21:17hiredmanI wonder if the non tail position might be a limitation of the special dispatch case uses
21:18a_strange_guyit should be possible on the JVM
21:18hiredmanwell, recur uses the goto bytecode, and case uses some special dispatch table stuff
21:18hiredmanthey might not play nice
21:20dnolenhttp://paste.lisp.org/+20QX
21:22dnolenhttp://paste.lisp.org/display/94281#1, in the macroexpansion recur isn't in the tail position.
21:23a_strange_guywe dont know actually
21:23dnolenmight be intentional in case's design tho. case meant for fast code, not expressive code.
21:24dnolenfast code == when clojure's core data types get rewritten in Clojure.
21:28chouserwill they be faster?
21:29dnolenchouser: think so ? :)
21:39jweissdoes clojars have some kind of picky thing about ssh keys? i pasted my dsa public key and it rejected it
21:39dakronehmm...can someone help me with the clojure equivalent of Object[] params = new Object[]{"xxx@yyy.com", "password"}; ?
21:40dakronenot really sure since it doesn't seem like a regular constructor
21:40hiredmanit isn't
21:40hiredmanthat is an array
21:40jweissdakrone: what's wrong with ["xxx@yyy.com" "password"] ?
21:40hiredman(to-array ["xxx@yyy.com" "password"])
21:40jweissor that if you really want an array :)
21:41ambient,(doc into-array)
21:41clojurebot"([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."
21:41dakroneoh hah, I thought it was doing something more complex underneath
21:41hiredmanambient: it's an array of Objects
21:41hiredmanso to-array is fine
21:41ambientok
21:41hiredman,(to-array ["xxx@yyy.com" "password"])
21:41clojurebot#<Object[] [Ljava.lang.Object;@1f3f16b>
21:42hiredmanweird print
21:42dakronehiredman: that solved it, thank you
22:02dakronewhat's the syntax for casting a java type to a different java type in clojure?
22:03hiredmandon't
22:04chouserno need
22:04hiredmanclojure is a dynamic language, you don't need to cast anything to anything
22:04dakronehmm...I'm getting a java.lang.IllegalArgumentException: No matching method found: execute for class org.apache.xmlrpc.client.XmlRpcClient
22:05dakronewhich I was guessing was due to using a HashMap instead of a regular Map
22:05tomojtype hint?
22:06hiredmandakrone: a HashMap is a Map
22:06hiredman~jdoc org.apache.xmlrpc.client.XmlRpcClient
22:07tomojI guess you only need type hints when there are overlapping instances?
22:07dakronehere's the code I'm trying to use: http://paste.lisp.org/display/94284
22:08hiredmandakrone: none of the execute methods on that take a map
22:08dakronehmm..maybe I'm reading some out-of-date tutorials on it
22:08hiredmandocjar could be out of date too, or something
22:09hiredmanparams should be an array or a list
22:11dakronewith a regular array I'm getting this error: http://paste.lisp.org/display/94284#1
22:11dakronewhich I interpreted as needing to use key/values instead of just a regular list from what I found online
22:12hiredmanthat is an error string from perl
22:12hiredman(bugzilla)
22:13hiredmanyou can tell because it takes about User.pm
22:13hiredmantalks
22:13dakroneyea, so browsing around on perl sites made it look like it should have been a hash instead of a list
22:13hiredmana perl hash has nothing to do with a java or a clojure hash
22:14dakroneperl is not my strong suit
22:14hiredmanI think you need to pass an array with a hash in it
22:15hiredmanthe array is the arguments for the rpc call
22:15hiredmanyou want to send one argument, a map
22:15hiredmanso an array with a map in it
22:15dakroneokay, so an array containing a HashMap then
22:15hiredmanI would just try a clojure map first
22:16hiredmanno sense using a hashmap if you don't have to
22:16dakroneokay, I'll give it a shot :) thanks
22:18dakronehiredman: progress, that got past it, thank you
22:55konris there a succint way to create a combination of n lists, like (comb [1 2] [a b]) -> [1 a] [1 b] [2 a] [2 b]}
22:55konr*{[1 2] ...
23:02konrhttp://richhickey.github.com/clojure-contrib/combinatorics-api.html
23:02konryay!
23:03liebke,(for [i [1 2] j [:a :b]] [i j])
23:03clojurebot([1 :a] [1 :b] [2 :a] [2 :b])
23:04KruppeI use java a lot at work, can I write libraries in clojure that my colleagues can import and use as if they were regular java classes?
23:10hiredmanthey will need to have the clojure runtime available
23:11hiredmanbut otherwise, yes
23:13Kruppehiredman: interesting, I might have to look into that