#clojure logs

2008-11-08

03:38knoboI have some problems starting clojure. Is there a paste-bin I can use?
03:39knoboI start clojure like this: java -cp clojure.jar clojure.lang.Repl
03:39H4nslisppaste8: url
03:39lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
03:39knoboAnd I get lot's of error messages. It starts with Exception in thread "main" java.lang.ExceptionInInitializerError
03:40lisppaste8knobo pasted "Error booting clojure" at http://paste.lisp.org/display/69939
03:42knobo $JAVA_HOME is /usr/lib/jvm/java-6-sun-1.6.0.07/
03:42knobo
03:43knoboI don't know anything about Java. Maybe I shood learn java before clojure?
03:43Carki don't know anything about java either ....but it's manageable it seems
03:44H4nsare you starting java in the directory that clojure.jar is in?
03:44knoboyes
03:44knobols -l clojure.jar gives -rw-r--r-- 1 knobo knobo 498538 2008-11-08 09:32 clojure.jar
03:45H4nsdid you compile clojure yourself?
03:45knoboyes, at 09:32
03:45H4nswhat java version do you use?
03:46knobohaha! I did not know... java version "1.5.0" gij (GNU libgcj) version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
03:47H4nserm
03:47H4nsmy guess is that you need sun java
03:47knoboMaybe better use sun.
03:48H4nsalso, you will need to learn java to some extent in order to use clojure.
03:48Carklearn to use javadoc and you're all set imho
03:50knoboDo I nead to do some kind of "make clean"?
03:50knoboI also don't know ant
03:51H4nsyou can remove all .class files
03:52knoboHurra!
03:52knoboI made it :)
03:52Carkbravo !
03:54knoboI can see. I need too learn swing, and other APIs
03:54knobolibs.
03:55Carki would recommend learning MigLayout along with swing
03:56knoboCan I load .jar files dynamicly after cojure has started?
03:56knobohmm. well. I'll start by reading some docs.
03:57Carkknobo : i have a directory in the classpath with all the jar files i want to use, then just (import) them
03:58knoboSo (import "MigLayout") should do it then.
03:59Carklet me copy past a namespace declaration
04:00lisppaste8cark pasted "example namespace" at http://paste.lisp.org/display/69940
04:04knobothanx
04:09knoboIs the slime patch maintained?
04:11Carki don't know
04:24knoboHow about using eclipse. Is that what people is doing?
04:25knoboI would like to know some best pratises
04:30Carki'm using slime
04:31Carki hear there's a netbean add-on too
04:31Carkthough i would think that emacs is best suited for sexpr based languages
04:42knoboIt would be nice if http://clojure.org/api had examples for each function. Like hyperspec have.
04:44Carkyep that's a problem ...
04:45Carkthere's the wiki-book with a few examples
04:45knoboWhy is it a problem. A wiki would solve that (almost).
04:45knobo:)
04:46Carkwell clojure is still pretty much a moving target
04:47Carkexamples should show up in the doc strings, that would be perfect, commiters could update it in place
04:48Carkthey're talking about making a test suite too, that would be even better !
04:49knoboIs clojure written in clojure?
04:50knobohmm, no it's not..
04:50Carknope ...much is done in boot.clj, but the basis is java
04:55knoboboot.clj is mostly understandable :)
04:56Carkit's a good reference
04:56Carkwhen you don't know how to use something
04:56knoboIt solves a lot of the missing examples
06:48Lau_of_DKGood afternoon guys
06:49Carkhello lau_of_dk
06:57Lau_of_DKAnybody here got some interesting projects on Sourceforge (Clojure ofc) ?
07:17kib2_awayhello, I wanted to know how to add a .jar to my classpath
07:18Lau_of_DKjava -cp /path/to/your.jar:/path/to/clojure.jar clojure.lang.**
07:18rhickey_djkthx: still here?
07:19kib2_awayLau_of_DK: thanks !
07:19Lau_of_DKnp :)
07:19Lau_of_DKUnless your on Windows kib2_away ?
07:19kib2_awayLau_of_DK: yes, I'm on windows
07:19kib2_awaywhy ?
07:19Lau_of_DKThen I think its java -cp "c:\jar1.jar;c:\clojure.jar" instead
07:20Lau_of_DKThe syntax is a little different
07:20kib2_awayok, " are there to handle spaces I think
07:20kib2_awaylike "Documents and Settings/..."
07:20Carkmost important is the : which becomes a ;
07:21Lau_of_DKok
07:21kib2_awayI've tried inside my code to use (add-classpath "file://core.jar") but it fails under windows. Do i miss something ?
07:22kib2_awaymaybe my classpath is not well configured
07:22philedI'm hoping to use Clojure for my next project, since it ticks most of the boxes I want for the purpose. One thing I'm concerned about is whether there currently is or will be a means to do the equivalent of reflecting into packages and the symbol table as in CL. Any ideas?
07:24Carki'm calling clojure with java -cp c:\path\to\libs\*;c:\clojure\clojure.jar clojure.lang.Repl
07:24Carkthen i only need to (require com.some.lib)
07:24rhickey_philed: look at: (find-doc "ns-")
07:25kib2_awayCark: nice tip, thanks.
07:25Carkerr not require but import !
07:25kib2_awayCark: import or use ?
07:26Carkimport for java stuff
07:26philedUnfortunately, I don't have clojure installed on my home machine at the moment. But I'm thinking more like "do-symbols" and "find-symbol" and "find-package" and so forth.
07:26Lau_of_DKphiled, take a look at this http://paste.lisp.org/display/67122
07:28lisppaste8rhickey pasted "ns fns" at http://paste.lisp.org/display/69948
07:28philedVery nice. That should be all I need.
07:29philedIt would be good to get this hooked up to SLIME so we can get some auto-complete working.
07:29Lau_of_DK:)
07:30Lau_of_DKI think we need to review the wiki's recommendations on setting up slime, for every 1 person who gets it working there seems to be 10 who cannot
07:32philedIt took me a while. I can't remember what the problem was. But I take it I have it set up correctly: there is no tab-completion available at the REPL, or any information about function arguments in the minibuffer as you type?
07:33kib2_awayphiled: C-c M-i does not do completion in Slime ?
07:34Carkphiled : i have both
07:34philedAh okay. Something's wrong with my setup then.
07:34ChousukeI set up tab completion manually
07:34Chousukebut the minibuffer info should be there.
07:35philedYes, I've read a few articles about doing tab-completion yourself, by loading in a database of function definitions and so forth. But I want this done automatically, with updates every time I write a new function.
07:35Chousukeno I mean I set up tab completion separately from slime :)
07:35Carkswank-clojure provides this, it should work out of the box
07:35Chousukeit does update automatically.
07:35philedOkay, then I definitely have done something wrong.
07:54philedOkay, so does the clojure swank server use the java reflection API to do all the tab-completions and other such stuff?
07:54Carknope
07:55philedAny idea how it works then?
07:55Carkit does completion for the clojure stuff only
07:56philedOkay, so does it work in any way like slime for CL?
07:57Carki don't know ... i'm a lispworks user.
07:57Carkit uses the namespace api at http://clojure.org/namespaces
07:59Carkyou can check this in swank-clojure\swank\commands\basic\
07:59Carki think adding the java reflection completion would be trivial
08:00philedAck! I don't know what I'm talking about then. I read "the read table is currently not accessible to user programs" on the website and stupidly confused "read table" with "symbol table".
08:00philedI had thought Clojure had no support for the equivalent of first-class packages, but it obviously does (and damn well should!)
08:01philedStill, surely swank could be extended to use both the ns API and Java reflection?
08:01Carkhas to because of the lisp1 thing
08:01philedWhy would lisp1 force it to?
08:02Carkbecause of name clashes
08:03Carkcan you imagine a single namespace a la emacs
08:03Carkthat's ugly
08:03philedNo I don't mean that. I specifically mean *first-class* packages. That is, packages and symbols that are first-class objects.
08:03philedSo you can do things like enumerate the symbols interned in a package.
08:04Carkyou know what, i never understood the meaning of "first class" =P
08:04rhickey_philed: Clojure's namespaces are first class but Java's packages are not
08:04philedI'm not sure I could give a formal definition. I would say anything which can be bound to a variable is a first-class object.
08:04rhickey_but I do think IDEs/Slime could do Java completion too
08:05rhickey_there are some context hints (like the presence of . ) that can help
08:05Lau_of_DKrhickey_, would you mind setting that up and then updating the wiki accordingly? :)
08:05rhickey_but being dynamically typed, a lot of the hooks used by Java IDEs won't work
08:06philedrhicker: That sucks. I don't really know much Java, but then, since I'm not going to be writing much Java code, it should be possible to just put lots of metadata around existing java functions so we can get autocompletion and documentation via "find-doc". Unless this has already been done.
08:06Chousernono, that's not rhickey_'s job
08:06Chouserlet him get AOT and io streams working. :-)
08:07Lau_of_DKI knew it was a long shot :) But they dont call me 'The Delagator" for nothing. No I actually already asked Chousuke to review the wiki, because he seems to have a well-working slime-setup
08:08rhickey_Chouser: It looks like cgrand is ahead of me on the io enumerators, so I hope he runs with that, then we can get it done in parallel - trying to get a dialog with him going on the group about it so everyone can follow along
08:08philedrhickey: By the way, though I haven't started coding in it yet, I have extremely high hopes for Clojure. The design philosophy matches up pretty much precisely with what I want from a language.
08:08philedGreat work!
08:08rhickey_Chouser: simpler doseq looks nice, I have 2 nits
08:08rhickey_philed: thanks!
08:08Chouserrhickey_: ok, go for it.
08:08rhickey_Chouser: will paste momentarily
08:09ChouserI got far enough in implementing that paper's io ideas, that I'm now pretty excited to see it implemented.
08:10rhickey_Chouser: yes, will be great addition
08:10Lau_of_DKrhickey_, I know this is probably also a long shot, but all these talks your doing around the US, is there any chance you'll have an oppotunity to do any such thing in Europe, preferably Scandinavia, preferably Denmark? :)
08:10ChouserUnless I'm missing something it won't be hard to *do*, it's more a matter of doing it well.
08:11rhickey_Chouser: yes, lots of little details, EOF, done protocol, timeouts etc
08:11philedrhickey_: Are Clojure namespaces hierarchical?
08:11Chouserphiled: nope
08:11rhickey_Like most of Clojure, I'd like it to be part of a unified model, in this case making sure it encompasses queues well
08:12Chouserphiled: but it's convention to use . to separate parts of the namespace name
08:12Chouserphiled: when used with "use" and "require" the name parts are mapped to directory names on disk, just like java packages.
08:12lisppaste8rhickey annotated #69926 with "doseq nits" at http://paste.lisp.org/display/69926#2
08:13Chouserapply assoc is good
08:13philedAny explanation for why? I've done things in CL to get something like hierarchical packages, extending the existing hacks in CMUCL. It's nice to be able to use relative namespace names.
08:14Lau_of_DKrhickey_, I know this is probably also a long shot, but all these talks your doing around the US, is there any chance you'll have an oppotunity to do any such thing in Europe, preferably Scandinavia, preferably Denmark? :)
08:14Chouserbut I don't think I can use destructuring at that point to boot.clj (I tried to at first)
08:14rhickey_Chouser: ah!, didn't consider that
08:14Chouserso apply emit was my hack attempt to use & in the fn instead
08:15rhickey_generally, if you always apply a fn, the sig is wrong
08:15ChouserI had to move partition up too, but that seems to be ok.
08:15rhickey_apply is fine then
08:16rhickey_I'll try your patch today if it's ready - might as well break everything at once :)
08:16ChouserMaybe a comment to warn people reading boot.clj looking for examples of how code should look.
08:17rhickey_Chouser: yeah, I'd love to just go through it and change all the Java interop to the latest conventions too
08:17Chouserheh, ok! You want a fresh patch against 1089?
08:17rhickey_but there will always be some trickiness to the bootstrap order
08:17Chouseryeah
08:18rhickey_Chouser: fresh patch welcome
08:18Chouserok. no need for extra exception throwing as mentioned in the groupthread?
08:18Chouserfor "too many bindings"?
08:19rhickey_Lau_of_DK: no plans for Europe yet - please send plane tix :)
08:20philedrhickey: Maybe I could persuade some of the Foundations of Computer Science people here in Edinburgh to get you over for a talk. Philip Wadler likes Lisps.
08:20rhickey_Chouser: no, let's keep it simple, I don;t think people will be inclined to try multiple bindings in if-let
08:21rhickey_philed: um, Wadler likes to beat up on Lisps :)
08:21Lau_of_DKrhickey_, Im sure air-fare wont be a problem, but if any such practicality is preventing you, feel free to let me know, I'll help resolve it
08:22philedrhickey: He does? He's got a copy of the "God codes in Lisp" poem on his blog, so I thought he would probably be into them. But then, being a Haskell guy, he probably hates dynamically typed languages. Haven't chatted with him about Lisp, actually.
08:22rhickey_philed: those folks are way into type systems, so Clojure is rather primitive from that point of view
08:23rhickey_philed: He gave a talk at a Lisp conf to the effect of - God codes in a strongly typed lambda calculus
08:23philedrhickey: Yep. I like type-systems as well from an intellectual point of view, and I think what Ocaml does is pretty amazing (static duck typing). I've also seen some cool tricks with the type systems, but they seem as obscene as template metaprogramming in C++ sometimes.
08:28arbscht_Lau_of_DK: while you're at it, sponsor him a trip to new zealand too! :)
08:30Chouserand Indiana. :-P
08:33philedSo going back to hierarchical namespaces: the only behaviour I like (which you can hack into CL) is to have it so that all symbols in a namespace foo are automatically interned in the namespace foo.bar, and having it so that, while in the namespace foo, the namespace bar can be referred to with a relative namespace name, perhaps just "bar". Depending on how the reader works, you can always add this behaviour to CL. Is it p
08:33philedossible in Clojure, or there already?
08:36philedHope this question isn't impertinent by the way. It hasn't been discussed to death already on newsgroups?
08:46rhickey_philed: I want to hold off on that until I see a need - with aliases, I don't see it
08:46rhickey_complexity/utility ratio is not good
08:49philedWould it be possible (for me) to write it as a library on top of Clojure? In CL, all you need to do is rewrite find-symbol and add a macro to define nested packages. It just requires that the reader looks up symbol definitions by using a function like "find-symbol" which can be rebound to a user-defined function.
08:49philedOf course, that latter issue is not guaranteed by the CL specification.
08:51rhickey_philed: as evidenced elsewhere, I'm not inclined towards language customization outside of macros, esp. reader customization, as such customizations can't be combined
08:57philedThat's fair. It opens the door to abuse. I think getting hierarchical packages in CL was justified though, since I feel there is a fair amount to be gained from them. In CMUCL, they are available out of the box.
08:57philedBut again, as a reader customisation.
08:58rhickey_Java and C# have much larger libraries and flat namespaces have been sufficient there, IMO
08:59rhickey_again, it's not that they are bad, just the complexity/utility ratio
09:01philedBut those languages rely on OO for much of their modularity, and their model of OO means that classes *are* effectively namespaces, and are frequently nested (right). With generic functions, you don't have this, and besides, aren't you putting much less emphasis on OO with Clojure?
09:04Chousukedeep nesting gets confusing pretty quickly :/
09:04rhickey_philed: yes, classes are namespaces, no, not too frequently nested, yes, Clojure is not very OO. That said, a one-line alias or :as at the top of a file le's you get a short name for anything vs everyone (incl. tools) having to understand hierarchical namespaces. It's simply a tradeoff
09:06philedrhickey_: Okay, cool. I'll trust your experience on this one and try hacking with flat namespaces. There's always a chance my early exposure to C++ has clouded my judgement on this matter.
09:07philedChousuke: Right, there's be diminishing returns involved. And I have noticed this with my own code, even with only three levels of nesting.
09:09Chousukeon thursday I was watching a presentation about distributed systems on .NET, and the guy did a code demo. Everyone (including the speaker himself) laughed a bit when he read aloud code that accessed a property that was nested at least 5 levels :P
09:10philedChousuke: Java and C# have the whole "kingdom of nouns" thing going on which just compounds the problem.
09:24ChouserYegge's got reach, doesn't he. If only Google would let him use Clojure.
09:28drewrI don't see why he couldn't. They already have a huge JVM infrastructure.
09:28drewrShould be easier than the Ruby battle he's been fighting.
09:29ChouserGoogle only allows javascript, java, C, and python (from what I understand)
09:29Chouserhe's only allowed to do his Rhino experiments because it's js and java.
09:30ChousukeI took a look at the wiki slime set up guide and changed it a bit to match how my setup is done.
09:30ChousukeI don't know if it works for others but it works for me :/
09:30Chousukemostly it was the same though.
09:30drewrChouser: He's said that limitation is based on deployment. Clojure would require little infrastructure change if any.
09:31ChousukeI also added a tab completion trick I found on the internet somewhere that I use
09:33Chouserwith the possible exception of C-like syntax, clojure is so much closer to what he seems to want than javascript it.
09:35drewrI get the impression he'd prefer a lisp if it was practical. I think he only puts up with JS because it's the most lispy of the mainstream languages.
09:37drewrI find it ironic that people complain about lisp's parens. I look at javascript and I am blinded by the braces, especially if I write it in a functional way.
09:39drewrhola wilkes
09:40kotarakdrewr: (-> obj .getAThing .makeMore .actions) vs. obj.getAThing().makeMore().actions()... 2 vs. 6, aha, so Java is the actual Lisp...
09:41wilkeshowdy drewr
09:42wilkesdrewr: I made a bit of headway yesterday on the pivotal-tracker client
09:42wilkeshttp://github.com/wilkes/pivotal-tracker-clojure-client/tree/master/
09:42drewrkotarak: :-)
09:43wilkesaccidently created a DSL
09:43drewrI see that.
09:46philedkotarak: Still, there is something to be said in the fact that I couldn't write Lisp code without paren matching switched on, while I can write procedural code with C-like syntax without any difficulty.. That said, when you have paren-matching, I have not found Lisp syntax any more of a pain than any other language, and the benefits of code-as-data and syntactic macros make Lisp syntax far superior. Now that mainstream lan
09:46philedguages such as C# are taking syntactic abstraction seriously, I think it will be easier to convince programmers of this, especially when working with C# expression objects (and Ocaml expression objects) is so much more painful.
10:13rhickey_Chouser: bindings patch applied - rev 1090. Thanks, that's a significant contribution!
10:14Chousergreat, thanks.
10:14Chouseri assumed there were a dozen or more such macros, so it's not as significant a contribution as I assumed it would be. :-)
10:15rhickey_still a lot of work - I appreciate it
10:17Chouseryou're quite welcome. I'm all about breaking other people's code.
10:18rhickey_nice
10:18rhickey_aargh, forgot to give you blame, er, credit in the checkin comment
10:20Chouser:-) no worries.
10:20rhickey_I guess there's a lot todo to bring contrib up to speed too
10:21Chousukedoseq etc. are like let now?
10:21rhickey_The next phase of AOT is a big one for contrib - moves directories around
10:22rhickey_Chousuke: yes, per: http://groups.google.com/group/clojure/browse_frm/thread/55213f2eb203ca39
10:23rhickey_also for AOT the mappings will now be from my.company.lib ns to class lib in my.company package Java-wise
10:23rhickey_this won't affect ns/require/use et al, but will lift everything up a directory
10:24rhickey_but biggest change is that clojure ns should really be at least one nested, lest it have no Java package, e.g. clojure.core
10:25rhickey_thinking about some standard aliases - core/set/xml/zip etc
10:27Chouserbah, I forgot to add the comment for (apply emit binds)
10:27rhickey_Chouser: when people start noticing that we'll be in good shape
10:28Chouserheh
10:32djkthxrhickey_: here now
10:33rhickey_djkthx: you were doing sieve?
10:34djkthxyeah
10:34rhickey_I had a faster version, here: http://paste.lisp.org/display/69952, commented on your blog
10:34djkthxyeah, why is it faster?
10:35rhickey_djkthx: because it uses primitives
10:35djkthxah, gotcha
10:35djkthxcool
10:35djkthxthanks :)
10:35rhickey_sure
10:36ChouserI was noticing that since doseq uses loop/recur, it could benefit from primitives, except there's no way to specify them.
10:37Chouserwould the benefit be to little just because it's always pulling from seqs?
10:37rhickey_Chouser: doseq uses numbers?
10:38rhickey_or if the seq contents are numbers?
10:38Chouserif the seq contents are numbers. range, primes, fibs, etc.
10:39rhickey_yeah, time will probably be dominated by seqs
10:40Chouserok.
10:41rhickey_numbers will be boxed in seqs anyway, unbox is no big deal
10:43ChouserYou might get primitive logic in :when and :while, but I can see it might not help much.
10:44rhickey_once you are at that point you're looking at amap/areduce anyway
10:45Chouserpity. :-)
10:45rhickey_tagged numbers needed to do better with Object-based interfaces
11:09lisppaste8mibu pasted "line-seq" at http://paste.lisp.org/display/69962
11:10mibuI have a question regarding recursive calls.
11:10mibuWhat exactly is the semantics of recur?
11:11Chouserrecur is like a call to the immediately containing function or loop
11:11Chouserexcept it doesn't consume a stack frame
11:13mibuWell in the paste above, line-seq recursively call line-seq. I assume it's possible because defn creates a var of line-seq instead of a let binding. But shouldn't that have worked with recur instead of line-seq? (It doesn't)
11:14kotarakThe function returns, before the "recursive" call happens because of the lazy-cons
11:16Chouseryeah, lazy-cons is the key. Neither of it arguments is evaluated immediately; they're both deferred until needed.
11:16mibuok. so how do I create recursive references when not using defn? for instance in a let binding clause: (let [lines (something) seqqer (fn [seq] (lazy-cons (re-seq #"\\w+" (first lines)) (seqqer (rest lines))))] (seqqer lines))
11:17mibuseqqer is not recognized in the fn def.
11:17kotarakseqqer (fn seqqer [seq] ...)
11:17kotarak(where seq is a bad local variable, because it shadows the function seq)
11:18mibuoh! thanks.
11:18mibuisn't it a little redundant?
11:19kotarakI almost never need it.
11:19kotarakbut letrec is on the TODO list
11:21mibuwhy use a different symbol for a recursive let?
11:35AWizzArdMoin
11:43mibuIs there a last-value-evaluated var in the REPL (like '*' in CL)?
11:43rhickey_mibu: *1 *2 *3
11:43kotarak*1 *2 *3 *e (<- last one is exception)
11:44mibuthanks.
11:45mibuah, that's not in the latest release (...0916), right?
11:45AWizzArdtry the svn
11:45mibuI will.
11:47Chouserdon't use the *latest* svn, though, unless you're feeling adventurous.
11:47rhickey_mibu: the last 2 checkins contained significant changes - try rev 1088 for the smoothest ride
11:48rhickey_anyone have any issues with clojure ns being renamed clojure.core ? (aside from the breakage)
11:48miburhickey: thanks. I will.
11:49kotarakrhickey_: why not clojure.lang? Would match the java side. (Although that might be a problem)...
11:50rhickey_kotarak: I'd rather avoid mixing the generated classes from the two sources
11:50rhickey_also would cause a class and a package to be called clojure.lang
11:51rhickey_most of what is in there (currently boot.clj) is core library, not language syntax
11:51rhickey_so seems easiest to have a different name
11:52kotarakjust an idea.. Separating the underlyings from the core librarary running on the former is a good argument
12:07mibuIs there an active issue tracker somewhere? (todo list, feature requests, known bugs, release schedule, and the like.)
12:08kotarakmibu: TODO list: http://richhickey.backpackit.com/pub/1597914
12:08mibuthanks
12:09kotarakmibu: feature request are discussed on the Clojure list of google groups
12:09kotarakmibu: bugs are dropped here and are immediately fixed by Rich. :)
12:09mibu:-)
12:09kotarak(of course they can also go to the Clojure list)
12:12mibuthe group is good to keep track of what's happening right now, but for newcomers (I am one) it's hard to see what was already discussed in the past without reading everything. right now, I'm trying to wrap my head around what's the current status of things and where it's going.
12:14rhickey_mibu: I hope to move to a tracker soon, the todo represents those things that made it onto the agenda
12:15rhickey_scary - just got rid of clojure namespace
12:15rhickey_(and Clojure still works)
12:16kotarakClojure finally transcedented to a higher being and doesn't need such profane things like a namespace anymore.
12:17miburhickey, is the project right now still rapidly changing or is it converging to something stable enough for production code?
12:17mibu(I'm good with rapidly changing. I just need to know)
12:18AWizzArdI feel its rapidly changing into something stable for production code :-)
12:18mibu:-)
12:18rhickey_mibu: there are very few breaking changes. A few have built up and I am putting them in now in prep for a 1.0 release. While there is a lot of dev activity, it's mostly enhancements/additions
12:19kotarakI had relatively few troubles lately. The biggest fluctuations in my code were during the require/use/ns transitions.
12:19AWizzArdAs soon we can compile everything into .class files and deliver apps the biggest hurdle for some companies is gone.
12:19rhickey_It only seems rapidly changing for those that want to try the latest toys
12:19AWizzArd...and deliver apps without delivering code...
12:20rhickey_AWizzArd: coming soon
12:20AWizzArdyes, and I am beginning already translations
12:21AWizzArdmibu: I think it makes sense to begin *now* to work on your products. If it is something that needs several months anyway then everything will be in place as soon you are done.
12:22mibuI'm all good with changing tech (what else am I doing here?), but my colleague are not. Changing tech means it's improving and not yet bound by compatibility issues and standards (like CL).
12:22mibucolleagues*
12:23AWizzArdwe are not forced to use newer versions.. one could simply stick to one of them and nothing will change
12:24rhickey_AWizzArd: true, the only caveat being that right now bug fixes and new features come together
12:25mibuawizz: yeah, but when things change fast you want all the latest cool toys at your possesion. otherwise you feel like using tape recorders in a world of Ipods.
12:26AWizzArdYes, that's right. Anyway, Clojure was done mostly right, and I think there won't be dramatic changes that would force us into full rewrites. But standing still like CL mostly is, is also not a good option.
12:30mibuI think CL also got the basics right, the only cardinal problem was the libs. Think about CL with a Java like library and it's pretty sweet. Of course, I welcome the much improved changes in clojure.
12:32AWizzArdCL still challenges us to not do what it offers: like imperative programming. One of the reasons that CL has not enough libs is that one needs big efforts to make them compatible.
12:32AWizzArdJava allows more or less only one way to do it. So everyone has to do it the same way, and often ends up with libs that can be shared and used with/by others.
12:36mibunow that I think of it, every single successful language in the last years became successful thanks to a batteries included philosophy--large useful well-documented library. It worked for perl, java, python, and I assert it's also true in relative terms to C.
12:39AWizzArdSure, a large library is the most important factor for productivity. The biggest factor for productivity is code reuse. If systam A already has a lib to do some stuff then making just a few calls is simply the easist thing to do. Clojure is prepared here, as Java offers the more or less biggest code base.
12:43mibunow that the library factor is covered, I think concurrency is the biggest issue, and immutability pretty much untangles that. Now the last two factors left is documentation and a following.
13:03mibu1088 rev broke something with regexes. Is it just me?
13:03mibu(moved from the 0916 release to 1088 svn)
13:05rhickey_mibu: http://groups.google.com/group/clojure/browse_frm/thread/789b57325c885752/7442ef6e2fc4d0b7?lnk=gst&amp;q=regex#7442ef6e2fc4d0b7
13:05rhickey_basically, \ doesn't need to be escaped
13:05rhickey_anymore
13:06mibuAh, thanks. That did it.
13:10mibuPeople working with code from Eric Rochester's blog will have problems. http://writingcoding.blogspot.com/2008/06/tokenization-part-2.html
13:12mibuGoogle's captchas are getting ridiculous. I tried living a note about the change in the above link, but couldn't decipher the captcha...
13:13mibu*leaving
13:54AWizzArdrhickey_: http://clojure.org/functional_programming .. ca. at the middle of that page a (def vec [1 2 3]) is suggested. Most people will have a problem when they try it in the default namespace.
13:58AWizzArdrhickey_: a little typo in "defonce". It should be "if" instead of "iff" I guess.
13:59rhickey_AWizzArd: page fixed - thanks
14:00rhickey_AWizzArd: iff == if and only if
14:00AWizzArdI see
14:00AWizzArdrhickey_: in (defn concat ... ) there is a (if (seq x) ..) was this supposed to be (seq x) or should it be (seq? x) instead?
14:01AWizzArd(in the now newly named core.clj)
14:01rhickey_AWizzArd: wow, you are bleeding edge
14:02rhickey_it is correct as is, testing a seq for non-nil idiom == is there more?, seq call only needed because it might not yet be one (i.e. an empty vector)
14:18Jedi_StannisHi, I'm trying to access javax.swing.GroupLayout.Alignment.TRAILING and the other Alignment constants, but can't fgure out the syntax for it in clojure
14:20Chouserjavax.swing.GroupLayout$Alignment/TRAILING
14:20Chouser$ for a nested class, / to access a static member of that class
14:22Jedi_Stannisis that document anywhere? I didn't see it anywhere on the website, I knew about / just not $
14:23rhickey_Jedi_Stannis: http://clojure.org/java_interop
14:24Jedi_Stannisoo, its kinda hidden in the . special form, I was looking for something in bold
14:25Jedi_Stannisthanks though
14:26Jedi_StannisI have GroupLayout imported, but still need to fully qualify for $Alignment to work, is that expected?
14:26rhickey_GroupLayout and GroupLayout$Alignment are 2 different classes
14:28rhickey_you can import it too (import '(javax.swing GroupLayout GroupLayout$Alignment))
14:28Jedi_Stannisgot it
14:28Jedi_Stannisthanks
15:38AWizzArdrhickey_: motivated by the google groups kotarak and I were discussing about why do is a special form and not simply implemented as a function: (defn do [& body])
15:42Chousukehmmh
15:42rhickey_while everything can be looked at as an expression in CLojure, some things are not actually expressions and I have to fake it, like void methods
15:43rhickey_those are exactly the kinds of things you'll have in do bodies, in which case there is no realized expression value produced
15:43rhickey_if they were fn args I'd have to produce them
15:43rhickey_plus there's some overhead to & body and arg packing
15:44AWizzArdI see, thanks
16:28sohaildo you guys use ns for multi-file projects?
16:29Chouserdepends on why I'm using more than one file
16:29sohailChouser, interesting statement. for me, I'm writing an app that is getting too big for one file now :-)
16:31Chouserclojure.contrib.lazy-xml has two files. The secondary file depends on a 3rdparty lib, so the main file uses load in a try block to use the 3rdparty lib if it's there or to fail gracefully if it's not
16:31sohailwhere is clojure.contrib?
16:32Chouserclojure.contrib.zip-filter has a set of features just for xml that not all users will need, so it's in a separate namespace, clojure.contrib.zip-filter.xml
16:33sohailChouser, ok none of these sound like: "This file is too damn big."
16:33Chouserhttps://clojure-contrib.svn.sourceforge.net/svnroot/clojure-contrib clojure-contrib
16:34Chousersohail: yeah, I haven't run into that problem yet.
16:34sohailok so say you had, would you be using ns for that?
16:34ChouserI guess it depends on your definition of "damn", or perhaps "big". Have you seen boot.clj?
16:34sohailI have
16:34Chouser>3600 LOC -- you've got more than that?
16:35sohailno
16:35sohailthat's pretty damn big though
16:35sohailbesides, I'm putting a lot of stuff together that really shouldn't be... mixing GUI and non-GUI things
16:35ChouserI guess if there are natural divisions, esp. reusable chunks, I might break those into namespaces.
16:36Chouserotherwise I'd tend to keep it in one big file.
16:36ChouserI'd rather have a big file, then have 2 small ones and not be sure where exactly I put a particular function.
16:36Chouserthan
16:37Chousergotta go
16:37AWizzArdI sometimes can't decide when something should go into another file. And even in one file I am sometimes splitting functions into 2-3 parts, although these are then used only once, for the main function.
16:37sohailwhere's the ant colony simulation code
16:38sohailthat's gotta be kinda big atleast
16:38AWizzArdsohail: check GG or the vid
16:39sohailAWizzArd, what is GG?
16:39sohailand I saw the vid, but it was not obvious how the code was structured
16:39AWizzArdgoogle groups
16:39AWizzArdsohail: the code is attached to the vid, there is some link below the vid itself
16:40sohaillol, that's tiny
16:42AWizzArd150 loc for the non-gui stuff, without comments and whitespace-only lines
17:15knoboIs it possible to write java objects in clojure?
17:15knobosorry
17:15knobodelete that line
17:15knoboIs it possible to define java classes
17:15kotarakYes. With gen-class
17:15kotarak(doc gen-class) in the Repl gives more information
17:16AWizzArdnote it is possible though that gen-class will get replaced by something
17:17knoboSo I could use clojure when working with tomcat for exaxmple
17:17AWizzArdabsolutely
17:17AWizzArdeverywhere, where you can also use Java
17:17knoboFor mobile-phone applications
17:18AWizzArdyes
17:18AWizzArdand soon this will be simpler
17:19knoboI feel I am starting to become a member of the society again :)
17:19AWizzArdthe mobile phone stuff will probably be more available in 2009 as I understand it
17:19knoboI have been an outsider, programming in common-lisp
17:20AWizzArdI also come from CL
17:20knoboI actualy have a paid job programming CL :)
17:20knobofor now....
17:20AWizzArdsame with me :-)
17:21AWizzArdClojure will offer most Lispers a way to get a job in which they can do Lisp
17:22knoboeven openoffice.org
17:23danlarkinis there a class that all clojure collections implement?
17:23AWizzArdwhat do you mean?
17:23AWizzArddanlarkin: you mean class or interface?
17:23rhickey_danlarkin: clojure.lang.IPersistentCollection
17:24rhickey_http://clojure.googlegroups.com/web/chart.png
17:24danlarkinrhickey_: thanks :)
17:25rhickey_chart courtesy of Chouser
17:33AWizzArdrhickey_: is it easy to use the Clojure datastructures in Java too?
17:35rhickey_AWizzArd: sure, there are interfaces for everything. Their functional style is not idiomatic Java, though
17:36AWizzArdBut does one need to do a lot of casting? I don't understand the static type system of Java not well enough. I think Clojures DS all work on Object and could need casting
17:37AWizzArd-not
17:37AWizzArdMoin Lau
17:37Lau_of_DKOla AWizzArd
17:38rhickey_AWizzArd: yes, they are all Object based, just like pre-generics Java collections
18:00sohailhmm.. anyone getting this with latest clojure: Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT at clojure.lang.Script.main(Script.java:71)
18:00Lau_of_DKno
18:00sohailseems clojure.lang.Repl has disappeared for me too... maybe I need to rebuild it again
18:01Lau_of_DKdistclean
18:01sohailTarget "distclean" does not exist in the project "clojure".
18:02rhickey_ant clean ?
18:03sohailtried that too
18:04Lau_of_DKhehe
18:04Lau_of_DKI know, I just meant, clean up the old before you start on the new
18:06sohailcrap client on phone
18:07sohailhttps://clojure.svn.sourceforge.net/svnroot/clojure/trunk is the right branch right?
18:08rhickey_sohail: stick with rev 1088, lots of changes in last few checkins
18:09sohailrhickey_, ok thanks
18:09sohailok this version works
18:10kotaraksohail: with the latest check-in clojure is gone.
18:10kotaraksohail: clojure is dead, long live clojure.core
18:10sohailkotarak, oh noes
18:10sohailah, I see
18:10sohailso clojure.core.Repl?
18:10kotaraksohail: just kidding. Rework of the clojure namespace.
18:11kotarakI think Repl should still be in clojure.lang
18:11sohail's not!
18:11Lau_of_DKFor an immutable language, the namespace-stuff sure mutates alot
18:12sohailhaha
18:12Chousukeheh
18:12Chousukebetter mutate now than be stuck with a suboptimal solution forever
18:13duck1123that's okay, yesterday I did a pull of one of the emacs libs I use. The maintainer switched hosters, and basically told everyone by deleting all the files with the commit message "it's gone"
18:13Lau_of_DKhaha
18:14Chousukewell that'd at least encourage people to investigate what has happened.
18:14Chousukethough the commit message could've been better...
18:14duck1123and Lau_of_DK, that's one of the benefits of git. even had I not found where it went, I would've still been able to back it up a revision
18:15Lau_of_DKSame with SVN though, right duck1123 ?
18:15duck1123what if he shut down the server between the time I pulled and realived what happened
18:16duck1123rare risk, but still...
18:17Lau_of_DKSure, and if you combine that with a sudden Earth/Moon collision, hitting directly on top of your broad band connection, you might also experience great packet-loss, but as you said.. rare risk
18:18duck1123I don't need the moon to hit the earth, I have DSL
18:18Chousukewell with GIT you could rehost the old repository easily.
18:18Chousukewith SVN all the history would be gone,
18:18Lau_of_DKoh I see
18:19Chousukethe big thing with git is that any clone of a repository is equal with its origin
18:20Lau_of_DKsame with SVN though, right?
18:20Chousukeno
18:20Chousukewith SVN, your checkout is still dependent on the repository you checked out
18:21Chousukeyou can't for example have other people check out your version of the repo
18:21Chousukewhich, with git, is trivial :)
18:21Lau_of_DKI cant have them checkout my version? What can they checkout then ?
18:22Chousukethe repository.
18:22Lau_of_DKoh I see, so you mean that Git checksout all the versions when you co ?
18:22Chousukewell, kind of.
18:22Chousukeit *clones* the entire repository
18:23Chousukeso if you have repository A and clone it as A', then as long as no modifications are made on either repo, they contain the same data
18:24Chousukeincluding history
18:24Lau_of_DKk, but thats still the same as SVN though, just excl. history
18:25arohnerLau_of_DK: no. In SVN, there is a master/slave relationship. When you check out, you get a copy of the current revision. Doing anything requires talking to the repo that you checked out from.
18:25Chousukebut with git, you could make modifications and someone could clone your A'.
18:25duck1123with svn, if you can't reach the repository (due to lunar disaster) you can't make any commits
18:26Chousukewithout even knowing that A existed
18:26Lau_of_DKoh I see, so theres more a bittorrent approach to Git
18:26Lau_of_DKTheres no central hosting for Git is there, people use their own servers primarily ?
18:26Chousukethere's no "master" in git, other than by policy.
18:27kotarakLau_of_DK: there's github
18:27duck1123so my github repository is just a copy of what I have here at home
18:27Chousukeyou can decide that there's a "central" server, but technically it's just another git repo
18:28Fandahello!
18:28kotarakWhich basically applies to all newer systems: hg, bzr, darcs...
18:28arohnerFanda: hi
18:28Fandajust wanted to ask, what sources have you used for learning how to write macros
18:28Fandai like clojure very much, but macros give me hard time
18:28arohnerFanda: some people have recommended On Lisp
18:29sohailhey Lau_of_DK, in your qt api thingy, how are you handling designer stuff?
18:29duck1123and mr rules them all
18:29Fandai am looking into: Practical Common Lisp
18:29Fandahttp://www.gigamonkeys.com/book/
18:29Lau_of_DKFanda, theres actually a section on the Clojure Wiki about that now
18:29arohnerFanda: that's another good option
18:29arohnerFanda: reading the clojure source is also good
18:29Lau_of_DKsohail, 2 ways: 1) For everything except Webkit, use 'designer' and import the UI, 2) Webkit: Hardcode
18:29Lau_of_DKAnyway, thanks to everybody for your explanations on Git vs Svn
18:30Fandayes, I will read all: On Lisp, PCL and wiki :-)
18:30sohailLau_of_DK, so you mean you have an extra juic step?
18:30arohnerFanda: in the source tree, src/clj/clojure/boot.clj
18:30Lau_of_DKYou mean when I dance, or when I code ?
18:30sohailLau_of_DK, both
18:31Lau_of_DKsohail, haha
18:31Lau_of_DKWhat do you mean by juic step ?
18:32sohailLau_of_DK, because designer has the ui files, do you use juic to generate the actual code or do you use the dynamic equivalent?
18:32sohailI think it's forms
18:32sohailI haven't used forms
18:32Lau_of_DKoh hang on
18:32Fandaarohner & all: thanks for pointers about macros
18:33Lau_of_DKsohail, for your education: http://paste.lisp.org/display/69450
18:33Fandait is gonna take me a little time to learn just it... just getting impatient here :-)
18:33ChousukeFanda: if you're going to read PCL, this will help as well: http://blog.thinkrelevance.com/2008/9/16/pcl-clojure
18:33Fandayes, that's true - completely forgot about it :-)
18:34Fandais there any other way than using macroexpand to see what's happening?
18:34sohailLau_of_DK, perfect, that's what I thought
18:34sohailright now I'm using code
18:34sohailwhich is so ugly it's not even funny
18:34Lau_of_DKhehe, its swing-like ugly
18:34arohnerFanda: macroexpand is your best option
18:35arohnerI'm not sure if there are other options
18:35arohnerare you an emacs user? because slime makes it very convenient
18:35ChousukeFanda: I think most important is to not get overly excited about macros though.
18:36Fandausually, i just use simple editor and repl
18:36sohailLau_of_DK, well I have never explored this part of the Qt framework before so I will be bugging you :-)
18:36FandaI have worked with macros in the interpreted-only LISP
18:36Lau_of_DKsohail, bug away :)
18:36Fandamacroexpansion at compile time is new to me
18:37Lau_of_DKthen you should try compilemacro at expansion time
18:37Lau_of_DK..but thats really advanced
18:38Chousukeclojure syntax-quote is a bit different from the common lisp quasiquote too. At least, I think so. I haven't yet grasped all of the macro-fu myself either.
18:38arohner they're fairly easy to translate between
18:38arohnerthere's a 1-1 correspondance for most things
18:38Fandaok, example
18:38Fandaa=1, b=2, c=3
18:39Chousukethe namespace-qualifying thing makes a difference though.
18:39Fanda(mac a b c) => ((a 1) (b 2) (c 3))
18:39Fandayes, namespaces and other symbol lookups make it hard for me
18:39arohnerso you want the symbols to be bound to sequential integers starting at 1?
18:40Fandajust any symbols
18:40Fandaand any numbers
18:42Fanda(def a 1) (def b 2) (def c 3)
18:42sohailwhat does this syntax mean? (QIODevice$OpenMode. something)
18:42Chousukesohail: inner class
18:42sohailI'm not fully up to snuff on my java interop syntax
18:43sohailChousuke, what about the trailing dot?
18:43Chousukeit's "new"
18:43Chousukethat's the same as (new QIODevice$OpenMode something)
18:43sohailah
18:51Fandacan i have one more question about macros?
18:51Fandalet have: (def a 1) (def b 2) (def c 3)
18:51Fanda(def lst '(a b c))
18:52Fandawhat expression do you write in order to evaluate symbols inside the list 'lst'?
18:52Fandauser=> `~lst
18:52Fanda(a b c)
18:52Fandauser=> `(~@lst)
18:52Fanda(a b c)
18:53Fandauser=> (map eval lst)
18:53Fanda(1 2 3)
18:54danlarkinWow, type hints give me a 6x running time decrease
18:54danlarkinI didn't expect it to be nearly that much
19:03verecrev 1092 throws java.lang.ClassNotFoundException: clojure.core$eval__1 (core.clj:0)
19:03verecfrom
19:03vereccompiledClass = RT.classForName(name);
19:03verec line 3198 in Compiler.getCompiledClass
19:03verec???
19:04danlarkinverec: revert to r1088 for a while
19:05verecAh. OK. Thx
19:06arohnerdo type hints work in the middle of function calls?
19:06arohneri.e. (foo #^java.lang.String bar)?
19:08arohnerand, on a javadoc, what does "..." mean in the type signature?
19:08danlarkinarohner: I don't think it works that way, only in function arg lists that I know of
19:08Chousukearohner: variadic?
19:09arohnerhuh. Didn't know java supported that
19:27arohneroh, that was fun.
19:27arohnerin this instance (I'm not sure about all), ... meant "array of"
19:27arohnerand if you want an array of strings, (into-array string) is not what you want
19:27arohneryou want (into-array [string])
19:28arohnerotherwise you get an array of chars
20:17AWizzArdIs there a string-reverse? (str-reverse "123") ==> "321"
20:19rhickey_AWizzArd: (str (reverse "123")) ?
20:19AWizzArdI know how to do this without a str-reverse, I'm just curious if there is something like that.
20:19rhickey_no dedicated function
20:20AWizzArd(str (reverse "123")) ==> "(\\3 \\2 \\1)" for me
20:20AWizzArd(reverse "123") ==> (\3 \2 \1)
20:20Chouser(apply str (reverse "123"))
20:21AWizzArdChouser: yes, I am doing this so far
20:21Chouseryou could lobby Stuart Sierra to add it to clojure.contrib.str-utils
20:21AWizzArdok
20:24AWizzArdHow would you name it if you had to chose a name for it?
20:24rhickey_ick
20:25AWizzArdWhat does it stand for?
20:25rhickey_do we need such specialized fns?
20:25AWizzArdnot necessarily
20:25AWizzArddepending on how regular people reverse strings
20:26AWizzArdbut one could argue if people would expect (reverse "123") to return "321" or (\3 \2 \1)
20:27Chouserreverse returns a seq.
20:27Chouser(reverse [1 2 3]) doesn't return a vector, so why should (revers "123") return a string?
20:27AWizzArdright
20:27AWizzArdalthough it's probably what most people would think about it first
20:28AWizzArdif reverse were a multimethod one could dispatch for the argument type
20:29AWizzArdwhatever, (apply str (reverse my-string)) is fair enough
20:43scgilardirhickey_: I'd be happy to update the former contents of boot.clj to the lispy Java interop syntax if that would be helpful and isn't already being tackled.
20:45rhickey_scgilardi: at some point that would be great - but right now I've got it my hands deep in - just booted Clojure with no source - all from classfiles!!
20:45rhickey_hands deep in it
20:45scgilardirhickey: ok, cool. Nice! another milestone passed.
20:46rhickey_boots like lightning
20:47rhickey_scgilardi: you might want to think about how lib will work when we have pre-compiled libs, some sort of try the class first, then the source
20:47rhickey_for load
20:51scgilardiyes, ok. maybe a new flag to force a compile or recompile as well. I haven't looked at the newest yet, is there a new routine to load a class file compiled from Clojure?
20:53rhickey_scgilardi: not yet, still working out loading logistics. We'll need compile, load, compile-and-load - still subject to limits for reloading of classes, i.e. reload must always be from source
20:58scgilardirhickey_: is that a limitation to preserve programmer sanity or something more fundamental to how things work?
20:58rhickey_Java can't load a class twice into same classloader
20:58scgilardidoes it also have no notion of unloading?
20:59rhickey_yes, no unloading
20:59scgilardiok I understand
21:14sohailrunonce
21:14sohailis it even possible with STM?
21:14sohailI think it isn't
21:14sohailso maybe Stuart shouldn't be using refs and friends for runonce
21:20rhickey_woo hoo!! AOT rocks!
21:20AWizzArdgrats
21:21rhickey_clojure.jar with no source inside
21:21Chousernice
21:21scgilardiand we were here when...
21:21scgilardidon't be goin' closed source on us.
21:22rhickey_source on the side
21:22scgilardispecial source
21:22rhickey_sadly, clojure.jar crosses 1mb mark
21:23rhickey_would still fit on floppy if they existed
21:23AWizzArdperhaps one day there could be deployment tools, like those for CL that can strip out parts that will not be used in the app itself
21:24Chousermy clojure.jar is half that
21:24rhickey_Chouser: right, precompiling doubles it
21:24Chousereven without the source, huh?
21:24rhickey_I haven;t worked on size at all
21:25Chousersure
21:25rhickey_including source only adds 150k
21:25AWizzArdbut it seems to reduce loading times a little :-)
21:25Chouserhm. .jar's can be zipped, can't they?
21:25Chouseranyway, shouldn't matter much.
21:26rhickey_reduces load times a lot - hard to measure, but it may be 5-10x reduction over Java baseline
21:26rhickey_gotta run
21:26AWizzArdChouser: .jar's already are zipped
21:27ChouserAWizzArd: ah
21:28scgilardiI know the latest svn is marked interim, do not use, but I gather it's possible to use. For me, it fails with ExceptionInInitializer in Repl.java. What's the trick?
21:29AWizzArdn8 n8
21:38scgilardisohail: could it perhaps be done with a counter instead of a boolean? Would it be possible for one of the parallel invocations to know that he was the one that accomplished the transition from 0 to 1 on a runcount and proceed with the run?
21:40sohailscgilardi, or just use a mutex and boolean :-)
21:40scgilardifrom java.util.concurrent yep.
21:41sohaili'm sure java has some more efficient interface to pthread_once
21:42scgilardisounds right. I haven't thought through all the options for updating a ref in a transaction. Everything I've done has worked with commute.
21:42sohailscgilardi, I think the counter wouldnt work either
21:43scgilardiit seems that if the update were done in a dosync before running the function, a call to ensure could allow one thread to know it was the one that made the 0 to 1 transition.
21:43sohailwhats dosync anyway
21:44scgilardiin fact, that's the same as a false to true transition, so a counter isn't necessary, it's just necssary to know that the ref was false before (this thread) changed it.
21:44sohailwell if there are no side effects then it doesnt matter really
21:45scgilardidosync wraps Clojure's ref operations
21:45scgilardiit seems that runonce would only be useful when there are side effects.
21:45sohailyep :-)
21:46sohailI don't have my head quite wrapped around STM but my understanding is that each transaction occurs within a timeline, so two could occur at the same time in the same timeline
21:47sohailonly one will succeed of course, but the effects are that it ain't runonce!
21:48scgilardiIf only one thread will run the function and that thread will only run it once, it seems to me that it is exactly runonce.
21:48sohailI think it is still possible for two threads to run the function
21:48sohailyou need the stm guy, rich to tell you it ain't so!
21:51Jedi_Stannisis there a way to eval in the current scope? I have a gui program that is trying to call eval on the text in a text field, but it can't find the function I have defined. the same function works fine from the repl
21:56Chouser(binding [*ns* (find-ns 'user)] (eval ...))
21:57Chouseroh, maybe not
21:59Chouseryeah, I think that's it.
21:59Jedi_Stannischouser: nope, that worked
21:59Jedi_Stannisthanks
22:30julian_morrison_hi, folks
22:30Chouserhi
22:31julian_morrison_does anyone know how to use (with-open x y ...) in a macro? defmacro qualifies the x and then complains about letting a qualified symbol
22:32duck1123~x
22:32duck1123I've been fighting that all weekend
22:32julian_morrison_and to access it from inside after expansion?
22:33julian_morrison_supposing it's JDBC and the x will end up being the conn
22:33duck1123you use x at first, ~x later
22:33julian_morrison_can you paste an example?
22:38duck1123one sec
22:38julian_morrison_I'm trying to (defmacro connected ([& body] `(with-open conn (DriverManager/getConnection ...) ~@body))) and then (connected (.createStatement conn))
22:39julian_morrison_do I need to use vars and bindings?
22:39duck1123http://github.com/duck1123/mycyclopedia/tree/4adfd71e42f626cf5f6fd2630a1bc2c16e1915a0/app/model/entry/entry.clj
22:39duck1123look at with-model
22:40julian_morrison_Ah. Thanks, that's about perfect.
22:41duck1123looks like we were doing very similar things.
22:41duck1123you were probably thinking about bindings due to clojure.contrib.sql
23:13danlarkinwow, 2x running time difference between passing around a hash-map of args versus each function having n number of arguments
23:14duck1123wow
23:14duck1123how many args?
23:15danlarkin4
23:16duck1123is there a fn that'll take a seq and filter out the dups?
23:16danlarkinI think it's all the object creation the JVM has to do, it isn't very fast at that type of thing I think
23:16duck1123nvm, found it
23:23danlarkinis there a better way to express this: (if (nil? (first coll)) 'foo (first coll))?
23:25Chouser(if-let x (first coll) x 'foo)
23:26Chousersoon to be (if-let [x (first coll)] x 'foo)
23:26Chouser...assuming it's ok to treat "false" like "nil"
23:27danlarkinin this case it is indeed