#clojure logs

2009-04-17

00:24pjb3I posted this little snippet of Haskell on Twitter earlier:
00:24pjb3takeWhile (< 5) (foldr (:) [] [1..])
00:25pjb3Something sort of equivalent in Clojure is:
00:25pjb3(take-while #(< % 5) (reduce conj [] (iterate inc 1)))
00:25pjb3But the problem is the Clojure one doesn't work
00:26pjb3The reason is that reduce does not produce a lazy sequence
00:26pjb3In Haskell, foldr is lazy, so it works
00:26durka42wait, is #(reduce conj %) a nop?
00:28pjb3Well, in this case it doesn't really do anything except realize the lazy sequence
00:28pjb3,(take-while #(< % 5) (iterate inc 1))
00:28clojurebot(1 2 3 4)
00:29hiredmanI just fail to understand how reduce can be lazy
00:29pjb3,(take-while #(< % 5) (map (fn [x] x) (iterate inc 1)))
00:29clojurebot(1 2 3 4)
00:30pjb3hiredman: It ends up being lazy in Haskell because function application and sequences are lazy
00:31devinusDoes anybody use any specific Java -switches to increase the performance of Clojure?
00:31pjb3I think Clojure's reduce is actually like Haskell's foldl, which isn't lazy even in Haskell
00:32hiredmanpjb3: but, I mean, if the reduce is done at all, should it all get done, and it all is a infinite list, does not compute
00:32hiredmandevinus: -server
00:33devinushiredman: does -server imply 64-bit, or should i use -d64 ?
00:35hiredmanjava ships with two jvms
00:35hiredman-server enables hotspot, which is the ony with all the JIT goodies
00:44pjb3Here's an implementation of foldr in Clojure: http://gist.github.com/96861
00:46pjb3So if you try to evaluate
00:46hiredmanI just don't see how an operation that uses an accumulator can be lazy
00:47pjb3(foldr cons '() (range 1 3))
00:47pjb3At some point in the evaluation it looks like this:
00:47pjb3(cons 1 (cons 2 (foldr cons '() '(3))))
00:47hiredmanhmmmm
00:47pjb3But eventually for it to finish, it has to continue the recursive calls
00:48pjb3and boil it down to (1 2 3)
00:48pjb3What happens in Haskell is that the expression evaluation is lazy
00:48pjb3so if nothing ever asks it to evaluate the expressions
00:49pjb3it can stop at:
00:49pjb3(cons 1 (cons 2 (foldr cons '() '(3))))
00:49pjb3If for example
00:49pjb3it is called like
00:49pjb3(take-while #(< % 2) (cons 1 (cons 2 (foldr cons '() '(3)))))
00:50pjb3So anyway, that's how
00:50pjb3takeWhile (< 5) (foldr (:) [] [1..])
00:50hiredmanok
00:50pjb3in Haskell works
00:50hiredmaninteresting
00:51pjb3It's pretty interesting, with all expression evaluation being lazy what you can do
03:16AWizzArdMoin moin
03:20cgrandHi AWizzArd!
03:48bOR_does any vimclojuran recognize this error?
03:48bOR_ /hosts/linuxhome/falcon/boris2/programs/src/vimclojure-2.1.0/build.xml:104: The <jar> type doesn't support the nested "path" element.
03:48kotarakYou ant is to old.
03:48kotarakYour ant...
03:48bOR_ah. will install a new ant then.
03:49bOR_thanks :)
03:49kotaraknp
03:54bOR_Apache Ant version 1.6.5 compiled on January 6 2007
03:55kotarakbOR_: Apache Ant version 1.7.0 compiled on August 25 2008
03:55bOR_hmm. that is the ant version in the (latest) binary 1.7.1 ant package.
03:56bOR_I'll install the source ant.
03:56bOR_nod.
04:20bOR_kotarak - downloading ant 1.7.1, both binary or source, gives me an ant that reports version 1.6.5
04:21bOR_hmpf. I'll look on the net if I can find anything about that.
04:21kotarakbOR_: Then check which ant is actually invoked.
04:21kotarakMaybe some PATH issue.
04:22bOR_seems logical, and I've made that error before.
04:22bOR_boris:falcon:~/.local/bin:cp ant ant2
04:22bOR_boris:falcon:~/.local/bin:ant2 -version
04:22bOR_Apache Ant version 1.6.5 compiled on January 6 2007
04:22bOR_I might just need a coffee and the problem will be solved :)
04:23kotarakHmmm... ./ant probably gives the same. (Considering the very absurd case, that there is also an ant2 on your system. ;) )
04:24kotarakJust try the version. Maybe it works although it reports a wrong version?
04:24bOR_good one.
04:24bOR_nope, genuine error.
04:25kotarakhrmpf
04:25bOR_might ask our sysadmin to look into it.
04:25bOR_it worked nicely on ubuntu, but here we are running a different flavor.
04:25bOR_maybe he can just update the ant :). delegate the problem.
04:26bOR_http://ant.apache.org/faq.html#RedHat_ES_3
04:26bOR_that might be the answer.
04:26kotarakHmm.. Check where your ANT_HOME env var points to.
04:26bOR_we're running centos, which I think is derived from redhat
04:27bOR_sysadmin time. I don't have su here
06:22cemerickI guess I never internalized that PersistentQueue existed. Lovely little thing, it is.
06:27rhickeycemerick: I keep needing to get around to putting some wrappers in the library for it
06:28cemerickyeah, it's quite the gem, IMO. I spent about 10 minute figuring out how/whether I'd implement a clojure-y queue, when I had the stroke of genius to *search the internet*! :-)
06:31cemerickrhickey: what would you think of a patch that would add "prefix-rest" destructuring? i.e. (let [[prefix > a b c] [1 2 3 4 5 6]] [prefix a b c]) => [[1 2 3] 4 5 6]
06:33rhickeycemerick: sounds really special purpose - I can't think of a single time I've desired that
06:35cemerickI bump into situations where it'd be handy every now and then...I generally just rearrange the order of the args to the fn.
06:35rhickeyone issue I have with exposing persistent queue is that I also want to provide wrappers for other queues - java.util, JMS et al, so how to best name them?
06:35cemerickThat obviously works, but often the arg order then doesn't entirely make sense given the fn's purpose.
06:38cemerickrhickey: why do you want to provide wrapper for queues from java-land? There's a *lot* of list/vector impls in java-land, with no wrappers in clojure.
06:45rhickeycemerick: because stateful queues are an important part of workflow, Clojure doesn't provide them natively, people that don't know Java don't know they are there, there are opportunities to add value in abstracting away some differences and standardizing e.g. timeouts, they will form the basis of any distributed story for Clojure...
06:47cemerickrhickey: fair enough. Wrappers are a tough business though, leaky abstractions and all. I guess where there's muck, there's brass, and all that.
06:50cemerickFWIW, I'd like to consider c.l.PQ to be the "primary" queue impl -- it likely suits a majority of use cases, and is far less environment-dependent than other queue impls (JMS, j.u.concurrent queues, etc).
06:51cemerick(especially in terracotta :-D)
07:40cemerickhrm, one cannot use set! to change *print-length* and such anymore?
07:47rhickeycemerick: I consider c.l.PQ to be an entirely different beast than stateful blocking queues and would rarely consider one useful where the other is
07:50cemerickrhickey: sure, so would I. I was only saying that a POQ (plain ol' queue) is generally required in more situations than anything else.
07:52rhickeycemerick: depends on what you are doing. I find queues as I/O more frequently used than queues as data structure
07:53rhickeyanyway, it's not either/or, but given the need for both, names are an issue
07:57aperottehello everyone! I'm working on a data structure for clojure and wanted to know if anyone (rhickey in particular) had any input. It's an n-dimensional array in some ways similar to python's ndarray.
07:57Raynes"What is a good starter language for a 10 year old? I want to teach my 10 year old daughter to program." "Assembly."
07:57cemerickyeah...my comments were mostly made assuming there will be a 'queue' fn, with the only question being, what does it produce? I think making it so that it produces a LBQ or somesuch would be unfortunate. Clojure's impl of persistent data structures and their 'first class' status is arguably its best feature.
07:58greghI learned assembly when I was 10, but it was a lot more fun on the apple ][ than it would be now
08:00rhickeycemerick: I don't disagree, but if queue returns a c.l.PQ, then what lingo should we use for I/O queues? - channel?
08:01rhickeyaperotte: are you trying to make a persistent data structure?
08:02aperotterhickey: yes
08:03cemerickrhickey: well, if you're making wrappers that interoperate with peek, pop, etc, then I'd be happy enough to see them go into clojure.core.queues/linked-blocking-queue, etc. Then if you really want to be fancy about it, you could exclude clojure.core.queue and use the linked-blocking-queue :renamed to queue.
08:03aperotterhickey: I wish there were a way to make java arrays immutable though
08:03rhickeyaperotte: me too
08:05rhickeycemerick: the semantics of stateful blocking queues and persistent queues are totally different, despite any apparent similarities
08:06rhickeythus, I think only one should get the name queue
08:06cemerickindeed. I just didn't know how far you wanted to try to paper over the differences.
08:08aperotterhickey: as it stands I'm implementing most of the interfaces of the other data structures (PersistentVector in particular).
08:08cemerickIMO, there are far too many possible (and actual) queue impls for various concurrency use-cases to do anything other than be very specific about each wrapper you want to have. Blessing just one of them doesn't seem right.
08:14rhickeycemerick: I'll be happy to prove you wrong about that. It's not a matter of blessing an impl (e.g. from a factory/ctor perspective), but rather one of defining some simple protocol that can be widely supported, thus making it easy to write impl-ignorant code. This in line with the Clojure model elsewhere. If someone wants to fully leverage something specific they can always do so explicitly
08:15cemerickrhickey: oh, so you're looking to fashion a corollary to seqs for queues?
08:15rhickeyyes, io-queues are one area where I think it would be valid to unify the local and distributed models, as they are substantially similar
08:16rhickeyasynchrony, blocking, remote failure, timeouts etc
08:18rhickeyI've done some thinking about it, and would like to try at some point to at least see how much can be factored out of j.u.c.BlockingQueue and JMS queues
08:19rhickeyI consider such queues an essential architectural element in most systems
08:21cemerickIn that case, I retract all of my previous statements :-)
08:21rhickeyWhen I see people polling on refs I realize that they need more support here, and I'm afraid if I only give them c.l.PQ they'll do even more of that
08:21cemerickI think I was thrown off by the 'wrapper' term.
08:22cemerickrhickey: well, see, I underestimated your ambition. I figured once 1.0 was out the door, you were just going to sit around, hang out on the channel, and argue with people on proggit ;-)
08:23rhickey:)
08:25cemerickunderstand that even though clojure has advanced so much, so quickly, old habits die hard w.r.t. expecting languages/frameworks to idle. Not many people keep reaching.
08:27rhickeyI have so many things I want to do, I think now I just need 1.0 so I can do them without pissing anyone off with Clojure's "rapid change"
08:27cemerickdo you still have a long-term todo floating around?
08:29RaynesI'm going to put it in a flash drive and mount it on my wall.
08:29rhickeycemerick: I do, but it's not a fixed roadmap. I made it non-public as I wanted to move it to issues, now I think issues shouldn't have wishlist items, so I may re-expose
08:30rhickeyRaynes: I don't see a lot of people clamoring for 1.0 in the gg thread, just requests for more stuff...
08:30cemerickyeah, the issue tracker is a little too concrete for such things
08:31Raynesrhickey: It's just a huge milestone for Clojure, I'm in no hurry to slow down the rapid change, I just love the numbers one and zero.
08:32rhickeyHolcxjo: There's a tradeoff, in that it will limit the Clojure user base to those willing to contend with trunk for an extended period. Obviously there's more work to do, and probably a (very) few breaking changes still to come, but if people expect things not to change they can just stick with a version indefinitely
08:36cemerickrhickey: indeed, I've not seen anyone volunteer to "backport" fixes and such.
08:37Holcxjorhickey: The problem is people sticking with an old version and developers then having to write sw that works with that old version -- not being able to use newer features...
08:37rhickeyI'd very much like Stuart's book to correspond to a release of Clojure - we both worked pretty hard on our ends of that, and it would be huge for newcomers
08:37cemerickI continue to be skeptical of the 1.0 "process". Those who want it likely aren't going to help maintain it.
08:38HolcxjoYou don't want to know how long I had to write sw to Python 1.4 standards... :-/
08:38cemerick1.4? ouch.
08:39rhickeyOne difference with Clojure is that it is 99% library, with very fine granularity. It's not like syntax changes in other langs
08:39HolcxjoOnce it's out there it'll live and live and live...
08:40Raynesrhickey: *cough*scala*cough*
08:41cemerickHolcxjo: some shops are still on java 1.1.7, and they like it that way. I'd love to see clojure 1.0 being used similarly by the same sorts of people 10 years from now. :-)
08:43rhickeyif no one produces bugfix patches for 1.0 then there won't be a 1.0.1, it's that simple. Doesn't completely negate the value of 1.0, but means that people that want fixes only get them with enhancements/changes in trunk
08:44cemerickrhickey: maybe those that are using clojure in some production capacity could pool their resources to support a guy (or half or quarter of one) that is responsible for the patching.
08:45cemerickWe're certainly not there yet, but I'd be willing to underwrite that kind of effort.
08:46cemerickwell, presumably someone will make it big using clojure, then hire you (or something). That seems to be the general arc of such things.
09:02cgrandHi! About c.l.PersistentQueue, should I be worried about it being used in c.l.Agent? I mean, it seems that it can keep references on actions after they are executed.
09:04rhickeycgrand: it can, but not doing so is not guaranteed. Is this causing an actual problem?
09:07cgrandI thought about it two months ago and wondered whether it could be correlated to my widefinde2 code being a memory hog... but I never tested this hypothesis
09:08cemerickspeaking of agents, this is the third time I've seen this talked about (two other times in the channel): http://groups.google.com/group/clojure/browse_frm/thread/409054e3542adc1f?hl=en
09:12kotarakHas anyone hashdot running with Clojure on OS X?
09:13rhickeycemerick: no one replied if shutdown-agents was sufficient or not
09:13kotarakrhickey: he calls shutdown-agents in his exit function, no?
09:15cemerickIndeed, and I think he's saying in msg #4 that the behaviour I predicted does happen interactively, but not when the thing is init'ed by cron (which I don't have any theories about).
09:15rhickeykotarak: I didn't see enough info to further pursue it - e.g. are his agents still active?
09:15cemerickmodulo the cron bit, the other two cases I helped with in the channel saw the same behaviour.
09:16cemerickbut then, like I said, I don't use agents, so I'm mostly speculating based on looking at the docs around the default threadpool impls.
09:18powr-tocIs there an easy way to determine dependencies between functions, for refactoring? I have about 2 dozen functions, many of which have been superceeded... Is the best thing to interactively evaluate and run them and see where they break?
09:18clojurebotfunctions are maps
09:18powr-tocI think I need to move to use the test suite in contrib...
09:28aperotterhickey: I'm nearing the point where I can share what I have, but I wanted to make sure you don't have any more suggestions re: an ndarray/matrix datatype
09:30kotarakIs anyone using hashdot with Clojure on OS X?
09:31rhickeyaperotte: probably easier for me to give feedback on what you've got
09:33aperotterhickey: would you prefer to wait until I think it's more shareable, or would you rather see it now
09:34rhickeyaperotte: up to you, I wasn't thinkisg about it until you mentioned your work, so I don't have any ideas at the moment
09:35aperotterhickey: ok, I'll come back with a link to what I've done in a few days
09:35rhickeygreat
09:41powr-tockotarak: no, not seen it before... looks usefull... is it?
09:42kotarakpowr-toc: Don't know. I can't compile it with the standard VM and with soylatte it shouts errors at me when I try to run it.
09:42kotarakpowr-toc: That's why I asked..
09:48powr-tockotarak: is it implemented in pure Java or something else?
09:48kotarakpowr-toc: It has a C part as it seems.
09:48kotarakDoing stuff with JNI.
09:51kotarak-.-
09:52kotarakpowr-toc: I have it running. Compiled with soylatte, but running with stock VM.... But it works and seems a way to start scripts while doing some configuration...
09:55powr-tocneat
10:01Chouser_I don't see a whole lot of people contributing patches for Issues that they haven't run into themselves.
10:02rhickeyChouser: nope
10:02Chouser_I wonder if that suggests anything about how hard it may be to get backport patches from anyone once there's a 1.0 branch.
10:03cconstantineI think it does
10:04Chouser_personally, the thought or watching trunk patches going in, trying to spot which are non-breaking-change no-new-feature low-risk (etc.) bug fixes vs. not, and creating an backport issue for each just sounds like work.
10:04Chouser_like a Job
10:04cconstantineSounds like more fun than the code I'm working with now... but yea
10:05hiredmanwait
10:05Chouser_though I suppose if someone shows up in IRC saying "I'm using 1.0 and foo breaks", and foo has been fixed in trunk, I might be motivated to spin a backport patch right then.
10:05rhickeyAt this point I see it as a way I can keep innovating in trunk without hindrance. If people don't want to contend with change, they can look into the 1.0 branch, if they want fixes there, they can submit patches. I don't want to apologize for improving Clojure, or have Clojure be perceived negatively because it is "changing"
10:05hiredmanI've got it
10:06hiredmanhave all the svn commits listed on a webpage where people can tag them as "fix" or "breaking change"
10:06hiredmancrowd source it out
10:07cconstantineeep, that''d be terrifying if I had to rely on clojure to make a living
10:07hiredman:P
10:07cconstantinemake it web 2.0?
10:07Chousuke:P
10:07Chousukethat'd require keeping commits small though.
10:07cconstantineI like the idea of just using the release number to encode what kind of differences there are between release
10:08cconstantineI think someone else recommended an x.y.z... z is bugfixes, y is new features, x is breaking changes
10:08Chouser_I think rhickey's perspective is good for now. Branch 1.0, then keep moving on trunk, while being open to accepting backport patches for 1.0
10:09Chouser_then what happens, happens. Clojure's done quite well so far not over-planning process or community details.
10:09cconstantinetrue
10:09hiredman~map
10:09clojurebotmap is *LAZY*
10:09Chouser_I think it's likely that some set of people will start using 1.0 (perhaps people not currently using Clojure)
10:09Chouser_they will find bugs
10:10Chouser_they may submit patches for those bugs, either by backporting existing trunk patches, or just plain fixing them.
10:10Chouser_why should anyone not using 1.0 work on keeping it fixed up?
10:11cconstantineChouser_: because there are new features that are irresistible.
10:11danlarkinChouser_: because it's the Right Thing To Do(TM(TM)
10:11cconstantineI see future new compelling features as the biggest threat to 1.0; if 1.x is better enough no bug fixes will move back to 1.0 forcing everyone to upgrade out of 1.0
10:12danlarkincconstantine: I mostly agree
10:13cconstantinethats the reason I'm on trunk of svn
10:13cconstantinemy usage of clojure is mostly educational/recreational though. I'm not doing anything *really* important with it yet
10:13Chouser_but if everyone moves to trunk or 1.x because of new features (which aren't even on the table for 1.0.x), then isn't that even more reason that nobody should waste their time backporting fixes to 1.0?
10:14cconstantineyes
10:14cconstantineI think you just restated the problem
10:14Chouser_oh
10:15Chouser_it doesn't sound like a problem to me
10:15danlarkinI look at it from this perspective: If I were to try to convince my boss to let us use clojure for work projects and I recommended to the team that we start off with 1.0, except there won't be any bugfixes unless we write them up with patches, they would question my sanity
10:15Chouser_hm, we should have a matching branch of contrib.
10:15cconstantinewithout backported fixes people who do find problems with 1.0 will be forced to upgrade; perhaps past a non-backwards-compatible change
10:15cconstantinedanlarkin: exactly
10:16Chouser_danlarkin: who would you *want* to be responsible for writing those patches, that would satisfy your team?
10:16cconstantineThe "Clojure development team"
10:16rhickeyoh, them
10:17cconstantineThe 'Them'
10:17danlarkinwell other projects assign a release manager for each release (not saying that's the only way)
10:17cconstantineright
10:17danlarkinso in essence, someone would have to volunteer for clojure to follow the release-manager model
10:18cconstantineIf there aren't any compelling new features for the language in the pipeline maybe it is time for a 1.0 *shrug* I don't know what is in development
10:18cconstantinedanlarkin: having never participated in an open source project, my experience tells me yes
10:19rhickeycconstantine: abstractions over queues, streams, scopes, clojure-in-clojure, improved modularity, easier porting, a new "make" construct, more targets, improved numerics...
10:19Chouser_well, if anyone wants to hire to me backport trunk patches to 1.0, drop me a line.
10:20cconstantinerhickey: what kind of timeframe on that, and how reasonable would it be to have them be released in chunks?
10:21danlarkinheh well that's just it... if none of us have any interest in maintaining a 1.0, what is the point of releasing it?
10:21rhickeyChouser_: yes, Clojure development sponsors welcome
10:21Chouser_heh. I bet.
10:22cconstantineClojure; sponsored by Dr. Pepper!
10:23cconstantineI think things like backports won't happen until there is a need for bugfixes without major upgrades
10:23cconstantinethat won't happen until people make a living off it, which won't happen until there are known stable releases and few breaking changes
10:23digashI am trying to push Clojure in the enterprise and 1.0 will make it easier for me to make my case.
10:23cconstantinethis sounds like a chicken-egg problem
10:23digash2.0 and 3.0 will make it even more easier.
10:24vegaiwhy not go to 4.0 straight away :)
10:24danlarkinbut it's all so arbitrary :(
10:24cconstantineMS model? not really stable until 3.0?
10:24digashyes, you got it.
10:24vegaiClojure Vista
10:24cconstantine'normal people' pay attention to the numbers way too much
10:24Chouser_maybe not a chicken-egg problem. a 1.0 branch can be created today
10:24cconstantinetrue, though this goes back to the problem of 1.0 not meaning much if there are no backported bug fixes
10:25rhickeyChouser_: exactly, and people for whom it is important will have to step up after that
10:25Chousukeis there symbol/keywords validation yet? :P
10:25Chouser_some selfless souls may backport some fixes. maybe that would be enough to create an impression of stability to get kind of users who need that
10:25danlarkincconstantine: exactly
10:26rhickeyor maybe I just need to thrash around in trunk to force people to care about the stable branch :)
10:26Chouser_there you go
10:26cconstantineis it reasonable to tell early adopters of 1.0 that they may need to do their own backporting for now?
10:26Chousukeheh
10:26kotarakIs there a way to specify an entry point for clojure.main?
10:27Chouser_a few more "Interim checkin - DO NOT USE!!" could get ball rolling
10:27cconstantinehehe
10:28danlarkinI wonder, is the plan eventually to have most users on a release? Like not many people run from Python trunk, or Ruby trunk
10:29kotarakrhickey: please don't! I use it for completion in vimclojure!
10:29chessguy_work'morning ya'all
10:29Chouser_could all-ns be thread-local?
10:30cconstantinedanlarkin: I would hope the goal is to get everyone on a release
10:31digashdoes anybody uses inspector-tree? i have a patch to add a path to the selected node in the bottom of the screen. would it be usefull to anyone?
10:31kotarakNo way to specify a function which should be called *after* loading the script file in clojure.main?
10:31rhickeyChouser_: it's orthogonal to threads - the problem is that modular Clojure will have some namespaces not visible from others and no global registry necessarily
10:32rhickeydigash: sounds nice - post 1.0
10:33rhickeyinspector could definitely use some love - the multimethods predate the hierarchy enhancements
10:33Chouser_oh, right, it's class visibility from *classes* not from *threads*. bleh
10:34digash /me need to learn about the new hierarchy enhancements.
11:21djpowelli think just-in-time backporting of fixes could work. Just wait until someone asks for a fix on the mailing list, and hope that someone will be nice enough to make a patch, then push it out quickly as a minor point release.
11:24powr-tocwhen working at the REPL in clojure-mode (Emacs) does anyone have any tips on the workflow around re-evaluating a function in its namespace? manually changing the ns in the repl, then evaluating the modified function and then switch back is a pain
11:26Carkpowr-toc : do you mean without slime ?
11:26djpowellyeah - i've just tended to stick all the code in one namespace, and then switch to that namespace in the repl. can slime automatically switch namespaces?
11:28Carki use clojure mode without slime, and here is what i do : i have a (comment section at the end of the file, with an in-ns form ...so i can eval it when i'm close to the end, or the top ns form when i'm close to the top ....i usually will be to the end of the file, using my test forms in the comment section
11:29Carkb ut yes, i think slime does this automagically
11:33powr-tocCark: yeah
11:34powr-tocok... was trying to avoid the complexities of slime until I've got more experience with clojure and know that I need the features
11:34djpowelli don't use slime either. i think because i have a fear of it breaking, and me wasting hours trying to get it working again, and also cause I seem to cope well enough with inferior-lisp mode. is it worth upgrading?
11:35powr-tocdjpowell: same
11:35powr-tocthough the ns thing I've just run into is annoying
11:35kensanataDoes anybody know how I can get the clojure docs I see on clojure.org as a PDF or a similar format so that I can read it offline?
11:36powr-tockensanata: I'd second that... but I'd just be happy with an offline version of the site... are the site docs generated at all?
11:37kensanatapowr-toc: I feel bad starting wget and leeching the site if there is an alternative...
11:37drewrkensanata: There's one on the google group, but it's old IIRC.
11:38powr-tockensanata: I wouldn't feel bad about it... It'd just be nice to have a better way :-)
11:38djpowellyeah, i'd quite like the docs to be part of the release bundle somehow
11:39Carkthe api page is generated, also there must be tools that can take a web site and make it a pdf
11:48arohnerdjpowell: I'd recommend slime
11:49arohneractually wait
11:49arohnerare you using (ns) declarations at the top of your files?
11:49arohneryou should be, and then you can just (load 'filename) from the repl, and the code will end up in the correct ns
11:57kensanataI decided to just print http://jnb.ociweb.com/jnb/jnbMar2009.html to a PDF file... :/
12:30pjstadiganyone know of a "swing repl"?
12:31pjstadigi.e. something that pops open a swing window that contains a repl
12:33Carkyou might be able to reuse clojure.main/repl to that effect
12:33Cark,(doc repl)
12:33clojurebotjava.lang.Exception: Unable to resolve var: repl in this context
12:34Cark,(doc clojure.main/repl)
12:34clojurebot"([& options]); Generic, reusable, read-eval-print loop. By default, reads from *in*, writes to *out*, and prints exception summaries to *err*. If you use the default :read hook, *in* must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing CR, LF, and CRLF into a single \\newline. Options are sequential keyword-value pairs. Available options and their d
12:53pjstadigCark: yeah i was just wondering if someone had done something similar already
12:53pjstadigwanted to be non-duplicative
12:59kotarakpjstadig: there was a graphical repl in the files section of the google group
12:59kotarakBut I'm not sure about its status
13:33Chouser_pjstadig: there's also "texture" -- it was meant to be a text editor, but so far is mainly just a repl
13:53powr-tocI forget how you print the last exception at the REPL... can anyone enlighten me? :-)
13:53kotarak*1
13:53Chousuke*e :P
13:53kotarakOops. Sorry. I read "the last expression"
13:56powr-tocahh thanks :-) (. *e printStackTrace)
13:56kotarakpowr-toc: you might be also interested in clojure.contrib.stacktrace
14:02cp2someone should write a nice bytecode library in clojure
14:02cp2so i dont have to work on my own projects
14:02cp2:)
14:07kotarakCould rhickey's defnk be added to clojure.contrib.def? http://paste.lisp.org/display/69347
14:14Raynesrhickey: You're right. They hardly even talked directly about the road to 1.0 at all. They mostly just complained about SVN and whined because Clojure isn't using Git.
14:14Raynes:\
14:18mattreplbah, the VCS is a part of the road ahead and _is_ pertinent to the discussion as the management of backporting fixes to release versions was mentioned
14:19RaynesBut shouldn't someone have made another thread if concerned about that?
14:21RaynesEither way. Rich will have to change to something else eventually, because Git-zealots are already rounding up pitchforks and torches ready to raid his home.
14:21Raynes:p
14:22mattreplhehe, I'd be hesitant to start a thread on it until Rich shows interest since he's shut down the idea in the past
14:23cp2im gitting angry, rhickey!
14:24RaynesOh I see. He stated that Git wont happen any time soon.
14:24rhickeywhatever the benefits of Git, it's not a contender until it is available on a credible host with attributes similar to Google Code, and has decent tool support a la SVN - it's simply not there yet AFAICT.
14:25rhickeyoh please
14:25cp2heh
14:25Raynesrhickey: Yeah, I see Ozzy has demanded that you not use subversion.
14:26RaynesEven Stuart is asking for Git. What is so great about Git?
14:26rhickeyI think Git has great ideas, everyone mentions it to me after my talks as having a kindred spirit with Clojure's persistent data structures, it's not a technical issue but an environmental one
14:27RaynesSeriously, I'm wondering. I don't know much about it. All I know is that it hardly works on Windows.
14:27rsynnottso many things use it now
14:27rsynnottI'm more used to svn, though
14:28cp2Raynes: oh yea
14:28cp2git sucks on windows
14:28cp2msysgit is decent, but still lacking
14:28cp2tortoisegit is just completely lame (at the moment)
14:28rhickeycp2: that's enough reason against it right there, sucks on the 90% share OS
14:29Chouser_I think there are some people who have been burned by svn in certain demanding environments, and have found git to be a helpful. It think these are most likely to be militant.
14:29cp2for the moment
14:29RaynesCommand-line tools would be nice, like the Scala compiler. Being able to compile something by saying "cljc teh.clj"
14:29RaynesBut I believe there was a discussion here stating that that would be difficult.
14:29cp2Raynes: bash + alias perhaps
14:29rsynnottrhickey: Windows is probably a minority share on development machines, though
14:30Chousukethe README file lists nice features but fails to mention how to use them
14:30Chouser_I've never been burned by svn, and don't see how a single-user commit structure like clojure core has is ever going to stress it. I personally prefer git and use git-svn quite happily.
14:30rsynnott(especially if you ignore the in-house corporate app market)
14:30RaynesThat's not the point. People /do/ still use Windows despite it's issues.
14:30cp2i heard using linux supports socialism
14:30cp2so i use windows
14:30rhickeyrsynnott: Clojure does not ignore the in-house corporate market
14:30rsynnottI suspect that the inhouse corporate market ignores clojure :)
14:30rhickeytrue
14:31kensanataIt doesn't hurt to be ready, though.
14:31RaynesI can get msysgit to clone, but not commit or anything of that sort.
14:31rsynnottthe inhouse corporate market still seems uncomfortable with Java and C#; pre .NET VB is still a very big part of it
14:31cp2Raynes: weird, works for me
14:32Raynescp2: I tested it by making a github project, after the master stuff, it complained about some linux-specific stuff, and apparently I'm the only one who has ever had the issue because I couldn't find anything about it.
14:32RaynesI just decided it wasn't worth worrying about.
14:32rsynnottChouser_: some early versions of svn built against certain versions of bdb had a very high-profile problem where they would occasionally irreversably corrupt themselves, often in suchh a way that it wasn't initially obvious
14:32rsynnottthis has set some people against svn for life :)
14:32cp2odd :|
14:32RaynesAt least I can clone without having to wade through linux crap. :D
14:32rsynnott"linux supports socialism" - what on earth?
14:33powr-tocWhat does %& do?
14:33durka42powr-toc: it's a seq of the remaining parameters
14:34rsynnott(linux isn't even my OS, but I hardly think that political principles are an issue with it :) )
14:35cp2rsynnott: hehe, im not serious of course
14:35powr-toccool
14:35rsynnotthas anyone ever said that seriously, though?
14:35rsynnottthe very idea seems weird
14:36cp2i hope not
14:43rsynnottbut yes, really, what is wrong with svn? :)
14:46cp2i dont really see anything _wrong_ with it
14:46cp2its just not ideal for gigantic projects
14:46cp2for example, the linux kernel
14:47cp2but clojure isnt a gigantic project, so svn works fine i would say
15:14kotarakChousuke: there is some documentation in the doc subdirectory
15:15kotarakChousuke: Short tour: start the ng-server, open a clojure file, type r-s and hit <C-x><C-o> in insert mode
15:15kotarakChousuke: in normal mode type \sr and enjoy the repl
15:15kotarakChousuke: Other things are explained in said documentation file
15:19kotarakChousuke: And for the SLIME question on the list: Write some macro call, eg. (defn foo [] :xxx) place the cursor inside the parens and hit \me or \m1. The preview window might closed with \p.
15:25jwinter_just got bit by the fact that println flushes output, but print doesn't
15:26jwinter_is there a reason why clojure.lang.Script wouldn't flush output when it finishes?
15:27hiredmanjwinter_: have you tried clojure.main instead?
15:27jwinter_no, would that make more sense for shell scripts?
15:28hiredmanjwinter_: take a look at java clojure.main --help
15:28jwinter_nice, thanks hiredman
15:29hiredmanwell, see if it flushes on exit first :P
15:29jwinter_yep, it does
15:59Chousukekotarak: thanks
19:45gvolis anyone successfully using slime with clojure (both from version control?)
19:45gvolI keep getting an exception: Caused by: java.lang.Exception: clojure.contrib.javadoc/javadoc can now be found in clojure.contrib.repl-utils. (javadoc.clj:0)
19:45technomancygvol: yeah, though I haven't updated in a while
19:46gvolHow recently?
19:46technomancyare you using git? I could just give you the exact revisions I'm using.
19:46gvolI'm using bc's build-clj script
19:47gvolso some git, some cvs and some svn
19:47technomancygvol: that script is unnecessarily complicated since it configures slime to also support Common Lisp
19:47technomancy(unless you *want* CL for some reason)
19:48gvolno
19:48clojurebotis_rhickey_is_a_minor_god? is yes
19:48technomancygvol: try the installation directions here: http://technomancy.us/122
19:48gvolcool, I'll check that out
19:48gvolThanks
19:49technomancyit's definitely not the best thing for users getting started. =\
19:49gvol:-)
20:04gvolbeautiful, slime starts etc.
20:04gvolnow it complains about lazy-cons
20:06cp2are you using latest svn of clojure (or relatively new)
20:06gvoljava.lang.Exception: Unable to resolve symbol: lazy-cons in this context (probs.clj:56)
20:06gvolI assume that I have to add something to some path
20:06cp2yeah, lazy-cons is gone
20:06cp2use cons and lazy-seq
20:06gvoloh
20:06gvolcons works like lazy-cons?
20:07cp2no, but cons + lazy-seq does
20:07gvolok
20:07cp2http://clojure.org/lazy
20:07cp2read more
20:07gvolthx
20:21danlarkinOh how I wish defmethod accepted a docstring
20:27cp2wow, i just took a look at the code for filter
20:27cp2pretty elegant
20:27cp2imo, anyway
20:48cp2rhickey_: tom hickey is your brother im assuming?
21:01danlarkincp2: yes
21:01cp2i like his designs, looks good
21:11cp2has anyone here used nbgit for netbeans?
21:50danlarkinit would be nice if contrib had an http library
21:55hiredmanthere are so many java http libs
22:00DrakesonI know it's embarassing, but I have no choice: why I cannot put (set! *print-lenght* 100) in my user.clj?
22:00Drakeson(it says: Can't change/establish root binding of: *print-length*)
22:02danlarkinbecause at the time user.clj is evaluated *print-length* has not yet been created
22:03Drakesonwhere should I put repl related setting, then?
22:04Drakesonis there a repl-hook ?
22:08Drakesonhow can I disable caching for a lazy seq like: (def N (iterate inc 0))?
22:17dreishI have (def *print-length* 30) in my user.clj
22:18cp2cool :)
22:18danlarkinoh? hm maybe I'm wrong
22:18danlarkinhappens a lot!
22:18dreishDrakeson: As for disabling caching, I think the short answer is you can't, and the longer answer is you can.
22:19dreishdanlarkin: I think that's consistent with your answer. But I'm puzzled by how it works for me.
22:19dreishWhat doesn't work for me right now is repl-utils/source. Very sad about that.
22:25Drakesondreish: does not work for me: Name conflict, can't def *print-length* because namespace: user refers to:#'clojure.core/*print-length*
22:25dreishWhat version?
22:26Drakesonthe most recent
22:26dreishWeird.
22:26dreishWish I could help. Sorry.
22:26Drakeson(Apr 14 is the last change)
22:26Drakesonwhat version is yours?
22:26dreishThat's about the last time I updated, too.
22:27dreishI'm pretty sure the way that works hasn't changed in months.
22:27Drakesonyou just put (def *print-length* 100) in user.clj and that's it?
22:27dreishOh! No, I didn't. Sorry.
22:28dreish(ns clojure.core) (def *print-length* 30) (def *print-level* 10) (ns user)
22:28dreishThat can't be the right way to do it, but it works. :)
22:29dreish(It has been a long week.)
22:29Drakesonyay! (iterate inc 0) cannot break my session anymore :D
22:30Drakesonthanks
22:30dreishnp
22:30dreishThe other way to protect yourself against iterate is to misspell it.
22:30Drakesonheh :)
22:30dreish,(interate inc 0)
22:30clojurebotjava.lang.Exception: Unable to resolve symbol: interate in this context
22:36cp2i guess when-let doesnt allow multiple bindings
22:37danlarkincp2: correct
22:38cp2question about type hinting
22:38cp2if i am doing (defn ... [#^Class clazz value] ...)
22:38cp2is there a way to hint that the type of value should be whatever clazz is
22:38cp2as in, #^clazz value
22:39cp2actually i should have tried that before i asked
22:39cp2but im assuming it doesnt work
22:39chessguyhey what would you guys use in clojure for a bi-directional map? that is, a map whose values are also keys to their keys?
22:40cp2hm, apparently that syntax is valid, doesnt do what i want though
22:41cp2user=> (defn testaroo [#^Class clazz #^clazz value] [clazz value])
22:41cp2#'user/testaroo
22:41cp2user=> (testaroo String 123456)
22:41cp2[java.lang.String 123456]
22:42cp2shouldnt allow that
22:43danlarkinString is a class
22:44cp2yes
22:44danlarkinorrrr rather String is a Class
22:44cp2hm, i think i see where you are going
22:47cp2alright, not necessary for my code
22:47cp2would have just been nice to enforce that with type hinting
22:51danlarkinwell you can enforce that the argument is a Class
22:52danlarkinbut you can't, say, require it implement an interface or something
22:52danlarkinthat isn't what type hints do
22:52cp2yeah, i see that now
22:53cp2no worries
22:53chessguyso...any thoughts on a bi-directional map?
23:11mihandI have not seen one in clojure and I think runtime suport is needed . i'd expect (assoc {:a 2} :r 2) to fail for that kind of map
23:11mihandbut i'm a newbie
23:13mihandi'd use regular maps with custom add remove
23:16mihandis there a way to implement an Associative in clojure?
23:17mihandlike you can implement sequences with lazy-seq and cons?
23:18durka42like proxy?
23:28mihandignore the question . it was nonsense
23:32technomancydanlarkin: I've been thinking about an http library for contrib
23:32danlarkintechnomancy: I just started one :)
23:32technomancydanlarkin: ooh; let's see it?
23:32danlarkinhah, it has GET so far
23:32technomancythat's a good place to start!
23:33technomancywhat's the JDK got as far as HTTP? is it just too low-level?
23:33generationkill,(first ())
23:33clojurebotnil
23:33generationkill,(first (list nil))
23:33clojurebotnil
23:33cp2URL / URLConnection
23:33danlarkinURL, HttpURLConnection... it's so stateful and disgusting
23:33generationkillam i the only one bothered by this?
23:34technomancyI heard a rumor that Google started using Python because the Java HTTP lib didn't let you set the HTTP user-agent header
23:34technomancy(back in the day, of course)
23:34generationkilllikewise:
23:34generationkill,({:a nil} :a)
23:34clojurebotnil
23:34generationkill,({} :a)
23:34clojurebotnil
23:34technomancyaha: http://groups.google.com/group/comp.lang.java/msg/88fa10845061c8ba?pli=1
23:35danlarkinWOW
23:35danlarkinthat's hilarious
23:36generationkill
23:36generationkillLawrence == Larry ?
23:36generationkillI didn't know
23:38danlarkinGET down, moving on to POST, /me cheers
23:39technomancydanlarkin: be sure to post to the ML once you've got something ready to share; I'd love to help out
23:39danlarkintechnomancy: will-do, I'll gist it or something
23:43generationkillIs Clojure ready to be 1.0?
23:45cp2heh, funny
23:45cp2i was about to write a function 'enumeration-seq' to put the elements in an Enumeration in a sequence
23:46cp2but then enclojure highlighted it, so i checked the api
23:46cp2already written!
23:49generationkill,(find-doc enumeration-seq)
23:49clojurebotjava.lang.ClassCastException: clojure.core$enumeration_seq__4930 cannot be cast to java.lang.String
23:51durka42(doc enumeration-seq)
23:51clojurebotReturns a seq on a java.lang.Enumeration; arglists ([e])
23:51cp2oh what
23:51generationkillwhy?
23:51cp2java.lang.Enumeration...
23:52cp2pretty sure thats a type
23:52cp2Enumeration is java.util
23:52durka42,Enumeration
23:52clojurebotjava.lang.Exception: Unable to resolve symbol: Enumeration in this context
23:52durka42,java.lang.Enumeration
23:52clojurebotjava.lang.ClassNotFoundException: java.lang.Enumeration
23:52durka42,java.util.Enumeration
23:52clojurebotjava.util.Enumeration
23:52durka42fact
23:53slashus2The doc is wrong?
23:53cp2(clojure.lang.EnumerationSeq/create e))
23:53cp2yes, it is wrong
23:53cp2public static EnumerationSeq create(Enumeration iter)
23:53cp2er
23:53clojurebotbender is my idol
23:53cp2import java.util.Enumeration;
23:58generationkill(apply * (range 1 1001))
23:58generationkill,(apply * (range 1 1001))
23:58clojurebot40238726007709377354370243392300398571937486421071463254379991042993851239862902059204420848696940480047998861019719605863166687299480855890132382966994459099742450408707375991882362772718873251977950595099527612087497546249704360141827809464649629105639388743788648733711918104582578364784997701247663288983595573543251318532395846307555740911426241747434934755342864657661166779739666882029120737914385371958824980812686783
23:59generationkillAm I the only one bothered by the ambiguity of the nils?