#clojure logs

2010-02-24

00:00brandonwholy crap, i finished optimizing the snake-solver algorithm i have been working on as my first project
00:01brandonwremoving duplicate transformations caused the run-time of the solver to go from over 4 minutes to 2.5 seconds
00:01brandonwi knew it would help, but i didn't think it would help *that* much
00:51slyphonso, to create custom exceptions, you have to use gen-class?
00:52slyphonoh
00:53slyphonchouser: is error-kit supposed to be more common-lispy ?
00:58jcromartielein uberjar is my new best friend
00:58jcromartieseriously
01:10hamzais there something in incanter that plots like mathematica's wordplot?
01:12slyphonargh, java is so fucking *lame* sometimes
01:50TheBusbydid something like Tim Bray's parallel line reader make it into contrib or any standard library?
02:06TheBusbynoticing that $ wc -l bigfile.txt takes 2.3 seconds while (time (count (read-lines "bigfile.txt"))) is taking ~27 seconds...
02:07TheBusbywc takes ~23 seconds the first time it's run, but then only about ~2.5 seconds every subsequent run. Clojure is taking 26+ seconds every time and I'm not clear why...
02:32hiredmandoes promise/deliver behave well with the stm?
02:35hiredmandoesn't look like it
02:35hiredman:(
02:38slyphonif i have two vectors and i want (f [:a :b] [:c :d]) -> [:a :b :c :d] what's the thing that does that?
02:41hiredman,(into [:a :b] [:c :d])
02:41clojurebot[:a :b :c :d]
02:41slyphonoh, right
02:42hiredman(repeatedly promise) ;chuckles
02:43slyphonhahaha
02:43slyphon(future-cancelled?)
02:43hiredmanan immutable infinite sequence of promises turns out to be fairl useful
02:44slyphonsounds vaguely like marraige
02:45slyphonor a very sepcific fortune-cookie
02:47hiredmanhttp://paste.lisp.org/display/95522
02:47hiredmanlisppaste8: :(
02:48avarusmoin
02:49radsis anyone else impressed that you can implement clojure-style multimethods in 10 lines of javascript? http://gist.github.com/313225
02:49slyphonhiredman: interesting
02:50hiredmanrads: I doubt that
02:50hiredmanclojure's multimethods provide a lot that is not always used in simple treatments of same
02:51hiredmanfor example you can use arbitrary hierarchies
02:51dnolenrads: not nearly as useful because you don't have value equality around arrays and object literals in JavaScript.
02:52hiredmanand you can use vectors with the hierarchies
02:52slyphonand, like, static typing :P
02:52slyphon"1" == 1
02:52slyphon== FAIL
02:52slyphon(sorry, pet peeve)
02:53radsdnolen: I'm not sure what you mean
02:53dnolenrads: ["foo", "bar"] != ["foo", "bar"] in JavaScript
02:54dnolen{"foo": "bar"} != {"foo":"bar"}
02:54dnolenthese are valid matches in Clojure multimethods and _VERY_ useful.
02:54hiredman,(isa? [String Integer] [Object Object])
02:54clojurebottrue
02:54radsdnolen: that seems to work in the example I posted unless I'm missing something (only tested in safari)
02:54hiredmansee clojure uses isa? for dispatching in multimethods
02:55hiredmanso if your dispatch function makes a vector of the types of the arguments
02:56hiredmanthe multimethods will look for methods that match exactly, but also walk up the hierarchy
02:56radsI'm not saying the 10 lines I posted are just as good as clojure multimethods, but they provide the core functionality.
02:57hiredmanthey provide something that is superficially similar
02:57dnolenrads: trust me, not even close. I breath JS. not even superficially similar. your code doesn't work for object literals
02:57dnolenvar o = {}; o[["foo","bar"] = "cool";
02:58dnolencoerces the array in to a string
02:58dnolenthat why it works for arrays
02:58radsI see
02:58dnolendoesn't work for nested arrays, doesn't work for object literals
02:58dnolentotally broken.
02:59dnolenit can work if you JSON.encode your key first
02:59dnolenalso you can take object literals and convert them into arrays sorted by key, recursiing through the object literal.
02:59dnolenthis is of course dog slow
03:00dnolenbut a useful technique depending, such as dispatching on url routes.
03:00slyphonwow, testing in clojure is pretty sweet
03:02dnolenrads: that said, JS is great. I love it. It actually spoiled me on most other languages. Then I found Clojure :)
03:02radsdnolen: I'm just thinking about applying clojure concepts to JS, mainly trying it without OO
03:04dnolenrads: yeah, Clojure has done wonders to my JS. http://github.com/ShiftSpace/functools
03:04dnolenrads: dispatch on fn arity, pre-post conditions, hash and arrays as fns, all useful in JS
03:05radsdnolen: looks good. I like underscore.js too
03:07radssomething I wonder now that I've learned clojure is how much OO is necessary
03:07dnolenrads: yes, I actually wrote that like the day before underscore.js came out :) underscore does most of this and without changing prototypes.
03:07dnolensomethings you just can't do in JS without OO. Since you can't write macros, you have to change the system via prototypes
03:08dnolenrads: http://github.com/ShiftSpace/promises, futures/promises, data-flow style programming in JS
03:09dnolenthis really needs OO to work (in a language like JS anyway)
03:13radsit seems that after working with clojure, advanced OO features like ruby's metaclasses just make things unnecessarily complicated
03:51a_strange_guyhi there
03:52a_strange_guyis there a reason why EvalReader doesn't use eval?
03:54a_strange_guybecause something like #=(+ (+ 1 2) 3) blows up
03:54hiredmanright
03:55hiredmanevalreader is for calling constructors basically
03:55hiredmanarguments are not evaluated
03:55a_strange_guyhmm, that sucks
03:56hiredmanwhy are you trying to do a lot of evaluating in the reader?
03:56a_strange_guyI want to define a print-dup which can print closures correctly
03:58hiredmana_strange_guy: fns are compiled to classes
03:58a_strange_guyyes
03:58hiredman,(class @#'+)
03:58clojurebotclojure.core$_PLUS___4518
03:58hiredman,(.newInstance (class @#'+))
03:58clojurebot#<core$_PLUS___4518 clojure.core$_PLUS___4518@1239b45>
03:58hiredman,((.newInstance (class @#'+)) 1 2)
03:58clojurebot3
03:59hiredman#=(fn.class.name.)
03:59a_strange_guybut this wont work if the fn closes over something
03:59hiredmanI don't thing you can expect to get that to work without many caveats
04:00a_strange_guythis is pretty fragile, but can work
04:03a_strange_guymy poor hack for now is to extract all private non-static fields from a fn
04:03hiredmana_strange_guy: http://paste.lisp.org/display/91148 might be interesting
04:06a_strange_guyhiredman: nice, never thought of using deftype to created Fns
04:07hiredmanit has a few issues, hence "fn minus"
04:07hiredmanI don't think recur or destructuring work
04:15AWizzArdHi guys
04:15AWizzArdHi Lau, how are you?
04:28avarusvery silent
04:29AWizzArdYes, they are all still sleeping :)
04:30esjfortunately they're non-blocking
04:30AWizzArd^^
05:06raekif I want to add unit tests to my project, is clojure.test the recommended lib to use?
05:06AWizzArdyes
05:06raekgreat!
05:07LauJensenMorning guys
05:08LauJensenSorry I missed you AWizzArd, it only beeps on 'LauJensen' - But I'm doing good thanks, you ?
05:10AWizzArdfine, thanks :)
06:40dmiles_afkachidemic question.. could clojure tranlate to a .java file instead of bytecode.. and stiull be somewhat ok?
06:41dmiles_afkwould it lose speed in running? .. (skipping the fact that one needs t compile the java)
06:42Chousukedmiles_afk: sure it could, but there's little reason to do that :/
06:43dmiles_afkwell sometimes a languge that emits bytecode .. if you decompile it . you realize that a java programmer might have done something better
06:44dmiles_afkafter you spot that.. you might imporve the compiler
06:44dmiles_afkor decide instead ot make something a java utility class
06:44Chousukewell, decompilation is inaccurate anyway
06:44dmiles_afkat least one part of ones program
06:44Chousukeprobably the clojure compiler produces bytecode patterns that a normal java program would never have
06:45Chousukedecompiled clojure is going to look really weird to a java programmer
06:49dmiles_afksoemtimes i use just javap
06:51dmiles_afkif someone is converting representtions for convenience of data type conversion.. but they didnt know they where gettign helped in the compiled form
06:52dmiles_afkmainly that might be if anything one might spot
07:03hamzaincanter does not support pie charts?
07:03Leafwjfreechart does, so it ma be a matter of some glue code.
07:05hamzayeah but it seemed a bit odd that it does not support it..
07:14ivanhas anyone seen any test runners that are integrated into an event loop, so that you can resume a test after doing some asynchronous stuff?
07:15ivanor is the generally strategy to always block in a thread if you want to do this
07:48powr-tocI have a problem with clojure-mode and swank-clojure... When Emacs starts I get the error "Cannot open load file" "swank-clojure-autoload"... Any advice?
07:57hoeckpowr-toc: thats an obsolete file
07:57powr-tocthen why is it in the latest swank-clojure?
07:57powr-tocI mean clojure-mode
07:58avarushave you tried turning it off and on again?
07:58avarusI mean a fresh install
07:58powr-tocyeah.... I'm looking at commit 2c3e27753ac40abd22f17d3f9c678d8fa9c8a16a
07:59powr-tocsee line 702: http://github.com/technomancy/clojure-mode/blob/2c3e27753ac40abd22f17d3f9c678d8fa9c8a16a/clojure-mode.el
08:13hoeckpowr-toc: it looks like you could safely remove this line (require 'swank-clojure-autoload) from clojure-mode.el
08:15powr-tocOk... I've nuked all my old emacs configs, and I'm trying to install fresh via ELPA... I've M-x package-list-packages and installed swank-clojure... but M-x slime fails to establish a connection... How is it I get swank-clojure to install clojure?
08:16powr-tocDo I know do M-x clojure-install?
08:17powr-tocHmmm... that fails to compile contrib, as that now uses maven...
08:17hoecknot shure what that does
08:17hoeckyou can download latest contrib and clojure from http://build.clojure.org/
08:20powr-tochoeck: I know... I'm just trying to figure out how to get slime/swank-clojure going... I attempted an upgrade and fubar'd everything...
08:24hoeckpowr-toc: how did you upgrade?
08:25hoeckbasically you need latest swank-clojure, slime and clojure-mode from technomancy, then add/update some config foo to your .emacs
08:26powr-tochoeck: I know that :-) ... unfortunately it doesn't seem to be working... and the swank-clojure docs etc... recomend ELPA installs... so I've tried that way, and it's still not working :-(
08:27hoeckpowr-toc: yeah, had no success with ELPA either, so I did a full manual install
08:27powr-tochmmm... maybe I'll back out and try again with a blank manual install
08:28powr-toclooks like another hour shaving yaks :-)
08:32Hali_303hi
08:32ohpauleezhi Hali_303
08:32Hali_303tab completion does not work for me on clojure sources files. any idea how to resolve this? on the border, it says "Clojure Raredit"
08:33Hali_303Paredit, sorry
08:34a_strange_guyhave you installed Slime?
08:35a_strange_guyyou need a running 'slime-repl clojure' for good tab-completion
08:35Hali_303a_strange_guy: sure, the repl is working (the border says: *slime-repl clojure*), and also, tab completion is working there
08:36Hali_303my problem is that tab completion does not work when opening a clojure source file using C-x C-f
08:37Hali_303ah, the reason is, that I need to do C-c TAB instead of simply TAB
08:37a_strange_guyjepp
08:38a_strange_guywhat i have done is binding tab completion to Ctrl-Space
08:38a_strange_guylike in eclipse/netbeans
08:40a_strange_guydoes anone know how to instanciate a class that lives in the default packags?
08:40a_strange_guy^package
08:40chouser:-(
08:41chouserit's not really supported
08:42a_strange_guydamn, have to use Reflection (yuck)
08:42chouseryou can't move the class?
08:42chousera_strange_guy: actually, try importing it first.
08:44chouser(import Foo) (Foo. args) seems to work.
08:44a_strange_guycan't do that, I'm trying to instanciate Fns directly (yep evil)
08:44a_strange_guyand import isn't an option in this case
08:46chouser(clojure.lang.Reflector/invokeConstructor (Class/forName "Foo") (to-array [args go here]))
08:46chouserunless you've got an unusual classloader situation as well, in which case you might need a different mechanism for getting the right Class instances.
08:47a_strange_guyc.l.Reflector works
09:01powr-tocARRGHHGHGHGHG... it looks like I need ELPA installed to run technomancy's slime regardless of whether I use ELPA to install slime/swank
09:02AWizzArdunfortunately yes I think
09:02AWizzArdIt was so nice until some time in October 2009
09:02AWizzArdYou could download the freshest version of slime, just download swank-clojure and put it into a dir, done.
09:02powr-tocAWizzArd: yeah, but is that clojure compatible?!?!
09:03powr-toci.e. does it work with technomancy's swank-clojure and clojure-mode?
09:05AWizzArdI don't think so. I used to use jochu-swank.
09:06AWizzArdBut unfortunately he seems to have stopped managing it.
09:06powr-tocthat versions way out of date
09:06AWizzArdyes :-(
09:07AWizzArdAnd also in slime there were some changes in October, and that seems to made it incompatible with that last version of swank-clojure
09:07AWizzArdSo I basically still use this 5 months old code.
10:17RaynesThree days. Three days I've been trying to find a bug in my code, and it's a mistyped keyword. :heartss instead of :hearts
10:17RaynesI'm off to kill myself now. You have a very nice day.
10:18cemerickRaynes: that's nothing compared to the time I blew a week looking for what turned out to be an unprintable char in a literal string.
10:19esjUTF8 vs ASCII is always fun that way
10:19cemerickapache's httpclient certainly is featureful, but *holy hell* is it complicated.
10:20_fogus_I've spent untold hours chasing misplaced semi-colons in Java and misaligned spacing in Python
10:21chouserI once lost an entire year tracking down a tab where there should have been eight spaces.
10:21chouserok, no I didn't.
10:22stuartsierraheh
10:23chousersorry, got caught up in the moment
10:23chouser_fogus_: ooh, at work?
10:23_fogus_yes
10:23_fogus_:)
10:23tmountainwhen I first started programming, a friend and I spent a whole day trying to find a missing curly brace in a gigantic monolothic perl script
10:23tmountainnewbs
10:24Maddas_fogus_: A verbal battle?
10:24_fogus_He didn't see the obvious flaw in his argument against the long string of closing parens ))))))
10:24_fogus_Maddas: We were not really arguing.
10:24tmountainparens are a lot easier to match on than "end"
10:25_fogus_tmountain: Bingo.. end end end end end end
10:25Maddas:-)
10:26tmountainother gripe about ruby... the methods aren't really first-class
10:27_fogus_Should they be?
10:27tmountainwell, it'd be a lot less clunky than using a proc object
10:28cypher23tmountain, http://yehudakatz.com/2010/02/21/ruby-is-not-a-callable-oriented-language/
10:28_fogus_http://yehudakatz.com/2010/02/21/ruby-is-not-a-callable-oriented-language/
10:28_fogus_ahhhhh, beat me to it
10:28cypher23heh
10:28tmountaindon't get me wrong, I like ruby
10:29tmountainI just like Clojure more
10:29cypher23tmountain, I also occasionally wonder why Ruby methods aren't first class (like in clojure), but then again, I've never actually missed them
10:29cypher23I rarely ever call a proc directly, almost always through yield
10:30tmountainyield essentially provides coroutines, so it negates a lot of the pain
10:30jcromartiewhat's the way to wrap up a Java method, like #(.trim %)
10:30jcromartiebut there's some other way
10:30chouserjcromartie: that's the best way currently
10:31chouserYou can build real coroutines in ruby because it has callcc.
10:31jcromartieoh, I just found memfn
10:32chouseryeah, memfn is old. likely to be deprecated, I think.
10:33tmountainchouser: yeah, I've never learned to fully exploit callcc
10:33tmountainchouser: although, I'd like to
10:33cemerickwow, memfn is still around :-/
10:34jcromartiehmm
10:34jcromartieis memfn bad?
10:34cemericksurely it doesn't do anything that #() doesn't handle?
10:34jcromartiedeprecated?
10:34chousercemerick: right. in fact, it does less.
10:34stuartsierramemfn is vaguely deprecated
10:34cemerickyeah, that's why I'm surprised it's still around
10:34stuartsierrachouser: less?
10:35chouser#() is useful in places where memfn is not. Anywhere memfn can be used, #() would also work.
10:35jcromartieis this a decent way to get the tokens out of a string? (filter (comp not empty? #(.trim %)) (.split x "[\\,\\s]"))
10:35stuartsierrachouser: oh, I see what you mean
10:36jcromartieor is comp obfuscating it
10:36chouserjcromartie: I'd recommend using the regex literal for regexes
10:36chouser(.split #"[,\s]" x)
10:36jcromartie,(.split "foo bar" #" ")
10:36clojurebotjava.lang.ClassCastException: java.util.regex.Pattern cannot be cast to java.lang.String
10:36jcromartie,(.split #" " "foo bar")
10:36clojurebot#<String[] [Ljava.lang.String;@1bc70f3>
10:36jcromartieah
10:36jcromartieI see
10:37jcromartiethat's why I wasn't using it
10:37jcromartieI didn't realize .split was a method of regexes
10:37chouser,(re-seq #"[^,\s]+" " foo, bar,baz bing ")
10:37clojurebot("foo" "bar" "baz" "bing")
10:37jcromartiebeautiful
10:38chouserand re-seq is lazy, so ... that's fun. :-)
10:38jcromartiethanks!
10:39jcromartiecode clarity++
10:39jcromartieerr, (inc code-clarity)
10:39jcromartieerr, (dosync (alter code-clarity inc))
10:40cemerickstuartsierra: how far did you ever get in wrapping httpclient?
10:40stuartsierracemerick: I didn't.
10:40cemerickoh, I thought you had started on that.
10:41stuartsierraI think technomancy & danlarkin have one on Github
10:41cemerickah
10:41danlarkinconfirmed
10:41danlarkinclojure-http-client
10:43stuartsierrai'm too preoccupied with test frameworks
10:43stuartsierrato do anything useful
10:44stuartsierra;)
11:00cemerickdanlarkin: yeah, I was actually talking about apache's httpclient :-)
11:01danlarkinohh right we just used standard java stuff
11:01danlarkinit's been a while
11:03stuartsierraIt's not that bad to just use the Apache client directly.
11:04cemerickit gets pretty gnarly if you're using basic auth + multipart POSTs
11:04stuartsierraoh. Well, anything would. :)
11:04cemerickheh, almost :-)
11:05cemerickI'm almost to the point of having a pretty clean solution using http.agent + my wrapper of it + httpclient's MultipartRequestEntity to construct the :body
11:06stuartsierrawow
11:06stuartsierraThat's... frightening.
11:06cemerickha
11:47a_strange_guy20 lines of clojure => closures can be serialized: http://gist.github.com/313601
11:48a_strange_guyevil hack though
11:49a_strange_guywould that be useful?
11:50chouserhm. closures but not the code of their fn
11:52a_strange_guysure, but print-dup didn't do that before anyway
11:54hugodI was thinking it would be nice to have pluggable behaviour in error-kit for what to do when there is no default handler - swank could then give us a list of continues to choose from...
11:55Hali_303clojure.contrib.str-utils disappeared from the online docs @ clojure.org
11:55Hali_303is there a new clojure.contrib coming? where is it available?
11:55ChousukeHali_303: make sure you have the docs for the correct branch
11:55ChousukeI think there's some reorganisation going on
11:55chouserHali_303: it's been renamed clojure.contrib.str and the arg order changed again
11:56chouserhm, or maybe c.c.string
11:56Hali_303ok, no problem, but where is the binary?
11:57chouserhttp://richhickey.github.com/clojure-contrib/string-api.html
11:57chouserwhat binary?
11:57powr-tocI have a thread running over some clojure code that needs to send an event to swing to toggle a button on/off on the gui... Any ideas on what the nicest way to do this might be?
11:58StartsWithKa_strange_guy, does it work with things like streams or sockets? i don't think you can serialize them
11:58Hali_303chouser: I've got a jar for clojrue contrib 1.1, that has str-utils and str-utils2. I guess there's a binary that has c.c.string in it
11:58Hali_303maybe I need to get everything from sources?
11:59chouserHali_303: I use the sources, but this might work for you: http://build.clojure.org/job/clojure-contrib/lastSuccessfulBuild/artifact/target/clojure-contrib-1.2.0-SNAPSHOT.jar
11:59Hali_303chouser: ah nice, thanks
12:00a_strange_guyStartsWithK: it doesn't, this makes it possible print and read a closure
12:00a_strange_guyserialization is the wrong word for that
12:01powr-tocI was thinking about using an agent to capture the boolean changes, but the real value I need to change Menuitem.enabled lives in a mutable MenuItem object.
12:03a_strange_guypowr-toc: i used a watcher for a simillar case
12:04a_strange_guywhenever the state of the agent changes you set the mutable field
12:04a_strange_guyjust make sure not to touch the mutable directly
12:05chouserpowr-toc: like SwingUtilities/invokeLater ?
12:05powr-tocchouser: Yeah, was thinking about that one
12:06powr-tocthat seems the best choice... anything else is overkill
12:08chouserif you have a bunch of state, something more sophisticated to keep the gui state in sync with some more carefully controlled state might be in order.
12:18powr-tocIs wrapping a def/defn inside a let bind considered good or bad form?
12:18stuartsierra"rand7 from rand5" puzzle in Cloure: http://paste.lisp.org/+21Q2
12:18chouserpowr-toc: I think it's acceptible *if* it only is evaluated once.
12:19StartsWithKpowr-toc, you can reverse it (def foo (let [helper (fn ..)] (fn ([] (helper)) ([a] (helper a)))))
12:19chouserpowr-toc: though I tend to prefer to rearrange to avoid it: (defn foo (let [...] (fn [a b] ...)))
12:19StartsWithK:)
12:20hiredmanof course that doesn't help if you want several defn's to close over the same thing
12:20powr-tocchouser: StartsWithK: There are two def/defn's sharing the bind though
12:21chouserpowr-toc: and using another var instead of a let is unacceptable?
12:21StartsWithKpowr-toc, create a toplevel private def or defn
12:21chouserI'll just go get some work done and let StartsWithK finish up here...
12:22StartsWithKhehe
12:22powr-tocNot unnacceptable no... I don't know why, but I like to maintain very tight scopes... is that bad form?
12:25StartsWithKno, but i don't think you should go to excessive lengths wit that
12:25StartsWithKwith*
12:27powr-tocwhy? Does it not improve legibility, by documenting explicitly what functions change the state? Or do you think the costs of refactoring later when more things need access to the state are to high?
12:32krumholtis there a version of assoc that only updates the map if the key does not exist?
12:33chouser,(merge-with (fn [a b] a) {:a 1} {:a 2})
12:33clojurebot{:a 1}
12:34chouserhm. not too impressive, but I don't know of anything better.
12:34krumholtok thanks
12:34chouserhm, or merge the other way 'round
12:35chouser,[(merge {:a 2} {:a 1}) (merge {:b 2} {:a 1})]
12:35clojurebot[{:a 1} {:a 1, :b 2}]
12:50chouserif IKeywordLookup were a protocol, I could extend it to an existing interface, right? But since it's an interface, I can't?
12:59chouserso I guess I'll have to wrap instance of this 3rd party interface, and use it to implement IKeywordProtocol
13:13chouseroh! I can't implement IKeywordLookup in a deftype because deftype wants to do it itself!
13:14chouserno choice. huh. okay -- next up, reify...
13:14hiredmansounds like a long road to hoe to avoid (.someField
13:15chouserheh. it does, doesn't it.
13:15chouserbut I did it the direct way before and it was a contributing factor to much pain. So I think this is worth some effort at least...
13:16chouserthere are a couple other features I'll be able to tie in with this. One is mapping of values in ways I consistently need.
13:16chouserAnother is sane printing at the repl
13:17chouserAnother is supporting all of IPersistentMap so I can use rename-keys and such.
14:07avarushi
14:17cemerickrequire seems to always look for a source file, even if the provided namespace exists.
14:19technomancycemerick: I was wondering about that myself.
14:20technomancyelisp has a "provide" function that will add the ns to the "already required" list
14:20cemericktechnomancy: OK, glad it's not just me. :-)
14:20cemerickIt seems like just looking for that namespace is sufficient.
14:20technomancyyou can alter clojure.core/loaded-libs in a transaction if you're crazy, but yeah.
14:21technomancyit's certainly an off-the-beaten-path need
14:21clojurebothave you heard about the bird? is<reply>The bird, bird, bird, the bird is the word.
14:21cemerickThe contract of require w.r.t. "skipping already-loaded libs" seems pretty broken as-is.
14:22cemerickloading new ns' over the wire is sorta painful as-is :-/
14:22technomancywell steve gilardi is working on revamping that anyway
14:22technomancybut I think the new version is going to check the status of the .clj or .class file on disk to determine whether it needs to be loaded
14:22cemerickexcellent. I'll go find something else to whine about. ;-)
14:23technomancyrather than the ref
14:23technomancymight not solve the problem you're running into
14:23cemerickno, it doesn't sound like it
14:23technomancyI think he posted about that c. January
14:23cemericke.g. remote process, pushing new code at it
14:23cemerickon dev, or the main group?
14:24technomancyprobably dev
14:24cemerickthanks, I'll take a look
14:24technomancyI get confused since I sort them all into the same place.
14:25cemerickI've stopped following the main group almost entirely. The traffic is simply too high, and interesting stuff filters up into twitter anyway. :-)
14:25technomancyyeah, that's inevitable at a certain point
14:27piccolinoI'm getting a test failure I don't understand: http://gist.github.com/313745
14:30esjtechnomancy: I'm having difficulty getting the -Xbootclasspath part of the command line that leiningen invokes to work under Windows. Have you run across this ?
14:32technomancyesj: transitive requires don't work when clojure is on the boot classpath, but there shouldn't be any of those in leiningen proper
14:32technomancycould be a problem with plugins
14:33esjperhaps - swank keeps throwing up its hands with "can't find clojure.main" error
14:33technomancyesj: that's something else; not sure what's going on there
14:33esjit only throws this on (-main "swank")
14:33esjwhere does it look for its clojure.main ?
14:34esjits all peachy if the library I'm using and the leiningen checkout use the same branch of clojure but if i try to got to 1.2.0 for my project then it all goes ape
14:35esjhow I hate windows. It works 100% on my mac
14:36technomancyesj: that sounds like a bug in a 1.1.0 leiningen snapshot that was fixed in the release; are you up to date?
14:36esjbtw: the .bat file that comes with leiningen does not import the leiningen deps into the classpath, like the .sh script does
14:36esjtechnomancy: should be, let me see
14:38robwolfeesj: it should, have you tried "set DEBUG=1"?
14:38esjrobwolfe: no, I've been debugging with echos (time of my life) and it only includes the lib dir for the current project.
14:39robwolfeesj: so what other dendencies you mean?
14:40esjthe .sh file includes the .lib dir for leiningen, if its not uberjar'd
14:40robwolfeyou mean lib dir from Leingen checkout?
14:40esjyeah
14:41robwolfethat's true lein.bat has only lain-stable functionality
14:41esjok
14:43cemerickoh multimethods, how I love thee.
14:43cemerickeom :-)
14:44esjrobwolfe: so if I checkout the latest github, make the jar, install it into the repository I should be good to go ?
14:44robwolfeyep
14:45esjhopefully that will give me swank
14:45robwolfeesj: make sure you use 1.1.0 swank
14:45esjyou got it
14:47chouserso ... I think I'm successfully hooking into the callsite caching stuff.
14:48chouserI wonder why rhickey said it wouldn't work.
14:51esjrobwolfe, technomancy: so having done all this. lein deps, repl etc all work 100%. lein swank only works if I'm using clojure-1.1.0 in my project. If I go to 1.2.0 I get the usual mismatch exceptions. do I need to rebuild swank under 1.2.0 ?
14:55esjYeah, usually I wouldn't be so gung-ho. Anyways, thanks for your help guys.
14:57chouserhttp://gist.github.com/313728 -- leveraging call-site caching for getter access
14:57hiredmanchouser: excellent
14:58chouserI'm indordinately excited about this. :-)
15:02hiredmanit's sort of keywordcallsites => java bean
15:03chouserah, yes!
15:03chouserright
15:04jeffmessdoes clojure have a library for for tunneling into servers on a port? Can server-socket do this
15:05hiredmanso the get method on the thunk is ignoring the argument?
15:05hiredmanoh
15:05hiredmanno
15:06albinojeffmess: are you thinking like ssh?
15:06jeffmesstelnet
15:06jeffmesssorry, "tunneling" probably wasnt the right word.
15:07chouserone potential issue is that the thunk closes over whatever object was first used at the callsite
15:07chouseroh! no it doesn't.
15:07hiredmanhmmm
15:07albinojeffmess: if you go the ssh route you can use something like this from clojure: http://www.cleondris.ch/ssh2/
15:07hiredmanit uses the gensym
15:08hiredmanit's nice
15:08jeffmessalbino: thx, Ill check it out.
15:08chouserno it doesn't. The message-map obj closes over the msg you give it, but that's just what you'd expect. if you drop the message-map, it and the msg can be GC'ed, but the callsite thunk should live on.
15:08albinojeffmess: for what it's worth I stopped doing telnet like 7 years ago.
15:09jeffmessgood old legacy code that wont be dying anytime soon :)
15:10albinojeffmess: hehe, I've also had that problem before too :)
15:11albinojeffmess: what about this? http://www.javassh.org/space/start
15:11jeffmessalbino: looks a bit more promising.
15:30hiredman,*clojure-version*
15:30clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
15:36hiredmanchouser: http://paste.lisp.org/display/95560
15:38chouserI think I need to support ILookup at least, as well as other stuff to be a good citizen
15:39chouserSeqable, etc.
15:43hiredmanso ILookup would just punt to the thunk?
15:44chouserhm... dunno.
15:45chousermaybe put the thunks in a cache of my own in the message-map obj, so that I could look them up and run them for ILookup?
15:45chousereh, that's kinda lousy
15:45chousernot sure if there's a good way to do ILookup without runtime reflection
15:49lancepantzi'm trying to build a war file with an example compojure project and having some problems
15:49lancepantzthe war file should contain a lib dir with compojure and clojure in it after it's built, correct?
15:53piccolinoDoes anyone have any idea why this test is failing when it so clearly appears it should succeed? http://gist.github.com/313745
15:55hiredmanlooks like you in your test you are expecting a map with symbols and otehr stuff in it, but passing in a map with strings and etc
15:57piccolinoHm. I just tried substituting the symbols for the strings the symbols refer to, but it gave the same output.
15:57hiredmanthen you did it wrong
15:58hiredmanit looks like a quoting issue, i.e. the symbols in the test are quoted so not resolved and what you pass in has been resolved
15:58hiredmanit's hard to say because all you have not posted much of anything
16:00piccolinoI just updated the gist with both versions of the test code and output.
16:03hiredman,(doc is)
16:03clojurebot"clojure.contrib.test-is/is;[[form] [form msg]]; Generic assertion macro. 'form' is any predicate test. 'msg' is an optional message to attach to the assertion. Example: (is (= 4 (+ 2 2)) \"Two plus two should be 4\") Special forms: (is (thrown? c body)) checks that an instance of c is thrown from body, fails if not; then returns the thing thrown. (is (thrown-with-msg? c re body)) checks that an instance of c is thrown AND
16:11arohneroh, here's a fun new error I haven't seen before:
16:11arohnerjava.lang.OutOfMemoryError: GC overhead limit exceeded
16:12hiredmanoooh
16:12morphlingarohner: it means that most of the running time is spend garbage collecting and not much memory is freed
16:12chouserin my experience that's generally interchangable with filling the heap
16:13hiredmanhttp://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#par_gc.oom
16:13arohneryeah, I was getting OOMs, and out of curiosity I tried raising my heap size to see if the problem went away, and got that
16:14hiredmanyou might try one of the options that prints out GC pass information
16:20chouserI'd like to be able to (optionally) print a *warn-on-reflection* type msg when a :inline-able function is not inlined.
16:21chouser*warn-on-noninline* would complain about (map + [1 2] [3 4])
16:23arohnerthat's a warning when you call the non-inline arity of a function that has inlined arities?
16:23chousernon-inline arity or refer to its value as a function rather than at the front of a list where its macro part can be expanded
17:01dakronecan anyone tell me what file I'm missing for this: http://pastie.org/private/fl1lzrr8n6wa8e8t4iw27a
17:06{newbie}dakrone: is you path set apropriatly
17:06{newbie}?
17:07{newbie}where is you ClojureTest.clj?
17:07_atothe file you're compiling is located in ./com/emc/avamar/dtlt/actions/ClojureTest.clj right?
17:07{newbie}yes
17:07{newbie}or it should be
17:07dakroneyea, here's a new paste showing that: http://pastie.org/841319
17:07_atoyou might also need to set -Dclojure.compile.path= to the location you want the compiled class files to go to, you'll also need to add that location to the classpath
17:08SirNickHello, I'm very new to clojure and am having a problem using recur. I am getting the error "Can only recur from tail position" from this function: http://paste.pocoo.org/show/182239/ I don't see why the recur is not in a tail position. Anyone have any insight?
17:08dakrone{newbie} / _ato: yea, the file exists, if it had problems with that I get a completely separate error that's much more helpful than this one
17:09_atoah right
17:09_atoI'm misreading it
17:10dakroneokay, I created a bin folder and added -Dclojure.compile.path=bin, now I get java.lang.RuntimeException: java.lang.ClassNotFoundException: com.emc.avamar.dtlt.actions.ClojureTest$loading__4925__auto____27 (ClojureTest.clj:1)
17:10_atoexcellent
17:10hiredmanSirNick: the recur is not in tail position in the let
17:10_atoadd bin to the classpath
17:10hiredman(let [] (recur) nil) is basically what you have
17:11dakrone_ato: awesome, that fixed it. Thanks!
17:11dakroneI didn't realize I needed the path and the path to be in the classpath, now I know :)
17:11SirNickhiredman: Ah I see it now... Thank you. I figured it had something to do with incorrect parens
17:12_atoyeah, sort of a bit counter-intuitive, since Clojure actually executes code while compiling (eg macros) it needs to be able to use classes it's compiled while it's compiling them
17:21jcromartieanybody using http-agent to do API testing?
17:23dakrone_ato: is there any way to get clojure not to execute code while compiling, some of my code executes shell commands so...
17:23jcromartieI can't imagine it would work with deftest?
17:23jcromartiedakrone: I'd have to reply with a quippy you're doing it wrong...
17:24dakronejcromartie: it's a giant complicated enterprise backup thing with no API, I don't have any other choice
17:24jcromartieyou can't put them in functions?
17:24jcromartiemake a main, or something?
17:24jcromartieuse gen-class and -main
17:25dakronejcromartie: I'm not familiar enough with clojure compile function, is only code in certain functions that get compiled actually executed when it's compiled?
17:25dakroneor is it possible to work around it by putting it elsewhere?
17:25jcromartieanything in the top-level will be evaluated
17:26dakronewhat do you mean by top-level?
17:26jcromartieso put it in a function
17:26jcromartie(ns foo) (defn top-level-fn [] nil)
17:26_ato(println "hello world") will print hello world during copmile
17:26_ato(defn foo [] (println "hello world")) will not
17:26jcromartie(ns foo) (def top-level-var nil)
17:27_ato(def x (println "hello world")) will
17:27dakronein the example I pasted, would -execute actually be called at compile time?
17:27_atono
17:28dakroneokay, then that wouldn't be a problem if I had shell stuff in there
17:28dakroneawesome :)
17:28_atoyep, it'll only be a problem if you put code outside any function -- which most people would normally not do anyway
17:29sthuebnersorry for interrupting. Just a quik question: what is this kind of form (#{a b} c) doing?
17:30chouser#{:a :b} is a literal set
17:30a_strange_guychecking if c is equal to a or b
17:30dnolensthuebner: a lot of the datastructures can act as functions, confusing but then ... useful
17:30dnolen,([1 2 3] 2)
17:30clojurebot3
17:31dnolen,({:foo 'bar} :foo)
17:31clojurebotbar
17:31_ato,({:a :b} :c)
17:31clojurebotnil
17:31_ato,({:a :b} :b)
17:31clojurebotnil
17:31_ato..
17:31_atooh right
17:31_ato,(#{:a :b} :b)
17:31clojurebot:b
17:31sthuebnerah, this is what's behind the phrase "Sets are functions of their members"!
17:32dnolensthuebner: pretty cool, eh? :)
17:32sthuebnerthnx!
17:32sthuebnerdnolen: cool indeed!
17:34a_strange_guy,(meta (#{(with-meta 'sym {:a 1}) 'other-sym} 'sym))
17:34clojurebot{:a 1}
17:35sthuebnerpuh, feels magic
17:36chouserI'm going to take advantage of exactly that property (being able to look up a symbol in a map without knowing its metadata, then using its metadata)
17:36chouser...at compile time.
17:36chouserwhee!
17:36a_strange_guyi've actually used it once ^^
17:37a_strange_guy... until i realized that I wanted a hashmap isnstead
17:37chouserheh. right.
17:37chouserbut I'll be using a hash-map created by the compiler, where I only have control over the keys. so this'll be perfect.
17:39a_strange_guychouser: It tookme a while to realize that you weren't joking
17:39sthuebnerthanks guys. that helped a lot
17:40a_strange_guystr
17:40chouser(defmacro hack [] (vec (map meta (keys &env))))
17:40chouser(let [#^:foo a 5] (hack)) ==> [{:tag :foo}]
17:41hiredmanD:
17:41hiredmaninteresting
17:45_atoha, nice. That's a usage that never occurred to me. &env opens up all kinds of interesting- uhh... abuse
17:46a_strange_guyare the vals of the &env map useful for anything?
17:48powr-tocchouser: what on earth does that do!? :-)
17:48powr-tocwhat is &env?
17:48powr-toc(keys &env)
17:49_ato&env returns a map from symbols to a compiler-specific thing for each binding in the lexical scope
17:49_atoit's kind of like locals() in Python
17:50_ato(you can only use it inside a macro, it's an implicit macro argument)
17:52powr-toc_ato: interesting... why does (defmacro foo [] (let [f 1] (prn (keys &env)))) print nil?
17:52powr-tocas does (defmacro foo [] (let [f 1] (prn &env)))
17:53chouser&env is a map of the locals where the macro is *expanded*
17:53powr-tocahh
17:53powr-tocwow... that's pretty crazy
17:53powr-tocwhat do you use it for?
17:54_atoblack magic
17:54_atoor debugging
17:54_atoeg you could write a macro that prints out the value of all the locals and use it for debugging
17:55chouserI plan to use it to pass some config info from an out macro to an inner one
17:55a_strange_guyyou could also write a macro pair
17:55a_strange_guyakin to loop/recur
17:55a_strange_guywhere one has to be inside another
17:56chouserso two macros, defthing and foo, used something like (defthing This That (alpha [a] ...) (beta [b] ... (foo b)))
17:56powr-tocam I right in thinking it's the macro equivalent of a closure?
17:56powr-tocor of accessing a closure?
17:56chouserbut I want 'foo' at macro-expand time to know that it's in the context of That
17:56a_strange_guychouser: use a dynamic var instead
17:56a_strange_guyless crazy
17:57chouserbut I want lexical scope, not dynamic
17:57_atodebug-repl was one of the first use-cases: http://github.com/GeorgeJahad/debug-repl/blob/master/src/alex_and_georges/debug_repl.clj
17:57chouserand I need it at macro-expand time
17:57powr-tocwhen did &env become a language feature?
17:57powr-tocis it documented?
17:57Chousukewhen functions got metadata I think
17:59powr-tocso wait... let me get this straight... &env allows a macro to compile different code based upon the context of it's current closure?
18:00a_strange_guyyou could do this already with macros + side-effects
18:00a_strange_guybut yes, you can get at the surrounding context
18:00powr-toca_strange_guy: how do you mean?
18:00_atoit lets you get a list of all the bindings in the lexical scope where the macro is inserted
18:01_atothat's all. You could already capture variables etc, but you'd have to know what they were called beforehand. With &env you don't have to know, since you can list them
18:02powr-toc_ato: can you access the values of the bindings, or just the symbols the values will be bound to?
18:02a_strange_guypowr-toc: there are tales of evil stuff that people did with side-effecting macros
18:03powr-toca_strange_guy: side effecting macros sound nasty... but I'm intreagued
18:03_atopowr-toc: all you need is the symbols (which is what the keys of &env are), then you can use 'resolve' on them to get at the values
18:04a_strange_guythey were used mostly for logging the uses of a macro
18:04hiredmandoes resolve work lexically?
18:05_atoerr.. sorry not resolve.
18:05hiredman,((fn [x] (resolve 'x)) 1)
18:05clojurebotnil
18:05_atomy brain isn't working this morning
18:05_atoyou just eval them
18:05_atoyou're in a macro
18:05_atoso return code to access them
18:05_atoand it'll be eval'ed
18:05_atoeg: (defmacro foo [] (symbol "x"))
18:06_ato(foo) will evaluate to the value of x in the lexical scope
18:06a_strange_guyyes
18:07a_strange_guyyou cannot get at the 'resolved' vals at compile time
18:07_atosee for example the local-bindings macro at the top of this: http://github.com/GeorgeJahad/debug-repl/blob/master/src/alex_and_georges/debug_repl.clj
18:07powr-tocahh of course... it's like the whole reason gensym exists
18:07a_strange_guybut you can emit forms that will
18:07_atoyeah, because they don't have values until run-time
18:07chouserI considered that -- my outer macro could make a note in some global environment, but I don't really see that as less magical
18:08ChousukeI tried to figure out the env stuff by creating a macro that calls itself in a let form if a certain local is not available :P
18:08Chousukebut I didn't quite get it working
18:11a_strange_guyclojurebot: paste
18:11clojurebotlisppaste8, url
18:13hiredmanlisppaste8 is broken
18:13hiredman:(
18:15a_strange_guydoes anyone know a nice way to syntax-color clojure code for a presentation?
18:16dakronea_strange_guy: use vim's :TOhtml option and embed that?
18:18technomancya_strange_guy: I use htmlize and Emacs.
18:18technomancygist.github.com works too
18:19technomancyactually, that might be hard to embed in a presentation
18:20a_strange_guyhtmlize looks nice
18:20powr-toca_strange_guy: yeah, it's pretty awesome...
18:20a_strange_guyI'll just need a color-theme that won't scare people
18:20powr-tocas is org-mode :-)
18:21technomancyactually I usually just give presentations straight out of emacs, so htmlize is unnecessary. =)
18:21technomancyyou probably want a high-contrast theme for presentations; blackboard might be good for that
18:21powr-tocpmade is pretty good...
18:22a_strange_guygotta disable rainbow-paren mode ^^
18:22a_strange_guytoo colorful
18:24powr-toca_strange_guy: how's this? http://www.contextualdevelopment.com/articles/2008/project-planning
18:24powr-toca_strange_guy: the colors translate well to clojure
18:30powr-tocthe-kenny: org-mode is awesome :-)
18:30the-kennypowr-toc: I know, but I don't use it very much :(
18:30fro0g+1
18:30the-kennyAnd this project-planning stuff looks incredible
18:31powr-tocthe-kenny: I don't think any org-moder uses it *enough* :-)
18:31powr-tocpeople keep finding new ways to use it more :-)
18:31fro0gyou can say the same thing about emacs in general
18:31the-kennyOrg-Mode is like Emacs - Your life isn't long enough to see all of it
18:34powr-tocI write my blog in org-mode: http://sourcesmouth.co.uk/
18:34powr-toc(only just kick started it again)
18:34a_strange_guyi'm stll amazed by emacs, or rather why it does not turn into a gigantic mess
18:35powr-toca_strange_guy: I love Emacs, but when you customise it... it frequently does turn into a gigantic mess :-)
18:35technomancywho said it doesn't? =)
18:35a_strange_guywell but it still works *kinda*
18:38a_strange_guytechnomancy: you maintain clojure-mode + swank-clojure, don't you?
18:40a_strange_guywould it be possible to syntax-color based on information from a live repl?
18:46krumholti have a vector of functions and i want a value to be applied to the first then the result of that to the second and so on. is there a sequence function for that?
18:46powr-toc->
18:47powr-tocwell, it's a macro so it might be no good for you
18:47krumholtno i need a function
18:48a_strange_guy,((apply comp [next next next]) '(1 2 3 4 5 6 7))
18:48clojurebot(4 5 6 7)
18:48powr-tocnice
18:50krumholta_strange_guy, thanks
18:52powr-tocis there any reason why comp applies the functions right-to-left rather than left-to-right?
18:52Chousukethat's the traditional order of composition, isn't it?
18:52a_strange_guyi think because ((comp f g) x) == (f (g x))
18:53powr-toca_strange_guy: yeah, was just thinking that
18:53Chousukesometimes, you need to read code from right to left :P
18:54powr-toctrue
18:54Chousukehmm
18:55Chousuke,((nth (iterate comp next) 5) [1 2 3 4 5 6 7 8])
18:55clojurebot(2 3 4 5 6 7 8)
18:55Chousukeah, damn
18:55Chousukefoiled :P
18:56ChousukeI suppose I'd need reductions instead :/
18:57Chousuke,((nth (iterate (partial comp next) next) 5) [1 2 3 4 5 6 7 8])
18:57clojurebot(7 8)
18:59technomancya_strange_guy: "maintain" is probably too strong a word for my relationship with swank-clojure
18:59technomancybut I'm the closest thing it's got to a maintainer, yes. =)
18:59technomancya_strange_guy: grabbing a list of core fns from a running process is altogether possible, yes
19:00technomancyI think slime does that with CL for macro-indentation calculation
19:00kwertiithe-kenny: hey, I'm getting the same "No matching method found: println for class swank.util.io.proxy$java.io.StringWriter$0" that you got at http://clojure-log.n01se.net/date/2010-01-01.html ... did you ever figure out what the problem was?
19:01the-kennykwertii: Yes, my init-file where I set *print-limit* etc.
19:01the-kennyLooks like this breaks swank-clojure
19:01ChousukeI wonder what it would take to make swank-clojure up to date with recent SLIME versions
19:01kwertiithe-kenny: ah.. er. I haven't set any of that.
19:02Chousukebut I can't even tell what changes broke it so ;P
19:02the-kennykwertii: hm :/ I have no clue then
19:02kwertiithe-kenny: when you stopped setting *print-limit*, it just worked again?
19:02technomancyChousuke: I'm in favour of rewriting swank-clojure from the ground-up
19:02technomancyor rather, convincing someone else to do it.
19:03the-kennykwertii: It was print-limit and one or two other variables controlling the reader
19:03the-kennyBut yes, after I stopped setting this stuff in my init-file, everything worked
19:04kwertiihmmm
19:05Chousuketechnomancy: heh
19:07Chousuketechnomancy: I just thought about familiarizing myself with the swank protocol, but I think I need to stop that before someone assumes I'm going to do something about the current situation :P
19:07kwertiiswank-clojure is only 356 lines with comments.... probably wouldn't be much trouble for someone who already knows swank, right?
19:09Chousukekwertii: hm, my copy of swank-clojure has well over a thousand lines :P
19:09Chousukekwertii: are you only thinking of the elisp part of it?
19:10kwertiiChousuke: oh. yes. you mean the clojure end needs rewritten... :)
19:11ChousukeI'd rather not touch the elisp as I have no elisp skills
19:11Chousukebeyond what I can guess from surrounding code :P
19:11technomancythe clojure-specific elisp bits are just launcher functions
19:11technomancyclasspath calculations, etc. nothing complicated there.
19:13Chousukebut now I have to get some sleep
19:13technomancyactually if you use lein swank you don't need swank-clojure.el at all
19:14ChousukeI wonder if there's anything in current swank that could be salvaged
19:15powr-tocwhat's wrong with the current swank-clojure, other than the installation process?
19:15technomancypowr-toc: combination of three things
19:15technomancy(0) it was written a long time ago, before atoms existed
19:15technomancy(1) My First Clojure Project symptom
19:16technomancy(2) no clear comments about if it's implemented this way in order to work around a non-obvious slime quirk, or just because
19:17piccolinoI asked about this earlier, but I've spent the past few hours digging through the source code of clojure.test and my own, and I'm still stumped: http://gist.github.com/314071
19:18piccolinoI don't understand why as-test and latest-as-test behave differently in the test. Clearly the test output shows they evaluate to the same maps.
19:18powr-toctechnomancy: well its pretty damn useful :-)
19:20technomancypowr-toc: yeah, it's a fairly common problem
19:21technomancypowr-toc: RDoc in Ruby is the same way; very clearly My First Ruby Program, but it was so useful that it became an integral part of the toolchain
19:21powr-toctechnomancy: what are your plans for leiningen?
19:22technomancypowr-toc: the only thing I want to add to core is multi-module builds and possibly the option to autogenerate shell wrappers for projects to ease deployment.
19:23technomancypowr-toc: the rest is all plugins: code coverage/statistics, dependency graphs, things like that.
19:25powr-toctechnomancy: I filed a feature request you didn't agree with... the ability to specify and manage custom classpaths
19:25technomancyoh right... did you have a patch for that?
19:25powr-toc(or rather I think you said you'd take a patch, but weren't interested yourself)
19:26technomancyI don't object to adding it if it's contributed; right.
19:26powr-tochaha no :-)
19:26technomancyI just think there's usually a better way to do it.
19:26powr-tocI just wondered if you had any ideas on how you might achieve it
19:26powr-toci.e. how a patch might implement it
19:26technomancypowr-toc: you'd need to add it to eval-in-project in compile.clj
19:27technomancyI think once you read through that function it would be pretty clear how to add it.
19:28powr-toctechnomancy: but clojure's add-classpath is deprecated... I was wondering if clojure did anything funky with classloaders...
19:28slyphonhow do you use the :as (insert-correct-noun-here) in the ns macro?
19:29technomancypowr-toc: definitely something funky with classloaders. =)
19:29technomancybasically the whole project runs in a subclassloader that's isolated
19:30technomancyso while you can't change leiningen's classpath, you can create a new nested environment over which you have The Power
19:31bsteuberslyphon: (:require foo.bar :as fb)
19:31bsteuberI guess - so. please correct me if it's wrong
19:31powr-toctechnomancy: and that's specific to leiningen or clojure?
19:31slyphonah
19:31slyphonbsteuber: ok, thanks
19:32technomancypowr-toc: specific to lein; it uses a call to an ant API
19:33technomancypowr-toc: it's the same way you build Clojure; the ant JVM doesn't know the clojure classpath before the VM boots
19:33raek(ns your-ns (:require [foo.bar :as db]))
19:33raekslyphon: here are some useful examples: http://clojure.org/libs
19:34slyphonraek: oh, thank you
19:34raek(this was added to the site fairly recently)
19:39powr-toctechnomancy: A different leiningen question... can you use it to do classical build process things? e.g. could I get it to move some files into a specific directory after compiling? that kinda stuff?
19:39powr-tocit's something that's not very clear from the docs
19:41technomancypowr-toc: yeah, that should be better-documented. in the latest release you can do things like (ns leiningen.mytask) (defn mytask [project] [do stuff...]) (ns user) (defproject ...)
19:41technomancyso you can put custom tasks in project.clj if they don't merit their own plugins
19:42powr-toccool
19:43powr-tocI'm not sure i've ever seen multiple ns declarations in a single clj file before
19:43technomancyit's a bad idea in the general case
19:44powr-tocpresumably the semantics for that are... top-down... you're in that namespace until you hit a new ns declaration
19:44powr-toci.e. kinda like what you do at the repl
19:54nathanmarztechnomancy: if I define a custom task like how you described, is that just available as "lein mytask" from the command line?
19:58technomancynathanmarz: should be
20:16Crowbar7So, being a noob I ws trying to test out myself clojurebot in an irc server and I'm having a ton of trouble getting a jar I build to run. is there something I'm missing about running this guy?
20:16hiredmanpossibly
20:17hiredmanwhat is the trouble you are having?
20:43SirNickHow can I get exceptions to show filenames? They always say NO_SOURCE_FILE, even when compiled as far as I can tell
20:49technomancySirNick: using swank-clojure? try C-c C-k to load your code.
20:50SirNickI was just trying to run it from the terminal
20:50Crowbar7hiredman: The problem is I can't open the jar because of a lack of a main.
20:51Crowbar7Does clojurebot not have a main?
20:54SirNickAm I compiling things wrong? Or am I not supposed to compile?
21:07chouserSirNick: if you compile or load files using use, require, load, load-file, etc. you should get line numbers in your stack traces
21:08chouseronly for things typed at the repl should you expect to see NO_SOURCE_FILE
21:08SirNickYea I was expecting it to show there, but using clojure.stacktrace seems to be working. Thank you
22:54hiredmanCrowbar7: right, clojurebot does not have a main, it runs via a script you write, example is hiredman/clojurebot.clj
23:02Crowbar7hiredman: ahh
23:03Crowbar7I really like clojurebot. the code anyways. I started writing my own bot then found clojurebot. I'm still writing my own, but seeing how you set it up was really nice.
23:14chouserwhat's the rule of thumb for performance cut-off between (condp = ...) and (case ...) ?
23:37cemerickchouser: probably when the number of clauses is > 1, prefer case, no?
23:39cemerickI mean, even if case's constant-time dispatch is ever-so-slightly slower overall for small N, it seems that constant-time guarantees are always preferable to over-thinking the issue. :-)