#clojure logs

2010-02-03

00:04konrHas anybody used Jambi? Do you know why (for [x (range 3) y (range 3)] (doto grid (.addWidget (lcd-range) x y))) doesn't do anything but (doto grid (.addWidget (lcd-range) 0 1)) works as expected?
00:04konr
00:05hiredmanfor is lazy
00:06konroh yeah! Nothing a dorun doesn't solve. Thanks!
00:07arohnerkonr: or you can just use doseq
00:07arohnerit's like for, but not lazy and returns nil
00:09konrarohner: seems more appropriate. Thanks!
00:17qbgIs there some way to blocking wait (preferably with timeout) on an atom/ref until it contains a certain value?
00:17hiredmanpromise/deliver
00:19qbgBut with promise/deliver can't reset it; only create a new one.
00:19hiredmanyou can put a promise in a ref or an atom
00:19hiredmanoh hell
00:19hiredmanjust use a blockingqueue
00:45qbgSpecifying :reload-all to require should cause all directly and indirectly required libs to be recompiled, correct?
00:47qbgBecause sometimes old definitions don't get replaced for me
00:47qbgcompile-buffer in SLIME also doesn't replace them for me sometimes.
01:25LauJensenMorning
02:55replacaLauJensen: Morning
03:19qedhi all
04:33sparievLauJensen: your writeup on Compojure is really nice
04:34LauJensenThanks :)
04:38zaphyrooh, could I have a link to that? sounds good
04:39sparievzaphyr: http://www.bestinclass.dk/index.php/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure/
04:39zaphyrthanks!
04:39zaphyrhehe, title of awesomeness :)
04:58LauJensenhttp://landshape.org/enm/20th-century-warming-not/
04:59LauJensenI must say I'm glad my webserver is running Linux, otherwise the amount of activity I get these days would probably have cratered it :)
05:00Chousukeare they taking that graph seriously? :P
05:02LauJensenOf course
05:14ambientproper statistics is sometimes more mysterious than black magic :)
05:18esj(inc ambient)
05:19ambientyou mean (swap! ambient inc)? :)
05:21ambientit really feels weird being a variable in an immutable language
05:22ambientdo i die when i change?
05:22ambienti guess the atom protects me
05:33LauJensenambient: I'm not saying that there isn't a myriad of stats that you can run in various ways, I'm just saying that the temperature isn't rising in the NOAA sets :)
05:33LauJensenIts weird why so many people believe that cutting up trees and digging ice holes can change that fact
05:36ambientcarbon dioxide working as a greenhouse gas seems to be the idea, afaik
05:38esjambient: oops, yes.
05:49AWizzArdHallo ulfster
06:00vu3rddLauJensen: I got really fascinated with your post that I downloaded all the NOAA data and have just started to play with it.
06:00LauJensenGreat - Hows it coming along ?
06:05vu3rddLauJensen: I am midway thru your post. As I told you over email, I got stuck with Java libraries, being a java n00b
06:07vu3rddbut slime makes it quite easy to explore the java libraries. The C-c I (inspect) and M-.
06:12LauJensenvu3rdd: Then I misunderstood your mail, I actually thought you had worked it out
06:13LauJensenBut the code should run right out of the box, why do you need to fiddle with Java ?
06:31vu3rddLauJensen: yes, code should work. But I was more interested in knowing the java interop and the logic used than the actual result of the code itself.
06:33LauJensenah ok
07:34vu3rdd,quit
07:34clojurebotjava.lang.Exception: Unable to resolve symbol: quit in this context
07:34vu3rdd:-)
07:34vu3rddtoo much use of slime
07:36LauJensenhehe
08:23avarushi!
08:26LauJensenHey
08:29avarushow are you guys (and girls)?
08:38avaruswell, you seem fine :P
09:03cemerickrhickey: I infer from this that clojure is fully osgi-capable: http://lambdalounge.org/2010/01/28/polyglot-osgi-in-february/
09:15rhickeycemerick: I'm still waiting for a definition of what OSGi-capable means
09:15cemerickrhickey: in some ancient history, clojure would simply fall down
09:17rhickeycemerick: I don't really see how that would be the case. It is more a matter of, afaict, people having expectations of providing the core language as a service (or whatever they call it), mostly driven by expectations formed by how interpreters work
09:18rhickeyOr, Clojure-loaded code being able to play with OSGi's classloader mechanism, but no one should have any expectation of some standard Java-based code that did dynamic loading doing that, as there is no standard for exposing classes across dynamic loaders
09:19rhickeyoriginally, all OSGi=like things expected al code to use Class.forName
09:19rhickeyall
09:20rhickeyhowever, even if it now 'runs' under OSGi, it doesn't mean it can provide the facilities people want
09:20cemerickSure. There was a time when one could not get a repl going at all, for example...at the very least, it appears such issues no longer exist.
09:20cemerickI'm guessing the move to use the context classloader by default helped there.
09:20rhickeyI never got a much better report than "it doesn't work"
09:21rhickeyI do know a few things that will make it more modular, in particular:
09:21rhickeygetting rid of symbol maps to class object in namespaces...
09:21rhickeygetting rid of global namespace map
09:22rhickeyspecial op all class-naming primitives, like instance? and resolve
09:22rhickeymoving away from reflection for type info
09:23rhickeybeyond that, I'd be willing to support an OSGi-specific recipe for dynamic loading
09:23rhickeywhen used in that context
09:23cemerickwell, jdk7 may end up providing various clever mechanisms that would make such things less necessary (if there's any demand for them at all anyway)
09:24cemerickI get the impression that there's a lot of noise about osgi, but very few people actually using it outside of e.g. eclipse
09:24rhickeythe dynamic case is still on the fringe - these things are oriented towards static relationships between modules
09:26chouserhas the first one happened yet?
09:26rhickeybut the bottom line is, Clojure's runtime was doing a lot of loading/resolution work for loaded code. Proxying that is incompatible with modularity systems that want to control which classes can see what
09:26rhickeychouser: March
09:27rhickey:)
09:27chouseroh. the month. ok, thanks.
09:27cemerickI figured the presence of jsr 292 features would motivate consideration by the modules folks.
09:29rhickeycemerick: It simply comes down to: no proxying of class resolution - the language must emit direct references in the compiled code, can't go through a central registry
09:29rhickeythings are already better (import)
09:30rhickeyother things need work (Namespace.namespaces)
09:42fdaoudgood morning
09:42stuartsierraI can't upgrade someone from Watcher to Member on Assembla myself, can I?
09:43chouserstuartsierra: afaik only rhickey can do that.
09:43rhickeystuartsierra: who needs an update?
09:43jcromartieI was kind of surprised to realize that docstrings are supposed to come before the arg vector
09:43jcromartie(in defn)
09:44jcromartieI always put them after the args, and nothing ever complained
09:44chouserjcromartie: it makes sense when you consider multi-body fns
09:44jcromartieyeah
09:44stuartsierrarhickey: trolard
09:44fdaoudjcromartie: +1
09:45rhickeystuartsierra: done
09:49stuartsierrarhickey: thx
09:57avarushrm...sometimes I get "Exception in thread "main" java.lang.Exception: EOF while reading" and that's it...the last time I simply missed a )
09:57avarusthis time, too :>
09:57jcromartiechouser: just made an improvement to that
09:57chouserI have a patch to give a bit more info
09:58jcromartie(oops, didn't want the ":")
09:58avarusoh, makes sense now :)
09:58avaruscool, where? :)
09:58chouseravarus: if you're building your own clojure, you can try this patch: http://www.assembla.com/spaces/clojure/tickets/249
09:59avarusbut sometimes it tells me that there is no matching blabla
09:59avarusah nice, I'll try it
09:59avarusthx
09:59chouseravarus: that's usually when you have an extra close. EOF is on an extra open
10:00avarusok
10:00jcromartieminor nitpick: the api docs have an extremely tiny font
10:00avaruscan you zoom with the ctrl+ + or mousewheel?
10:00jcromartieyeah I can
10:00jcromartiebut that leads to more funkiness
10:01avarushehe
10:02jcromartieI think the fixed-width fonts would be much more readable at even 10pt
10:04avarusperhaps a user stylesheet can help you for now
10:04avarusotherwise contact the webmaster and tell him if he had planned to ruin your eyes :P
10:04avarusask him actually
10:05jcromartieavarus: the webmasters are here I believe :)
10:05jcromartie(not 100% sure on that thoug)
10:05avarusI have no idea
10:07jcromartieyay user styles
10:07jcromartie10pt Monaco :)
10:08avaruscool
10:08jcromartieof course now it messes some sites up unless I make super-specific selectors :P
10:08avarusah lol :)
10:09jcromartiediv#content_view.wiki.wikiPage pre { font-size: 10pt; font-family: "Monaco" }
10:12avarusI'm just wondering...all clojure code I've seen so far is written like this: http://pastie.org/807601 but can't one write it like this: http://pastie.org/807603 ?
10:14avarusthe ebook though because I wasn's sure about international shipment of the book
10:14avaruswasn't
10:14avarusand because it was cheaper :)
10:14fr0ogdead-tree+ebook
10:14avarushehe
10:14Raynesavarus: I'm buying the ebook as well. I never buy dead-tree non-fiction books.
10:15avarusI did in the past but handling a thick book beside the screen and keyboard sucked
10:15_fogus_Raynes: You'll me disappointed to know that at least 75% of our book *is* fiction. :-p
10:15Raynes_fogus_: :p
10:16avarusso I bought a bigger screen so I can have the ebook and the editor open side by side :P
10:16fr0og_fogus_: I only browsed the book so far, so no comments on the content, but is there any reason why it is written in bold-face throughout?
10:17chouseravarus: one could write it that way, but one doesn't.
10:17avarusthat's not bold for me
10:17_fogus_fr0og: Odd. It shouldn't be.
10:18avaruschouser: got it...I just found it a bit confusing sometimes
10:18fr0ogoh? is it just a very thick font, or is it evince
10:18chouseravarus: you find having all the closing parens on one line to be confusing?
10:18avarusI'm on evince, too
10:18avaruschouser: yes
10:19avarusperhaps because my editor doesn't support clojure
10:19avarusthough gedit highlights the parens
10:19zaphyravarus: sounds like you want a less losing text editor :)
10:19RaynesThey should be stricken down from the heavens.
10:19fr0ogit does look better in acroread actually, my apologies
10:20avarusyes, it's confusing how gedit highlights the parens
10:20RaynesHoly... For the last 30 minutes, I was under the impression that this was the year 2012.
10:20chouseravarus: I think you'll get used to it. One reason for doing it this way is that it's much more common in lisps than in c-like languages to having nothing much of interest after a close paren.
10:20RaynesI need to sleep more often.
10:20zaphyrthere used to be a convention where you'd separate parens that were closed on a different line with a space, but i think that fell out of disuse and you'd get funny looks
10:20avaruschouser: ok, my brain still thinks c-ish I guess
10:21zaphyrbut that was, hm. common lisp, circa 1980something :)
10:21_fogus_avarus: If your editor supports Lisp then that should get you much of Clojure support
10:21avarus_fogus_: gedit doesn't even support lisp by default :D
10:21chouserbut in practice, we all read code often outside our main editor
10:22avarusI'm in c mode now so at least strings get highlighted
10:22zaphyr:S
10:22RaynesThat's horrible.
10:22RaynesWhy do you subject yourself to such evil editors?
10:22Raynes:|
10:22zaphyryou'll find an editor with good lisp indenting will aide your understanding much quicker
10:22cow-orkerfinally got around to buy "the joy..." (paper+pdf) ... looking forward to the rest of the book :-)
10:23avarusRaynes: because the "external tools" plugin is useful :)
10:23jcromartieconnections in clojure.contrib.sql are kind of awkward
10:23jcromartiealthough maybe it's MySQL's docs that are weird
10:23Raynesavarus: If GEdit can do it, Emacs can do it better.
10:23Raynes:p
10:25avarusRaynes: I'm sure of that
10:25avarusthough I never used emacs
10:26jcromartieis get-connection deprecated?
10:27avarussee you later
10:27avarusbye
10:31jcromartiewhat's with all the fruit junk in the sql docs?
10:50zaphyrhmz. the only thing that i don't really like about "Programming in Clojure" is we seem to keep using multimethods waaay before the chapter on multimethods :(
10:54LauJensenThats just to warm you up a little
10:55zaphyryeah, it's not a major issue (especially since I come from CL), but I'd have liked a little quick box introducing them earlier
10:56zaphyrother than that minor quibble on presentation order, the content's good
10:58jcromartiehow can I return SQL results to something outside of with-connection?
10:59jcromartieI've tried things like (vector results)
11:00jcromartiebut does that not un-lazify the lazy seq returned by with-query-results?
11:00ohpauleezjcromartie: use a closure or a ref
11:00ohpauleezjcromartie: yes, that'll unlazy the results
11:00jcromartieit doesn't seem to work though
11:00stuartsierrajcromartie: you can also call 'doall' inside with-connection
11:01ohpauleezahh good idea
11:01jcromartie(with-connection db (with-query-results results ["select * from venues"] (vector results)))
11:01jcromartiethrows java.sql.SQLException: Operation not allowed after ResultSet closed
11:01jcromartieseems very strange to me...
11:02jcromartieor should I design this differently
11:02jcromartiethis is a compojure app
11:02stuartsierrajcromartie: (vector a-sequence) creates [a-sequence]
11:02stuartsierraYou probably want 'vec'
11:02jcromartieah, yes
11:02jcromartielovely!
11:03stuartsierra'doall' will also un-lazy the sequence, without the need to create an intermediate vector
11:06jcromartiehmm
11:06jcromartiejust (doall some-seq)
11:07LauJensenjcromartie: (let-query [users (query usertable [username email] (not= "frank" username)] (doseq [user users] (println user))))
11:08jcromartielet-query?
11:08jcromartieoh that's your fancy layer :)
11:08LauJensenThats just the ClojureQL frontend
11:09LauJensenor you could just to a normal run on whatever query you got (run [db query results] (doseq [r results] (println r)))
11:12LauJensenWith the new front-end, it'll be more like
11:12LauJensen(->> (only (either (= :user %) (= :email "some@email.com"))
11:12LauJensen (from :table1 [:user :email])
11:12LauJensen (run :mysql))
11:12LauJensenBut the design isn't quite final, however I feel quite convinced that whatever we agree on, you will love
11:22jcromartielooks nice LauJensen
11:28zaphyrhm, are there any plans to replace clojure.lang.Compiler with a clojure implementation?
11:29stuartsierrayes
11:29zaphyrgoodie :)
11:29chouserzaphyr: http://www.assembla.com/wiki/show/clojure/Clojure_Compiler_in_Clojure
11:29zaphyrexcellent, thanks
11:33zaphyrare there any notes to help trying to understand the current compiler?
11:33zaphyrI guess it's some kind of ANF based thing rather than CPS, given the lack of tco
11:37chousera clojure fn that takes 2 args compiles to a java class with an invoke method that takes 2 args. so no automatic CPS
11:37_fogus_There was a trick here (by cgrand?) a few days ago that had nested arrow macros: (-> blah blah ->> blah blah) -- something like that ... I can't find it
11:39zaphyrchouser: hmm, yeah, it seems surprisingly simple
11:39stuartsierra_fogus_: it was on the dev list
11:39chouser_fogus_: http://github.com/cgrand/clojure/commit/9f2e7ed8c678d5619ff7e8baad74a847b07a7973
11:40chouserthough I think he has imporoved versions committed since then
11:41_fogus_stuartsierra: Great, thanks
11:41chouserzaphyr: keeping interop with java simple is definitely an explicit goal.
11:41_fogus_chouser: And to you too sir
11:42zaphyrchouser, right, and worthwhile. might be nice to have some "I know what I'm doing" hints to get compiler plugins to do things like block compilation, or compile fns to statics when you know they won't change, with obvious caveats that you must know what this implies if you use it
11:43chouserzaphyr: static methods instead of instance methods, or ...?
11:43zaphyrstatic methods for a fn, instead of a class per fn
11:45zaphyri.e. you lose everything- it's no longer first class, etc. but if it's say, part of some horrible matrix library, that's less of an issue
11:47chouserzaphyr: I don't know if that would buy you much. hotspot is really good with single-dispatch final instance methods.
11:51zaphyrtrue. I'm getting worst case 1/2 the speed of java so far, which isn't too bad since i'm completely new to clojure anyway
11:52zaphyrand in simple cases it matches, which is great
11:53chouserthe two biggest sources of clojure code being slower than similar java are: runtime reflection due to insufficient type hints, and auto-boxing of numbers instead of using primitives
11:53zaphyryeah, boxing is the big killer for me
11:53chouserthe former is completely solvable, usually with just a few well-placed hints
11:54chouserthe boxing is still more of an issue. you can have primitive locals, so your small tight loops can be good.
11:54zaphyralthough i'm not sure of the deref cost when you're extracting a fn from a var, that must have some overhead, surely?
11:55zaphyrchouser: right, and i noticed looking at core.clj there is some :inline trickery going on, which surely must help if it does what i think it does
11:55chouseryes, a little, though the compiler now supports direct linking (is that the right phrase?) of vars, though that's not exposed for user code quite yet.
11:55redalastorIs there some css library that exists for clojure. Kinda like clj-html but for css?
11:55chouseryeah, the :inline is to help work around the fact that clojure fns only take and return Objects right now, so no primitive args or return values.
11:56zaphyrcan i rely on it myself? i looked at definline but that looks more like cl's compiler-macro thing than an 'inline'
11:56stuartsierrayou can use definline
11:56zaphyrsee above :)
11:56stuartsierraIt works more like a macro than a function though
11:56chouserand no persistent collections that can hold primitives yet. for now you have to use (mutable) java arrays for best performance
11:57zaphyrreally i just want to say "beta reduce this into the code as is, because i told you"
11:57zaphyrwithout having to break the clarity of a function def
11:57stuartsierradefinline is the closest you can get to that right now
11:58chouserthe only benefit of definline over a macro is that you can still use what you define in a high-order function, unlike a macro.
11:58zaphyryeah
11:59chouserpersistent collections of primitives and clojure fns that accept primitive args are planned ... eventually. they complicate things enormously though.
11:59zaphyr99% of the time though, clojure is fine. the only reason i'm griping is because i turned up with the specific intention of hurting it. it's stood up quite well really
11:59zaphyrchouser: right, that definately calls for a sufficiently smart compiler
12:00zaphyrdefinitely*
12:01jcromartiehow do I coerce a struct into a hash-map?
12:01chouserwhich will be much more fun to develop when it's implemented in clojure instead of java.
12:01chouserjcromartie: (into {} thing)
12:01zaphyrchouser: heh, s/more fun/actually possible/ :)
12:05jcromartieOK this is weird, this function returns nil, while (doseq [x r] (println x)) prints them: http://gist.github.com/293778
12:05jcromartie(if I put the doseq in the with-query-results)
12:05chouserdorun always returns nil
12:06jcromartieah
12:06jcromartiedoall
12:06chouseryes. :-/
12:06chouserI get doall and dorun confused, and confuse the names occasionally with doseq
12:06jcromartiedosequis
12:06chouserI kinda with doseq was called dofor or do-for
12:06chouserwish
12:07jcromartieui-related doseq
12:08jcromartieit will happen, just wait
12:08chouser?
12:08jcromartie(dosequis)
12:09zaphyrwhat would that do?
12:09stuartsierraOpen a beer.
12:09zaphyrman, implement it :)
12:10zaphyrthere's no macrolet equivalent in clojure is there?
12:11chousernot yet, though I think there's something in contrib.
12:11zaphyrfair enough
12:12chouserclojure.contrib.macro-utils macrolet and symbol-macrolet. I've not used them.
12:12zaphyrthanks, i'll have a play with them in a bit
12:13MecIs there a way to abort a repl in netbeans?
12:13zaphyrMec: in enclojure I can't figure out how to close the IDE repl, but you can start and stop project repls from the project tree
12:13chouserMec: not sure. have you tried http://blog.n01se.net/?p=85
12:15Mecweird, my *print-length* is 40 but it deffinity went infinit
12:16zaphyrhands up who wants *print-circle*? :)
12:16zaphyralthough i think it would be much harder to implement in clojure
12:18Mecok rather than stopping at 40, it just keeps printing ... after that
12:18chouser:-( Does the CTRL-C thing work?
12:19chouserit may not in a GUI like that.
12:19MecNo it doesnt
12:20chouserzaphyr: is that anything like this? http://paste.lisp.org/display/83647
12:23zaphyrchouser: yes, it's exactly like that! :)
12:25zaphyrMec: I think if you hung the IDE repl you may have killed it :(
12:27jcromartiehmm
12:27jcromartieclojure.contrib.sql doesn't escape column names
12:27jcromartiethat's bad
12:28jcromartieI'd like to use columns like "first-name"
12:28Mecah well i'll just try not to hang my repl :x
12:28jcromartiebut maybe I should stick with underscores
12:28rsynnottjcromartie: in my experience it's relatively unusual for ORMs and similar to escape column names
12:29jcromartieit's just a shame because the convention in Clojure is hyphenated names
12:29jcromartieand MySQL supports that
12:29jcromartiebut I am not sure about other databases
12:45zaphyrMec: if you right click on your project and 'start project repl' you may have more luck, although enclojure is a bit flakey
12:46zaphyrcertainly i just broke out of (cycle [1]) successfully
13:15LauJensenJust passed 11k visitors today and still 5 hours remaining - The interest in Clojure is sky rocketing
13:21cemerickstuartsierra: HLS' issue (#23) is that if one has an ns A that requires ns B, but only ns A is specified for compilation (e.g. to clojure.lang.Compile), he wants A to get AOT-compiled but not B.
13:21stuartsierraoh
13:21stuartsierrathat's a Clojure issue then, not contrib
13:21cemerickyeah
13:22cemerickthough I don't think it's an issue at all
13:22stuartsierraand I'm not sure it's even possible
13:23technomancyLauJensen: awesome
13:25cemerickstuartsierra: wouldn't it just require *compile-files* to be rebound to false in load if the next ns isn't in the set of ns' specified for compilation (which would have to be in a new var)?
13:26cemerickI guess load doesn't know what ns it's aiming for. *shrug*
13:26stuartsierramaybe
13:26stuartsierrabut those libraries are going to get loaded when the AOT-compiled namespace is initialized anyway
13:27cemerickyeah, I think HLS just doesn't want to have clojure/contrib/def*.class in his jar file
13:27cemerickor whatever
13:27stuartsierrahe'll have to deal
13:27stuartsierra:)
13:28cemerickheh
13:28cemerickI'm a little sad about the general push towards minimal AOT compilation anyway.
13:29hiredmanpor que?
13:29stuartsierraI wish it were avoidable
13:29stuartsierraIt might be good to AOT releases, but not SNAPSHOTs
13:30cemerickhiredman: because HLS has a point insofar as (a) if one is concerned about distributable size, you've got to prune out the duplicated stuff, and (b) not AOT'ing things "in place" and pushing that responsibility up to every single dev that needs to ship classfiles rather than source isn't nice, IMO.
13:31cemericksource-only distribution is more lightweight and apparently hip, but is nothing but a hassle for a lot of use cases.
13:32cemerickstuartsierra: I think it's an unavoidable fact of life that people build production stuff on snapshots, every day. *shrug*
13:32hiredmanhmmm
13:33chouserwho needs to ship classfiles?
13:33chouserwhy?
13:33clojurebothttp://clojure.org/rationale
13:33stuartsierraThe bigger problem with AOT-compilation is that it breaks compatibility between different version of Clojure
13:33stuartsierraThis is especially problematic for snapshots, because one change to the compiler can break any AOT-compiled namespace.
13:34cemerickchouser: because some customers flip out otherwise.
13:35cemerickNevermind that startup time is a serious consideration in many contexts.
13:35_fogus_cemerick: (inc customers)
13:35_fogus_That's been my experience
13:36chouseroh, if you're providing a lib to non-clojure developers?
13:36cemerickyup -- financial services, some gov't, etc etc
13:36cemerickheh, yeah
13:36zaphyrchouser: right, say (horror) you want to ship an EJB component
13:36cemerickchouser: you've been in open-source land too long, my friend :-)
13:37_fogus_Customers tend care less than my bosses though
13:37chousernah, it's just been a decade or so since I was producing (non-free) code to developers instead of some kind of end user.
13:37chouserend users don't care
13:38cemerickstuartsierra: I wonder if those issues aren't resolvable. I don't have any immediate solutions, of course. ;-)
13:38cemerickchouser: I guess I should have ;-)
13:38cemerickchouser: depends on who your end users are
13:38stuartsierracemerick: they might be, but it would require changes to the compiler
13:38cemerickyeah
13:39stuartsierraI'm following the less-AOT trend, not pushing it. :)
13:39hiredmanone resolution would be a stable abi
13:39_fogus_Anyone know if there are any plans to produce warnings/errors when name-shadowing core fns?
13:39cemerickwe have a couple of customers that pull apart every jar we send to them and run who-knows-what sort of verification tool on the contents. They *flipped* when a binary file was in there that they didn't recognize.
13:40alexykhey guys, what's the latest and greatest version number for core which sync with contrib from build.clojure.org?
13:40cemerickstuartsierra: yeah, I know
13:40hiredmanhah
13:40hiredmanwow
13:40cemerickin their context, I totally understand
13:40hiredman_fogus_: lexically?
13:40alexykwhat did I miss which elicited a hah and a wow from hiredman?! :)
13:40hiredmanI doubt it
13:40_fogus_hiredman: yes
13:40LauJensentechnomancy: Past quarter 7 Googlers have hit my site searching for "autoloading failed to define function swank-cloju"
13:41stuartsierraalexyk: both core and contrib have SNAPSHOTS on build.clojure.org, they should sync with each other
13:41hiredman_fogus_: do you really have a problem with doing that often?
13:41alexykstuartsierra: 1.1.0-SNAPSHOT?
13:41cemerickstuartsierra: do you not like a prior suggestion of mine: simply AOT everything by default, but produce -sources artifacts that contain those minimal set of .class files?
13:41alexykor 1.2.0-...?
13:41_fogus_hiredman: I do not, but I am sympathetic to the potential frustrations
13:41stuartsierracemerick: not much :)
13:42stuartsierraI'm aiming for maximum compatibility right now.
13:42alexyktechnomancy: does lein look at clojars first, or build.clojure.org can preemt that?
13:42hiredman_fogus_: is it really one of those? I don't recall it ever being a problem
13:42cemerickstuartsierra: I'll pick up a new épée for you :-D
13:43stuartsierraheh
13:43stuartsierraI was a foil fencer, actually.
13:43cemerickstuartsierra: how about the source jar as the primary artifact, and a full AOT as a -binary artifact?
13:43alexykso, 1.2.0-SNAPSHOT or what?
13:43stuartsierraalexyk: yes
13:43alexykcool
13:43stuartsierracemerick: that's a good idea
13:43_fogus_hiredman: You've never named a seq something like keys, then tried to call the keys function and produced an error? (this is a totally fabricated example and certainly never happened to me... never... no way... stop looking at me like that!)
13:44stuartsierraAnnoying to implement, though.
13:44cemerickstuartsierra: I could take a poke at it this weekend.
13:45stuartsierraAnother possibility is to make a profile that AOT-compiles everything.
13:45stuartsierraThat would be easier.
13:45cemerickthat just pushes the complexity to hudson, no?
13:46stuartsierraI was thinking of making it an option for people to build themselves.
13:46stuartsierraNot part of the standard snapshot builds.
13:46cemerickhrm
13:47hiredman_fogus_: not that I recall, but I'm sure I have, and once I eval -> run the problem is pretty obvious
13:47cemerickstuartsierra: that's not a huge improvement over the current situation.
13:47stuartsierracemerick: What is it you're looking for? Fully AOT-compiled contrib?
13:48_fogus_hiredman: I definitely do it far less than I did in the beginning, but I fail to see the downside to providing a warning especially for the benefit of newcomers. Maybe I'm missing something
13:48hiredmanso 98% of the time it is not a problem, and in that 2% the fix is immediately obvious
13:48cemerickright, which we produce for ourselves already anyway. Trying to make the path easier for others, and hopefully establish a little precedent for libs. :-)
13:48hiredman_fogus_: there is a downside, noise
13:48hiredmanI do shadow names from core when I want to
13:49hiredmanand I don't want a warning everytime I do
13:49stuartsierracemerick: I'd approve of the precedent IF we can fix the compatibility problems, but that's a big IF
13:49_fogus_hiredman: As do I, but I try not to if I can avoid it. Well, noise could be eliminated with some sort of *warn-on-shadow*
13:50zaphyrit wouldn't be horribly un-clojure like to make a (with-graphics g & body) macro to make drawing a little less um.. baggy in clojure than java would it?
13:50cemerickstuartsierra: you mean breakage when the clojure.core api changes?
13:50zaphyri.e. binding *g* to g within body
13:50stuartsierraI mean breakage whenever the compiler internals change.
13:51cemerickright
13:51fdaoud_fogus_: kudos, how'd you convince Manning to have two simultaneous Clojure books?
13:51stuartsierraRight now, something AOT-compiled under 1.0 doesn't work under 1.1
13:51hiredman_fogus_: defaults to on or off? surely the majority of developers would not be newbies so you would default to off, then you have to explain the flag just like *warn-on-reflection* to newbies when they have the issue
13:51stuartsierraEven if the source is API-compatible
13:51a_strange_guyHi there,
13:52cemerickstuartsierra: that's fundamentally not a problem if one is talking about a maven toolchain. It'd be incredibly rare for someone to independently force a different clojure.core dependency.
13:52a_strange_guywhat is the process to file tickets? do i need the CA for that?
13:52stuartsierraYes, with libs that get updated often.
13:52stuartsierraBut what about all the stuff on Clojars?
13:52stuartsierraThat's really what drove the less-AOT idea.
13:52_fogus_fdaoud: I had nothing to do with their decision. I think they liked the idea of having two books that approach Clojure from different angles
13:53fdaoud_fogus_: well that's excellent. I couldn't even convince them to have one book on Stripes ;)
13:53_fogus_hiredman: Default to "on" of course. The majority of users night not now be newbies, but I imagine that one of the goals is to make it as newbie friendly as possible (within reason)
13:54cemerickstuartsierra: clojars is the land of lein, which I don't know well at all. However, insofar as version A of a lib depends (perhaps transitively) on clojure.core version B, it will do so forever. The trouble only happens when people start throwing around jars willy-nilly.
13:55stuartsierracemerick: But with source code, it doesn't necessarily have to depend on clojure.core version X.
13:55stuartsierraI.e., most code written for 1.0 works with 1.1, but NOT if it's AOT-compiled.
13:55hiredman_fogus_: so then if I don't want the noise I have to set! it to off everytime I open a repl?
13:56cemerickstuartsierra: yeah, I understand that, but talking about source distros puts us back to where we started.
13:56hiredmanstuartsierra: is there a list of what doesn't work?
13:56hiredmanthe only issue I see regular enough to remember it is the RestFn thing
13:56ordnungswidrighi all
13:56stuartsierrahiredman: It's not an API problem. It's binary incompatibility between what the compiler generates.
13:56hiredmanstuartsierra: right
13:56_fogus_hiredman: Or better yet, as a flag to clojure.main
13:57hiredman:(
13:59hiredmanstuartsierra: is there a list of abi changes?
13:59stuartsierrayes, in the Clojure source
13:59stuartsierraas CHANGES.txt
14:00stuartsierrain the release branch
14:00hiredmanoh
14:00hiredmanthat would explain why I've never seen that file
14:10jcromartieusing clojure.contrib.sql, how would I get the IDs of the records I am insterting?
14:12jcromartieor should I manage my own IDs?
14:12jcromartieI could generate UUIDs or something like that
14:12KruppeI'm having serious difficulty setting up slime and clojure so that clojure.core/compile works from the slime repl. It works on my simple test file from a clojure repl outside of emacs and slime, and the I've set the classpath to be the same in both. The error I get is "No such file or directory [Thrown class java.io.IOException]". Is there anything obvious this might be?
14:13cemerickjcromartie: that's database dependent
14:13jcromartieOK so how about a general approach?
14:13jcromartieshould I perhaps be generating my own UUID
14:16technomancyKruppe: is there a reason you're compiling manually rather than using a build tool?
14:16cemerickjcromartie: I don't think there is a general approach for obtaining the primary key of the last inserted row. You can use a UUID, or some natural key, but that decision is highly app-specific.
14:16technomancyKruppe: probably classes/ is not on your classpath, but why don't you try Leiningen instead? it handles that stuff for you.
14:17jcromartiecemerick: yeah I mean just in general, are there people here using clojure.contrib.sql who have solved this?
14:17Kruppetechnomancy: it is on my classpath :(
14:18Kruppetechnomancy: ill look into Leiningen though
14:20cemerickjcromartie: c.c.sql is just a wrapper around jdbc. There's this, although many jdbc drivers don't support it: http://java.sun.com/javase/6/docs/api/java/sql/Statement.html#getGeneratedKeys%28%29
14:20jcromartiehmm
14:21jcromartieI think I am just going to have a required unique short id
14:21jcromartieit works for a few reasons in this case
14:25stuarthallowayhow do I tell from build.clojure.org what names I can use in leiningen dependencies?
14:26arohnerjcromartie: you can usually grab the next id from the sequence before inserting, and do it yourself
14:26jcromartietrue
14:28stuarthallowaynevermind. link is /snapshots -- which isn't linked anywhere on the main page
14:33jcromartiehmm, this is a fun one: Caused by: java.lang.RuntimeException: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 5 to TIMESTAMP.
14:33jcromartiejust trying to print the result of a query
14:38wtetzner_is there a way to define something such that it only takes that value if it hasn't been bound yet?
14:38chouserdefonce
14:38wtetzner_oh
14:38wtetzner_thanks
14:38chouserthat's meant for defining something that will survive a reload of the source file. Is that your use case?
14:39dakronewhat's the constructor method called when proxying a java class? (proxy [MyClass] (MyClass [] ((proxy-super) ...) ?
14:39wtetzner_yes, that's exactly what i want
14:39chouserdakrone: you don't get to override the ctor
14:40cemerickquote from a friend I showed clojure to once: "Oh, so if I say (defonce foo (ArrayList.)), that list is immutable now?" :-D
14:40fdaoudwe need amit and luke and we have all the clojure book authors here at once
14:40cemerick_fogus_: simple solution: stop writing python ;-)
14:40chouserdakrone: instead, provide your users a function (defn make-foo [a b] (proxy [MyClass] [a] (foomethod [] ...)))
14:40qedwhat does it mean for something to be debogonised?
14:40the-kenny_fogus_: I always type (if instead of if( in ObjC, Java etc.
14:41dakronechouser: okay, I'll do that, thanks
14:41chouserdakrone: note you've got a spot there in proxy to pass args to the superclass ctor.
14:42chouserdakrone: and all your proxy methods are closures, so they can use the args passed into your make-foo fn
14:42_fogus_cemerick: I like Python! (plus it allows me to feed my kids :p)
14:42dakronechouser: cool
14:42the-kenny_fogus_: Looks like xkcd is true.. with python, you can do everything
14:44_fogus_the-kenny: Hacking Python in Emacs makes me almost omniscient.
14:44the-kenny_fogus_: And you can fly, right?
14:44drewr_fogus_: do you use pymacs?
14:44cemerickfunny, I could never make a dime with python
14:45the-kenny_fogus_: http://xkcd.com/353/ :)
14:45_fogus_M-x superman-mode
14:50bobo_i followed http://riddell.us/tutorial/slime_swank/slime_swank.html but get NoClassDefFound clojure/main when invoking slime. any clues?
14:50_fogus_drewr: I am not, but one of these days I plan to get it working
14:58hyp3rvigi1antbobo_: I would recommend this approach: http://github.com/technomancy/swank-clojure (scroll down to "Installation")
14:58bobo_hyp3rvigi1ant: ok il give it a go
15:05bobo_that was almost to easy
15:10esjqed: bogons are reputedly the fundamental particles of bogusness
15:17zaphyresj: I thought that was Lenats?
15:18zaphyrhehe, douglas lenat, makes Cyc :)
15:18esjIt is perhaps for this reason that "bogosity" is jokingly said to be measured in microlenats according to the Jargon File, the lenat being considered too large for practical use.
15:18zaphyrhahahaha
15:18esjfrom our friends at Wikipedia
15:18zaphyrthat would be it :)
15:31duncanmhmm - what's the best way to represent a fixed-size grid using clojure's data structures?
15:32ulfsterduncanm: probably 2dimensional vectors
15:32chouseror one-dimentional with fns to do the math from 2d
15:41DeusExPikachuhow do you edit a remote file in emacs such that when you C-c C-l it, it loads correctly in the remote swank server?
15:44the-kennyDeusExPikachu: Maybe with TRAMP?
15:44DeusExPikachudoesn't work
15:44DeusExPikachugives an error, like file not found
15:44the-kennyhm ok. Can you define "remote file" for me? Where does the swank server run?
15:45DeusExPikachuso on the server, there is a file bar.clj in directory foo/src
15:45DeusExPikachuI can connect to server with tramp and edit it in emacs
15:45DeusExPikachubut C-c C-l gives error
15:46dnolenDeusExPikachu: is SLIME connected to the remote REPL?
15:47DeusExPikachuyeah, I started swank on the server with "lein swank", ssh tunneld 4005 and used slime-connect to localhost
15:47the-kennyI'm not sure - Does slime-load-file load the contents locally and pushes them to swank or does it say "hey there, swank, load this file from your file system"?
15:48dnolenDeusExPikachu: oh I see, C-x C-e works, just not C-c C-l ?
15:48DeusExPikachuyeah
15:49duncanmhmm
15:49duncanmchouser: i don't know how to do a scheme-like vector-set! with clojure vectors
15:50duncanmchouser: i can store the vector in a ref, but how do i replace one specific element by index?
15:50kotarak,(assoc [1 2 3] [1] 0)
15:50clojurebotjava.lang.IllegalArgumentException: Key must be integer
15:50the-kennyha!
15:50kotarak,(assoc [1 2 3] 1 0)
15:50clojurebot[1 0 3]
15:50the-kennyDeusExPikachu: slime-load-file (the fun bound to C-c C-l) loads the file locally in emacs and pushes the contents of the file to swank to evaluate it.
15:50duncanmahh
15:51the-kennyDeusExPikachu: Looks like it doesn't work together with elpa
15:52DeusExPikachubtw, I can manually load the file using (load-file "src/bar.clj")
15:53the-kennyDeusExPikachu: Seems logical to me
15:56_atoDeusExPikachu: have you tried C-c C-k ? or did you want to load one by name, rather than the current file?
15:57DeusExPikachu_ato, I hacked C-c C-k to work specially for my sbcl stuff, so I kinda prefer using C-c C-l for clojure
15:57_atofair enough
16:00DeusExPikachuwhere's the definition for slime-load-file? I might just tweak it myself
16:11tcrayfordotherwise I'd roll with using mexpand-all, but this has to keep the rest of the code the same
16:11jcromartieOK new rule: when your library hits an unexpected EOF, you are NOT ALLOWED to just say "EOF while reading"
16:12somniumtcrayford: ah, you only want -> or ->> to expand. why not use clojure.walk and check for lists starting with -> or ->>
16:12jcromartiebecause then the REPL tells me, essentially, that there was an EOF while reading whatever.clj
16:12tcrayfordooh!?
16:13tcrayfordclojure.walk has an implimentation of macroexpand-all as well as contrib.macro-utils
16:13alexyksomnium: what's the latest congomongo in clojars, still 0.1.1?
16:13somniumalexyk: yup
16:13duncanmuser=> java.io.FileNotFoundException: Could not locate swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0)
16:13duncanmhmm
16:14alexyksomnium: liebke pushed it as 1.0.0, you should fight
16:14duncanmahh
16:14duncanmi get it
16:14the-kennyduncanm: added swank-clojure to the lib-directory?
16:14somniumalexyk: author's humility :)
16:14the-kenny(swank-clojure-1.1.0.jar or something like this)
16:14alexyk1.0.0 is a filed-wise bit not on 0.1.1
16:14tcrayfordsomnim that might work
16:14tcrayfordcheers for the pointer at walk
16:14somniumalexyk: filed-wise ?
16:15alexyksomnium: 0=>1 in 0.1.1 => 1.0.0 :)
16:16somniumalexyk: the root group is being squatted too, Im more concerned with the accumulating patches I still havent gotten to
16:16tcrayford,(postwalk
16:16tcrayford (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll))
16:16tcrayford'(->> 1 (+ 1))
16:16tcrayford )
16:16clojurebotEOF while reading
16:17tcrayford(postwalk (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) '(->> 1 (+ 1)))
16:17tcrayford,(postwalk (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) '(->> 1 (+ 1)))
16:17clojurebotjava.lang.Exception: Unable to resolve symbol: postwalk in this context
16:17tcrayfordweird
16:17tcrayfordworks on my repl
16:17somnium,(use 'clojure.walk)
16:17clojurebotnil
16:17alexykif I want to exclude a jar from lein, should I use :excusions per a deoendency or there's a global way?
16:17tcrayford,(postwalk (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) '(->> 1 (+ 1)))
16:17clojurebot(+ 1 1)
16:18tcrayfordyeah that works perfectly
16:18tcrayfordand I can trivially use it for expanding ->> as well
16:18alexyktcrayford: what's the use case for postwalk?
16:19tcrayfordmacroexpanding any ->> forms inside a list
16:19alexyktcrayford: before applying ->>?
16:19tcrayfordnope
16:20tcrayfordI'm doing this as part of a refactoring tool, so if you have an expression that is currently in a ->> form, you can convert it to one without said form automatically
16:20alexykah, just expanding it for sure
16:24qedLisp Chainsaw
16:24alexykok I have a sneaky jar which is copied by lein deps every time. How do you folks do explusions again?
16:25alexykexclusions
16:28alexyktechnomancy: ping
16:29_atoit's in the FAQ in the readme: http://github.com/technomancy/leiningen/blob/master/README.md
16:29_atoQ: Is it possible to exclude indirect dependencies?
16:29alexyk_ato: I try to do that and lein still copies teh damn jar
16:29alexykso I was wondering why -- is there a tracking/verbose way to make it explain/
16:29somnium_ato: oh, youre back. welcome back!
16:30alexykalso, do I have to push :exclusions into a dependency, why not have it globally?
16:30alexykI've added the :exclusions to two deps, and it's still getting it
16:30_atoalexyk: not sure. I haven't looked into how that stuff works. Guess you do need technomancy then. :-P
16:30somnium_ato: any way I could get the congomongo root group? (it was accidentally squatted by a fork))
16:31_atosomnium: yeah sure, just a sec
16:32_atosomnium: done
16:32somnium_ato: great, thanks!
16:34technomancy:exclusions need to be on a per-dependency level so you can block one version of a dependency while letting another one through
16:34technomancyleiningen is just exposing the underlying maven functionality
16:35technomancyalexyk: what's the offending jar?
16:36alexyktechnomancy: so I use org.mongodb/mongo-java-driver "1.2.0-SNAPSHOT". But I also use congomongo which wants 1.1.0-SNAPSHOT. I tell congomongo, no-no, bad dep! -- and lein still gets the 1.1.0-SNAPSHOT.
16:37alexykI thought maybe incanter tries to get it, and slapped another :exclusions on incanter -- no luck. I have explicit dep, [org.mongodb/mongo-java-driver "1.2.0-SNAPSHOT"]
16:37technomancyalexyk: have you tried ordering it so the one that depends on the correct version comes first in the dependencies list?
16:38technomancyalexyk: it could be a bug in the :exclusions support. I haven't used it myself.
16:38technomancymattrepl might know; he implemented it
16:38alexyktechnomancy: the fact is. congomongo depends on 1.1.0; I checked I can safely fool it with 1.2.0, so nobody depends on it per se.
16:38alexykI want to supplant 1.1.0 by 1.2.0
16:39alexykah! mattrepl likes to reply that a missing feature is left as an exercise to the reader. We'll see about a buggy one! :)
16:39mattreplalexyk: bah basicauth is deprecated
16:39mattrepl=)
16:39alexykmattrepl: I lived it down already :)
16:40alexykso, what about 'em exclusions?
16:40mattreplthey're actually officially removing it this summer, just a heads up
16:40alexykmattrepl: that's ok, I've mastered oauth fine, your stuff works great
16:40mattreplwhere's the project file at?
16:41alexykmattrepl: http://paste.pocoo.org/show/173588/
16:42alexykI try to exterminate the mongo-java-driver-1.1.0-... which lein deps pulls from its rear orifice
16:42tcrayfordsomnium etc: cheers for that, everything works properly now
16:42alexykbtw, would be nice to have a top-level :exlusions like shown there -- does nothing though
16:44mattreplhmm, looks fine
16:44somniumtcrayford: great
16:45mattreplwill try to duplicate
16:45technomancyalexyk: try putting a few trace lines in deps/make-exclusion to make sure the underlying API is getting called at all
16:45tcrayfordended up having to recur through it to expand ->> until it was no longer present, but otherwise its good
16:45alexyktechnomancy: KDD deadline 2/2, for now will rm :)
16:46alexykpost-lein hook, manual
16:47technomancyKDD?
16:48alexyktechnomancy: kdd.org
16:48alexyka clojure-driven twitter-eatin' paper, lein-swankin', incanter-plottin'!
16:49technomancynice
16:49AWizzArd~seen rhickey
16:49clojurebotrhickey was last seen in #clojure, 424 minutes ago saying: stuartsierra: done
16:49alexyksomebody should do something in the real world with all the stuff you kids make up here
16:50AWizzArdrhickey: ping
16:50mattreplalexyk: was gonna say.. jung, twitter, mongodb.. sounds interesting =)
16:51alexykthe real problem, my repls are gone after a day. clojure garbage strewn all over the ram
16:51alexykI use compressed oops, and give it 30 gb -- it reaches that fast and starts saying, gc overhead reached
16:52alexykthen it's time to restart and reload painfully; mongodb is the persistent savior
16:52alexykmattrepl: yeah, I inferred you plotting along the same lines :)
16:53alexyktcrayford: a PhD? where?
16:53mattreplmuahaha... not for KDD though =)
16:53alexykmattrepl: yeah, sensed $$$ too :)
16:54mattreplunfortunately, none of that either
16:54alexyk,(def $ 1000)
16:54clojurebotDENIED
16:54alexykhmm
16:54alexyk,(def a 1)
16:54clojurebotDENIED
16:54tcrayfordalexyk, not a phd, just a bsc (at sheffield in ze uk)
16:54alexyktcrayford: ah ok, you guys write a bsc thesis then?
16:55tcrayfordconfirm
16:55alexyknice
16:55tcrayfordwell, dissertation
16:55alexykmattrepl: I'm curious, will ping offline
16:56alexykthere's a gang of twitter clojurers already here
16:56alexykwe need t organize
16:56alexykto
16:56hiredmananyone know a good way to generate an html file with side by side diffs of all the files in a directory?
16:56tcrayfordthe twitter ops guys have been playing around with clojure/hadoop for statistics
16:57mattreplalexyk: use org.clojars.somnium/mongo-java-driver
16:57alexykmattrepl: ah for exclusions! duh.
16:57mattreplorg.mongodb ns (or whatever it's called in mvn world) is incorrect
16:58alexykwell, it's correct for maven, if only folks wouldn't stuff the jars into clojars under their ns's...
16:58somniumalexyk: they only had the 1.0 jar on mvn at the time
16:58alexyksomnium: true. We need a clojars Nazi
16:59alexykto move them into the right place
16:59alexykor something
16:59alexyke.g. it wouldn't let liebke upload congomongo
16:59technomancysquatting on the group for a project you don't own is not cool
16:59alexykand enforce naming for things existing in mvnrepository
17:00alexyksometimes people just want to package stuff and have it there
17:00alexykand since clojars search was broken, they didnt find it
17:00alexykwe'll have a major problem soon
17:00mattreplwonder if we could provide a symlink or such for groups that have not yet been claimed by the appropriate owner
17:01mattreplhave to vet it somehow
17:02alexykmattrepl: should I still stick :exclusions under a dependency, or can I have one global as I've written?
17:03mattreplno global support at the moment. it could be added, but the semantics of it are a little weird
17:03mattreplyou exclude it as a dependency of your dependencies yet it's listed as a project dependency
17:03neotykHi
17:03neotyk~pastebin
17:03clojurebotexcusez-moi
17:03alexykmattrepl: it's just next to :dependencies
17:03neotykwhere is pastebin that clojurebot picsup?
17:04alexykit's a global exlusion, saying, don't auto-pull any version of it, except possibly what :dependencies mentions explicitly
17:04alexykor, perhaps, :only flag on a dependency in this case
17:04alexykmeaning no other version
17:05mattreplwould rather see some way to improve version dependencies
17:08alexykmattrepl: the problem is, I'm enforcing a version bump; the deps wnt an older one. Unless it's auto-detected, need to exclude
17:08alexykwant
17:09mattreplwell, needs to be approved by technomancy
17:10hiredmanneotyk: lisppaste8 is the one with the pastebin
17:12hiredmanclojurebot: ~paste
17:12clojurebotPardon?
17:12hiredmanclojurebot: ~url
17:12clojurebotExcuse me?
17:12neotykhttp://clojure.pastebin.com/m3e22d711
17:12wtetzner_is there a way to check if a var is bound?
17:12neotykI'm looking into add-watch
17:13neotykcan someone tell me why this code of "archtect?" is not getting called?
17:13wtetzner_i want to create a binding form, like (binding [item 1 ..., item 2 ...]), but i want to keep the existing values only if that symbol is already bound
17:13hiredmanwhat makes you think it isn't getting called?
17:13neotykno printin'
17:14hiredmanneotyk: println relies on *out*, which is thread localy bound, by say, swank-clojure
17:15neotykso this code "works"?
17:15hiredmanI don't know
17:16neotyklet me try outside emacsitor
17:16hiredmanI am helping you test it
17:17neotykhiredman: briliant
17:17neotykit works
17:17neotykas soon as outside of emacsitor
17:18hiredmanhttp://www.thelastcitadel.com/lab/master-1.0.x.diff.html <-- diff of the abi of master and 1.0
17:19ctdeanneotyk: are your running in slime ?
17:19neotykctdean: yes
17:19hiredmanline 1011 has the RestFn issue
17:19tcrayfordcheck the terminal window where you ran swank from
17:20tcrayfordor inferior lisp if you're using swank-clojure
17:20ctdeanneotyk: try looking in *inferior-lisp*also
17:20ctdean:)
17:20neotykyes it is there
17:20neotykbut not very helpful, right?
17:22kotarak,(let [a [5] b [5]] [(identical? a b) (set [a b])])
17:22clojurebot[false #{[5]}]
17:23duncanmhmm
17:23duncanmi'm trying to use agents, and I see RejectedExecutionExceptions
17:23duncanmhow do I debug them?
17:23duncanmthe stacktrace doesn't tell me where it's failing
17:23chouserthat probably means you called shutdown-agents in that JVM already
17:23duncanmhmm
17:23chousers/probably/usually/
17:23duncanmoh, if i call that once, my JVM is toasted for all subsequent agents?
17:23chouseryessir
17:23duncanmoh!
17:24duncanmand the only way to fix that is to start anew?
17:24chouserI think so.
17:24hiredman,(doc identical?)
17:24clojurebot"([x y]); Tests if 2 arguments are the same object"
17:24hiredman^-
17:24chouserthe thread pools used by send and send-off are static final.
17:28duncanmahh
17:28chouserwhich means they can't be replaced.
17:28chouserI don't see any way in the api to start up a pool that's been shutdown.
17:28duncanmchouser: in a function that's used to update an agent, the first argument is usually the agent itself, right?
17:28chouserno, the value of the agent
17:29hiredman~def shutdown-agents
17:29the-kenny,(shutdown-agents)
17:29clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)
17:30hiredman~def c.l.Agent
17:31neotyk~def restart-agents
17:31clojurebotNo entiendo
17:43dsopwhats the best way to do kindof pattern matching, something like (defn foo [x] ([1] (println "foo") [2] (println "2foo"))) ?
17:44chouserfor that example, I'd recommend 'case' or if you're on 1.1 'cond'
17:44dsopokay, I'll try to figure out how to use it, thanks.
17:44Chousukeisn't there a pattern matching macro in contrib somewhere too? :/
17:44the-kennyWhen I read "pattern matching", I think of http://www.brool.com/index.php/pattern-matching-in-clojure
17:44dsopChousuke: tit seems that there is match in contrib, but I don't want to use contrib
17:45wtetzner_is there a way to do something like (binding []), but for symbols that are not already defined?
17:45the-kennywtetzner_: let?
17:46wtetzner_no, i need to be able to set! them
17:46Chousukedeclare the vars first
17:46technomancythere's with-local-vars, but you probably shouldn't be doing that
17:46wtetzner_technomancy: why not?
17:47technomancybecause set! is almost always the wrong thing
17:47technomancyoutside of a repl/screwing around context
17:48technomancythere are much better ways provided by Clojure of managing state
17:48wtetzner_it's for a DSL i'm writing. I want to have something called defval, which will check if the var has a value already
17:48wtetzner_so it would be set once
17:49tomoj27 jars in lib/ for a blank project... :/
17:49wtetzner_so set! would only be called once, but i need to have "global" values
17:50wtetzner_technomancy: anyway, thanks
17:50tomojI must not understand you, that sounds like defonce
17:52wtetzner_tomoj: it's like defonce, but i don't necessarily want to define things outside of an enclosing function
17:52tomojah yes, they'd leak out I guess?
17:52wtetzner_also, i need to capture the values into a hashmap
17:55AWizzArdWhy does this await not return when the agent function throws an Exception?
17:55AWizzArd,(let [a (agent 0)] (await (send a (fn [_] (throw (Exception. "Bar Foos"))))))
17:55clojurebotnil
17:56AWizzArdokay, the bot does not react on this, but if i paste this into my repl it stops, the await seems to block forever
18:02AWizzArdschlafen wohl schon alle
18:02wtetzner_is there a way to check if a var has already been defined?
18:03arohnerwtetzner_: use resolve
18:03AWizzArdwtetzner_: yes, (resolve some-symbol)
18:03wtetzner_ok
18:03wtetzner_thanks
18:21duncanmhmm
18:22duncanmif i have a data structure like {1 ['foo 'baz], 2 ['mumble 'grumble]} and I want to get to {1 ['foo 'bar 'baz] 2 .... } - how do i do that?
18:22duncanmi need a mix of assoc-in and conj together...
18:23duncanmhmm
18:23AWizzArdduncanm: first you should write a function (vector-insert ...)
18:23duncanmi'm starting to think that I should just use a Map
18:23duncanmi need to index via x,y,z
18:24AWizzArdThis was intentionally left out, because the performance would not be good. FingerTrees would make this easier.
18:30jcromartiewhat's a good way to filter through a hash-map and produce another map?
18:30AWizzArdin what way you want to filter?
18:31jcromartieI want all of the pairs with non-nil values
18:31AWizzArdjcromartie: you can do this with reduce.
18:32somnium,(into {} (remove (fn [[k v]] (nil? v)) {:a 1 :b nil :c 2 :d nil}))
18:32clojurebot{:a 1, :c 2}
18:32jcromartieeven better, somnium
18:33jcromartiethanks
18:33jcromartieI thought it would be something like that
18:34AWizzArdreduce could still be more efficient though
18:34AWizzArd,(reduce (fn [m [k v]] (if-not (and k v) m (assoc m k v))) {} {:a 1, :b nil, :c 3, nil 5})
18:34clojurebot{:c 3, :a 1}
18:36tomojwrote my first emacs function :) https://gist.github.com/c120edd064ad145656eb
18:36tomojif you're in a lein project in a .clj file under src/, it inserts the appropriate ns declaration
18:37herdrickquestion: i've got a working version of clojure, swank-clojure, slime, etc running. how to i update it? I just did a "git pull" for everything, then tried mvn to build things. Not good. Among other problems, i'm now getting "File error: Cannot open load file, swank-clojure-autoload" when I try to start Emacs.
18:37herdrickis ELPA the accepted way to install swank-clojure? and how much does it do - i.e. do I "git pull" and "mvn compile" myself before using it? does it install clojure?
18:37herdrickalso, i just did a "mvn compile" in my swank-clojure dir and its messages said it downloaded a clojure 1.0 jar. apparently, i'm supposed to specifiy a local jar using the -o option. correct? if so, why is swank configured to go get an old one?
18:37herdrickor am i supposed to be using leinigen to manage this?
18:38tomojpersonally, I use elpa to update slime/swank-clojure/etc and use leiningen to install clojure into each project
18:38tomojthat way you get to pick the clojure version per-project as well
18:39herdricktomoj: ok, thanks
18:39tomojand when I just want a repl, the elpa stuff installed clojure-1.1.0-master
18:39tomojand M-x slime gives a repl to that to me
18:39herdricktomoj: but when you M-x slime, doesn't it always use the same version of clojure? no matter what project you want to work on?
18:39tomojyeah
18:39dsopI'm sorry I'm really new to lisp, how do I expand a list to a set of parameters, so that (foo (list 1 2 3)) is equal to the call of (foo 1 2 3 )
18:40tomojif you want to work on a specific project, you can use swank-clojure-project or lein swank
18:40tomojthose both use the project-specific clojure version you installed with lein
18:40herdrickdsop: you want: (apply foo (list 1 2 3))
18:40tomojM-x slime is useful when you just want to get to a repl to play with something outside of a project
18:40dsopherdrick: thank you
18:41jcromartiewhat's the test for wether something is seq-able?
18:41herdrickdsop: glad to help!
18:41tomojand I think if you want to change the version M-x slime launches, you can just drop the jars into ~/.swank-clojure, though I haven't tried this
18:42jcromartie(isa? Seqable)
18:42dsopherdrick: is it usual that you define this as a arity overloading?
18:42herdricktomoj: ok, i'll look up lein swank and swank-clojure-project
18:42herdrickthanks
18:43herdrickdsop: not sure what arity overloading is. it definitely is usual in the lisp world to use 'apply' a lot
18:43Chousukeif creating maps, into will most likely be most efficient for large ones, because it uses a transient map internally.
18:44dsopherdrick: I mean like (defn foo ([x] (apply foo x) ) ([a b c] ...))
18:44herdricktomoj: somehow i knew i was going to hate trying to update my clojure install. sure enough...
18:44tomojyeah.. I run into trouble occasionally
18:44dsopherdrick: nevermind, it works so far, thank you :)
18:44tomojthe past couple days, though, I've set up clojure on bare emacs on two different boxes, and it was delightfully easy
18:45tomojpackage.el, install the elpa stuff, install paredit, add my clojure-mode customizations, install lein, no problems at all starting fresh
18:45herdricktomoj: hmmm... that's probably the way for me to go. my .emacs file is small enough - aside from the clojure stuff - to make starting over easy
18:46herdrickparaedit?
18:46herdrickparedit?
18:46tomojyeah.. if you're using emacs you should look into it
18:46tomojuse paredit-beta.el
18:46herdricki thought it was included in slime
18:46herdrickor swank
18:47tomojdunno, I just grabbed paredit-beta.el
18:47herdrickdsop: ok, good luck
18:47tomojit's in elpa but that one is old
18:47dsophmm (defn foo ([x] (apply foo x) ) ([a b c] ...)) looks like a bad hack for lisp startes soehow
18:47ChousukeI don't think that's very common
18:48dsopokay.
18:48Chousukeit IS common in Clojure to use arity overloads to provide default values, though.
18:48tomojherdrick: here is my paredit stuff for .emacs, may be useful https://gist.github.com/3416b90cf4b77d5c3af9
18:48AWizzArdOooh, very good. I just learned about the existance of http://code.google.com/p/google-collections/
18:48tomojthough I don't guarantee usefulness or even that it works :)
18:48AWizzArdThey have several immutable data structures, very interesting.
18:49AWizzArdIs the Apache 2 License compatible with the Eclipse License?
18:49tomojjust grabbed paredit-beta.el and put in on the load-path as paredit.el for that
18:49dsopChousuke: but it is nice that I can do (hsv2rgb (rgb2hsv 242 212 0)) :)
18:49herdrickisn't there a documented standard way to install clojure with emacs?
18:49herdrickcurrent, i mean...
18:49tomojelpa is the standard way, I think
18:49tomojnot sure where it's documented
18:50tomojor if
18:50tomojI could write up my process sometime I suppose, if it's not out there already
18:50Chousukedsop: well. that works.
18:53herdrickhow does clojure-mode fit into this? i've got a clojure-mode.el that seems to be directing things
18:54herdrickshould i just kill that?
18:54tomojyou would just use the elpa version for the putatively standard install
18:54technomancyherdrick: it's probably out of date; installing anything from clojure-mode has been deprecated for quite some time
18:54herdrickah
18:54herdrickok
18:54herdricki'll wipe it out
18:54technomancypossibly since the summer
18:54herdrickhmmm
18:55herdrickso this is out of date:
18:55herdrickhttp://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started
18:55tomojI'm starting a blog post whether it's needed or not :)
18:55technomancypretty much everything on the wiki is out of date, yeah. =(
18:56herdricktomoj: needed!
18:57herdricktomoj: i'll be ok, now, though, thanks
18:57herdricktomoj: thanks, and bravo for doing it
18:58herdricktechnomancy: bummer, eh?
18:58technomancywikis are really hard to keep updated
18:58technomancybetter just to link to the official documentation
18:59tomojis there any?
18:59technomancythe swank-clojure readme is pretty thorough
18:59technomancyif it's not, file a bug
18:59technomancyI guess people just don't know to look there first.
19:00tomojah, yeah, looks good
19:00tomojI guess I only remember hearing someone not understand how to follow the step "Install from ELPA using package.el" once
19:01herdricktechnomancy: on this step: "3. Project: Put your project's dependencies in the lib/ directory,"
19:01herdrickwhich /lib ?
19:02technomancyherdrick: lib inside your project root. if it doesn't exist you can mkdir it
19:02technomancyor better yet, use "lein new" from leiningen
19:03herdrickok, thanks
19:03technomancyherdrick: http://vimeo.com/8934942 <= maybe start here
19:03herdricki'm not using leiningen yet
19:03tomojtechnomancy: do you know why I have lein-clojars and swank-clojure in my dev dependencies?
19:03herdricktechnomancy: ah, excellent, thanks
19:03tomojI've just always copied a working project.clj to a new project so those are always there
19:04tomojdon't remember why I put them there though
19:05tomojlein new's not including them makes me wonder if they are unnecessary
19:05hiredmanhttp://www.thelastcitadel.com/lab/abi-watch/ <-- abi diffs for the java part of clojure
19:06tomojwow, I hadn't even seen that vimeo series at all
19:24duncanmif i just want to use condp for the ::> feature, what do i put it as the 'pred'?
19:25hiredman,(doc condp)
19:25clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must b
19:25Chousukeidentity
19:25duncanmand condp doesn't have a :else, right?
19:25hiredmanidentity doesn't take two args
19:26Chousukehmmh
19:26somniumdo many people use condp with #(%1 %2) as the pred?
19:27duncanmi just like the :>> part, it's like the => in Scheme's COND
19:27AWizzArdsomnium: no
19:28somniumI find it useful, but it looks a bit odd
19:28herdricktechnomancy: i installed ELPA and swank-clojure on a fresh emacs install. but this line: (require 'slime) in swank-clojure.el is failing. can't find the file.
19:29AWizzArdduncanm: what is it doing?
19:29herdrickdid i not delete enough dirs?
19:29herdrickpretty sure i cleaned everything up
19:29duncanmAWizzArd: http://gist.github.com/294229
19:30duncanmAWizzArd: that doesn't look right
19:30herdrickhmm, sorry maybe not let me clean up some more junk bbiab
19:31itistodayis it possible to create a macro that takes a body with unbound symbols and bind them?
19:32itistodayi.e., i'm not an experienced clojure dev, so this is as far as i've gotten, and it throws an exception:
19:32tomojif I understand what you mean, yeah, but it's generally frowned upon
19:32itistoday(defmacro foo [body] (binding [a 1] (cons 'do body)))
19:33duncanmitistoday: yeah, that's an unhygienic macro
19:33chouserbut it's actually common
19:33chouserwith-out-str, for example
19:33itistodaywell 'body' would have an unbound 'a' symbol, that gets bound when you call foo
19:33itistoday(bound to 1)
19:33itistodayso is it possible to write that in clojure?
19:34herdrickhmm, i think everything is cleaned up
19:34herdricktomoj: any thoughts? I installed ELPA and swank-clojure on a fresh emacs install. but this line: (require 'slime) in swank-clojure.el is failing. can't find the file.
19:35Chousukeitistoday: it is
19:35tomojherdrick: I just installed slime from elpa as well, did you?
19:35tomojor were you wanting to use the slime you've got
19:35herdrickyes,
19:35herdrickright
19:35Chousukeitistoday: (defmacro foo [& body] `(let [~'a 1] ~@body))
19:35herdrickbut i don
19:35herdrickdon't care about that
19:35herdricklet me wipe it
19:36tomojChousuke: hmm, why doesn't the same thing with binding work? (unable to resolve a)
19:36Chousuketomoj: binding is for dynamically rebinding vars
19:36tomojah, yes, of course
19:36Chousuketomoj: the var needs to exist beforehand
19:37herdricktomoj: actually it looks like ELPA took care of that and installed a new version of SLIME anyway. which is good. not working tho, i'll try again
19:37itistodayChousuke: thanks!
19:38tomojhmm, strange
19:38itistodayChousuke: i know that should have been obvious to me, but i don't write clojure code ... it's just something i read up on every now and then
19:38itistodayone day i'll fully embrace it :-p
19:39itistodayi'm just not a big fan of dealing with the jvm and maven and all that
19:40Chousukeitistoday: the fun thing with macros is that if you can create the code, then macros can too :P
19:40Chousukeand if macros can't, then you can't either
19:41itistoday:-)
19:41itistodaythe issue is that i can't write clojure code for shit yet :-p
19:42tcrayfordread more and write more
19:42tcrayfordyou'll get it
19:42Chousukeof course for a lot of code it makes no sense to write a macro but... it sounds wise, doesn't it?
19:42itistodaytcrayford: i will, as soon as i have a need for doing a big web app, i'll do clojure most likely
19:43tcrayfordmacros let you write code that you'd hate to have to write out by hand as well though
19:46herdricktomoj: nope, i installed slime from ELPA first, that worked ok. but then installing swank-clojure from ELPA failed
19:46herdricktomoj: same as before, but there was an earlier error i didn't see:
19:46herdrick"slime-repl.el:122:39:Error: No setf-method known for slime-connection-output-buffer"
19:46itistodaywhy does the 'a' have a ~' in front of it? (defmacro foo [& body] `(let [~'a 1] ~@body))
19:47itistodaywhy isn't it simply (defmacro foo [& body] `(let [a 1] ~@body))
19:47Chousukeitistoday: it works around the namespace qualification that syntax-quote does
19:47somnium,`a
19:47clojurebotsandbox/a
19:47somnium,`'a
19:47clojurebot(quote sandbox/a)
19:47somnium,`~'a
19:47clojurebota
19:47itistodayChousuke: gotcha, so this is a clojure-thing, in CL it wouldn't have it right?
19:48Chousukeitistoday: I consider the ugliness a featue :) it shows that your macro is doing evil things
19:48Chousukecorrect
19:48itistodaygot it, thanks!
19:49itistodayit's actually not doing evil things (IMO)
19:49itistodayi was trying to convert a neat newlisp macro i came up with
19:49Chousukewell, generally, introducing bindings out of nowhere is considered evil
19:49Chousukebut it is useful in some cases
19:49Chousukeas long as you document it well
19:50itistodayyeah, but check this out: http://paste.pocoo.org/show/173665/
19:51itistodayso: (for-query-with-db db "SELECT rowid,name,age FROM people" (println NAME)) => prints the names of all the people
19:52Chousukeah, well, that's not really generating the names from nowhere I guess
19:52itistodayindeed, and i'm happy to hear that can be done in clojure too
19:55itistodayit might be slower though, because i think that can only be done with 'eval'
19:55itistodayand clojure's isn't very fast :-(
19:55DeusExPikachuhmm, how do you close a socket which you forgot to store a reference to?
19:56itistodayDeusExPikachu: you kill the process? :-p
19:56DeusExPikachunooo, is there another way? :P
19:57DeusExPikachuso I guess the question is, how to I get that lost reference?
19:57itistodayDeusExPikachu: what are you doing?
19:57DeusExPikachuits running on a server, and there are other threads running that I can't stop
19:58DeusExPikachuI started a serversocket on it, and forgot to store it in a var
19:59itistodayi personally don't know of any other way to close it
19:59DeusExPikachuooh, maybe *2?
19:59DeusExPikachui'll try it
20:02itistodayeh... seriously this is ridiculous, why is clojure's eval so slow?
20:03DeusExPikachudamn, doesn't go to *7
20:03tomojherdrick_: no idea, sorry
20:03tomojI just did the install-from-elpa process again and it worked fine :/
20:11herdricktomoj:ok, thanks anyway for your help
20:19herdricktomoj: i'm using Aquamacs... i suppose someone will say this is the problem?
20:23tomojherdrick: nah
20:23tomojI did it with aquamacs just some hours ago
20:23herdricktomoj: great to hear it!
20:24herdrickhuh
20:24tomojonly difference in my process was where to put paredit and my customizations
20:24herdrickok
20:24tomojthat was a freshly installed aquamacs, dunno if some config could break it
20:26kibahello
20:27kibawhere do I put my clojure-contrib.jar ?
20:28tcrayfordfor what
20:32tomojherdrick: I imagine you did everything right and have just run into some incompatibility or config issue, but here's exactly what I did (just did it again on a fresh box): http://tomojack.com/?p=8
20:33tomojherdrick: maybe check that wherever elpa put the packages is properly on the load path?
20:33tomojthe little initialization bit that the package.el install adds is supposed to do that, I believe
20:34tomojmaybe that got put somewhere aquamacs isn't looking
20:35tomojthis bit https://gist.github.com/654c262d3a32baf0ada3 (adjusted for wherever your elpa packages are) needs to be in Preferences.el or somewhere else aquamacs will find it
20:35tomojanyway, good luck
20:36kibawhere do I install clojure-contrib?
20:37herdricktomoj: thanks! that's great. i'll check the load path
20:38herdrickgotta go now, thanks for the help and advice
20:39kibawhere do I install clojure-contrib?
20:48kibawhere do I install clojure-contrib
21:04dnolenkiba: you don't need to install it anywhere, you just need to make sure it is on the classpath when you start the Clojure REPL
21:49jcromartieHow do I set the current working directory of the clojure process for swank-clojure-project?
21:49jcromartieMaybe there's a better way for me to load files?
21:57jcromartieI suppose loading from the classpath is better
22:16itistodayi need help writing the clojure version of this:
22:16itistodayhttp://paste.pocoo.org/show/173705/
22:16itistodaythat's newlisp code, but it should be simple to understand
22:17itistodayit lets you do this: (for-query-with-db db "SELECT name FROM people" (println NAME)) => prints the names of all the people
22:24itistodayand the api seems to be down, making it even more difficult ... :-\
22:54hiredmanugh
22:55hiredmanclojure.lang.Repl everywhere :(
23:05chouser\3~4~
23:05chouserum. sorry.
23:06hiredmanclojurebot: appoligize for chouser
23:06clojurebotmea culpa!
23:26nathanmarzif i've already called (use 'package) in the repl, how can i reload the file and rebind the defs?
23:27hiredman,(doc use)
23:27clojurebot"([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."
23:28hiredman,(doc refer)
23:28clojurebot"([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current name
23:28hiredmandunno where it is documented, but there is a :reload argument
23:30nathanmarzyup, (use 'package :reload) worked
23:30nathanmarzthanks hiredman!