#clojure logs

2009-06-01

04:21cadshey, would a multilanguage VM running java do tailcall optimization?
04:30cgrandcads: http://wikis.sun.com/display/mlvm/TailCalls the experimental branch of the JVM does TCO
04:35cadscgrand I could smooch you but I won't
04:36cadsthis is great!
08:04hsuhhi... whats the current recipe for installing slime+swank? svn versions aren't working for me... anyone?
08:07jdzhsuh: you need swank-clojure
08:07jdzhsuh: from the git i think
08:07hsuhyes, all that
08:08hsuhso what i currently get is: the REPL starts and is functional, but i get some errors (java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70), java.lang.Exception: No such var: swank.swank/ignore-protocol-version (NO_SOURCE_FILE:3), java.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:5)) and slime keeps polling or something
08:21hsuhhm... here we are.. replacing lazy-seq (not found) with seq makes things work.. anyone knows if that was removed from clojure or i need to require a library before calling it ?
08:25Chouserhsuh: yeah, lazy-seq has been gone awhile.
08:25cemerickit sounds like you have an old version of clojure. lazy-seq is definitely in clojure, since before v1.0 was marked.
08:26Chouseroh
08:26cemerickwha? :-/
08:26Chouseruh
08:26Chousersorry. I blame monday.
08:26Chousercemerick is, of course, correct.
08:26cemerickwhew, I thought I was going bananas!
08:26cemerickChouser: you were probably thinking of lazy-cons
08:27Chousercemerick: yes, of course. Thanks for making my mistake sound reasonable. :-)
08:27cemerickChouser: heh. How goes the new gig, anyways? I hope all's well in general.
08:27Chouseryep, thinks are well, can't complain, etc. :-)
08:28Chouserchecked in some clojure code last week, so we'll see how that goes.
08:29cemerickis clojure still in skunk-works mode there?
08:30Chousera little higher profile than that, but only in "prototype" code for now -- slated to be replaced by something that performs better later. ...again, we'll see. :-)
08:32cemerickGood luck. We actually just made some huge strides in performance. We now have a use-case for pmap, which *really* helps -- our older data structures weren't parallelizable, but starting early last week, we switched to a new set of impls that are...and wow, the difference is fun :-)
08:37Chouserah, great.
08:38Chouserdid you see Rich's comment about pmap and chunked seqs?
08:39cemerickuh, no. My list inbox is oh-so-neglected.
08:39Chousernah, it was a passing irc comment.
08:39cemerickah. log link?
08:40Chouserhttp://clojure-log.n01se.net/date/2009-05-29.html#07:40
08:41cemerickoh, so chunking (not that I'm clear about what chunks are at all, of course) makes seqs almost naturally parallelizable, in that the work partitioning is almost done for you....?
08:42Chousukehmm
08:42cemerickOur two usages of pmap happen to be in cases where we always have to invoke a particular fn over a dataset with a couple of different parameters, making for an obviously-parallelizable process.
08:43Chousernot quite. more like the overhead of doing 'next' (calling down the stack, allocating a new seq, etc.) is enough that in a lot of cases pmap doesn't make sense right now.
08:43cemerickOh, I see. Reaching for the stars, I am :-)
08:44Chouserbut with a chunked seq (such as a seq over a vector, for example) that overhead is required much less often, so pmap may make sense of less heavy funcs.
08:44Chouser:-)
08:45hsuhcemerick: i just compiled from svn...
08:45cemerickI was thinking of how seq producer might know how to partition a dataset better than its consumer, so the chunks could be sized appropriately for pmap-ing.
08:45Chouserseq producers do the chunking, yes.
08:45cemerickhsuh: hrm. I don't work off of trunk, but I'd be very surprised if rich pulled something like lazy-seq...
08:46hsuhmaybe i need to require something (lazy) ?
08:46Chouserhsuh: can you check at a repl if you've got lazy-cons?
08:46hsuhser=> lazy-seq -> java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (NO_SOURCE_
08:46Chouserif you do, something's definitely amiss.
08:46cemerickhsuh: no, it's in the std lib, as it were. I'd grab the latest release jar, start with that to get a baseline, and then move on to build from sources if you're so inclined.
08:46hsuhuser=> lazy-cons java.lang.Exception: Can't take value of a macro: #'clojure.core/lazy-cons (NO_SOURCE_FILE:0)
08:46hsuh
08:46cemerickyeah, that's very old
08:46hsuhcemerick: k thanks
08:47hsuhi've done something wrong :)
08:47cemerickhsuh: what svn URL are you using?
08:47Chousukehsuh: did you get it from sourceforge? :P
08:47cemerickman, it's a groupthink in here :-)
08:47hsuhhmm err :)
08:47hsuhyes...
08:47Chousukeheh
08:47hsuhops
08:47cemerickhsuh: http://code.google.com/p/clojure/
08:47Chousukeclojure is on google code nowadays
08:48hsuhand i thought i was on the edge
08:48hsuhhehe
08:48cemerickwow, I didn't think the SF svn was still up and running. Seems like it should be switched off.
08:48hsuhi'll ping jochu to update github page for swank-clojure
08:48hsuhbecause github feels updated... so i blindly followed it..
08:49hsuhwell, thanks a lot
08:50cemerickhsuh: hth :-)
10:58cemerickhrm, I'm getting odd pauses at the end of compilation cycles -- I suspect dangling agent threads. Anyone hit this before?
11:02cemerickah, removing the pmap calls I just added makes the compilation process finish immediately as before....
11:25hiredmanhttp://groups.google.com/group/clojure/browse_thread/thread/b6f192eca22f6820 <-- the kind of maddess that insues if you combine quote and syntax-quote
11:27Chousercemerick: didn't see your posts, sorry. If you use futures or agents (which pmap does), you'll have to shut down the agent pools to exit cleanly.
11:27drewr..and even then maybe not :-)
11:28cemerickChouser: I'm about to post to the group with a patch. To be clear though, none of the pmap calls were *invoked* -- but their usage in the code probably caused the loading of c.l.Agent, which sets the threadpools off on their way.
11:28Chouserwell, I've been doing a lot of that, and haven't had issues. I saw there was a thread, but didn't read into it deeply enough to spot the difference.
11:28Chouserhm.
11:29cemerickChouser: the patch I'm proposing adds an Agent.shutdown() call to finally blocks in the entry points of clojure.main and clojure.lang.Compile. Does that seem reasonable?
11:29ChouserI don't think your diagnosis is correct.
11:30Chouserclj -e "(fn [] (agent nil))" ;exits promptly
11:30Chouserclj -e "(agent nil)" ; exits promptly
11:30Chouserclj -e "(send-off (agent nil) identity)" ; hangs
11:30cemerickah, that code *is* run, so yes, the agents are being used. My bad.
11:31Chousercemerick: and so you know, agent shutdown calls and/or System/exit calls have been added and removed from the various entry points a few times. People always complain either way.
11:31cemerick(creating a default EMPTY value)
11:31cemerickhrm.
11:32Chouserthe problem the other direction being if you have an agent or something that shuts down the pool when it's the last one out, and your main program just falls off the end, an automatic pool shutdown would break things.
11:32cemerickwell then, certainly no one could complain about a shudown call in clojure.lang.Compile, which would fix my immediate problem.
11:32Chouserhm.
11:35cemerickIn general, it doesn't seem like everyone should keep tripping over this problem in different directions. It's a frustratingly difficult thing to debug if you're not attuned to it already. :-[
11:39Chouserin my experience, for any particular app it's pretty hard to know when all other threads are done and it's safe to exit.
11:39drewrcemerick++ It's extremely difficult to debug. I think I have mine figured out and then I see different behavior.
11:39Chouserit's hard for me to imagine how it could be solved automatically.
11:39rhickeyhmm... #clojure on the plane - awesome
11:41Chouserrhickey: nice.
11:41Chouserheading to CA?
11:41drewrChouser: Yep, I finally had to remove agent activity from my script. Couldn't determine even for my own program what the right behavior was.
11:41replacarhickey: cool. best wishes for the script bowl tomorrow!
11:41rhickeyyup
11:41cemerickChouser: why not declare that agents are shutdown when the main thread exits, period, and if you don't want that to happen, join as necessary?
11:41rhickeyreplaca: thanks!
11:41cemerickrhickey: Indeed, good luck :-)
11:41rhickeythe 4 minute limit is quite short
11:41cemerickI just don't see why everyone that works with agents should have to trip over this particular issue.
11:41replacarhickey: do you want me to make a hand-out/poster for you for the clojure meetup, or do you want to just let that be?
11:41cemerickor actually, not even agents, just a simple pmap usage ropes you into the same area...
11:42cemerick(as in my case)
11:42rhickeyreplaca: I don't know that I could hand them out, but you could
11:43replacarhickey: I won't be there - I guess I could come and see if there are some public places to post
11:43rhickeyreplaca: ah, right
11:43replacaI think they'll only check at the entrance to the sessions, so that would probably work
11:43rhickeyI imagine those who would come are on the ggroup or here
11:44replacarhickey: I'll do that.
11:44replacarhickey: Yeah, I think you're right + anyone you sufficiently inspire
11:44replacaThe twittersphere has had a bit of buzz about Stuart's book!
11:46Chousercemerick: I guess that may be reasonable. For the cases where my code is carefully collecting the threads before agent-shutdown, it would be no harder to do that work and then rely on automatic agent-shutdown. *shrug*
11:46triddellrhickey: I'm sure you have other things on your mind but I wondered if Issue #100 on the tracker had any plans to get attention. It's a bug that basically stops compiled classes from working on IBM JVMs.
11:47djpowellIs there any way to dispatch on array types in multi-methods - or to use hierarchies to derive from array types
11:47cemerickChouser: yeah, I'm not at all clear on what the solution is, but I can't imagine how frustrating it would be as a complete noob to hit this issue. That's why I'm agitating :-)
11:47rhickeytriddell: I'd welcome a patch
11:48rhickeycemerick: do you have a proposal?
11:49triddellrhickey: A patch was attached to the post that describes the original issue (it wasn't my post/patch so I didn't attach it to the issue)
11:49clojurebotrhickey is a T-1000 sent from the future
11:49cemerickrhickey: well, an immediate fix to keep compilation runs from hanging for 60s (add Agent.shutdown() in the finally block of main). I don't think anyone could complain about that.
11:49triddellrhickey: http://groups.google.com/group/clojure/browse_thread/thread/e64719d716c29ce0
11:50triddellrhickey: the patch works for me but I didn't know if it might have any other ramifications
11:50cemerickrhickey: On the solution in general, I'm generally aiming for something that will result in sane behaviour for noobs, and something that experienced users can easily work with (my current idea being, shutdown on exit from clojure.main in every case, and if you're clever enough to know that that's not what you want, make your main thread join until you're ready to be done).
11:51cemerickChouser says that's gone back and forth a couple of times, but the current state of play doesn't seem reasonable for the common case, or for new users.
11:51cemerick(i.e. difficult-to-explain "hanging")
11:52rhickeytriddell: someone with a CA needs to attach it to the issue
11:53djpowellIs there any way of writing an array class literal? Something like Ljava.lang.Object;?
11:54rhickeycemerick: I think there needs to be a recipe for both scenarios, by join you mean what?
11:55rhickeydjpowell: you need the class object or just a type hint?
11:56djpowellwell, I wanted to do multi-method dispatch, with 'class' as my dispatch function, and have it handle array types
11:56djpowellor - alternatively, to use derive to handle array types the same as lists - with a seq wrapper or something
11:57cemerickrhickey: sorry, that was a poor term choice. I just mean that if you want to delay your program's exit until your agents are done doing their thing, you should be responsible for holding the main thread until you're ready to exit. Lots of ways to do that.
11:57triddellrhickey: ok, I'll send a CA off and ping you about the issue after you've received it
11:58cemerickdjpowell: we're just using (defmethod foo (class (make-array Character/TYPE 0)), etc
11:59rhickey,(Class/forName "[Ljava.lang.Object;")
11:59clojurebot[Ljava.lang.Object;
12:00djpowellah - I had some strange idea that the dispatch values had to be literals for some reason
12:01rhickeycemerick: we need to automate that, lest we make a change and the other side complains again, round and orund
12:01djpowellthat will work ok - or I could just change the dispatch function
12:01replacarhickey: on second thought, I may not sell the meetup too hard - we've already got about 35 people signed up and the space will be crammed with 50. Feel free to mention it in your talk or to interested folks and just give them my email/number for info.
12:01rhickeydjpowell: dispatch value do not need to be literals
12:01rhickeyreplaca: fair enough - I'm looking forward to it
12:02replacarhickey: us too!
12:02djpowellrhickey: yeah cool. although on the subject of arrays, I did have some trouble type hinting that something was a char-array
12:02cemerickrhickey: I can see people wanting to do it in a lot of different ways. I hesitate to think I'd have enough perspective to propose a general-enough solution.
12:03cemerickrhickey: A sneaky option would be to trim back the keepalive of the threads in Agent's Executors' threadpools. It's 60s now, and could be a lot lower.
12:05rhickeyhit 2000 members on group today!
12:08cemerickreally? It says 1983 right now...
12:08rhickeycemerick: I don't know how often they update that, the admin screens say 2000
12:08cemerickah
12:09rhickeycemerick: what about letting people set *auto-shutdown-agents*, default true? puts it in their hands without establishing a policy
12:12stuhoodrhickey: would it be possible to model them like threads, where each agent could be a 'daemon'?
12:12cemerickrhickey: yeah, that's fine by me. :-) I think c.l.Compile should just have it hardcoded, though -- there's no user code in involved in that path that could customize the behaviour, anyway.
12:20rhickeybiab
12:30replacadysinger: are you in the channel?
12:35dysingeryes
12:38replacadysinger: are you coming to SF for the clojure meetup? I saw you said something like that on Twitter.
12:38replacadysinger: If so, I want to make sure you're on the rsvp list
12:38dysingery
12:38dysingerI wasn't able to get logged in and rsvp yet
12:39dysingeryes thank you - put myself and phil hagelberg on there
12:39dysingerTim Dysinger
12:39replacadysinger: Don't worry, consider it done. I already had Phil on my list.
12:40replacaAnyone else coming can just ping me here or email me and I'll put you on the list
12:40dysingerthanks replaca
12:43replacadysinger: np
12:46Rouxanyone here got the 'programming clojure' book?
12:46dnolen_yes
12:47triddelltriddell: yes
12:47Rouxdoes it do a good job of explaining functional programming to people not familiar with that paradigm?
12:47triddellRoux: oops, yes
12:47danlarkin_replaca: wish I was on the west coast :) consider me there in spirit!
12:47Rouxtriddell: does it do a good job of explaining functional programming to people not familiar with that paradigm?
12:48triddellRoux: I think it does a very good job... I was new to it before clojure and it was the book I used to "get" it
12:48Rouxgreat
12:48Roux:)
12:49Rouxbut with only 200 pages i would think it only has time to explain clojure library itself and no time to help ppl grok functional programming
12:50triddellin fact, I'm writing a review on Amazon right now and I'd encourage other readers to do the same and help to promote the book
12:51replacadanlarkin_: we all wish you were here too. I envision a future where we'll be able to have our own national events like the Ruby guys do.
12:52Rouxreplaca: you a python or a ruby guy?
12:53replacaRoux: both, to a certain extent
12:53Rouxwhich softens your heart most of all
12:54Roux?
12:54triddellwell, it's two hundred pages of functional programming! because clojure is a Lisp it can cover what would take another language 200 pages in chapter or two... the rest is practical examples and api specifics (the majority of which highlight its functional nature)
12:54dnolen_Roux: also compared to Python and Ruby, Clojure is fairly miniscule. Daunting at first but then you realize how small Clojure actually is.
12:54triddellRoux: arg, well, it's two hundred pages of functional programming! because clojure is a Lisp it can cover what would take another language 200 pages in chapter or two... the rest is practical examples and api specifics (the majority of which highlight its functional nature
12:54Rouxtriddell: yeah bro! i bought the scala book, and it's about 700 pages!!!
12:55replacaRoux: well, Clojure's my favorite right now cause I feel like I can really rock'n'roll in it
12:55dnolen_compared to Scala, Clojure is nanoscopic.
12:55RouxScala strikes me as very complex
12:55Rouxscarily so
12:55Rouxbut quite clever and nifty too :)
12:56replacaRoux: python and ruby are a little different, but overall I prefer Ruby. I end up using python more because at work we're based on the CLR and IronPython gives me a nice interface to that
12:56triddellRoux: bought that too, was interested and then found clojure, never read the Scala book after it arrived
12:56replacaRoux: I've just begun learning scala
12:57replacaI'm interested in some of the more advanced communication stuff that's being implemented in scala (esp. by the twitter folks) and would like to bring some of that tech into the Clojure fold
12:57replacasince I'm mostly a distributed systems guy
12:58Rouxcool
12:58Rouxthere is alot to like in scala
12:58Rouxesp. if you come from a c++/java background
12:59replacaRoux: yeah, I'm not of the "one language to rule them all" school. Clojure feels best to me, but I don't want to be chauvinistic about it.
12:59Rouxscala feels quite rubyish too
12:59Rouxi mean you iterate through a list like this in scala: myList.foreach(x => println(x))
13:00dnolen_scala doesn't work via messaging tho, so that seems like an odd comparison.
13:00Rouxit's a pity they didn't credit ruby as an influence on the wikipedia page, cos as a rubyist myself i see alot of ruby in scala and i dont think it's a coincidence
13:01triddellRoux: the other day I wrote a simple Rest/Json service for use on Google App Engine in under a hundred lines using Clojure... it was the most fun I'd had programming in quite a while... I'm not a language snob either but fun is fun!
13:01Rouxyeah i cant wait to get my head around a lisp, the most i've done so far is just muck around with e-lisp a teeny tiny bit and it was alot of fun thinking and programming recursively
13:03dnolen_well it seems to me that Ruby -> Clojure is natural, since Ruby was Matz's attempt to merge his two favorite languages, Lisp Smalltalk with the UNIX shell convenience of perl.
13:04Rouxyeah that also probably explains the similarity of ruby to scala too, in so far as ruby is an amalgum of the oop/functional paradigmns in a similar way that scala purports to be (though it's true that scala values immutability higher than ruby)
13:06dnolen_well there's definitely a connection Gilad Bracha (of StrongTalk fame, and developer of NewSpeak) said he's had many conversations with Odersky about Scala.
13:08Rouxodersky probably just doesn't give ruby as an influence so he doesn't scare off the python dudes, who love to spit on the ground of anything connected to ruby
13:11hiredmanclojurebot: have you heard the word about scala?
13:11clojurebot"you can usually accomplish a lot by laboriously enumerating type arguments everywhere." -- seen in #scala
13:11Rouxclojurebot: have you heard the word about ruby?
13:11clojurebotExcuse me?
13:12Roux:D
13:13Chousukeclojurebot: ruby is <reply>Chunky bacon!
13:13clojurebotRoger.
13:14Rouxnice one :)
13:15ChousukeI hope someone will trigger clojurebot's random auto reply with "ruby" and be thoroughly confused as a result
13:16hiredmanclojurebot: outback steak house?
13:16clojurebotI don't understand.
13:16hiredmanbah
13:16hiredmanclojurebot: steak?
13:16clojurebotI want to go to there
13:16Rouxhehe although i dont know a single rubyist who hasn't read _why's guide ;)
13:25Rouxtriddell: finished writing your review yet?
13:25Rouxim curious to see it
13:53cemerickreplaca: coming in late, but I've begun to ponder what a couchdb clone would look like implemented with clojure. That'd be a big (but interesting) task.
13:55danlarkin_cemerick: beware NIHS
13:56hiredmana clojureql type deal for couchdb might be nice
13:56cemerickdanlarkin_: oh, I quiver in terror in the face of NIHS :-)
13:56ataggart~google NIHS
13:56cemerickcouch-in-clojure is fancy more than anything else
13:56clojurebotFirst, out of 166000 results is:
13:56clojurebotNIHS
13:56clojurebothttp://www.nihs.go.jp/
13:57cemerickOur Pacific friends will be happy to know the terror they instill in clojure programmers. :-)
13:57hiredman:P
13:57hiredmanhmmm
13:57ataggartlol
13:59dysingercemerick - why re-write couchdb in clojure ?
13:59dysingerit's awesome as is
14:00cemerickdysinger: I have no good reason right now, which (among other reasons) is why I'm not.
14:00dysingerI think it would be more interesting to write a couchdb view server for clojure
14:00dysingerso you can write your map/reduce in clojure :)
14:00cemerickdysinger: that's something we'll probably be tackling in the next month or two, unless someone else gets there first :-)
14:00stuartsierraI already do that with Hadoop.
14:00dysingeryucky
14:01cemerickwe couldn't handle the admin complexity of hadoop, unfortunately.
14:01dysingerwe are looking at that too - thanks for your example code.
14:01stuartsierrawelcome
14:01dysingerI just don't like how rube goldberg hadoop is at the moment.
14:02dysingerI am leaning towards straight clojure and amqp
14:02stuartsierraIt's not so bad once you get into it - most of the complexity is for edge-case optimizations.
14:02dysingerprobably
14:02hiredman:|
14:03dysingerother thing I want to look at is terracotta and clojure for map/reduce in native lang.
14:03replacacemerick: well, even if we don't need to recreate the wheel, it is interesting to think about how you'd tackle a problem like couchdb in Clojure and whether a Clojure implementation would be a good thing
14:03dysingerusing agents ore something
14:03stuartsierraDoes terracotta provide data locality?
14:03dysingerno
14:03dysingerall our data is on s3 anyway
14:03dysingerso import to hdfs or disk - doesn't seem to make much diff
14:04stuartsierraMost of Hadoop's performance comes from data locality.
14:04dysingery
14:04dysingertrue
14:04dysingerin order to keep hadoop happy hadoop must also be your storage engine
14:05dysingertis the nature of the map/reduce paper....
14:05stuartsierraWell, not necessarily. You do have to copy things in and out of HDFS, but you don't have to store it there permanently. I store everything on S3.
14:05dysingerer "as in the paper"
14:05replacamore generally, it *seems* right that a good set of clojure primitives would allow clojure to enter the problem space currently dominated by erlang in a nicer package
14:05dysingerdoesn't swap in and out of s3 take a long time with large data sets ?
14:05dysingerthat's been my experience
14:06stuartsierraNot really, b/c you can parallelize the copy.
14:06dysingeracross the nodes
14:06hiredmanreplaca: the main problem is all the cool message buses use erlang
14:06replacahiredman: and maybe we need a cooler message bus of our own :-)
14:06dysingerstill yeah - copying 4TB to each node is going to take a long time.
14:07hiredmanreplaca: maybe just use terracotta?
14:07stuartsierraWell, yes. I get around 1GB/min from S3 on an 18-node cluster.
14:07dysingerteracotta would be much more fun if it was dynamic language - capable
14:07replacahiredman: could be. I don't understand terracotta well enough to know if it's the answer
14:08dysingeryou have to AOT compile, instrument things and then describe each generated closure class in their XML files
14:08dysingerand last I checked it required a hack to clojure
14:08hiredmandysinger: oh, I did not realize
14:08dysingerbut still it seems to work
14:09hiredmanthe repl works
14:09hiredmanI am not sure how that would work if "dynamic" stuff doesn't
14:09dysingerpaul stadig did these tests http://paul.stadig.name/2009/02/clojure-terracotta-yeah-baby.html a while back and he has a project on github
14:09hiredmanyeah
14:09hiredmanI've seen them
14:09dysingerthat's all I've been playing with.
14:09dysingerwould be cool to have it working
14:10dysingerthat would eliminate the need for hadoop and rabbitmq for me.
14:10dysingerIn theory
14:10dysingerand move the problem into straight clojure code
14:10clojurebot"There is no problem in computer programming which cannot be solved by an added level of indirection." -- Dr Maurice Wilkes
14:10dysingerheh
14:10hiredman~botsnack
14:10clojurebotthanks; that was delicious. (nom nom nom)
14:12cemerickdysinger: what would you use for primary storage, though?
14:13hiredmanopenmq is java
14:14cemerickopenmq is jms, jms is painful :-(
14:15dysingerwe use s3 and xfer to local disk
14:15cemerickmaybe rhickey's forthcoming queue abstraction will help there
14:15hiredmancemerick: :|
14:15dysingernothing beats erlang for messaging
14:16dysingerI don't have any stats but if I had money to bet - I'd bet rabbitmq could take a better beating than any jms server
14:16hiredmandysinger: but having everything on the jvm would be nice
14:16dysingerI used to think that but it's not such a comfortable thing for me anymore.
14:16dysingeranyway - it's not a requirement for me anyomer.
14:16dysingeranymore
14:17dysingerOur plan is to use rabbitmq & json to make the messaging language neutral
14:18hiredmanhttp://clojure-log.n01se.net/date/2008-09-08.html#14:26
14:18dysingerwe are connecting to rabbitmq with ruby, python, java and soon erlang
14:20dysingerand if we can tie in the messaging primitives in clojure to it -> that would be nice.
14:20dysinger(the currently being thought about but not yet existing primitives)
14:20hiredmanI just going to say...
14:23dysingerhey technomancy - ready for some SF meetup ?
14:25danlarkin_cemerick & tashafa: my response on twitter didn't come off as light hearted as it did in my head before I typed it :)
14:25cemerickdanlarkin_: heh, you worry too much :-)
14:25technomancydysinger: woo!
14:26cemericktashafa: hey, another Bostonite :-)
14:26cemerick(not that I'm in Boston, but it's close, anyway)
14:40dysingertechnomancy took a bunch of twiddling but I got emacs 23 working with mac environment.plist
14:40dysingernow am happy eshell user
14:41technomancyugh; I'm sorry you had to do that
14:41dysingerIt's fine
14:41dysingerwe should add it to the starter kit
14:41technomancymanually editing plist XML files is not a task fit for a human
14:41Chousukethere's the plist editor :p
14:42dysingerI have a rake task to push to the plist file
14:42technomancyyeah, if you can automate it, I'm sure it would save poor future users a lot of pain.
14:42dysingeranytime my env vars change
14:42dysingerI have never even used the environment.plist file before -> and I have been OS X since 2002
14:42technomancywould prefer a standalone solution, but that's definitely better than the current situation.
14:43dysingerI always just used ~/.profile
14:43dysingerbut emacs carbon ignores that
14:43dysingerretarded
14:43dysinger!
14:44technomancydysinger: it's because it's launched from the finder/dock
14:44dysingery
14:44technomancyI submitted a bug report about that a few years ago
14:44technomancynot exactly holding my breath
14:44dysingereshell should just read .profile like other terminal apps.
14:44triddellRoux: my review is up on Amazon... it's mostly a "feel good" piece than a technical review though
14:44dysingers/read/source
14:45technomancyit should be easier to source .profile than it is now (as a workaround for the broken OS X behaviour), but the correct behaviour is to inherit
14:46ataggartah nice! the meetup is 2 blocks from my office
14:47dysingerI just eneded up including osx-plist.el and adding a (if.... (eq system-type 'darwin)
14:47dysingerblock
14:47dysingerit works
14:48technomancydysinger: great; would love a patch
15:25cemerickhrm, what's the incantation to get a type hint to emit properly from a macro? I've tried `(.foo #^Bar someBar), `(.foo #^{:type Bar} someBar) so far...
15:26Chousertry `(.foo ~(with-meta `someBar {:type Bar}) ...)
15:26hiredmaninteresting
15:26cemerickActually, #^Bar works according to (meta (second (macroexpand ...))), but I still get reflection warnings.
15:27cemerickI meant :tag above, sorry
15:27rhickey#^Bar should be fine unless Bar is a variable or something
15:27Chouserright, me too. :-)
15:28rhickeydoes a non-macro version of the #^ work?
15:31cemerickrhickey: I was actually just trying to type-hint defmacro so as to limit the noise when printing reflection warnings :-)
15:32rhickey?
15:32cemericksorry, defmethod
15:33Rouxrhickey: you look a bit like wittgenstein
15:34rhickeycemerick: ah
15:37rhickeypresuming multifn is a symbol is likely but not required...
15:38leonHello
15:38rhickeyyou'll need to add metadata to the form, as Chouser showed, since you are unquoting it, but given it could be an arbitrary expression yielding a
15:39rhickeyMultiFn, you might want to wrap it in a call to identiy and add metadata to that call
15:39rhickeyidentity
15:39leonI have a short question: is there a 'length' function in clojure for lists or any seqs? I cannot find any in the api/wiki
15:39Chouser_leon: count
15:39leonthanks Chouser
15:39rhickeyChouser - fastest gun in the west
15:39ataggart,(count [1 2 3 4])
15:39clojurebot4
15:40leoncould go into the lisp/clojure differences :-)
15:40hiredman,(counted? [1 2 3 4])
15:40clojurebottrue
15:40ataggart,(doc counted?)
15:40clojurebot"([coll]); Returns true if coll implements count in constant time"
15:40ataggartnice
15:40Chouserit helps when I have #clojure up in mutliple windows on the same desktop. :-P
15:40cemerickrhickey: why the call to identity?
15:41Chouseraslo wehn I quit caring abuot my tpying
15:45rhickeyleon: what's the length of a hash table in CL?
15:46leonno idea
15:46rhickeyCL/CL differences
15:47rhickeyhash tables don't have length in CL, they have... counts
15:48rhickeyonly count works across collection types IMO
15:49rhickeycemerick: I guess I'm afraid that somehow the expr used for multifn won't support metadata, just paranoia, but defmethod doesn't dictate it be a symbol - maybe it should
15:52ChouserI had hoped I wouldn't have to think about races in Clojure. But you throw enough agents, blocking sockets, and atoms in there and *poof* complexity.
15:52Rouxrhickey: http://agbellotti.files.wordpress.com/2006/11/wittgenstein.jpg
15:53rhickeyChouser: is it inherent in blocking sockets, or is there something missing?
15:54rhickeyChouser: did you look at the executors framework?
15:54ChouserIf I had a coherent suggestion, I would have described it by now.
15:55Chouseragents are my executor framework api. :-)
15:55danlarkin_oh wow! He does really look like wittgenstein
15:55ChouserI think the kinds of complexity I'm seeing can be had as soon as you mix agents and atoms.
15:56Chouseror I guess agents examining/responding to any external state
15:56Rouxdanlarkin_: hehehe :D
15:56triddelltriddell: I hope Rich brought his tweed jacket for JavaOne ;-)
15:56rhickeyChouser: yeah, but maybe they aren't a good fit, or need to expose some more of the support, e.g. interruption
15:57Rouxdanlarkin_: quite similar features but he lacks the 1000-yard stare of our friend ludwig: http://peernet.lbpc.ca/Philosophy/images/Wittgenstein.jpeg
15:59ChouserRoux: also Rich isn't quite as grainy
15:59Roux;)
16:02Rouxclojure is in good hands: Described by Bertrand Russell as "the most perfect example I have ever known of genius as traditionally conceived, passionate, profound, intense, and dominating", Wittgenstein is considered by many to be the greatest philosopher of the 20th century.
16:04stuhoodrhickey,Chouser: at the risk of trying to solve a problem that isn't fully defined, perhaps agents should be able to be shutdown individually? such that they will finish any (sends) in the queue, but throw Rejected for new (sends)
16:05Chouserstuhood: I very nearly said something like that earlier today. I was thinking more that once all agents were in the finished state, the pools could shut down automatically.
16:05Chouserbut I don't know what "all agents" means
16:09stuhoodyea... it seems like agents really just need to be a thread+queue abstraction: so each agent could be marked as a daemon or not, so that shutting down the pool would wait for all non-daemon agents
16:12hiredman(actor)
16:14stuhoodthey execute Actions, so why not? =P
16:15ChouserI think rhickey nailed (as I'm suprised) ... replacing several of my agents with single-thread exectors may remove a lot of my complexity.
16:15hiredmanjava.util.concurrent is pretty great
16:18hiredmanI feel sort of cheated never having been introduced to it before
16:29cemerickaaah, :tag's value needs to be a symbol, not a class! :-(
16:29Chouserwow
16:30Chousersorry, I didn't even consider that.
16:30cemerickyup, I'm that slow :-/
16:30cemerickthat should really be changed to be more accepting, no?
16:35cemerickah, no, nevermind, that's just the way it has to be.
16:47Chousergah. why does every different lib have to have it's own callback class (or two or three)
16:47technomancywhat's up with libraries always requiring the JAVA_HOME env variable to be set?
16:49Chouseroh, because they each have different signatures. :-P
16:49technomancyanyone want to recommend an alternative to mvnrepository.com that isn't down most of the time?
16:57cemerickugh, beating gensyms into getting type-hinted isn't proving much easier than the last challenge
17:05cemerickah, blast from the past from cgrand saves the day :-) http://groups.google.com/group/clojure/browse_thread/thread/776f65f8a2f134f7
17:05cemerickspeak of the devil :-)
19:45gcvwhen it comes to handling file paths, is there an idiomatic Clojure alternative to using java.io.File? I just typed (.. (java.io.File. "/my/path/here") getParentFile getParentFile) in a source file and it looks verbose.
19:46technomancygcv: c.c.java-utils/file works for me
19:46technomancythough... only a few chars less verbose
19:46technomancyyou could do (file "/my/path/here/" ".." "..")
19:49gcvtechnomancy: thanks, that's pretty good. although it doesn't quite return the same thing: #<File /my> for my original example, and #<File /my/path/here/../..> using the file function.
19:49dysingerclojure never promised magic/non-verbose java interop :P
19:49dysingerit's still java
19:50technomancygcv: yeah, that's lousy. it'd be cool if "file" would automatically get the canonical version instead of just allowing crazy crap like that
19:51dysingerhttp://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#getCanonicalFile()
19:51gcvyeah, I was just wondering why file doesn't call that before returning
19:52hiredmanwell, it ain't a final class...
19:53dysinger(str .getCanonicalPath (file "/my/path/here/" ".." ".."))
19:53hiredmanuh
19:53hiredmanno?
19:54gcvhiredman: getCanonicalPath already returns a string, I don't think you need the str call.
19:54hiredmanand str is not comp, and you cannot compose method calls
19:54dysingertrie
19:54dysingertrue
19:54dysingertrue
19:54dysingeralso
19:54dysingerI was just goofing around
19:54hiredmanI know
19:55dysingerI am rusty - it's been a week since clojure coding :P
19:55dysingerneed back on horse
19:55dysinger(.getCanonicalPath (file "/my/path/here/" ".." ".."))
19:55hiredmandysinger: I saw some video where some guy from australia was presenting about openmq and he said in his testing it beat activemq
19:55dysingercool
19:55hiredmanof course this was just some random video on the internet
19:56dysingeractivemq isn't hard to beat - I think it uses derby by default for presistent message queueu
19:56dysingerqueue
19:56hiredmanhuh
19:56hiredmanwell that makes sense
19:56dysingerjava db
19:56dysingerbut you can configure it faster
19:56hiredmanfor some reason I was thinking activemq was erlang
19:56dysingerno that's rabbitmq
20:01achinI'm trying to port someone's pre-1.0 Clojure code to 1.0. I'm having trouble figuring out why you would test for something being an instance of clojure.lang.LazyCons. Would I want to change this to test for LazySeq? just use seq?
20:03ChouserI've never felt the need to test for LazyCons
20:03Chouserwhat do that do with it if it's a LazyCons?
20:03Chouserwhat if it's not?
20:03achinI'm trying to figure that out. I don't know enough about the library I'm porting.
20:04hiredmanChouser: if you want, for example, lazy code to be forced on a sandboxed thread
20:04achinThis is clj-html. It's the bit of code that dispatches bits the DSL to expand it.
20:04hiredmanachin: (instance? clojure.lang.LazySeq s) or something like that
20:05hiredmanachin: erm, I think clj-html has been updated
20:05hiredmanjust pull from github
20:05achinhiredman: that was my guess, but I don't know enough about Clojure to know if LazySeq is a drop-in replacement for LazyCons.
20:05achinhiredman: I *just* pulled.
20:05hiredmanh,,,
20:06hiredmanhmm
20:06achinhiredman: It's still using lazy-cons.
20:06achinhiredman: And stuff like rrest that's gone now.
20:06hiredmanhttp://github.com/mmcgrana/clj-html/tree/master from this?
20:06Chouserrrest --> nnext
20:06achinchouser: right.
20:06achinhiredman: I pulled from git://github.com/mmcgrana/clj-html.git
20:06hiredmanweird
20:07achinLast updated 19 Jan.
20:07hiredmanoh
20:07hiredmanheh
20:07hiredmanI fixed it locally
20:07achinHeh.
20:07hiredmanno wonder it works for me(TM(TM)
20:08achinWould you mind sharing? I'm just getting into Clojure and I was using this as an exercise to get oriented.
20:08hiredmanhttp://github.com/hiredman/clj-html/tree/master
20:09hiredmanwow
20:09achinThanks.
20:09hiredmanthis was just sort of a quick fix, so some of it is not the best
20:10achinIt's not like mine's going to be any prettier.
20:18achinHrm. If I write, (.toUpperCase "text"), everything's okay. If I wrap it in a macro, I get an unrecognized form exception. http://pastebin.com/mcbf21fd
20:22achinHeh. That never even worked to begin with.
23:31ChouserUsing the Executors API helped, I think, to solve the complexity I had, making it easier to see the (different) complexity I need. :-/
23:39rhickeyheh
23:46ChouserIf I need to serialize small pieces of work from n different threads, is there a performance consequence for using a single-threaded executor vs. an atom vs. a plain lock?
23:47ChouserI suppose I should read that concurrency book I've seen waved around...
23:48Chouserwell, that's not a problem for tonight.
23:49Chouserrhickey: hope you have a great day tomorrow. Knock 'em dead, and all that. :-)
23:49rhickeythanks!
23:57twopoint718I'm curious about the role of the "this" in the arguments to "impl-foo" toward the bottom of defn impl-foo [this]
23:57twopoint718 (str (class this)))
23:57twopoint718
23:57twopoint718(defn impl-bar [this]
23:57twopoint718Sorry about that, this was the page I meant to reference: http://clojure.org/compilation
23:58twopoint718In particular, it looks like these clojure-generated methods are getting the class as their first argument. Is that correct?