0:31 rzezeski: Excuse me if this is a newb question, but is the only diff between recur, and using the function symbol itself, the fact that recur won't consume the stack?
2:40 bradbev_: I've written a little viewer app, in much the same style as the ants demo. I listen on a socket inside an agent (started with send-off) and process messages in a loop. Another send-off agent calls repaint & then sleeps. However, my repaint function is not actually getting called :(
2:41 is the swing thread getting choked?
3:19 jtoy: can android apps be written in clojure yet?
3:30 tWip: in theory I guess
3:31 You can create classes with AOT which the android tools would turn into its own format
6:27 polli: Hi, I've got a silly noob question. How would you write something like this "(let [m someFunction] (. someInstance m))"?
6:28 That is call (. someInstance someFunction)
6:28 do you follow? :)
7:29 hoeck: polli: still here?
7:29 polli: yeah
7:31 you can use this to call a java method dynamically using reflection
7:34 polli: ah! I get it. Hmmm..
7:36 Chousuke: isn't the annotation there a reimplementation of memfn?
7:44 hoeck: chousuke: yes looks a bit like memfn
7:48 Chouser: I bet both memfn and that annotation would frequently require runtime reflection anyway, to pick the right method based on object type and arg types.
9:05 fyuryu: rzezeski: that's correct. Another thing is: you can't recur into other functions
9:20 Pupeno: Hello.
9:20 leafw: bored?
9:21 Pupeno: me? no.
9:22 fanda: hello! looking for some comments on new syntax for tests:
9:22 just one person replied
9:22 bad? good? have better one?
9:23 i would like to start writing some tests
9:23 i can learn that way and help too :-)
9:25 Pupeno: I have a jar with a file a/b/c.clj that has (in-ns 'a.b.c) (defn d ...). In another jar I have a function that calls (a.b.c/d) and both jars are in the classpath. It doesn't work (java.lang.ClassNotFoundException: a.b.c), what am I doing wrong?
9:25 Chouser: fanda: did you see the existing test effort in contrib?
9:25 fanda: yes, I saw it
9:26 rhickey: Pupeno: does the other file use/require a.b.c ?
9:26 Chouser: Pupeno: you need (require 'a.b.c)
9:26 fanda: Chouser: it seems unnecessarily verbose to me
9:27 Chouser: fanda: ah, ok. Personally, I'd try to reach a concensus with the people already working on tests.
9:28 It seems more important to me that all the tests use the same format than that it's the ideal format. Bring them 'round to your point of view and you get the best of both.
9:29 fanda: yes, I guess, I should talk directly with Stephen C. Gilardi
9:30 it seems he wrote the tests
9:31 Stephen, are you here?
9:32 Chouser: he's infrequently here, but he generally responds quicly on the google group.
9:33 fanda: I will write him an email
9:33 somehow testing seems fun to me (I am all about quality :-) )
9:33 Chouser: great!
9:33 Pupeno: Thanks rhickey, Chouser. So now it is failing because a.b.c.c doesn't exists, this is something that recently change, right?
9:36 rhickey: Pupeno: you have to do one thing or the other - pre-change your file should have been in a/b/c/c.clj - post change in a/b/c.clj, do whatever matches the code revision you want to use
9:37 Pupeno: rhickey: just checking if I understood your mail correctly; since I don't want to be stuck in the past, I'll upgrade. Thanks.
9:38 rhickey: sure
9:51 danlei: when you think that i
10:07 Pupeno: Is there a way to find out, from the REPL, which svn revision was used when compiling clojure?
10:10 rhickey: Pupeno: this comes up occasionally and the answer is the same as "when did you stop feeding your dog?"
10:10 i.e. the question contains a presumption
10:11 Pupeno: A false presumption I suppose.
10:11 rhickey: maybe
10:11 Pupeno: Which one is it?
10:11 duck1123: so, I can't find the answer from the Repl because I don't have a dog?
10:12 rhickey: or you didn't build from a set of sources matching an svn revision
10:14 Pupeno: rhickey: yes, I understand that part, it may sometimes give false information, but right now, it would be useful for me.
10:15 Chouser: It's such a mess to solve even to 80% correctness. I've seen shell scripts that try to produce a string like "1080" for a clean revision or "1080+" if local changes are detected.
10:15 rhickey: Pupeno: there's an svn command for that
10:15 duck1123: Pupeno: there have been several threads on this subject, many options were given, but none of them stood out as the best way to do it
10:16 Pupeno: ok then.
10:16 duck1123: does sourceforge allow you to set up svn hooks?
10:16 Chouser: But the ones I've seen would use hash-codes for hg and git, which is unhelpful. You'd want to track back to the SVN rev number, if that's even possible.
10:16 duck1123: I've never run a sourceforge project
10:17 Chouser: And of course you'd need all this to work not just on Linux, but Mac and Windows as well.
10:17 all of which makes typing "svn info" seem pretty nice.
10:18 leafw: Chouser: a hack would be to checksum the contents of the jar and check that against every revision with a shell script ... could take some time
10:18 duck1123: the ant task inserting the number seems the best option, possibly with a fallback to read from a file for the case of downloaded releases
10:19 rhickey: svn info, like Chouser said
10:19 leafw: agreed.
10:20 Chouser: Now once we have a real version number and a "release culture", it might be worth a bit of effort to get that version number into the runtime environment somehow.
10:20 but that wouldn't be VCS based.
10:20 Pupeno: There's an assumption for svn info, and that is that you have the matching repository intact. My problem is "Where did that clojure.jar come from?", not "What is my current revision for this tree?".
10:24 What does (all-ns) return post 1094?
10:24 cemerick: fwiw, we maintain a local authoritative (for us) build of clojure that is tagged with a revision number in ivy, and has that revision number set in a properties file in the clojure.jar we produce
10:26 rhickey: cemerick: a properties file with $Rev$ and a touch in the build script would work maybe?
10:26 jtoy: git
10:29 cemerick: rhickey: maybe -- ours is a bit heavier of a process -- using the svn/status task to set an ant property to the current svn rev #, and then propertyfile to update the properties file
10:30 I don't really trust $Rev$ and such. I actually thought such things were frowned upon in svn (though provided for those who long for cvs)?
10:33 rhickey: could be
10:34 Chouser: cemerick: I'm not sure they're frowned on in SVN, but they're completely unavailable in git.
10:35 Chousuke: (automatic) revision numbers don't really make any sense in git anyway
10:35 mostly because git is rather nonlinear, unlike SVN :/
10:35 rhickey: Chousuke: right - see "feeding dog" above
10:36 cemerick: Chouser: turns out I'm wrong -- the red bean book describes svn keywords (like $Rev$) without any cautionary notes. I thought I read something discouraging keyword usage, but I suppose I could have imagined it.
10:37 rhickey: I think if you are going to save off a jar before moving ahead, you should give it a meaningful name
10:37 Chouser: rhickey: have you had specific requests for PersistentHashMap for some other language?
10:38 rhickey: seems like there should be a relationship between the most recent modified datetime and the svn rev
10:38 Chouser: has been ported to Factor and Scala
10:38 cemerick: I'm probably being dense, as I'm not getting the dog feeding metaphor, but having some notion of a "version" of clojure that can be determined at runtime will eventually be pretty important. We've just been updating our entire codebase each time we upgrade the clojure we use, but eventually, that will become impractical, so some version-aware conditional execution forms will be necessary.
10:40 rhickey: cemerick: again, that comes to meaningful names - release versions will have meaningful names
10:40 cemerick: Sure. I'm just blathering over here. :-)
10:41 rhickey: and I'm all for an automated solution - no one's come up with one
10:42 cemerick: rhickey: it's a pretty simple thing in svn-land, if you want it; but do we need to support git and hg as well?
10:43 rhickey: cemerick: that was the complaint at the end of: http://
10:43 duck1123: I am perfectly okay if I don't get proper build numbers if I use a non-standart repository
10:44 cemerick: yeah, seriously -- do we need to support perforce and pvcs and vss, too?
10:45 * rhickey hates this stuff
10:45 duck1123: I would like a solution that supports any scm, but I'd rather just have a solution
10:46 rhickey: so much time, so little accomplished
10:46 cemerick: rhickey: don't let the jets and the sharks knock you off course. Rule with an iron fist. ;-)
10:47 rhickey: I'm concerned for everyone's productivity - these vcs discussions always go nowhere
10:48 jtoy: election projection systems,machine listening systems
10:48 listening right now
10:52 dudleyf: vcs discussions are almost as productive as licensing discussions ;-)
10:58 cemerick: dudleyf: I'd swap them in that comparison, but sure :-)
11:01 albino: couldn't you just version every release, and make that part of the version that shows up at runtime?
11:04 leafw: albino: just do it yourself and submit a patch.
11:04 i.e. create the system, if you want it.
11:06 albino: leafw: heh
11:06 I just realized python actually does display that (the svn rev number) in its repl. I didn't even know that and I've been using it for years.
11:07 triddell: In the tutorial at http://
11:07 cemerick: there's already a patch for that functionality on the google group. If Rich wants it, he'll pick it up.
11:08 Chouser: triddell: you got cut off at: fails with a...
11:08 triddell: fails with a "FileNotFoundException: Could not locate utils.class or utils.clj on classpath" Any ideas? Is anyone else using this script?
11:10 Craig: Anyone else having problems with slime on the latest bits? I keep getting "Evaluation aborted" in the minibuffer, although I can still run commands in the REPL no problem.
11:14 dudleyf: triddell: I doubt that script's been updated for a while
11:17 triddell: dudleyf: right, but it seems pretty basic and I'm just wondering why it would be broken now... all it really tries to do execute java with the classpath options... guess I just need to simplify it even more and see if I can tell what it breaking
11:18 dudleyf: triddell: The AOT stuff changed where Clojure looks for namespaces
11:19 from path/to/name/name.clj to path/to/name.clj
11:19 If I'm not mistaken
11:21 duck1123: What are your opinions? In Compojure, should the request and response objects be made available thread-locally, or no?
11:22 I'm kinda for it mostly because many of the libraries I'm using expect me to have it, but I also see the author's point
11:22 Chouser: duck1123: I haven't spoken up on the list because I have zero experience with compojure. Having said that, I'm leaning against it.
11:23 triddell: dudleyf: I think I just fixed it... it looks to optionally run an additional script when starting the REPL... this may have been reseting the working directory and then not allowing the main clojure classes to be found I guess
11:23 Chouser: Having "global" access to the request in rails makes it very difficult to tell what data any particular method is relying on.
11:24 You can look at a method and think you know what it needs, but it may call a helper function that depends on some other request field.
11:24 duck1123: it seems to me like having a hash of data, and then pulling all that data out for every function
11:25 Chouser: duck1123: sure, essentially the same thing. What might be better is to isolate the request data right at the handler, and pass in specific arguments that are needed.
11:26 candera: I get java.lang.ExceptionInInitializerError when trying to evaluate '() on the latest bits.
11:26 Chouser: The idea of using multiple threads on a single request further pushes in the direction avoid a thread-global.
11:26 duck1123: I hate filling up the handler macro with code that really should go elsewhere
11:27 candera: (list) evaluates fine. (quote ()) also blows up.
11:28 duck1123: I think I'll just drop it and continue doing what I have been doing
11:28 Chouser: duck1123: well, you could pass the request one level in to a function that unpacks the request or whatever, and passes the specific args on down.
11:29 duck1123: that's essentially what I have been doing
11:29 Chouser: duck1123: I'm by no means convinced, but I'm giving you the reasons I've come up with for one side of the argument.
11:30 I think the usual trade off is between making it easy to make changes (global request means you can easily add a new arg without changing all the functions between the handler and the one that needs the data)
11:30 duck1123: I have a template that needs access to the session, so that means I need the session to be available to every "page-view" function
11:31 Chouser: between that and easy of understanding (being able to see at each point exactly what data may be used, and what will be modified/returned)
11:32 hm. Well, you could add it as your own thread-global if you want, couldn't you?
11:32 drewr: I'm now confused about this ns/in-ns conversation on the list.
11:33 If I use (in-ns 'foo) from a different file from where (ns foo) resides, none of the symbols is available in the in-ns file.
11:33 duck1123: I suppose I could. Although I'm not sure where the best place to do that would be if not in the compojure.http ns
11:34 drewr: Even a refer doesn't make them available.
11:34 duck1123: drewr: wouldn't you need to require 'foo?
11:36 drewr: I can (clojure.core/require 'foo).
11:36 How come that then makes clojure.core symbols available? Because of the ns?
11:36 I suppose that makes sense.
11:36 rhickey: I see a request being more of a context, so prefer the var approach, you can bind that var in any launched threads
11:36 Chousuke: hmmh
11:37 Chouser: rhickey: as in, pass the request to the new thread and using (binding ...) again there?
11:37 drewr: Now I get Reflection warnings in calls to .toUpperCase.
11:38 * rhickey knows nothing about Compojure yet
11:38 drewr: All this just magically worked with ns. :-)
11:38 rhickey: Chouser: yeah
11:39 Chousuke: I'm trying to precompile clojure.core but it fails with a rather cryptic error: java.lang.NoClassDefFoundError: clojure/core$str__2721$fn__2725 (core.clj:325) ... on that line in core.clj there's the definition of 'symbol?
11:40 Chouser: Chousuke: you have the "classes" dir in your classpath?
11:40 Chousuke: hmm, no. duh :P
11:43 well, now it compiles
11:44 Chouser: rhickey: isn't relying on that kind of implicit context one of the things Tarpit warns against, in favor of more functional and explicit passing of data?
11:45 Chousuke: if I remove the classes dir though, the compilation works a bit weird: I have to run clojure, (compile 'clojure.core), it fails, but after restarting clojure it can now use the classes in the classpath and compilation will succeed.
11:46 rhickey: Chouser: yes, you have to use it wisely. OTOH, *out* would have to be threaded through the entire world...
11:47 that's a different problem - lack of encapsulation, tainting the call path
11:49 Chousuke: hm
11:49 now this behaviour is rather interesting.
11:49 Chouser: yeah, ok. feels like a judgement call, and anyone who trusts my judgement over yours is undoubtedly asking for trouble. But *out* is one thing, as is *err* and *in*. the request is n things, the number and names of which can change just by adjusting the request URL.
11:49 duck1123: for reference, here's my current controller file: http://
11:54 Er, not casting.. type hint.
11:55 Chouser: I think you type-hinted a list
11:55 drewr: I get Reflection warnings if I don't.
11:56 Chouser: (when true #^String %)
11:58 Is this a consequence of AOT that I have to type hint everywhere now?
11:59 Chouser: duck1123: yeah, I can see what you mean. It's very interesting to me, though, that returning the output looks very natural, even without an *out*-like global.
12:00 drewr: I don't think so. You're getting more reflection warnings now than you used to?
12:00 that might be intended behaviour, but it sure is confusing.
12:02 Chouser: Chousuke: what happens if you have an empty classes directory before you start?
12:03 Chousuke: ah. it works.
12:05 Chouser: Chousuke: I think java may be essentially eliminating "classes" from your classpath when the dir doesn't exist.
12:06 drewr: are you sure? I don't see how it could have. "size" could legally be either an int or a java.util.Collection
12:07 drewr: All I know is that I didn't get any warnings before.
12:07 I don't mind type hinting, but I don't understand why the compiler now cares.
12:08 Chouser: You don't have to type hint -- it'll just use reflection at runtime.
12:08 drewr: So what is the warning telling me then?
12:08 Chouser: I just rebuild clojure SVN 1088, and this generates a warning:
12:08 (set! *warn-on-reflection* true)
12:08 (defn m [size] (java.util.concurrent.LinkedBlockingQueue. m))
12:09 The warning is simply saying that that call will use reflection at runtime rather than being able to resolve the call perfectly at compile time.
12:09 it's essentially a performance warning.
12:10 rhickey has generally recommended using type hints only when you know you need the performance.
12:11 drewr: Yeah, it's ugly.
12:11 Chouser: yep
12:12 drewr: Maybe it's that I started using in-ns again.
12:12 I don't know why they would be related though.
12:12 Chousuke: hmm
12:12 Chouser: If *warn-on-reflection* is false, you shouldn't get any of those warnings.
12:13 It certainly used to always default to false, and I think it still does.
12:13 drewr: It's set to true (in SLIME), but it's been that way for months of usage.
12:13 Chousuke: I can't compile clojure.inspector on OS X without causing a clojure.lang.Repl process showing up in the dock. I suppose that's because of the Swing-related imports.
12:14 I suppose it's harmless. :)
12:14 drewr: Chousuke: Except that CMD-Q causes it to kill your JVM.
12:15 Chousuke: well, yeah
12:15 drewr: Sometimes I forget about that.
12:24 cemerick: rhickey: I often get "java.lang.Exception: Accessor/struct mismatch" when developing in the repl -- presumably, the ordering of a struct's def has changed, and some client code is trying to use an old def to access a newer version of a struct. In virtually every circumstance, I've not actually changed the keys in a struct. So, shouldn't struct defs be compared with .equals (instead of !=) in PersistentStructMap?
12:24 Of course, Def would have to gain a proper equals impl.
12:25 s/the ordering of a struct's def as changed/
12:35 fanda: rhickey: In the latest SVN, there are both core-proxy.clj and proxy.clj files in src\clj\clojure
12:35 is this intentional?
12:44 danlei: (/ 1 0)
12:44 ... well ... no debugger in irc ;)
13:13 Drakeson: is there a better (lazy) way of doing (seq (.split (slurp file-name) "\n"))
13:14 something that could be called slurp-lines
13:17 fanda: see this
13:17 for line-seq
13:17 Drakeson: fanda: thanks
13:18 fanda: no problem
13:20 Drakeson: How would you read into a variable what you have prn'ed into a file?
13:20 drewr: Drakeson: (doc read)
13:20 Drakeson: thanks
13:21 drewr: Or read-string I suppose if you've already read the file.
13:23 Chousuke: Can a jar Manifest file contain multiple classpaths? I'm trying to include precompiled .class files in a jar but I'd like to have them all under a /precompiled directory; however, it seems that clojure doesn't use the .class files if I have them like that. If I put them in the same dir with the .clj counterparts it works though.
13:25 Chouser: Chousuke: http://
13:26 Drakeson: what's wrong with this: (with-open [f "test.dat"] (read f))
13:27 hiredman: many many things
13:27 well, I am not sure what the latest with-open does
13:28 Chouser: drewr: read wants a PushbackReader, not a filename
13:28 ^^ Drakeson
13:28 drewr: sorry. :-)
13:28 hiredman: and strings don't have a close method
13:28 Chouser: Drakeson: do you have clojure.contrib?
13:30 Drakeson: is `f' in (with-open [f "test.dat"] (read f)) a filename or a stream?
13:30 I guess I have contrib ...
13:30 drewr: Drakeson: It's anything that can be .close()d.
13:30 Chouser: with-open is somewhat poorly named. It doesn't actually open anything, just closes whatever you bind at the end of the block.
13:31 (with-open [f (java.io.PushbackReader. (java.io.FileReader. (java.io.File. "test.dat")))] (read f))
13:31 Drakeson: oh!
13:32 there should be a macro/function for that
13:32 Chouser: duck-streams
13:32 Drakeson: (with-open-file [bindings] do-things)
13:33 Chouser: what is in contrib for that?
13:33 Chouser: (require '[clojure.contrib.duck-streams :as ds])
13:33 (with-open [f (java.io.PushbackReader. (ds/reader "obj.clj"))] (read f))
13:34 candera: Is anyone else having trouble evaluating '() on 1099? I get ExceptionInInitializerError.
13:35 (quote ()) also blows up, but (list) does not.
13:35 drewr: Doesn't work for me either.
13:35 rhickey: candera: fixing now, hang tight
13:35 Chouser: huh. () works though
13:35 candera: rhickey: roger. Thanks.
13:39 Chousuke: I fixed it so that the manifest has only one Class-Path attribute but it still doesn't work :/
13:40 hiredman: is the path with the .clj files first in the class path?
13:40 Chousuke: no, it's last.
13:41 currently it looks like "./precompiled/ ."
13:41 rhickey: candera: print-dup on '() fixed. Now please start using () instead of '() :)
13:42 Chousuke: I wonder if it's causing problems that precompiled/ is a subdir of the second classpath element :/
13:42 danlei: '(
13:42 doesn't work for me either
13:43 rhickey: danlei: what doesn't?
13:43 danlei: evaluating '() throws an exception
13:44 Chouser: danlei: time to upgrade :-)
13:44 danlei: hm
13:44 rhickey: danlei: you have rev 1100?
13:44 danlei: just built it an hour ago :)
13:44 candera: rhickey: thanks!
13:44 Chouser: it's been fixed for 3 minutes now!
13:44 * danlei smiles
13:44 danlei: ty
13:45 rhickey: I am serious though, please don't write '() - quoted lists are ugly
13:45 danlei: depends
13:45 actually, it's a common ideom
13:45 rhickey: not in Clojure
13:45 danlei: can't argue that
13:45 in cl, it is
13:45 rhickey: () is the empty list, if you want literal tuples use vectors
13:45 Chousuke: I really can't figure out why clojure appears not to be finding the .class files from the jar classpath. :/
13:47 though I could probably use a more accurate method for determining that than running a hello world script and looking at how long it takes.
13:47 hiredman: ...
13:48 Chousuke: the difference is pretty noticeable though.
13:48 danlei: apropos vectors: how relates  to (vector ...)? one can't write (defn (vector ...) ...) as it seems
13:48 Chouser: Chousuke: you could try removing the .clj classpath entry entirely
13:48 Chousuke: I suppose.
13:49 danlei: typo: (defn foo (vector ..) ..
13:49 Chouser: danlei: defn doesn't evaluate it's arguments -- if it did (defn foo [a b] ...) would complain that a and b are not yet defined.
13:49 hiredman: defn is a macro, yes? so it just sees the (vector ...) function call, not a vector
13:50 danlei: so its like (quote (vector ..)), ok. thanks. same relation like '( and list.
13:50 Chouser: danlei: not quite -- when  is evaluated, all of its values are evaluated, unlike if it is quoted
13:50 rhickey: danlei: not really - vector literals are evaluated
13:51 what he said :)
13:51 danlei: ok, got it.
13:54 oh, no dotted lists
13:55 Chouser: nope. use a vector
13:55 danlei: i see
13:55 Chouser: well, or a list or whatever.
13:57 There's a Cons class, but although the first thing can be any Object, the second thing must implement ISeq
13:57 rhickey: if you were doing (x . y) in CL, please switch to [x y]
13:58 for 2-tuples
13:59 danlei: ok, thanks rhicky. is there some kind of tutorial, which compares clojure with cl? there is a little table at wikipedia, any tips above that?
14:00 rhickey: Stuart Sierra posted a patch for precompiling Clojure's core libs into the jar, doubles the size and halves the startup. I'm for it, any objections?
14:01 danlei: gnuvince: thank you
14:01 rhickey: a useful exercise - try avoiding using lists except when writing macros, question every time you use reverse etc
14:02 will get you up to speed on seqs, vectors and maps
14:04 Chousuke: rhickey: I was trying to do that myself (mostly as an excercise though :))
14:04 rhickey: Chousuke: I did it as a proof of concept of AOT, but Stuart did the ant side
14:05 works great
14:05 Chousuke: In my version I got it working but it's pretty ugly, as the .jar file clojure/ dir will be full of .class files :p
14:05 danlarkin: +1 for precompiling clojure.jar
14:05 Chousuke: I tried to figure out how to move them outside the main clojure/ dir but that didn't seem to work no matter what I did.
14:05 AWizzArd: rhickey: many clojure functions return what looks like a list... are those really always lists?
14:06 rhickey: Chousuke: um, aren't jars supposed to be full of class files?
14:06 AWizzArd: rarely
14:06 danlarkin: AWizzArd: run (class ...) on it
14:06 Chousuke: rhickey: I kind of wanted to separate the precompiled stuff from the .clj stuff, but that's just me :)
14:06 rhickey: AWizzArd: almost never actually lists
14:06 AWizzArd: Ah oki, so it's just the printed representation, good
14:06 rhickey: Chousuke: the .cljs are not in the jar
14:07 AWizzArd: Clojures vectors don't leave very much room for the usefullness of lists
14:07 rhickey: AWizzArd: how so?
14:07 danlei: ah, there are transcriptions of pcl chapters in clojure. nice ...
14:07 rhickey: oh I see what you meant
14:08 fanda: danlei: another comparison CL-Clojure
14:08 Chousuke: rhickey: in my version of the .jar builder I left them in. Now that I think of it, it seems rather pointless.
14:09 danlei: fanda: thanks that's fond that one already
14:09 fanda: thanks excuse my english ;)
14:09 fanda: :-)
14:10 i am not a native speaker either :-)
14:10 * gnuvince neither!
14:11 fanda: see? :-)
14:11 danlei: yes, but normally, i can at least parse my own sentences .. =)
14:11 gnuvince: Quite the multi-cultural community we have here
14:11 danlei: . o O (that's fond that one already)
14:12 rhickey: gnuvince: yes, it's great
14:15 fanda: watch for typos or I say that you are not a native speaker (n)either :-)
14:17 (just having fun :-) )
14:18 Chousuke: Many times I've seen native speakers use worse English on IRC than non-natives :P
14:19 fanda: as long as both sides understand, it's just fine
14:19 Chousuke: Yeah.
14:19 No prizes for literary excellence.
14:19 danlarkin: what?!
14:20 but that's what I'm gunning for :'(
14:22 fanda: rhickey: I remember discussion about #+ and #- macros from CL. They gonna eventually make it into Clojure in some way. Has that happened already or not? (Just curious, no pushing).
14:22 Chouser: fanda: those haven't happened yet.
14:22 gnuvince: What are #+ and #-?
14:22 rhickey: cemerick: struct equality test would be a lot of overhead on every access
14:22 could do some hash thing I guess
14:24 cemerick: rhickey: it gets tricky otherwise -- you've been knocking around in the repl for an hour, and then all of a sudden a pile of structs that are being held somewhere (or in many places) are rendered "stale", so you have to go around and reconstitute them, which isn't always possible.
14:25 fanda: gnuvince: they are reader macros
14:25 #+ symbol include-this
14:25 if symbol exists, include-this gets put in the place of the whole thing
14:25 cemerick: maybe Defs could be interned? I wouldn't think there'd be many Defs in any particular app/library.
14:25 fanda: or should I say - if symbol is bound to something true
14:26 rhickey: fanda: on todo list
14:26 fanda: rhickey: oh, ok
14:27 i was first confused, if it isn't #= macro
14:28 rhickey: cemerick: I don't want to tease you, but in doing aot, I realized (again) that structmaps don't serialize well due to their relationship to the def. I'm thinking now that maybe structmaps should do some codegen and have a real class as basis - would also give you named fields on Java side
14:29 * cemerick laughs maniacally :-P
14:30 cemerick: rhickey: that's exactly how I was hoping I could reimplement genbean, once AOT is ready for me
14:30 I'd prefer methods on the Java side, though (:foo structmap) in clojure => structmap.foo() in Java.
14:31 rhickey: cemerick: really, why?
14:31 cemerick: My latest genbean impl also adds "setters" for those slots, so structmap.foo(newFoo) => updated-structmap-with-newFoo
14:31 rhickey: ah
14:32 last call - precompiled clojure.jar 10, 9, 8 ...
14:32 cemerick: exposing methods instead of fields also allows for emergency subclassing down the line
14:33 rhickey: cemerick: :(
14:34 cemerick: rhickey: yeah, I know. That's more of a symptom of it not being straightforward to "subclass" a genbean specification at this point.
14:34 In my defense, I've only done it twice so far.
14:44 rhickey: svn 1101 - Clojure ant script now precompiles .cljs into jar
14:45 Chouser: beautiful. it Just Works.
14:51 fanda: do you see any usefulness in keeping 2 different build scripts? one for .clj, second for .class?
14:52 Chouser: -Xverify:none seems to reduce startup time slightly
14:52 as does -client
14:53 AWizzArd: Chouser: but do you usually run java in a -server for programming Clojure?
14:53 rhickey: Chouser: I think the JRuby guys tout -Xbootclasspath as being a big boost
14:54 Chouser: AWizzArd: I do usually use -server
14:57 rhickey: -Xbootclasspath/a:clojure.jar
14:59 doesn't seem to make a big difference for me, but I'm just over a second here
15:00 AWizzArd: i will see if i can test this inside vmware later, with my mobile processor on just 50%
15:00 Lau_of_DK: About this AOT business - Im completely blank on the uses of this, where do I go read ?
15:03 Chouser: rhickey: with your bootclasspath option and -client, -Xverify:none doesn't seem to help. But I'm down to 0.448s
15:04 rhickey: Chouser: bootclasspath subsumes verify:none
15:04 dudleyf: Classes added to the bootclasspath bypass the verifier, so -Xverify:none shouldn't do anything
15:05 Chouser: I assumed it was something like that.
15:07 dudleyf: I vaguely remember JRuby having some problems using bootclasspath
15:08 Lau_of_DK: About this AOT business - Im completely blank on the uses of this, where do I go read ?
15:09 rhickey: Lau_of_DK: http://
15:09 "This can be used to save startup time, deliver
15:09 applications without source, interop with bytecode-based tools etc. "
15:10 If you don't need it, you can ignore it
15:10 Lau_of_DK: thanks rhickey
15:10 rhickey: Lau_of_DK: don't ignore the code changes though, just ignore compile
15:11 Lau_of_DK: k
15:11 Are the interrim SVN changed completed now?
15:12 rhickey: Lau_of_DK: I think the experience on HEAD is back to normal
15:12 Lau_of_DK: k
15:12 Chouser: clojure.contrib isn't quite all caught up yet.
15:14 rhickey: Chouser: what's left?
15:16 Chouser: I've got that squirrely gen-interface thing.
15:16 rhickey: ah, yes, I didn't get to look at that last night
15:16 It happens when manual loading and compiling in same session>
15:17 Chouser: oh, Stuart S. moved lazy-xml and command-line for me. I guess everything should load ok now.
15:17 rhickey: cool
15:17 Chouser: rhickey: yes, that's the only time I've seen it.
15:18 rhickey: you guys are awesome to have switched over so quickly
15:19 Chouser: But like I said, I can follow the directions I posted and *not* see an error.
15:25 Lau_of_DK: Are there currently any other languages available which can offer the concurrency guanrantees that Clojure does?
15:25 rhickey: Lau_of_DK: Haskell
15:25 Lau_of_DK: k
15:25 rhickey: Erlang
15:26 gnuvince: Is there a method to know if a number is negative, positive or zero?
15:26 Lau_of_DK: pos?
15:26 rhickey, thanks
15:26 gnuvince: Lau_of_DK: all in one, like signum in Haskell IIRC.
15:27 Chouser: gnuvince: #(compare % 0)
15:28 Lau_of_DK: But rhickey, unless I misunderstood Clojure, you say that even in race-conditions, no locks are used? Erlang suffers from deadlock situations according to your (very excellent) 'state' article
15:29 rhickey: Lau_of_DK: no, clojure's STM uses locks quite a bit - there are no user locks and no deadlock
15:29 Lau_of_DK: oh ok . I must have missed that
15:29 rhickey: Erlang leaves it to you to avoid deadlocks
15:30 using timeouts etc
15:30 but Erlang has a distributed concurrency model, so is a different thing altogether
15:30 If that's what you need there's no substitute right now
15:31 Lau_of_DK: Yes I get that. But I understood that the STM creates snapshots for all readers coming in, so that you get a consitent view of the data. And when writing is atomic, because youre only changings refs. Where does locks occur in that?
15:32 rhickey: Lau_of_DK: you don't have to lock, I do in the implementation of STM, which is, shall we say, tricky
15:33 probably the only part of Clojure Chouser hasn't yet gotten around to
15:33 Lau_of_DK: haha
15:33 rhickey, STM is purely your brain-child?
15:34 rhickey: STM is a well known idea - there are many implementations
15:35 Lau_of_DK: ok, but you wrote your own I mean, its not a copy of PostReSql or something like that? I seem to remember you mentioning it in a screencast somewhere
15:35 Chouser: heh. ClojureScript doesn't even have Refs yet, let alone ones that would work if JS had threads.
15:35 rhickey: Lau_of_DK: Clojure's STM is unique to Clojure
15:35 Lau_of_DK: rhickey, cool, thats what I wanted to know
15:35 AWizzArd: rhickey: what about F# for concurrency?
15:38 rhickey: AWizzArd: AFAIK F#'s refs don't have any transactional semantics, just the regular ML ones. It's a mixed paradigm language like Scala - you can write in a functional subset, or not
15:38 AWizzArd: I see
16:15 * sohail lols at tagged type discussion on mailing list
16:15 * Lau_of_DK points and sohail and giggles
16:16 Lau_of_DK: (/s/and/at)
16:16 Chouser: sohail: oh, stop it.
16:17 sohail: Chouser, time to make a FAQ methinks
16:18 Chouser: yeah, perhaps. but that question needs more than a pat answer.
16:18 it needs a blog post that I can't seem to write. or something.
16:19 AWizzArd: Would clojure run also under this open java? What about Kawa?
16:20 Chouser: sohail: did you solve yours to your satisfaction?
16:21 hiredman: I know the repl at least starts on openjdk7
16:21 walters: AWizzArd: under OpenJDK? if so yes, OpenJDK has all the important code from the proprietary JDK
16:21 AWizzArd: nice
16:27 sohail: Chouser, no
16:27 problem was I wanted CL-like dispatching and I was too arsed to do it properly
16:37 astor: can someone explain to me how I use defmulti/defmethod to implement a function that dispatches on say a vector of 3 elements where I want some of the elements in the vector to be what in CLOS would be 't - that is "don't care"?
16:37 polli: Are there people here using aquamacs and clojure-mode/swank-clojure?
16:37 astor: polli: I am
16:38 polli: astor: when I do M-x slime it gives me an exception. Ever had that problem?
16:39 kotarak: astor: (defmulti foo (fn [[x _ _]] x)) (defmethod foo :x [x] :xxx) (foo [:x :y :z]) (foo [:x 1 2])
16:39 polli: astor: "java.io.FileNotFoundException: Could not locate Clojure resource on classpath: swank/swank.clj"
16:41 when I look in swank-clojure there's a swank.clj, but none in swank-clojure/swank
16:42 astor: kotarak: I mean something like (defmulti foo (fn [x] [(:a x) (:b x) (:c x)])) (defmethod foo [:x _ _] :xxx) (defmethod [_ :y :z] :asdf) ...
16:43 kotarak: where the _s in defmethod mean don't care.
16:43 polli: have you set swank-clojure-jar-path?
16:45 polli: erm.. have you done (add-to-list 'load-path "/Users/foo/path/to/swank-clojure/")?
16:45 AWizzArd: nice, nearly 900 users in the GG.. and nearly 90 people here in #Clojure
16:45 and maybe something like v0.9 ;-)
16:46 polli: yes, add-to-list-thing is in
16:46 I tested with the swank-clojure-jar-path now, but it did not fix it :/
16:48 astor: I followed some screencast setting up aquamacs with clojure-mode, I checked it twice but was not able to spot any differences
16:48 kotarak: astor: you could probably do something like (derive ::Foo ::Bottom) (derive ::Bar ::Bottom) (derive ::Baz ::Bottom) (defmulti foo (fn [x] [(:a x) (:b x)])) (defmethod foo [::Foo ::Bottom ::Bottom] :xxx) (defmethod foo [::Bottom ::Bar ::Baz] :yyy) (foo [:a ::Foo :b ::Bar :c ::Foo]) (foo [:a ::Baz :b ::Bar :c ::Baz]) (not tested, though)
16:57 astor: ok. doesn't work obviously. Although (isa? ::Foo ::Bottom) returns true, you has to define a dedicated multimethod.
17:05 astor: polli: I seem to remember that there is some ordering magic in .emacs for swank and slime. swank-clojure sets up some functions to be called after slime is loaded, so you might get in trouble if you have slime pre-loaded.
17:06 polli: astor: aha!
17:07 astor: I'll test that to disable the pre-loaded
17:09 astor: kotarak: my problem is that I have an unlimited number of ::Foo and ::Bar values, so the derive stuff isn't trivial. what happens when one dispatches on a map. do all elements have to match?
17:11 kotarak: astor: it seems so
17:13 astor: if there was a designated name for the supertype of everything, then that could be dispatched on, but that doesn't seem to be possible to specify using the derive interface.
17:14 kotarak: You can, but you have to provide a multimethod anyway for all possible types. (derive ::Foo ::Bottom) and (defmethod foo ::Bottom ...) still complain, that there is not multimethod defined for ::Foo.
17:19 astor: kotarak: it shouldn't be like that if I understand the example in http://
17:24 kotarak: astor: hmm.. you are right. There must have been something messed up. With a fresh Repl it works now. So I can derive everything from ::Bottom and can use ::Bottom as a wildcard.
17:25 astor: kotarak: the problem is that I have no way of saying "derive everything from ::Bottom"
17:28 I guess hierarchies could have a list of parents that everything derives from so that isa? simply returns true whenever the second argument is in that list.
17:31 danlei: 404 for me
17:31 Chousuke: some kind of an always-match value might indeed be useful for multimethods :/ Are there any arguments against having one?
17:32 astor: chousuke: i see that underive semantics might change slightly. are you allowed to underive from a always-match parent?
17:33 rhickey: Chousuke: I might bake in everything isa? Object, still thinking about it
17:36 astor: rhickey: my original question was how to implement something like (defmulti foo (fn [data] [(:a data) (:b data)]) (defmethod foo [:x _] :xxx) (defmethod foo [_ :y] :yyy) where _ is don't care. Basically to specify 't as in a CLOS method.
17:37 rhickey: astor: I understand, and with what I am proposing you could say Object where you have _
17:37 astor: but I would love to see some smart default logic when dispatching on maps. the above would be really elegant if I could express the map properties I wanted directly.
17:37 rhickey: yes I see..
17:40 Chousuke: hmm.
17:40 Chouser: I suppose allowing an pluggable alternative to "isa?" would be one step too meta?
17:43 rhickey: Chouser: it's tricky, as to make multimethods fast they have to have a cache, and that cache has to track changes to the hierarchy, plugging in isa? doesn't solve the cache problem
17:44 Chousuke: maybe it'd make sense to consider a map dispatch-val as matching if it's a subset of the map passed as a parameter. Or is that already doable? :/
17:44 Chouser: rhickey: ah, good point.
17:44 astor: couldn't my example be solved by adding some sort of destructuring support when matching arguments to each defmethod?
17:45 you require that the destructuring have no "nils" for the method to be called.
17:45 destructuring seems to be cacheable to me.
17:46 ..or maybe not.
17:46 rhickey: I think the current multimethod capabilities have barely been exercised, so not inclined to enhance yet
17:48 jewel: do you cache at call sites?
17:50 kotarak: I find it difficult to come up with a suitable dispatch method. And how to design the overall structure with derive and friends. Maybe someone can enhance the wiki with a real-world example? Or write a blog post? *hinthint* ;)
17:52 rhickey: jewel: no, on the methods
17:52 Chouser: I need an simple concrete example of a objects with more than one "type" worth dispatching on.
17:53 jewel: wouldn't call site caches be more effective? is the space penalty too large?
17:54 Chouser: So far my best is vehical class (car, van, truck) and vehical make (Ford, GM, Toyota)
17:54 but that's pretty lame.
17:57 Lau_of_DK: Funny, if I type (drop<tab>) SLIME throws a "Stack overflow exception for regex"
17:59 astor: rhickey: I think there needs to be a way to dispatch on Object as you mention. In CLOS, adding random aux arguments that you don't necessarily want to specify a hierarchy for is common, and you can just say 't for those in your method. another thing I haven't figured out is how to disambiguate multiple methods that can be applied. In one screencast, I hear you say that this is possible, but I haven't seen how. Something like CLOS (left-to-right) is what I
18:00 Chouser: astor: did you see (doc prefer-method)
18:00 astor: Chouser: no. I will!
18:06 Lau_of_DK: Question. lets say I have a loooooong string "xyzxyzxyzxyzxyzxyz % abcabc" where I want to drop everything before % in an efficient concise way, how do I do ?
18:06 danlarkin: Lau_of_DK: split on %
18:07 kotarak: Lau_of_DK: hi lau, obvious idea (drop-while #(not= \% %) str)
18:07 Lau_of_DK: there might be others
18:07 kotarak, doesnt that just drop everything thats not % ?
18:08 kotarak: Lau_of_DK: it drops until it encounters %
18:09 Chousuke: the problem is that it doesn't return a string
18:09 kotarak: Lau_of_DK: what you mean is filter
18:09 Lau_of_DK: I confused remove and drop-while Mr. Kota
18:09 You were right
18:10 kotarak: Chousuke is right however. You get a seq back, not a string.
18:10 danlarkin: apply str result
18:10 look ma, no parens!
18:10 Chousuke: you can perhaps use some java method to find the first occurrence of %, then make a substring.
18:11 Lau_of_DK: drop-while worked like a charm, exactly what I needed
18:11 Thanks both of you for the inspiration
18:12 kotarak: Lau_of_DK: eulering again?
18:12 Lau_of_DK: Actually, I wanted to run through the Python Challenge in Clojure, just for the fun of it :)
18:14 astor: Chouser: I don't see prefer-method as being very powerful. Thinking in CLOS-style MOP, there should be a multimethod that gets *called* when clojure gets confused and that function should disambiguate. then clojure could cache the result of that call. prefer-method seems to imply that one knows beforehand all possible argument combinations to the method, but something like left-to-right is an *algorithm* to disambiguate.
18:14 kotarak: Lau_of_DK: Show 'em the power of Clojure. :) Have fun.
18:14 Lau_of_DK: Thank you Mr. Kota, and thank you for all your wonderful contributions to both the wiki and clojure-euler.wiki - Its good stuff all of it
18:15 kotarak: Lau_of_DK: thanks
18:15 hiredman: there is a clojure euler wiki?
18:16 kotarak: clojure-euler.wikispaces.com (out of my memory)
18:16 hiredman: nice
18:53 mrsolo_: how fast is clojure
18:53 hiredman: how fast is the color blue?
18:54 mrsolo_: does it run as fast as java native code most of the time?
18:54 duck1123_: 299792458 m/s
18:54 mrsolo_: without hinting?
18:54 or 1/2 fast?
18:55 Chousuke: I don't lnow, what kind of code?
18:56 mrsolo_: any kind... just it is just a bit of generalization but i just want a ball part figure
18:56 web has some clojure performance comparision on fib function that is about it
18:57 hiredman: you need something to compare it to
18:57 some context
18:59 mrsolo_: say compares to java native
18:59 duck1123_: Clojure is just as fast as Java except for the times when it is faster or slower
18:59 mrsolo_: say..ranking in greatest language shootout? <duck>
18:59 hiredman: you came to the perfect place to answer that question
19:00 obviously clojure is #1
19:00 mrsolo_: scala number is somewhat close to java native.. i assume clojure number is somewhat similar?
19:07 duck1123_: I think I remember hearing Rich saying in one of the screencasts that Clojure is almost as fast as native Java
19:07 who knows what it's like now with AOT
19:07 barn_: I have never pushed clojure, but speed of execution isn't the main goal for most people.
19:08 duck1123_: really the only diffeerence should be what you're doing
19:08 kotarak: Cliff C from Azul posted some numbers on the group.
19:08 barn_: Lol
19:08 I don't think id being using the Azul numbers
19:08 mrsolo_: it is general langauge characteristic that i like to know
19:08 barn_: Mortals can't own those machines
19:09 mrsolo_: execution speed, memory footprint etc
19:10 barn_: It completely depends on your balance of HLL code vs java libraries
19:10 I code most everything still in Jython, and the code is 80-95% the speed of java
19:10 since all the heavy lifting is in libraries
19:11 But I can write code 4 - 8x faster
19:12 2hrs vs 8hrs, gives my computer 6 more hours of execution time
19:12 hiredman: and computer time is cheaper then people time
19:12 barn_: By leaps and bounds
19:12 I wish my mobo had 40 dimm slots
19:13 Side note, but I will share anyway since your captive
19:13 hiredman: my blackberry idles all day doing nothing, and it can run some kind of stripped down java
19:14 barn_: I worked on a system that cost the client over 100k per instance, and I was tasked with making sure we could munge gigabytes of data in a program that had a hard limit of 512MB
19:14 It made absolutely no sense, we charged the client 100K for this software and we could not assume, nor mandate that they had at least 2GB of ram to work with? We could have delivered buckets of ram for no extra charge
19:15 hiredman: heh
19:15 barn_: I had to write code using JDBM to spool intermediate results to disk and do external sorts like I was using tapes
19:15 It still pains me to think about it
19:16 gnuvince_: Do you guys have any finished projects that you wish you could do again (with Clojure possibly)?
19:17 barn_: I can't use clojure on a commercial project until I am productive as jython
19:19 AWizzArd: is there already something like apropos?
19:20 billc: AWizzArd: find-doc isn't the same; however, it's similar
19:22 gnuvince_: barn_: we're talking "wishing" :)
19:22 When I first joined the company I work with, it was to help on a network daemon program written in PHP (yes, PHP)
19:22 I wish I could use Clojure for that now
19:23 barn_: 90% of the java projects I was on could have been done in Jython, and so to in Clojure
19:24 I tried using some of the other schemes but they didn't integrate with java well enough
19:24 Chousuke: hm
19:24 barn_: Clojure is awesome in this regard
19:25 Chousuke: I posted a reply to a question on the group but it didn't appear immediately. Is it normal behaviour for google groups?
19:25 * Chousuke doesn't know how google groups work :P
19:26 gnuvince_: barn_: yeah. I'm writing a tutorial, and it's amazing to be able to use Java libs natively
19:26 AWizzArd: Chousuke: yes, it can appear within seconds or take one day
19:26 Chousuke: :/
19:26 AWizzArd: often it's fast
19:27 but a few times I had to wait for hours
19:27 is there a way to find out in which Clojure version I am? Like (lisp-implementation-version) or (lisp-implementation-name)?
19:28 Chousuke: I posted an answer to the collection containing itself -question; you can emulate with trickery: (def foo [1 2 3 #'foo])
19:59 ReplRat: has anybody been having trouble with swank-clojure over the last day or so? i'm trying to install it and i wonder whether it is tripping over recent Clojure check-ins. when i do (require (quote swank)) i get Unable to resolve symbol: require in this context.
20:02 Chousuke: do you have the most recent versions of both clojure and swank-clojure?
20:02 ReplRat: yeah.
20:02 is there a way to check my clojure version from the repl?
20:02 Chousuke: no.
20:03 This really is a FAQ. :)
20:03 ReplRat: i'm not great with svn but i did svn update and a new build so i'm pretty sure its new.
20:03 where's the FAQ?
20:04 Chousuke: no, I meant, your Question is a FAQ (a frequently asked question) :p
20:04 ReplRat: sorry
20:04 Chousuke: I suppose we could use a FAQ list somewhere.
20:05 but I can't say what's wrong with that. it looks like namespace trouble, but if you have the most recent revisions of everything then it should work :/
20:08 you're trying to setup slime and clojure? or just doing something else with clojure-swank?
20:13 ReplRat: Chousuke: just trying to set up slime and clojure.
20:13 clojure doesn't seem to know how to (require)
20:13 ATM i'm trying to verify that i have the latest clojure.
20:14 Chousuke: you don't need to (require 'swank) in clojure
20:14 this is what you need in your .emacs: http://
20:14 ReplRat: it looks like that's what slime is doing though; after a (add-classpath)
20:15 ok i'll read that
21:01 barn_: gnuvince_: I would be interested in proof reading your tutorial
21:01 What is it on?
21:01 Collections classes by chance?
21:15 barn_: the draft of the second part is half completed
21:16 ReplRat_: Chousuke: I'm pretty sure my Clojure checkout was old. Everything is OK now. Thanks for the help.
21:17 barn_: gnuvince_: reading it now
22:17 duck1123: Does anyone know what the easiest way to get the current time as an xsd:DateTime
22:18 it's looking like I need to specify each segment, which leads me to believe there is an easier way