#clojure logs

2009-02-26

00:04arohneris there a clojure facility for compareTo?
00:07durka42arohner: what do you mean?
00:07durka42,(.compareTo 2 3)
00:07clojurebot-1
00:08arohnerI was disappointed to see <, >, <=, >= etc don't work on objects that implement compareTo
00:08arohnerI was hoping there was a clojure fn for it
00:08durka42oh, i see
00:11durka42,(compare 2 3)
00:11clojurebot-1
00:13durka42,(< (Date.) (do (Thread/sleep 2000) (Date.)))
00:13clojurebotjava.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Number
00:13durka42,(compare (Date.) (do (Thread/sleep 2000) (Date.)))
00:13clojurebot-1
00:13durka42arohner: clojure.core/compare
00:14arohnerdurka42: thanks
00:14hiredman(doc compare)
00:14clojurebotComparator. Returns 0 if x equals y, -1 if x is logically 'less than' y, else 1. Same as Java x.compareTo(y) except it also works for nil, and compares numbers and collections in a type-independent manner. x must implement Comparable; arglists ([x y])
00:21durka42does y not have to?
00:21hiredmannope
00:21hiredman~def compare
00:22hiredmanugh, my internet is so slow
00:25durka42hum, flip those three tweets
00:27hiredmanflip?
00:27durka42so that al3x's reply to elazar would have shown up below
00:57jwhitlarkWhat's a clean way to keep asking a user for input until a certain value is received? I'd use a loop in another language, but that's obviously not the right thing here.
01:02hiredman(doc repeatedly)
01:02clojurebotTakes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it; arglists ([f])
01:02hiredman(take-while some-pred (repeatedly read))
01:03arohnermetadata question: If I do (defn foo "my metadata" [x] ...), where does the metadata live?
01:03arohneron the var, the fn or the symbol?
01:03hiredmanthe var
01:03hiredmanand that is not meta data, it is the docstring, which is stored in metadata
01:03arohnerok, so on clojure.org, where it says "Symbols and collections support metadata..." is that incomplete, or are vars collections?
01:05jwhitlarkclojurebot, hiredman: thanks. This stuff gets tricky with side effects.
01:06arohneradditionally, since the metadata for fns contains the source file and line number, that means you can be evil with it. i.e. (defn foo [x] ...), and then in the repl thread (binding [foo bar]), if you do (doc foo) inside the binding, you will see foo's docstring, not bar's, right?
01:06hiredmanarohner: anything that implements IMeta can have metadata
01:09stuhoodjwhitlark: i love that you thanked clojurebot =)
01:09jwhitlarkheh, I'm new here.
01:10jwhitlarkbut it's late, and it reminded me of pythons' Fbot...
01:10clojurebothey, it wouldn't hurt anyone if people thanked me once and a while
01:11arohnerhiredman: http://clojure.org/reader also indicates that the metadata lives on the symbol, not the var
01:12arohnerand to "manually" add metadata to a var, you do (def #^{:doc "my docstring"} a). #^ says it attaches metadata to the next form read
01:12hiredmanarohner: I am not 100% sure, but I am fairly sure that the docstring is on the var
01:12jwhitlarkstuhood: you been here long?
01:12hiredman,(var doc)
01:12clojurebot#'clojure.core/doc
01:13hiredman,(meta (var doc))
01:13clojurebot{:macro true, :ns #<Namespace clojure.core>, :name doc, :file "core.clj", :line 2897, :arglists ([name]), :doc "Prints documentation for a var or special form given its name"}
01:13hiredmannow I am 100% sure
01:13jwhitlark(var not=)
01:14hiredman,(var not=)
01:14clojurebot#'clojure.core/not=
01:14jwhitlarkah. I see.
01:14jwhitlark,(var spit)
01:14clojurebotjava.lang.Exception: Unable to resolve var: spit in this context
01:15stuhoodjwhitlark: i've been following clojure for about a month now
01:15jwhitlarkhuh. clojurebot cant' look into contrib?
01:15hiredmanwhere in contrib is spit?
01:16jwhitlarkdon't remember, that's why I was asking. I think it's in str-utils, just a sec.
01:16stuhoodyou'll need the fully qualified name if it is in another namespace
01:16hiredman,(doc clojure-contrib.str-utils/spit)
01:16clojurebotjava.lang.Exception: Unable to resolve var: clojure-contrib.str-utils/spit in this context
01:16jwhitlark,(clojure.contrib.str-utils/spit)
01:16clojurebotjava.lang.ClassNotFoundException: clojure.contrib.str-utils
01:16hiredman,(use 'clojure-contrib.str-utils)
01:16clojurebotjava.io.FileNotFoundException: Could not locate clojure_contrib/str_utils__init.class or clojure_contrib/str_utils.clj on classpath:
01:17jwhitlarkgrrr beat me to it.
01:17jwhitlarkAnyone know where the source for clojurebot is?
01:17hiredman,(use 'clojure.contrib.str-utils)
01:17clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath:
01:17hiredmananyway
01:17hiredmanclojurebot: where are you?
01:17clojurebothttp://github.com/hiredman/clojurebot/tree/master
01:20hiredman,(doc clojure-contrib.str-utils/spit)
01:20clojurebotjava.lang.Exception: Unable to resolve var: clojure-contrib.str-utils/spit in this context
01:22jwhitlarkexcellent.
01:22jwhitlarkThat give me something to read tomorrow.
01:22jwhitlarkhiredman: you wrote the bot?
01:23hiredmanI, uh, yes
01:24jwhitlarkwas it difficult? I've been looking into writing a clojure xmpp bot, so...
01:24hiredmanactually I have done two xmpp bots
01:24jwhitlarkanything you thought was particluarly interesting?
01:24jwhitlarkyes? are they os?
01:24hiredmanI guess I should publish some of that code
01:25jwhitlarkI would like to look at them.
01:25hiredmanthey where very lite on the features
01:25jwhitlarkI've been struggling a little with using the smack libraries from clojure.
01:26hiredmanone was just a repl over xmpp, it was one of the first things I did with clojure
01:26hiredmanyes, I used smack
01:26hiredmanI seem to recall have trouble with the latest smack, but it has been a few months
01:26jwhitlarkI've been writing python code for the last 8 years, never took java, or lisp, and my C++ was ancient... so...
01:27hiredmanI started working on a wrapper lib, but did not get very far, and was not very satisfied with it
01:28hiredmanI mean it worked, but it is not really pretty
01:28jwhitlarkWhere I ran into problems was the listener that the chat object needed, I've not seen that part of java before, and I'd swear it looked like an anonymous inner block. Does java even have those?
01:29hiredman http://gist.github.com/70695
01:29jwhitlarkHmm. We'll, I'd like to see you code in any case. xmpp is likely to figure heavy into what I'll be working on for a while.
01:29jwhitlarktnx
01:31hiredmanhttp://gist.github.com/70696
01:31hiredman:/
01:32jwhitlarkI've been through stewart's book once, and I've got agrasp on the basics, I trying to find the stuff to take it to the next level.
01:33hiredmanclojure does seem to be hankering for some message passing based distributed solution
01:35jwhitlarkI've started reading xmpp: the definitive guide, and I'm realy excited about the possibilities.
01:36hiredmanxmpp is really cool, but I am not to fond of smack, and smack seems to be the best java xmpp lib
01:36hiredmanclient lib
01:37jwhitlarkWhen I get a little fartner, i'm going to dig out my paradigimes of ai, and see how it translates...
01:37hiredmanExcellent
01:37hiredmanclojurebot could use some ai, it is written in lisp after all
01:38jwhitlarkthat would be a great place to play.
01:38jwhitlarkI'll poke around in the code, and let you know if I have time to work on it.
01:38hiredmancool
01:38jwhitlarkif you don't like smack, what do you like?
01:39hiredmanjwhitlark: I like nothing
01:39jwhitlarkdifferent language, or have you never seen a workable implementation that you approve of?
01:40hiredmanthe only other language I have used to play with xmpp was ruby
01:41hiredmanwhich, uh, I think I looked at xmppr and rbot(xmpp ruby bot framework ontop of some other xmpp lib)
01:42jwhitlarkhmm. I did a bit with xmpppy, which worked out ok. didn't get very far, it's very proof of concept right now.
01:42hiredmanI would have liked something a little simpler then xmppr but exposing more functionality then rbot
01:43jwhitlarkyou think it should be written in clojure?
01:43hiredman*shrug*
01:43hiredmanI mean yes!
01:44hiredman:)
01:44jwhitlarkbigger question, are you interested in writing it?
01:44hiredmanI want pircbot for xmpp
01:44hiredmanheh, no
01:45hiredmanpircbot is the java ircbot lib that clojurebot is ontop of
01:45jwhitlarkhmmmm.
01:46jwhitlarkI'm looking for projects that will help me really learn xmpp and clojure.
01:46jwhitlarkI'll have to thing about that.
01:47jwhitlarkanyway, nice chatting with you, got to run
01:47hiredman#clojure should move beyond legacy irc to MUC xmpp
01:47hiredmanbye
01:47jwhitlarkthat would be very nice. If I meet the central committee, I'll put that to them.
02:28owen1http://blog.urbantastic.com/post/81336210/tech-tuesday-the-fiddly-bits#disqus_thread
02:29owen1interesting site - clojure and couchDB
02:30owen1are there any django/rails equivalents for clojure?
02:31stuhoodowen1: i just heard about Compojure, but i wouldn't call it equivalent
02:31stuhoodhttp://ericlavigne.wordpress.com/2008/12/18/compojure-on-a-slicehost-vps/
02:32owen1stuhood: i am reading about it. it's more modular than rails. more in the lines of sinatra/merb.
02:33stuhoodyea
02:34hiredmansomeone is working on some kind of django port
02:34owen1which rails will follow soon, after the merb merge.
02:35hiredman~ring
02:35clojurebotring is http://github.com/mmcgrana/ring/tree/master
02:38stuhoodhiredman: good to know there is competition
02:38stuhoodi'm going to need to pick one in a few months, so more choices will undoubtedly have sprung up
03:51AWizzArdclojurebot: max people
03:51clojurebotmax people is 149
04:45BrackiWhat's the equivalent of update-in for StructMaps?
06:13hoeckkotarak: thanks for fixing LazyMap so fast!
06:13kotarakhoeck: np. Did it work?
06:13kotarakI didn't do much testing. :/
06:15hoeckkotarak: as far as i can tell (test) it works fine
06:16kotarakhoeck: good to hear :)
06:16kotarakI need some unit tests. But side-effects are so ugly to test. :|
06:24hoeckkotarak: or write a correct version in the first place :)
06:25hoeckbut how would one test the "forcing" of a delay?
06:59kotarakhoeck: I think something like (defn test-helper [x] (swap! some-atom inc) x) and then (lazy-hash-map :a (test-helper 1) :b (test-helper 2)) and then access things in various ways, checking the value of the helper-atom afterwards.
07:02Chousukehm
07:02Chousukeinteresting vandalism on wikipedia :P
07:03ChousukeThe applications paragraph for haskell states "It can be also used to heapsort a heap."
07:09cemerickoddly, when I use clojure.assert-if-lazy-seq=true, an exception is thrown when a lazy-seq is passed to empty?, which of course implies using seq
07:09rhickeycemerick: that's funny
07:10cemerickrhickey: I thought so. I presume that's just an issue with the assert-if-lazy machinery. I mean, (if (seq coll) ...) is *the* way to test for empty (or, non-empty) colls, yes?
07:11rhickeycemerick: I don't think that's really happening
07:11rhickey,(empty? (lazy-seq nil))
07:11clojurebottrue
07:11rhickey,(empty? (lazy-seq [42]))
07:11clojurebotfalse
07:12rhickey,(if (lazy-seq [42]) 2 3)
07:12clojurebotjava.lang.Exception: LazySeq used in 'if'
07:13cemericknot sure what to say....
07:13rhickeycemerick: do you have a reproducible case?
07:13lisppaste8cemerick pasted "rhickey: exception out of empty?" at http://paste.lisp.org/display/76189
07:14cemerickI'm going to switch out jars and see if that test that uses empty? works. I'll see if I can prune things down to something simply repeatable
07:15cemericknote that there's no cause trace after that particular stack
07:15rhickeycemerick: maybe the code in your lazy seq is itself testing a lazy seq with if?
07:16cemerickmaybe. That should result in a 'caused by...' addendum trace, tho.
07:17cemerickam I right in remembering that the current lazy impl doesn't bring the significant performance improvements that the stream impl would have brought?
07:23rhickeycemerick: lazy by itself, no
07:24rhickeybut lazy brings an important change in the contract of the sequence fns that opens other doors
07:36ChouserI've fallen off the wagon.
07:36ChouserThere are 53 threads with messages I haven't read.
07:37Chousercemerick: really? I haven't found it to be a problem for new code.
07:39cemerickChouser: That's just a projection. I'm going through tweaking our existing code to be lazy-friendly, and a lot of tight stuff is needing a bunch of "extra" seq calls (e.g. fns that were expecting seqs and returned seqs, but now return sequences).
07:39cemericklazy is making me work harder! ;-)
07:40rhickeycemerick: you are using next instead of rest when possible for that?
07:41Chouserwell, you could be right. But as it was I had to think a bit to make sure I couldn't have a collection when nil punning. So now I don't have to think more times, just use different criteria.
07:42cemerickrhickey: yeah. I actually just did a global F&R for (rest => (next. A solid chunk of the tests are passing, so I'm hopeful.
07:43rhickeyusing next will leave all of you local loops eager, leaving only nil puns of sequence fns like map/filter
07:44Chouserso is that the right terminology now? something that returns a seq will return nil instead of an empty collection, but most of the library functions return sequences?
07:45ChouserIf the answer is "no", I'll go read Halloway's post again.
07:45cemerickChouser: I'm just blowing smoke at the moment. I admit I honestly don't see the benefit of the lazy changes, but my brain is tiny and I'm probably just having a blub problem.
07:45rhickeyChouser: I think that would be good, haven't been consistent enough about it, doc strings need audit
07:46Chouserwould 'seq?' need a new name?
07:46rhickeyI don't think so, sequences are seqs
07:47Chouserbut (seq? (seq x)) may return nil, which seems a little surprising.
07:47Chousersorry, false
07:47rhickeyThere were twp types, people were confused, now there is one, people are confused :(
07:47Chouser,(seq? (seq []))
07:47clojurebotfalse
07:48Chouserwell ... when there were two, I was confused. Now there is one and I'm mearly uncertains as to which words to use when.
07:48rhickeyseq tries to get a seq but might not
07:48cemerickwha?
07:48rhickeydoesn't make nil a seq
07:48cemerickwow, (seq? (seq [])) definitely => false
07:49cemerick,(doc seq?0
07:49clojurebotEOF while reading
07:49cemerick,(doc seq?)
07:49clojurebot"([x]); Return true if x implements ISeq"
07:49Chouserrhickey: ok, that's not a bad way to think about it.
07:49cemerick,(doc sequence?)
07:49clojurebotjava.lang.Exception: Unable to resolve var: sequence? in this context
07:49cemerickwasn't there a sequence? at some point?
07:50rhickeyChouser: after rereading Stu's sequences chapter I realized adding precision here doesn't help much, easier to just doc returns nil or returns empty sequence
07:50Chouserthere's no predicate for 'seq-or-nil?', I assume because nobody's ever needed it.
07:50rhickeyick
07:52rhickeythere's no getting around sequences are chains of seqs, and, a seq can be treated as the sequence of things starting with it
07:53rhickeyrather than treat the return values of seq as some sort of unified type, just treat it as something/nothing
07:54rhickeyread seq as "seek (to first)", nil if no first
07:55rhickeycemerick: there was and people were confused
07:55rhickeythe types were a bit tricky too, no empty seqs, only empty sequences. It made sense to me, but...
07:56cemerickpeople will always be confused
07:57Chouserat least now the word "sequence" is free now, and can be used more casually without undue fear
07:57cemerickpre-lazy, it was pleasantly convenient to explain the state of play as "it basically works like python w.r.t. empty lists => false"
07:57Chouseroh dear
07:57rhickeyChouser: yeah, as I said, they can be used interchangeably, seqs don't constitute a different type
07:57rhickeycemerick: that was never true
07:58rhickeynil was not the empty list and () was not false
07:58cemerickheh. Well, that's how I thought of it.
07:58cemerickI knew the formalism, but that didn't interfere with my coding. :-)
07:59rhickeyI thought of it as eos was false, and still do, just now the sequence functions return collections
08:00rhickeyseq brings me to my something/nil world, and next keeps me there
08:01Chouseryes, I now think of sequences as always collections instead of sometimes being nil.
08:02rhickeyyes, sequence => collection, seq => cursor
08:02rhickeybut not distinct from a type perspective
08:03ChouserI've never thought of seq as a cursor. cursors are very tied to mutation in my mind.
08:03rhickeylocation?
08:04Chousercons cell or nil
08:04rhickeywhat about ()
08:04rhickey?
08:05cemerickrhickey: () was never an issue before -- () was emitted as nil by all of the std fns, and any other good fns that one might write
08:05rhickeycemerick: it seriously wasn't, there was a proper notion of an empty list
08:05rhickeydistinct from nothing
08:06rhickeythe list of groceries could have nothing on it or you might not have made it yet, distinct
08:06rhickeynil was eos
08:06rhickeyno more
08:07rhickeynil is no more a list than it is a vector or string
08:08Chouserhm. well, previously the only () was an empty list, so that was outside of my concept of seq as "cons cell or nil"
08:08cemerickrhickey: formally, sure. However, in pre-lazy clojure, (filter pos? [-2]) => nil, not ()
08:08rhickeyChouser: right and () wasn't a seq then
08:09Chouserbut (pop '(1)) was (). I think.
08:09rhickeycemerick: right, that's the change, sequence functions now return collections
08:09rhickeyChouser: right, because pop was a list, not seq, function
08:09cemerickwell, that's what I meant by '() was emitted as nil by all of the std fns'
08:10cemericktrue, insofar as one could ignore the difference between colls and seqs for predicates
08:10rhickeycemerick: no, seq fns returned non-empty seqs or nothing, they never returned empty collections
08:11rhickeycemerick: you never could ignore colls/seqs for predicates and still can't (if [] ...) (if {} ...)
08:11rhickey[], (), {} are all true
08:11rhickeyalways have been
08:12rhickeyyou could use the something/nothing protocol in predicates, but now the sequence fns don't use that protocol
08:13rhickeysince knowing there's nothing is eager
08:13cemerickrhickey: yes, I know that. But '() was never returned by seq fns, as you said. Insofar as one's fns were seq-oriented, nil and '() were functionally identical.
08:13cemerickWe're in total agreement, I think. I'm just far, far less precise in my terminology.
08:14rhickeythese kinds of discussions are important, it all makes sense to me but I want to understand how it doesn't to others, also how best to describe things
08:16cemerickyou are more patient than I, thankfully :-)
08:17Chouserwell, that was fun. Now, what about Vars implementing Named?
08:18rhickeyChouser: why?
08:18rhickeythey might not be
08:18Chouserso I can use them in a heirarchy
08:19rhickeyOn today's agenda is watches
08:19Chouseryou haven't looked at error-kit
08:19Chouserah, good enough. I'll leave you alone, then.
08:20rhickeyI'm going to make them synchronous, and I'll see if I can pass both old/new values
08:20rhickeyleave it to clients to do change detection
08:21Chouserperfect. I seem to recall that the lack of notification on non-changes made my one use case more difficult.
08:21cemerickI was going to bother rhickey about serialization and such today, but I think I spent my token on the lazy stuff. :-P
08:23rhickeyChouser: I still don't know how that complicates transactions, the other references are easy
08:23Chouserah, sure.
08:23rhickeyclojurebot: translate
08:23clojurebotExcuse me?
08:25Chousergoogle says: just put algebraic data types Clojure gradually we reimplement Haskell: "VIVAT academia, vivant professores
08:25rhickeyyeah, I wanted the last bit
08:26rhickeysomething about life/living
08:27Chousermaybe an idiom for celebration. perhaps facetious.
08:27durka42it says "they just put algebraic data types in clojure"... that isn't quite true, is it?
08:27Chouserah, "Long live the academy! Long live the teachers!"
08:28Chouseraccording to http://www.newfoundations.com/Gaudeamus.html
08:28durka42clojurebot: translate acaban de meter tipos algebraicos de datos en Clojure, poco a poco estamos reimplementando Haskell from es to en
08:30Chousukeheh, we had to sing that song in the graduation ceremony from upper secondary school... Well, part of it at least
08:34Lau_of_DKChouser: I fixed that problem we discussed yesterday, turns out LD_LIBRARARY_PATH needed some more .so files :$
08:35Lau_of_DKoh, and before you say "Oh, does that mean Sofiaba now supports dynamic transparent water and real physics that affect every object" then let me reveal that, yes, thats what it means :)
08:43rhickeyIn the time it took me to get through the group's overnight messages, there were 10 more...
08:44Lau_of_DKI understand, I had to give up on the group :(
08:44Lau_of_DKI know - I really appreciate and respect your dedication to the Clojure community btw, dont think I ever told you, but thanks alot
08:45hoeckLau_of_DK: are you playing with the jMonkeyEngine and/or the jme-physics???
08:46Lau_of_DKand
08:46hoeckcool, you got something to show off?
08:46Lau_of_DKI'll do the final testing tonight, but it seems like Ive got a beautiful island, rendering in the middle of an active ocean and when you hit a key, a huge sphear with a picture of my daughters falls from the sky and bounces off the island
08:47Lau_of_DKhttp://wiki.github.com/Lau-of-DK/sofiaba <-- I show off features as I go along on this project-site, I'll update it tonight with the ocean/physics stuff
08:48hoeckwow, and is it usable from clojure, i mean, really interactive object manipulation like in the story of this common-lisp game shop (naughtydogs) or so?
08:48hoeckand how is the performance?
08:48Lau_of_DKYea, fully useable from Clojure, you drive the 3d engine from 1 thread while maintaining a repl in another
08:49Lau_of_DKThe performance - I'll have to test tonight, last time I checked it ran about 800 fps with a large ImagedBasedHeightMap + Detailmap
08:49hoecksounds like a dream comes true :)
08:49Lau_of_DKFelt like it too when I got it working :)
08:50hoecki have read the jme physics tutorial few days ago .. and wondered wether it may work with clojure
08:52hoeckand i spend one day figuring out how to compile jme and jmephysics on my machine
08:55Lau_of_DKYea that part was a little tricky, specially getting jmephysics to work in the same project as Jme2.0, but it looks like its working now, I've tried to describe in the README how I did it
08:55Lau_of_DKMaybe it'd be a good idea to include the LIBRARY_PATH files...
08:56Lau_of_DK8.3 MB
08:56ChouserThat's a big LIBRARY_PATH
08:56Lau_of_DKand besides those, you need jme2.0.jar, jmephysics.jar, odejava.jar...
08:56Chouseroh, the files are 8.3MB. I guess that make more sense.
08:56Lau_of_DK8.3 isnt really that big is it? these days I mean? :)
08:57hoeckno, not really
08:57Lau_of_DKJust to save people the trouble of having to compile and setup the whole thing themselves
08:57ChouserI thought you were saying the env var itself was 8.3MB. I was a bit surprised.
08:58Lau_of_DKjme2.0 is 16 mb and jmephysics is 197 kb... :)
08:58hoeckbefore trying to use it with clojure, I wanted to be sure that I'm able to compile all those deps by myself
08:59Lau_of_DKk, I downloaded the precompiled jme-2.0.jar
08:59hoeckthere are a lot of abandoned graphics-game-physics project out there
08:59Lau_of_DKthen svn'ed down jmephysics and just ran
08:59Lau_of_DKant release.all -lib /path/to/jme-2.0.jar
08:59hoecks/project/projects
09:37cemerickthis is totally OT, but: Peter Norvig (of PAIP fame) used some of my code, and I'm just as giddy as a schoolgirl about it. See: http://blog.snowtide.com/2009/02/26/whoa-peter-norvig-used-some-of-my-code
09:38Lau_of_DKuuh congratz :)
09:39Chousercemerick: nice
09:39cemerickI guess it's sort of like the Rolling Stones doing a cover of some song from an out-in-the-wilderness folk musician or something.
10:20cooldude127i just discovered the factor language, and it's pretty cool, and then i noticed the persistent data structures in the library list
10:20Chouser:-)
10:20cooldude127factor's persistent vectors are based on clojure's
10:21cooldude127it says it right there
10:21Chouseryup. someone ported them to work with Scala as well, I believe.
10:21cooldude127wow, i didn't realize how influential clojure was already
10:21cooldude127that's really cool
10:22WizardofWestmarcyeah everyone's been drooling over them throughout the programming language land it seems like, constant references to them come up.
10:22WizardofWestmarcBut they're so awesome it makes sense :)
10:22cooldude127yeah, persistent data structures are awesome
10:27HolcxjoPersistent data structures are maybe like static scoping? An idea that people considered theoretically interesting but impractical for real use until they were proven wrong by an implementation...
10:28WizardofWestmarcholcxjo: wouldn't surprise me, they've certainly been mentioned before
10:29HolcxjoWizardofWestmarc: But were they really used somewhere?
10:29Chouserhm, the clojure log pages don't show clojurebot tweet parroting
10:30WizardofWestmarcHolxcjo: Not that I know of, which is why I was agreeing with you...
10:35p_lhmmm, what do you mean by persistent data structures?
10:36WizardofWestmarcp_l: http://en.wikipedia.org/wiki/Persistent_data_structure
10:37rhickeysync watches in svn 1308 - testing help appreciated
10:37p_lI think many people used their own implementation through Red-Black trees for a long time
10:38cooldude127p_l: all the data structures in clojure. they are immutable, where operations efficiently produce new structures by sharing data with the old one
10:38cooldude127s
10:38p_lcooldude127: I know. I referred to the fact that people _outside_ functional languages probably used those :-)
10:39cooldude127oh
10:40Chouser"watch" is synchronous and "watcher" not, eh?
10:40yasonWas there a map-like doseq that consumes all sequences in parallel (unlike (for))? Or do I have to use (loop ..recur) ?
10:40clojurebotsvn rev 1308; interim checkin - needs testing - made watches synchronous, send old+new state, added add-watch, remove-watch, redefined add-watcher in terms of add-watch
10:40clojurebotsvn rev 1309; interim checkin - needs testing - made watches synchronous, send old+new state, added add-watch, remove-watch, redefined add-watcher in terms of add-watch
10:41p_lcooldude127: In a way, classical virtual memory on unix systems is a form of persistent data structure (not fully persistent usually)
10:41rhickeyaargh, core.clj changes didn't make it into 1308 - use 1309
10:41cooldude127rhickey: that's the problem with SVN :)
10:41rhickeyChouser: watcher may go away, this was to make it least disruptive, watcher being an agent implies async
10:42Chousercooldude127: what vcs doesn't have that problem?
10:42rhickeycooldude127: that's the problem with not hitting save :)
10:42cooldude127some vcs's like git allow you to rewrite the history, merging commits
10:42cooldude127git rebase -i
10:43rhickeyfeedback welcome, add-watch should be fully powered for all needs I hope
10:46Chouseryikes. I'd much rather document a revision as bad than try to claim it never existed.
10:46cooldude127Chouser: it's good for situations like this. you just commit, what you missed, run that command and squash them together
10:47cooldude127ideally you'd probably do this before you push
10:49ChouserI've got some background in RPN. It makes me panicky. I suppose I should try to get past that...
10:50cooldude127i'm trying to get past it too, cuz otherwise it seems like a pretty awesome language.
10:50cooldude127the emacs environment (FUEL) is almost as good as slime
10:51WizardofWestmarcstack based languages weird me out for some reason
10:51WizardofWestmarcthough I should probably look at factor at some point
10:52Chousernormally, arity becomes a desperately important detail of a func to keep in mind. Perhaps factor has something to mitigate that.
10:53yasonWizardofWestmarc: I guess it's Forth the trouble sometimes :)
10:53cooldude127LOL
10:53WizardofWestmarcgroan
10:54yasonBut about doseq? Anyone?
10:55cooldude127yason: i'm not sure i understand what you were asking for
10:55yasoncooldude127: In python I would write it like this: for item1, item2 in zip(seq1, seq2): ...
10:56cooldude127yason: are you using it for side-effects?
10:56yasoncooldude127: that is, to "do" two seqs at the same time. Yes, for side-effects (=drawing).
10:57cooldude127yason: my first instinct is a (dorun (map #(blah %1 %2) seq1 seq2))
10:57Chouseryeah, the way to run seqs in parallel is 'map' or perhaps 'zipmap'
10:57yasoncooldude127: ok, I was thinking about map but thought I'd fish for an existing construct first
10:57Chouserso either as cooldude127 suggested, or (doseq [[x y] (map vector xs ys)] ...)
10:59yasonChouser: all right then. The manual construction+deconstruction just bothered me but if I can't do it more simply, then it's ok.
10:59yasonThanks.
11:02Chouserif doseq could do it for you, what would the syntax look like?
11:03Chouser(doseq [:parallel [x y] [xs ys]] ...) ?
11:04Chouser(doseq [x xs :with y ys z zs] ...), where x and y would run together, and z would be nested inside?
11:05yasonChouser: or a variant like pdoseq with the same syntax except that the prefix 'p' is already taken
11:05Chouserthat wouldn't allow you to mix nested and parallel in the same construct.
11:05Chousukewhat about some kind of destructuring? (doseq [[x y] [xs ys] z zs] ...)
11:06ChouserChousuke: that's already valid, but means something else.
11:06Chousukehm.
11:06Chouser,(doseq [[x y] [[1 2] [3 4]]] (prn x y))
11:06clojurebot1 2 3 4
11:07Chousukeah, right.
11:07yasonChouser: Destructuring could do it if it was clear enough to distinguish from the basic doseq
11:08ChouserI think the use of (map vector xs ys) and destructuring is relatively clear, but it's not very efficient.
11:08ChouserI think doseq could do the parallel case very efficiently if it knew that's what it was supposed to do.
11:09yasonYup, there's nothing much "doing" to it after all
11:09Chouser(doseq [[x y] :zip [ys zs]] ...) ?
11:10Chouserexcept with, you know, corrected names
11:10Chouser:-)
11:10yasonkeywords do stick out but it's not immediately clear that which items belong together
11:10Chousukesomething like (doseq [(:parallel x xs y ys) z zs]) would look okay to me
11:11yasonbetter.
11:11Chousukeperhaps with the parallel forms in a vector as well
11:12yasonI'd vote for plain parentheses if they only stood out better
11:12ChousukeI mean like (:parallel [x xs y ys]) so it can support destructuring
11:12yason(doseq [([x y] [xs ys]) z zs] ...)
11:12yasonthe "[([" part looks horrible :)
11:13Chouser(doseq [(x xs, y ys) z zs] ...)
11:13yasonThat's cleanest so far.
11:14ChouserI have no reason to think rhickey would accept such a feature. :-)
11:14rhickeyexactly
11:14Chouser:-(
11:14rhickeyhow often do you need parallel + sequential together?
11:14yasonwell that's why we have macros, anyway
11:15ChouserI need parallel for side effects infrequently enough -- adding any other qualifier pushes it off the bottom of the curve for me.
11:15yasonrhickey: can't think of many cases. But parallel occurs semi-regularly
11:15rhickeycould have doseqs or something that looked like doseq but was parallel
11:16rhickeymixing the two seems very confusing
11:16rhickeyMy next pet addition for for/doseq is :let
11:16Chouserfor non-seqs, right? yeah, I've wanted that.
11:17rhickeyfor anything you'll need to use twice, like in a :when plus in the expression
11:17ChouserI've even written things like (for [x xs, y ys, z [(+ x y)]] ...)
11:18rhickeyow
11:18rhickeyright, :let is for that
11:18yasonrhickey: sounds useful
11:22yasonChouser: (dopseq [x y, xs ys] ...)
11:35Chousercalling seq the second time on a lazy-seq is free now?
11:37Chouserwell, anyway, the new add-watch works beautifully on an agent, which is the only test case I have laying around.
11:38rhickeyChouser: nothing is free, and I can't promise there won't be different kinds of lazy seqs for which it matters (i.e. functional seqs that recalc every the time), but right now seq on lazy-seq is fast
11:38Chouserok
11:46djpowellI wanted to create a decorator pattern class that implemented an interface and allowed a delegate implemenation to be passed in, and added some instrumentation to some of the methods. I ended up doing it in Java cause it just seemed very awkward to do with gen-class. Is that typical? Are there any helpers for doing that kind of thing?
11:47Chouserdid you look at proxy?
11:50djpowellthe instrumention records some stuff to a map, and I wanted to add a method to get hold of the map.
11:50djpowellalso, i'd have to implement all of the methods, when it'ld be better if I could just default them to call super
11:51Chouserthe class created by proxy already takes a map of methods, and for methods that are not given defaults to calling super
11:53djpowellhmm, sry I was confused there, i'd want them to default to calling the method on the delegate instance
11:56djpowellperhaps it might be best to use DynamicProxy directly, and write some sort of framework for adding before/after/around advice to the methods
12:11Chouserexample of new add-watch usage: http://gist.github.com/32494
12:14durka42so watchers are no longer agents?
12:14Chouserwell, there's still add-watcher which uses an agent
12:15Chouserbut that's built on top of add-watch, which takes a fn and calls it synchronously.
12:15leafwChouser: why do you call vec on the returned list of the inner map call in parse-grid [s] ?
12:15leafwChouser: just curious.
12:17Chouserleafw: I do indexed lookups on it.
12:18Chouserit's a vector of vectors so I can get the value at x,y in constant rather time.
12:18leafwChouser: I see, parse-grid returns a vec of a vec.
12:18Chouserright
12:18leafwthanks.
12:18Chousernp
12:20leafwthat's a great example, thanks for sharing.
12:25shooverdrewr: (slime-setup '(slime-repl))
12:25shoover
12:25shooveryou need that now
12:26shooverI put it in my (swank-clojure-config) form
12:27drewrshoover: Thanks, that works.
12:27drewrI hadn't updated since Dec!
12:33drewrI wonder if slime-fancy is only for CL.
12:52shooverI couldn't see any useful difference loading slime-fancy
12:55drewrshoover: Yeah.
13:22Chouserclojurebot: not useful.
13:22clojurebotI don't understand.
13:23Chouserme either
13:25rhickeyhas anyone tried: http://www.mongodb.org/ ?
13:26danlarkinseems a lot like couchdb on first glace
13:26danlarkinglance
13:28rhickeyI know they were trying to make their Java driver more palatable to JVM dynlangs like Clojure
13:34p_ldanlarkin: Except developed in inferior language ;-)
13:40rhickeyanyone try the new watches?
13:42ChouserI ported my euler solution, in case you missed it: http://gist.github.com/32494
13:46drewrChouser: I've been doing some research with it as well.
13:47rhickeyChouser: did it get easier with watch vs watcher?
13:47Chouserrhickey: very much so.
13:47drewrIs (seq ...) the canonical approach to fixing stuff like (when (re-seq #"foo" s) ...)?
13:48Chouserdrewr: for regex in particular, look at using re-find instead of re-seq
13:48Chouserbut otherwise, yes.
13:49drewrem
13:50drewr(wrong window)
13:50drewrChouser: Cool
13:50rhickeyI'm thinking -seq fns should still be eager...
13:53ChouserI don't know. re-seq on an mmap'ed file works well, and I don't know that I'd want that any more eager than necessary.
13:53rhickeyjust seq/nil eager
13:54Chouseroh, for the first ... thing. cell?
13:55rhickeyright, so re-seq still punned, just like (seq any-collection) does
13:58ChouserSo far the most annoying has been (seq (filter identity (map foo coll)))
13:59Chouserthat's a whole lot of words to say something that seems conceptually rather simple
14:02rhickeyif you're throwing away the seq why not use some ?
14:03ChouserRight, but I'm not. That goes into an if-let or similar.
14:08drewrSo is concat fully lazy now?
14:09drewrI see there's still lazy-cat, so maybe not.
14:09Chouserit's still not a macro, so its args are evaluated.
14:09drewrChouser: Oh, good poitn.
14:09rhickey99% of all lazy-cat calls could become concats now
14:09Chouserif all its args are fully-lazy, I think it amounts to roughly the same as concat now
14:25durka42couldn't this error message be more helpful?
14:25durka42#<CompilerException java.lang.IllegalArgumentException: No matching method found: replaceAll for class java.lang.String (REPL:14)>
14:25durka42what it meant was: Exception: method replaceAll called with wrong number of arguments
14:27Chouseror the wrong types of arguments
14:27Chouseror there's a typo in the method name
14:29durka42well "no matching method repalceAll" is true
14:29durka42i guess the problem is it doesn't reveal the reason behind no matching method
14:29durka42maybe the compiler doesn't know
14:33ChouserI thought rhickey posted briefly recently about using datalog to support type checking of some kind. Anyone got a link?
14:47drewrrhickey: Would this be all of them? http://gist.github.com/71059
14:51ChouserRaynes: ?
14:51Raynes?
14:52Raynes:o
14:52rhickeydrewr: looks like it - iterator-seq and enumerator-seq are probably already seq/nil, and file- xml- fall out of tree-
14:53drewrrhickey: k
14:56Chouser(doseq [x xs, y ys :let z (+ x y) :when (< z 5)] (prn z)) ?
14:56Chouser(doseq [x xs, y ys :let [z (+ x y)] :when (< z 5)] (prn z)) ?
14:57pjstadighey all
14:57pjstadigi've been experimenting with terracotta and clojure
14:58pjstadigi've run into a snag with Keyword
14:58hiredmanNeat.
14:58pjstadigsince Keyword doesn't implement hashCode, when they're used as keys into a map it duplicates entries
14:59gnuvinceHoly crap...
14:59gnuvincehttp://sardakcode.blogspot.com/2009/02/litterate-programming-in-clojure.html
14:59gnuvince(.replaceAll (.replaceAll (.replaceAll st "&" "&amp;") ">" "&gt;") "<" "&lt;"))
14:59pjstadigi verified that it works by just adding a simple hashCode method to Keyword
14:59durka42,(reduce #(.replaceAll %1 (first %2) (second %2)) "stu&ff<goo>" {"&" "&amp;" "<" "&lt;" ">" "&gt;"})
14:59clojurebot"stu&amp;ff&lt;goo&gt;"
14:59rhickeyChouser: the second, due to (for [x xs :let [foo (bar x)] y ys...
15:00hiredmangnuvince: indeed
15:00pjstadigis it possible to add a hashCode method to Keyword? or is that not a good idea?
15:00rhickeyof else only one let local per :let
15:00rhickeybbl
15:00Chouserah, good point.
15:00gnuvince,(reduce #(.replaceAll %1 (key %2) (val %2)) "stuff & <goo>" {"&" "&amp;" "<" "&lt;" ">" "&gt;"})
15:00clojurebot"stuff &amp; &lt;goo&gt;"
15:01hiredmangnuvince: yes
15:01Chouser(zipmap "'<>\"&" (map #(str \& % \;) '[apos lt gt quot amp]))
15:01Chouseroh, that just builds the map
15:01gnuvinceyah :)
15:01Chouser(apply str (map #(escape-xml-map % %) text))
15:02Chouserhalf of one, six dozen of the other...
15:02durka42,(.hashCode (keyword "blah"))
15:02clojurebot19152757
15:02gnuvinceIt must be a sure sign that Clojure is becoming popular when we have code that could be submitted to the DailyWTF :)
15:02durka42pjstadig: ^^
15:03pjstadigthe problem is there is no hashCode method on the Keyword class
15:03pjstadigit returns the memory address of the instance
15:03pjstadigwhich is different for different JVMs, even if the object is shared by Terracotta
15:03hiredmanOh
15:03hiredmaninteresting
15:04pjstadigso (assoc {:a :b} :a :b) returns {:a :b, :a :b}
15:05pjstadigwell if the original hash was shared across JVMs anyway
15:05Chouserbecause within one jvm they're interned and .hashCode would be the same.
15:05pjstadigright
15:05pjstadigif you share the hash
15:05pjstadigand then do (assoc some-hash :a :b) you would get {:a :b, :a :b}
15:06pjstadigsimply adding hashcode(){return this.sym.hashCode();} fixes it
15:07pjstadigidentical? will return true for a distributed keyword and a local keyword
15:07pjstadigbut the hash is different
15:07Chouserah, interesting.
15:08hiredmanthat is what I said
15:09Chouserhiredman: you're right. it is.
15:10Chouserexcept you said Oh and I said ah
15:11pjstadigactually i said that wrong
15:11pjstadigif you pull a keyword out of terracotta it will hash the same as a locally interned keyword
15:11pjstadigbecause they're in the same jvm
15:11pjstadigbut what happens is that PersistentHashMap caches the hash value of each key that it adds
15:12pjstadigand on a different jvm when you try to add the same keyword as a hash key the cached value (a memory location from another JVM) and the local hash value (the memory location from the local JVM) don't match
15:12pjstadigso it adds the same key twice
15:12hiredmanOh
15:13hiredmanhmmmm
15:13pjstadigis there any reason not to add hashCode() {return this.sym.hashCode();} to the Keyword class?
15:15durka42what if you had a map like this { 'sym "symbol" :sym "keyword" }
15:15pjstadigwell we could make a more interesting hashcode method for Keyword if we want, but i don't think hashcodes are required to be unique
15:16durka42actually, i guess it wouldn't matter if the code calling .hashCode checks type first
15:16pjstadigthe javadocs for Object say hashcodes should be equal if the objects are equal (i.e. a.equals(b) returns true), but they are not required to be different if the objects are unequal
15:17pjstadigso i guess technically hashCode() {return 1;} is valid
15:18pjstadigthough not the most performant
15:23Chouserpjstadig: it seems likely to me that such a change would be accepted
15:24pjstadigk
15:24Chouserpjstadig: the symbol has already computed its hash anyway, so I wouldn't expect any performance issue.
15:24pjstadigi'd submit it but i haven't submitted a CA :-/
15:25pjstadigi hate to beg, but it's such a small change :0
15:25pjstadig:)
15:25Chouserpjstadig: just bring it up on the google group with your description and test case or whatever.
15:25pjstadigk
15:25Chouserwithout a CA it's better not to include code.
15:25rhickeypjstadig: hang on...
15:25ChouserI mean it's better not to include in your message code that might be useful to have in the code base.
15:26pjstadigyeah rich?
15:26Chouserpjstadig: ooh, you may have just gotten a fastpass.
15:27hiredmanit might be another few minutes
15:28clojurebotsvn rev 1310; gave Keywords non-identity hashCodes
15:28pjstadigthat was easy :)
15:29pjstadigthanks rich!
15:29rhickeynp
15:30hiredmanit would be great if you could post anything about working with terracotta to the group
15:30rhickeyyes, please
15:30pjstadigi'm working on a blog post
15:30hiredmanExcellent
15:30pjstadigit's been pretty easy so far
15:30pjstadigi've only been experimenting for a couple of days
15:36hiredmando companies offer jvm hosting? like you don't get access to the underlying OS, you just upload a jar file and they run it in a sandboxed jvm?
15:37durka42~google shared jvm hosting
15:37clojurebotFirst, out of 74000 results is:
15:37clojurebotPrivate/Shared JVM Hosting Solution - HostIgnition
15:37clojurebothttp://www.hostignition.com/index.php?page=jsp-servlets
15:38durka42those are servlets though
15:38Chouserhm, might be sufficient.
15:39hiredmanJVM Restarts: 5 Times Every 24 Hours
15:39hiredmanI lol'ed
15:40ChouserI thought someone said they got a Clojure app working here: http://www.stax.net/
15:41hiredmaninteresting
15:41StartsWithKhi
15:41durka42,(.startsWith "StartsWithK" "K")
15:41StartsWithKhow can i construct proxy for given interface?
15:41clojurebotfalse
15:42hiredmanStartsWithK: with proxy ...
15:42StartsWithKdurka42: (.startsWith "Kresimir" "K") :)
15:42StartsWithKuff, i meant dynamic construction
15:42durka42cloudjure :)
15:43StartsWithKi give it something like base interface and map of methods and names
15:43durka42that sounds kinda like a proxy
15:43StartsWithKdo i need to use java.lang.reflect.Proxy
15:43Chouserah, here it is. Compojure on stax: http://groups.google.com/group/compojure/msg/7142fd318e0f45d0
15:43hiredmanthat is more or less what (proxy ...) does
15:43StartsWithKor is there something like that in clojure
15:43Raynes(doc proxy)
15:43clojurebotclass-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, must be first. If not provided it defaults to Object. The interfa
15:44StartsWithKi'm looking in clore_proxy.clj and see construct-proxy and init proxy
15:44cemerickit would be great if one could define rough "cost" values for each test-is test, and then test-is would run your tests in increasing order of cost -- run the shorter tests first, keeping test/fix cycles small.
15:44hiredman(proxy [someInterface] [] (someMethod [someArg] ...))
15:44StartsWithKRaynes: i don't know what interface it is before runtime
15:45RaynesThat sucks.
15:45StartsWithKso more like (new-proxy Interface {'method (fn [] ..)})
15:45hiredmanuh
15:45hiredmanyou are making this way too hard
15:45StartsWithKi see construct-proxy will do: (. Reflector (invokeConstructor c (to-array ctor-args))))
15:46hiredmanhave you tried using proxy?
15:46StartsWithKyes, that won't work
15:46StartsWithKi will find the name of interface i want to implement on runtime
15:46StartsWithKwith method i shoudl implement
15:48hiredmanthat sounds like a bad idea
15:48StartsWithKdocs for init-proxy say that they can take proxy and map of name function mappings
15:49StartsWithKand they will update my proxy with them
15:49ChouserStartsWithK: everything you need is there
15:49StartsWithKbut i don't know how to construct that proxy
15:49ChouserStartsWithK: get-proxy-class
15:49ChouserStartsWithK: construct-proxy
15:49ChouserStartsWithK: init-proxy
15:50StartsWithKthats is a correct order?
15:50StartsWithKget-proxy-class says "Takes an optional single class followed by zero or more interfaces."
15:50ChouserI've not done it, but it seems likely.
15:51StartsWithKi take it optional class can be interface too
15:51StartsWithKor i will need (get-proxy-class Object Interface)
15:52Chouserif they're all interfaces, order shouldn't matter
15:52Chouserif there's a class, it must be listed first.
15:52StartsWithKso i'm fine to skip Object as first argument
15:52Chouseryou'll have the class object at runtime, or a string?
15:53StartsWithKclass object
15:53StartsWithKand string for method name i should implement
15:53Chousermultiple interfaces, or just one?
15:53StartsWithKjust one
15:54StartsWithKi know method i will implement has sig ? -> Void
15:54StartsWithKand know it has that one argument
15:54StartsWithKbut it's type will be unknown to me
15:57Chouser(defn proxy-one-method [c meth fn] (doto (construct-proxy (get-proxy-class c)) (init-proxy {meth fn})))
15:58Chouser(let [d (proxy-one-method clojure.lang.IDeref "deref" #(str "hello from:" %))] @d)
16:01StartsWithKlisppaste8: help
16:01lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
16:02lisppaste8StartsWithK pasted "Dynamic proxy construction, it works" at http://paste.lisp.org/display/76216
16:02StartsWithKit worked, thans everyone
16:03ChouserStartsWithK: note that if you use 'proxy' directly, you get the class file when compiling AOT
16:03Chouserthe way you're doing it you won't.
16:03StartsWithKi know, i hope i don't
16:04StartsWithKbut this will not construct any proxy classes with aot?
16:04Chouserhm, I guess it may depend on how/when you call it.
16:08StartsWithKclass type is clojure.proxy.java.lang.Object$ActionListener in that paste
16:08StartsWithKshoudn't it be clojure.proxy.java.awt.event.ActionListener
16:09StartsWithKor is it that implementing only interface defaults to Object as base class
16:09Chouserit uses the superclass name followed by interface names
16:10StartsWithKis that name part of the 'abi', can i count on it?
16:10ChouserNo, I wouldn't think so.
16:11Chouseryou can call 'class' on an instance at runtime to get the class object, though.
16:12StartsWithKtrue, i should not look at class string names at all i guess
16:12StartsWithKas a side quetion, not related
16:12StartsWithKis there any way to covert class names generated by clojure back to clojure names
16:14Chouseroh, for functions and such?
16:14StartsWithKyes
16:14Chousermany of those functions don't have any name.
16:14Chouserbut anyway, no, not as far as I know.
16:15StartsWithKi was thinking integrating code coverage tool with test, cobertura to be exact
16:15StartsWithKand looking how it spits a lot of weird names for scala code, it will do the same for clojure
16:16StartsWithKok, i have more questions :) hehe
16:17StartsWithKin rev1230 macro now returns Var, for what can this be used?
16:18Chouseroh, that's mainly for consistency with defn and def, I think.
16:18ChouserVars often have useful metadata
16:18StartsWithKi still can't take value of macro?
16:18Chouser,^#'proxy
16:18clojurebot{:macro true, :ns #<Namespace clojure.core>, :name proxy, :file "core_proxy.clj", :line 249, :arglists ([class-and-interfaces args & fs]), :doc "class-and-interfaces - a vector of class names\n\n args - a (possibly empty) vector of arguments to the superclass\n constructor.\n\n f => (name [params*] body) or\n (name ([params*] body) ([params+] body) ...)\n\n Expands to code which creates a instance of a proxy class th
16:18Chouserright
16:19Chouserheh. poor man's macroexpand:
16:19Chouser,(#'lazy-cat [1 2] [3 4])
16:19clojurebot(clojure.core/concat (clojure.core/lazy-seq [1 2]) (clojure.core/lazy-seq [3 4]))
16:19StartsWithKok, in rev1253 IRef was split to IRef and IDeref, why was it done? for futures, they don't have watchers?
16:20Chouserdelays and futures aren't refs, but you can use @ on them
16:21StartsWithKoh, and in rev1232 there was a change in class loader, but i didn't understand what does that mean, what is a new behaviour, and why it was changed
16:22hiredmanyou can also rebind vars
16:22hiredmanoh
16:22hiredmannm
16:24ChouserStartsWithK: that helps close up a potential memory leak when doing lots of evals
16:26StartsWithKand, some time ago, someone posted a patched version on add-classpath that should solve problems with using add-classpath, but cant find when it was merged
16:26StartsWithKwas that accepted?
16:26Chousernot sure what you're referring to, sorry.
16:28StartsWithKah.. can't find a post anymore..
16:29StartsWithKhere it is: http://is.gd/l11v
16:30Chouserno issue, no CA, no response. I would assume it's not been applied.
16:31StartsWithKi see
16:32StartsWithKin rev1309 there are now add-watch and add-watcher, will add-watcher be removed then?
16:34ChouserStartsWithK: possibly. It's currently implemented on top of add-watch
16:37StartsWithKand last question :) if i jump to revision after lazy branch merged, all i need to do is rename all (rest) to (more) and check that i check for seq with (if (seq x)) and thats it?
16:37ChouserStartsWithK: http://clojure.org/lazy#toc6
16:39StartsWithKflag works for (and) (or) too?
16:39StartsWithKthat will help a lot
16:40Chouseryep
16:42StartsWithKChouser: thanks for help
16:42ChouserStartsWithK: sure, I'll send you the bill.
16:42StartsWithK:)
16:45danlarkinHow's "Nantes" for a name
16:49pjstadigmaven doesn't compile clojure anymore?
16:50pjstadigr1299 seems to have gutted the pom.xml
16:50pjstadigthere is no source directory defined anymore
16:53digash`pjstadig: http://tinyurl.com/dyxsku
16:54pjstadigbroken link
16:54digash`pjstadig: http://code.google.com/p/clojure/issues/detail?id=70&amp;can=1&amp;colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary#c23
16:56digash`pjstadig: looks like the issue is closed now, but my patch was not applied.
16:57pjstadighmm
16:57pjstadigof course running ant works fine, but mvn doesn't build anymore
16:58digash`pjstadig: the idea is to use ant to drive maven local install
16:59digash`pjstadig: apply the patch and ant install, you will get clojure in the local mvn repo
17:19Lau_of_DKGood evening gents
17:20danlarkinHiya Lau!
17:20danlarkin"Nantes"?
17:25hiredmanwhy hasn't someone written a wikimarkup poster with fnparse yet?
17:26hiredmanparse
17:26hiredmanr
17:27hiredman:P
17:27Chouserhiredman: I don't know about anyone else, but I haven't because I kinda hate wikimarkup.
17:28hiredmanmake sense to me
17:28Chouser:-)
17:34camponoblancoHello
17:36durka42hi camponoblanco
17:40__marius__are notes supposed to work w/ clojure & slime
17:40__marius__?
17:49hircushi all
17:49hircusthe answer is probably very silly, but...
17:49hircus... how do you instantiate a Clojure class from Java?
17:50durka42,(Date.)
17:50clojurebot#<Date Thu Feb 26 14:50:15 PST 2009>
17:50durka42oh, the other way
17:50durka42sorry
17:51durka42don't they work like normal classes?
17:51Chouserif AOT-compiled and gen-classed, yes.
17:51hircusChouser: will try. Netbeans (with Enclojure) is not auto-completing it, for some reason
18:01hircuscould someone go over the constructor syntax again?
18:01hircusthe return value is a vector of two-elements... which is which?
18:09hiredmanthe second arg is the initial value for state
18:09hiredmanI dunno about the first
18:48gnuvince_~seen rhickey
18:48clojurebotrhickey was last seen joining #clojure, 81 minutes ago
19:51dreishAny idea why the tweets don't show up on http://clojure-log.n01se.net/ ?
19:52hiredmannotice
19:53dreishAh, I see.
19:55Chousershould they?
19:55ChouserI imagine they could be made to.
19:55dreishTime for rhickey to hit the talk circuit again: http://www.google.com/trends?q=clojure%2Cjruby%2Cjython&amp;ctab=0&amp;geo=all&amp;date=ytd&amp;sort=0
19:56dreishNice.
19:56gnuvince_And there's QCon in two weeks or so?
19:57rhickeyyup
19:57rhickeythen ILC
20:02ChouserILC!
20:02gnuvince_http://www.youtube.com/view_play_list?p=AC43CFB134E85266
20:02gnuvince_You guys seen this?
20:02gnuvince_Oh
20:03gnuvince_rhickey: now that you're here. I sent my CA application last week. Did you receive it?
20:03rhickeygnuvince_: just today
20:03Chousergnuvince_: haven't seen that, have you?
20:03gnuvince_ah cool
20:04gnuvince_Chouser: watching it now, it was posted on reddit just today.
20:05dreishThat guy needs a pop guard.
20:08gnuvince_I'm at video #2, and so far the guy is not bad at all
20:11Chouseras long as he's accurate
20:13gnuvince_There was an inaccuracy, but it was about Haskell
20:13gnuvince_So I can let it slide :)
20:18Chouserheh
20:22gnuvince_Do you guys pronounce data "dah-tah" or "day-tuh"?
20:22dreishI like it so far, but he implies adding something to the end of a list shares data, but I believe that's a case where it wouldn't.
20:22dreishday-tuh
20:23WizardofWestmarcday-tuh
20:24danlarkinthese videos are very well produced
20:24gnuvince_Yes
20:25WizardofWestmarchm
20:27WizardofWestmarctrying to access a static enum in a java class and I can't seem to get the syntax right. Classname/Enumname it doesn't like the namespace (when I just (new Classname) it gives me an instance so it isn't lack of importing).
20:27dreishI've never heard anyone say "may-tuh-dah-tuh".
20:27WizardofWestmarcany pointers on what dumb thing I'm missing?
20:28WizardofWestmarcfor reference here's the javadoc of the enum: http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/packet/Message.Type.html
20:29danlarkinwhoopsie, this guy has a error in example code in video 7
20:36durka42,(let [ls '(1 2 3 4 5) ls2 (concat ls '(6))] [ls ls2 (identical? (nth ls 3) (nth ls2 3))]) ; dreish
20:36clojurebot[(1 2 3 4 5) (1 2 3 4 5 6) true]
20:37dreish,(identical? 2 2)
20:37clojurebottrue
20:37dreishI don't think that proves anything.
20:38durka42i'm not sure either, but
20:38dreish(Not saying I can't be wrong, though.)
20:38durka42,(identical? 2 (Integer. 2))
20:38clojurebotfalse
20:38durka42(doc identical?)
20:38clojurebotTests if 2 arguments are the same object; arglists ([x y])
20:38durka42as i typed that, briantwill explained identicality ;)
20:40dreishWizardofWestmarc: So org.jivesoftware.smack.packet.Message.Type/chat doesn't work, for example?
20:41dreishThat syntax seems to work for, e.g., java.util.concurrent.TimeUnit/SECONDS
20:42ChouserWizardofWestmarc: org.jivesoftware.smack.packet.Message$Type ... something
20:43WizardofWestmarcah ha
20:44dreishThat sounds promising. Looks like Type is a whatchamacalit ... inner class?
20:44WizardofWestmarchm
20:44ChouserWizardofWestmarc: org.jivesoftware.smack.packet.Message$Type/groupchat ?
20:45WizardofWestmarcthat did it
20:45WizardofWestmarc<3 Chouser
20:46WizardofWestmarcteach me to take so long to interop with java beyond basic io, etc
21:23cp2oh nice
21:23cp2a clojure plugin for idea
21:33WizardofWestmarcsweet, finally got my xmpp client code recieving messages
21:34WizardofWestmarcturns out the end set of my problems was not understanding how the server was working <__<
21:36__marius__user> (or nil "two")
21:36__marius__"two"
21:36__marius__user> (or '() "two")
21:36__marius__()
21:37__marius__did this behavior change recently ?
21:37gnuvince_no
21:37gnuvince_nil != ()
21:37__marius__since inception? :-)
21:37gnuvince_Only nil and false are false values. Everything else (including the empty list) is true
21:38__marius__k. so this is wrong? http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Norvig_Spelling_Corrector
21:39__marius__(in correct)
21:39WizardofWestmarcnil punning went away with the lazy branch merge
21:40WizardofWestmarcdid (if get modified to auto test for empty btw? I'd heard it was being considered but I'm still not on lazy.
21:40durka42,(if () 1 2)
21:40clojurebot1
21:41WizardofWestmarcso no, you have to be explicit on empty? I guess
21:41WizardofWestmarcreally should get onto the new stuff since it's guaranteed in at this point.
21:43stimulihi
21:45stimuliis there a function that takes a boolean function and returns not-that-function .. in other words (something fred) would be the same as #(not (fred %)) ??
21:48Chousercomplement
21:48Chouser(doc complement)
21:48clojurebotTakes 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.; arglists ([f])
21:52stimulithanks !
22:26Chouserrhickey: :let http://code.google.com/p/clojure/issues/detail?id=88
22:28gnuvince_Chouser: cool feature!
22:30Chouser:-) not my idea, of course.
22:30gnuvince_Oh
22:30gnuvince_Well
22:30gnuvince_Still cool :)
22:30Chouserwe'll turn doseq into CL's loop yet.
22:30gnuvince_You know, that's exactly the kind of thing that keeps me wondering whether I prefer dynamic or static typing :)
22:32WizardofWestmarcIMO depends on what you're doing how good each is
22:32WizardofWestmarcexploratory programming gimme static every time.
22:32WizardofWestmarcbut having the compiler help you avoid weird bugs via static typing, doubly so if it's also strict, can be huge.
22:32WizardofWestmarcerr dynamic for exploratory *durr*
22:33Chouser:-)
22:34WizardofWestmarcGood thing I seem to mostly do exploratory programming <_<
22:34gnuvince_I work with Python at work (Django development mostly) and sometimes I'd kill for Haskell's static typing
22:36Chouserby the way, what kind of thing were you referring to?
22:36Chouserdoseq??
22:36cmvkkif i do (let [[x & xs] a-lazy-seq] ...) can xs be empty?
22:37Chousernope. seq or nil
22:37Chouserum, non-empty or nil
22:37Chouser& is like next
22:37cmvkkoh really. so "& xs" is like doing 'next' rather than 'rest'.
22:38Chouserright
22:38cmvkkthanks.
22:38cmvkkactually, why is that?
22:38Chouser,(let [[x & xs] (lazy-seq 1 ())] xs)
22:38clojurebotnil
22:39Chousermost of the time when iterating you don't mind being a little extra eager, which is why & and next are recommended.
22:40Chouserif you specifically want extra laziness, then you can use rest and watch your nil punning.
22:40cmvkkhmm, okay.
22:40erohtari have a question about how bindings and laziness work together...
22:40Chouserthat's my understanding anyway
22:41Chousererohtar: mostly they get in each others way
22:41erohtarchouser: i've had a hard few hours going crazy working this out...
22:42erohtarchouser: if i use bindings to create a lazy sequence, and i rebind later, how does the earlier sequence behave?
22:43Chouserwhen the fns in the lazy seq execute, they pick up whatever the dynamic context is when they run, which may be completely different from what it was when they were created.
22:43Chousertrue of all closures, actually, but lazy seqs are the most likely to be surprising.
22:43erohtarchouser: damn
22:43erohtarchouser: maybe im using dynamic vars incorrectly
22:44danlarkinerohtar: but like Chouser just implied, they're closures, which means they can capture state
22:44cmvkkha i hadn't thought of that. although to me that seems to speak more to the dangers of special variables than it does to lazy seqs
22:44erohtarchouser: i've used them so that i dont have to pass these two 'configuration' paramers around this set of mutually supporting functions
22:44erohtarchouser: is that an OK use of vars?
22:44bradbevI've just upgraded from an older Clojure (circa r1100) to head. Require statements that used to work, can no longer find the files (java.io.FileNotFoundException: Could not locate memorytool/src/memorytool/globals__init.class or memorytool/src/memorytool/globals.clj on classpath: (NO_SOURCE_FILE:0) Am I missing something?
22:45bradbevmy classpath (set with -cp) has a root that contains memorytool
22:45Chousererohtar: maybe, but you have to be careful.
22:45hiredmanwhat is the require statement?
22:46bradbev(require 'memorytool.src.memorytool.globals)
22:46ChouserI agree with cmvkk -- dynamic vars are touchy and need to be used with care.
22:46erohtarchouser: ok, but what is the pattern of good usage? is it true that a binding form will only affect within its call chain?
22:46bradbevBTW, I think this is just a hack so I can put my project in a root dir rather than have lots of classpath entries. I'm open to better setups
22:47Chousererohtar: yes
22:47Chouser,(take 5 (binding [*print-dup* true] (repeatedly (fn [] *print-dup*))))
22:47clojurebot(false false false false false)
22:48Chouserthere's a lazy seq, defined while *print-dup* is true, but not realized until outside that dynamic scope.
22:48erohtarchouser: hmm... but if that seq was lazy, and before it was realized, if i changed binding of *print-dup*, then...?
22:48cmvkkthat's what happened.
22:49hiredmanbradbev: I would recheck your classpath
22:49Chouser,(take 5 (binding [*print-dup* true] (let [q (repeatedly (fn [] *print-dup*))] (doall (take 3 q)) q)))
22:49clojurebot(true true true false false)
22:49erohtarcmvkk: i see, ur right, that is what happened
22:49hiredman(System/getProperty "java.class.path")
22:49bradbevhiredman: (println (. System (getProperty "java.class.path"))) ...
22:49bradbev (println (. System (getProperty "java.class.path"))) ...
22:50bradbevargh, is that appearing?
22:50erohtarchouser: ok, so vars are dangerous
22:50hiredmanis the namespace declared correctly in globals.clj?
22:50bradbevhmm, perhaps not
22:51bradbev(ns memorytool)
22:51erohtarchouser: what is the pattern for not having to pass params around through a call-chain?
22:51hiredmanuh
22:51hiredmanso no
22:51hiredman(ns 'memorytool.src.memorytool.globals)
22:51Chousererohtar: Hard to say. Generally I'd recommend passing the params around.
22:52Chousererohtar: you can pass a map full of data and destructure as needed
22:52erohtarchouser: yea - that makes sense
22:52Chousererohtar: that would allow you to pass a single arg around, not knowing exactly what's in it.
22:52erohtarchouser: i will do that... this vars thing has really messed me up the entire day
22:52Chouseror you can carefully use 'binding', just make sure you don't let any closures or lazy seqs leak out.
22:52erohtarchouser: i thought i was being smart by using vars...
22:53bradbevhiredman: so each namespace must be scoped to the path & filename?
22:53erohtarchouser: whats a good example of a var usage?
22:53Chouser:-/ sorry about that.
22:53bradbevI really wanted one namespace, with multiple files
22:53Chouserthey also lose their bindings when you do threads -- pmap, agent, etc.
22:53erohtarchouser: that i also learnt the hard way about a month back...
22:54hiredmanbradbev: sounds like you want multiple namespaces
22:54erohtarchouser: but i was using the same value for all binding forms in all agents... so it didnt matter, once i re-bound in each agent
22:54erohtarchouser: but now, trying to use different bindings... messed up!
22:54bradbevhiredman: so namespaces have a 1:1 mapping with files
22:54erohtarchosuer: thanks for ur help
22:55Chousererohtar: sure.
22:55hiredmanbradbev: they don't have to, but I think it is a good idea
22:55bradbevAh, OK.
22:55ChouserI generally think of binding as a sort of clever hack. when nothing else will do, they can be useful.
22:56Chousercore uses them almost exclusively for repl and print configuration.
22:57ChouserI think print config hurts less because it's already stateful IO stuff -- you're less likely to be using closures and lazy seqs.
22:58Chouserthough you can still get in trouble: (with-open [f (java.io.BufferedReader. (java.io.FileReader. "graph.dot"))] (line-seq f))
22:59Chouserlazy seq on a file, close the file, try to walk the seq. *boom*
23:00hiredmanI guess scopes don't completely solve that problem
23:00erohtarchouser: got it
23:01erohtarmakes sense...
23:01erohtartoo clever for my own good
23:01erohtarhey
23:01erohtarthanks everyone, chouser
23:02cmvkkthat file example seems a little more obvious at least. wrap it in a lazy seq if you want, but you're clearly still reading in lines from a file.
23:10bradbevI might understand it now. require is used to load a whole module. I guess that module can contain multiple files (?). So how do I build a project that has multiple files. Docs anywhere?
23:37cmvkk,(seq (str 'c5))
23:37clojurebot(\c \5)
23:37cmvkk,(pop '(\c \5))
23:37clojurebot(\5)
23:37cmvkk,(pop (seq (str 'c5)))
23:37clojurebotjava.lang.ClassCastException: clojure.lang.StringSeq cannot be cast to clojure.lang.IPersistentStack
23:37cmvkk:(
23:38Raynes:(
23:51bradbevshould there be a difference in my classpath when I (add-classpath "foo") at run time vs java -cp foo? There is - require won't work for #2, but will for #1
23:54danlarkinadd-classpath is really only intended to be used at the REPL
23:55bradbevdanlarkin: I'm using Slime, I guess that counts though
23:55danlarkinyep