#clojure logs

2010-03-07

01:08brandonwam i doing something wrong if i want to do something like this:
01:08brandonw,(letfn [(foo [arg1] (* arg1 x))] (let [x 5] (foo 2)))
01:08clojurebotjava.lang.Exception: Unable to resolve symbol: x in this context
01:09brandonwhow can i get functions i want to define only for the use inside of one method, to use symbols scoped inside of that method without having to use something like partial
01:10brandonws/method/function
01:10brandonwunless partial is the idiomatic way to do so
01:19hiredmanbrandonw: put the let outside the letfn
01:20brandonwthe functions bound in letfn are available outside the body of the letfn?
01:21hiredmanno
01:22hiredman,(let [x 5] (letfn [(foo [arg1] (* arg1 x))] (foo 2)))
01:22clojurebot10
01:22brandonwah
01:23brandonwokay, thanks
01:23brandonwi have to dissuade myself from assuming i won't need more than one let per function :)
01:45timothypratleyUsing Compojure I'm expecting :query-string "foo=1" to result in :params {"foo" "1"} or something like that... but I'm seeing an empty :params {} instead
01:46timothypratleyany clues what I'm missing?
01:49hiredmanwhere are you seeing that? I think I saw something about middleware not getting the :params values
01:51timothypratleyI'm just writing out the request (well I'm doing that because I couldn't find the param :)
01:55timothypratleyHmmm I think I must have stuffed up my routes to cause it.
02:02tomojanyone seen this error before?
02:03tomojtrying to use penumbra master as a lein dependency
02:03tomojget that error when running lein swank
02:04nedis there a clojure equivalent of pythons urllib2/BeautifulSoup/lxml ?
02:09hiredmanned: beautifulsoup is, I believe, based on the java lib tagsoup which is very usable from clojure
02:09hiredmanyou might look at enlive which is a clojure lib
02:09nedhiredman, will take a look. im coming from python (as implied before), and i guess its time to brush up on my java.
02:10timothypratleyah.... I should have read this first: "In 0.3, Compojure provided several magic variables, like "params" and
02:10timothypratley"session". In version 0.4, these will be replaced with a binding form.
02:10nedare there any good docs delineating best practices for interacting with java (other than the stuff on clojure's site)?
02:13timothypratleyned: "Use Klass/staticField, (Klass/staticMethod), (Klass.) and (.method obj) interop styles, with the only exception being in code-generating-code where the older (. obj method) style may be easier to produce."
02:14timothypratleyned: according to "http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards"
02:14timothypratleyI guess that's not much more - but thought I'd mention it :)
02:17nedtimothypratley, hah, its like a mini-PEP8 sort of. thanks for the link :)
02:20timothypratley:)
02:31nteonim having trouble with a pesky macro I'm writing. http://fpaste.org/3cvb/ its almost there, but I'm having problems with autogenerated symbols, specifically state# in the paste
02:31nteondoes anyone have any pointers as to where I went wrong?
02:37nteonI know state# shouldn't be quoted on line 15, but I wanted to get it to compile so I could see how the expansion looked
02:37_atothe problem is autogenerated symbols are local to a syntax-quoted form, so the state# in eqns-kv is different to the one on in `(def ~set-name ...)
02:40_atoI guess one way to fix it would be to call gensym explicitly instead of relying on auto gensym
02:43nteon_ato: I don't seem to understand how to explicitly use gensym. I expected to be able to do ~(gensym "state") in place of state#, but that doesn't seem to work
02:43_atoright as that will generate a new symbol each time
02:43_atoyou want to use the same one
02:44nteon_ato: no, I understand I need to do it in a let binding. I get 'unable to resolve symbol in this context' when done with a let or spliced in
02:47_ato,(let [state-sym (gensym "state"), eqns-kv `(blah (+ ~state-sym 2))] `(fn [~state-sym] (let [~@eqns-kv] ...)))
02:47clojurebot(clojure.core/fn [state11379] (clojure.core/let [sandbox/blah (clojure.core/+ state11379 2)] ...))
02:49nteon_ato: ah, thanks! I had been doing a splicing-unquote instead of a simple unquote, which would explain it
02:56bobo_hm, is there any built in stuff to transform a list? ie applying a function to all items in a list
02:57somniumbobo_: map?
03:01nteon,(doc map)
03:01clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
03:01bobo_that sounds right, but cant seem to find any example
03:02bobo_and there it is :-p
03:02nteon,(map #(* 2 %) (1 2 3))
03:02clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
03:02nteon,(map #(* 2 %) '(1 2 3))
03:02clojurebot(2 4 6)
03:02bobo_thank you very much
03:02nteonbobo_: more than welcome
03:03nteonman i am so psyched on clojure
03:03bobo_:-)
03:04bobo_ive missed lisp since uni, now i can finally sneak it in everywhere
03:05nteonI've never done lisp before. its a mind-boggling (in a good way) experience
03:15jeffmessis there an issue with lein swank version 1.1.0 ? I have :dev-dependencies [[leiningen/lein-swank "1.1.0"]] in my project file but when I run lein deps i get 1 required artifact is missing. org.apache.maven:super-pom:jar:2.0
03:23_atojeffmess: I used it this morning and it worked okay
03:24_atojeffmess: http://gist.github.com/324243
03:25jeffmess_ato_: thats almost identical to mine except I have compojure aswell as a :main line
03:26_atostrange
03:27jeffmessI am a clojure newbie though. How does Leiningen handle classpaths? Or is that handles automatically?
03:29hiredmanautomagicaly
03:49Rayneshttp://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards Is huge.
03:49RaynesAnd intimidating.
03:49RaynesIt scares me.
08:00dermatthiashmm, i have a update function for an agent. inside this function i have another batch of agents (i.e. list of agents inside an agent), for which i want to do (dorun (map #(send % up-func) agents))....gets me Agent has error, and I have no idea how to debug it with (agent-errors) or where the error is in the first place
08:01dermatthiasany ideas?
08:02dermatthiasperhaps it isn't possible to call agents recursively?
08:07chouserit's ok to send from inside an agent action
08:07chouserdermatthias: you're using clojure 1.1?
08:07dermatthiasyes
08:08chouserwould it be too difficult to put try/catch around the entire contents of all of your action fns?
08:09dermatthiasgood point, needs some rewrite, but worth a try
08:09chouserclojure 1.2 has some better options
08:10chouserbut on 1.1 although there are some things you can try, I generally have found that the quickest route to actually understanding what I'm doing wrong with agent actions is try/catch everywhere.
08:10chouseryou have a lot of action fns?
08:11dermatthiasahh, found something
08:11dermatthiasException java.lang.Exception: Can't await in agent action
08:11chouserah, yes, there is that.
08:11dermatthiaswhy? :)
08:12chouserto prevent the possibility of deadlocks
08:14dermatthiasok, thanks. then this has to be solved something else...:)
08:14dermatthiasdifferent...
08:16chousersometimes when you've got agent+await you can use future instead
08:22vyAre there anything like assoc/find of CL? I need to get the "second"s in a list of lists: '(("foo" 2) (3 "bar") ...)
08:23a_strange_guy,(map second '((a 1) (b 2))) ; ?
08:23clojurebot(1 2)
08:24a_strange_guyvy: sry didn't understand
08:24a_strange_guydon't use alists
08:24a_strange_guywe have real maps
08:26vya_strange_guy: But function arguments appear as lists, not maps.
08:28a_strange_guy,(second (some #(when (= :elem-to-find (first %)) %) '((:elem-to-find 1) (b "foo")))
08:28clojurebotEOF while reading
08:29a_strange_guy,(second (some #(when (= :elem-to-find (first %)) %) '((:elem-to-find 1) (b "foo"))))
08:29clojurebot1
08:29a_strange_guydon't know of an easier way
08:40vy(first (filter #(= :elem-to-find (first %)) ...)) is relatively shorter, but I was expecting a find/find-if/assoc, whatever.
08:43arbschtmaybe c.c.seq/find-first
08:44vyfind-first source code: (first (filter pred coll)). Heh!
08:45arbschtit's exactly what it says on the tin :)
08:47djpowellJust been using clojure-jna. Noticed that if you just use jna-invoke, then when a GC happens, your DLL unloads, which was a bit unexpected. It loads back, but I lost some context then. Is that supposed to happen?
08:48djpowell(programming the screen on my logitech G19 keyboard from clojure)
08:52vyUsing SLIME installed by ELPA, C-M-f and C-M-b doesn't work right for [ and ] characters in SLIME REPL buffer. Anybody experiencing same problem?
08:54vydjpowell: May I ask how did you manage to track the load and unload of the DLL during a GC pass? (BTW, I use JNA and had never experienced a similar problem.)
08:58djpowelli put some printfs in my DllMain
08:58djpowellIt is fine when I keep a ref to a function, eg, with jna-fn
08:59djpowellI had a problem cause I was using a thread-local in my Dll to hold onto some state, which suddenly disappeared when I created a big ByteBuffer
09:00djpowellcause I was getting a DLL_PROCESS_DETACH
09:01vyHrm... I see. I always keep a ref to a function, that explains why I never had same gotcha.
09:01djpowellI guess GCing the DLL is a good thing, and making jna-fns is probably better anyway, but maybe it needs a bit of a warning in the readme
09:02vyIMHO, it's not clojure-jna related, is it mentioned in the JNA documentation?
09:42dermatthiasI want to use dosync on many expressions and unroll them somehow, because I only know at runtime how many there will be. is there are way to do is?
10:04dermatthiasnevermind, think i got a workaround (not involving dosync)
10:50powr-tocAre chunked sequences becoming the default in clojure 1.2? If so
10:50powr-toc*** #how do you specify that you want to consume different sized chunks?
10:51StartsWithKpowr-toc, i don't thing you can
10:52kotarakI also think that the chunk size depends on the underlying data structure.
10:52kotarakOr could depend, that is.
10:54powr-tocI guess it's probably not worth worrying about... I was just
10:54powr-tocwondering whether chunks make sense when the cost of generating each
10:54powr-tocelement is high
10:54powr-tocughh... my irc clients breaking lines :-\ what have I changed?
11:01powr-tocHas anyone here read let over lambda? If so how well does it
11:01powr-toc translate to clojure?
11:05kotarakoha
11:07scodeIs leiningen expected to work with git versions of clojure/clojure-contrib?
11:07scodeI started failing in various ways as soon as I tried upping the dependencies for my project to require newer clojure/clojure-contrib (becuase I wanted to make changes to -contrib).
11:07scodeAnd I'm not sure why, and I'm no maven expert...
11:16scodeOh. Truncated/broken .jar in my ~/.m2/repository. Nevermind.
11:35joeggCan someone please take a look at http://paste.lisp.org/display/96055 ? I'm dying here. I can't for the life of me figure out why this isn't printing things out in order. I've written it in java, and it works fine, but I can't get it working as written.
11:49tjgjoegg: I think I might see your problem. comparator() assumes it's getting function which returns truth/falsity values.
11:49joeggtjg: Are you my inner monologue? I'm looking at the documentation for that right now! And I think you are *quite* right.
11:49tjgjoegg: The problem is, compare(), which you pass it, returns numbers, not truth/falsity issues.
11:49joeggYeah.
11:50tjg"issues" -> "values"
11:50joeggOkay, I'm really close, though, then. Before I just thought I was crazy.
11:50joeggThanks!
11:51tjgNo prob, such things drive me mad too...
12:04avarIs there a more up to date guide to getting clojure working with emacs/swank than this one: http://riddell.us/tutorial/slime_swank/slime_swank.html
12:05avarit references stuff in swank-clojure-extra-classpaths that's not there anymore in the latest git versions
12:06tjgavar: Yeah, that's crazy old. I use ELPA, as (I believe)described here:
12:06tjghttp://github.com/technomancy/swank-clojure
12:07tjgThough that's kinda hard to read, I think. This is a bit outdated, but a better explanation: http://technomancy.us/126
12:09tjgEhh, I should go on the Clojure wiki (if it still exists) and help fix up its entry on Slime; many have complained that all that exists is a bunch of disconnected and questionable blog posts.
12:14avarELPA will just get me the relevant packages right? I already have clojure.git / swank-clojure.git and slime.git (the version that's frozen to work with clojure). The problem is that I can't figure out how to configure emacs + those parts to work together because I can't find the right elisp to glue it together
12:16avarM-x slime and M-x swank-clojure-project give me "Searching for program: no such file or directory, lisp" which suggest that I'm not setting up the path to the clojure lisp correctly, but I'm too rusty at SLIME to find out what the problem is
12:17tjgavar: I think that swank-clojure-project error means that you need to put things like clojure.jar into the src/ directory.
12:19tjgavar: ELPA is supposed to download the relevant packages. (if i understand your constraints correctly.) it creates an emacs.d/elpa/ dir and puts the necesasry stuff into it. it also modifies your .emacs file to auto-load things. if you wish, it'll also fetch clojure and clojure-contrib via git, IIRC.
12:20tjg(When I say "clojure.jar into the src/ directory", I mean the project-root/src/ directory, whereever that may be.)
12:27avarmy clojure-mode from http://github.com/technomancy/clojure-mode tries to require swank-clojure-autoload which is only there in an older version http://github.com/technomancy/swank-clojure/tree/34e6921fb1f89b3f30354539c6b8f9791f7913ed
12:27avar*sigh*
12:30tjgI think (maybe I'm wrong) that ELPA packages both clojure-mode and swank-clojure, so you don't need to manually use the Github versions?
12:31avarRight, maybe I'll bite the bullet and install it via ELPA, I just have a git-based emacs configuration that I try to use instead of elisp I wget over the net: http://github.com/avar/dotemacs http://github.com/avar/elisp
12:32somniumavar: last time I setup slime it was less than 5 minutes to get a clojure env going from a blank .emacs: install ELPA, install clojure-mode, (get leiningen: optional).
12:33avarRight, the issue seems to be that the git HEAD versions of the repositories I pulled down are incompatable
12:45LauJensenI read about some high performant JSON lib for Clojure a while ago - Anybody remember where it is ? :)
12:47tjgPerhaps the benchmarks mentioned here? http://disclojure.org/2010/03/01/this-weekend-in-the-intertweets-feb-28th-ed/
12:49LauJensenthx
12:50StartsWithKLauJensen, http://bitbucket.org/ksojat/yummy-json/src/ is ~4-7x faster on reads than clojure.contrib.json
12:50StartsWithKand ~2x on writes, reads don't consume stack and it has no (known) parsing errors
12:50StartsWithKlike parsing invalid json ala "1" "[1,,2]"...
12:54LauJensensounds great - why isnt that in contrib ?
12:56somniumhmm, it depends on Jackson, LGPL/AL
12:56StartsWithKyes, jackson rocks
12:57StartsWithKthey spent years writing that thing
12:57StartsWithKpure jackson can even compare in speed to procol buffers
13:00StartsWithKhttp://code.google.com/p/thrift-protobuf-compare/wiki/Benchmarking
13:04StartsWithKand i used http://inkdroid.org/journal/2008/10/24/json-vs-pickle/ for data
13:04StartsWithKit has a nice large json and numbers to compare with
13:06kotarakhttp://github.com/mmcgrana/clj-json also uses Jackson
13:07StartsWithKthats the only way to go imo
13:09StartsWithKother problem with c.c.json, is that it will accept invalid json
13:10StartsWithKand as i understand that thing will maybe go to core
13:11kotarakStartsWithK: raise your concerns on the dev list.
13:12StartsWithKkotarak, i can't post on -dev
13:12kotarakhuh? o.O
13:12StartsWithKno CA, no -dev
13:12kotarakoo.OO really?
13:13LauJensenmmcgrana's looks interesting enough to give a try
13:13StartsWithKi tried to register, just for lurking, and on registration form there was a notice how i should provide .. something CA related
13:13StartsWithKand if he can get his json in core, that would be awesome
13:14LauJensenI think contrib should strive to assimilate superior libs outside of contrib, and by doing so avoid being thought of as irrelevant
13:14StartsWithKi think it already is irrelevant.. don't get me wrong, but i don't even have anything that is using c.c
13:15LauJensenThere's a ton of good stuff in there
13:15somniumI use string and seq all the time
13:15StartsWithKand with stuff like logging getting in.. i don't think i care anymore about it
13:16somniumand c.c.monad for the pleasures of suffering
13:17LauJensenmonads caused the swine-flu pandemic :(
13:17StartsWithKalso, mondas use macrolet and that thing has errors
13:17kotarakmacrolet is a big hack. You can write monads without.
13:17StartsWithKyou can spot them just by reading the code, no need to even run anything :/
13:19kotarakJust as quasiquote in CQL was a big hack.
13:20StartsWithKkotarak, but why are 'big hacks' in 'standard/incubator' library
13:25kotarakStartsWithK: dunno, other things (much less hacky) were not included were I would have seen much more use cases.
13:26kotarakBut I'll shut up. For me it's not clear where Rich's going with contrib.
13:28StartsWithKi'll shut up.. after the short rant about the log lib :)
13:28StartsWithKthere are like two rules.. no external deps and no wrappers, and logging is both
13:29StartsWithKto avoid detection, it wrapps all its code in three giant eval blocks
13:30StartsWithKit dosn't support slf4j (as it is a wrapper itself; and it isnt) and supports commons-loggins (that is a wrapper)
13:30StartsWithKand in the end, from three libs it does support, non of them are maintained anymore, as slf4j is pushim them all aside
13:31StartsWithKand commons-logging has know class loader problems
13:31StartsWithKso.. i can't see the logic in that lib, and how it ended in c.c in the first place
13:33somniumOT, anyone know if its possible to run ClojureCLR on mono? (visual studio is mentioned on the wiki :/)
13:36LauJensenEhm - I dont see why it shouldnt, but why would you want to ?
13:39somniumIve been playing with F# and will begrudgingly admit that I rather like it (a kind of practical haskell), but I dont know .NET at all. Clojure has been great for exploring java libs, so -
13:39hiredmanStartsWithK: it seems like the main stuff people use contrib for (io) will spin off into clojure.lib which may or may not be distributed with clojure, and then contrib can disapear
13:40StartsWithKhiredman, it would be nice, maybe not to kill contrib, but maybe to present the problem, the vision of solution and the code before the inclusion
13:41kotaraksomnium: F# is rather nice as are the other parts of the ML family. I particularly like OCaml.
13:41hiredmanStartsWithK: I think it's better to split out anything anyone wants to save to its own library
13:44StartsWithKhiredman, isn't one reason why c.c lives is that all contributors have ca signed and rich can include the code in core
13:44StartsWithKif there is no c.c, how will new code enter the core?
13:45hiredmancode doesn't enter core from contrib very often
14:26fanaticoclojars is timing out, and it has taken 'lein deps' down with it. Is there a way to force leiningen to use the local repository without looking for updates?
14:42rem7I was reading that you can only use recur from a tail position. Can it used in a cond? like so: http://paste.lisp.org/display/96061
14:48hiredmanyou don't need an extra (loop ...) there
14:49rem7hiredman: i thought recur and loop had to be used together.. no?
14:50kotarakrem7: recur also works on function boundaries
14:50hiredmanrecur will jump to the enclosing loop or function
14:51rem7ah ok, thanks
14:52ska2342Hi. After my son separated my machine from the current today I need to reopen many windows. And I can't open the Clojure source code in Netbeans now. Am I just too stupid right now or is there a trick (other than removing pom.xml)? I'm trying the 1.1.0 release, downloaded as ZIP.
15:00lespeaHello
15:04kotarakInteresting how two weeks of work suddenly end up a just a few lines of code...
15:06ska2342nevermind my question. NB somewhere had a reference to that dir and didn't want to open it again.
15:08lespeaSo I'm new to both functional programming in general as well as clojure. I'm trying to make an infinite pascal's triangle (so you can take 10 to get the first 10 lines) but I'm running into StackOverflowError. I assume that I'm "hanging onto the head" but I can't figure it out. Could anybody give me some pointers? http://pastebin.com/qmNJ19pU
15:12derefedis there a way to get the current classpath clojure is using from the REPL?
15:13the-kenny,(System/getProperty "java.class.path")
15:13clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
15:15derefedthanks
15:15derefedhmm... it seems to be different than what's in my $CLASSPATH
15:17bsteuberlespea: you don't need to do the iteration on your own
15:17bsteuber,(doc iterarate)
15:17clojurebotPardon?
15:17the-kenny,(doc iterate)
15:17clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
15:17bsteuber,(doc iterate)
15:17clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
15:18bsteubertoo late
15:18bsteuberso you can run (iterate mkline [1])
15:18bsteuberand this don't need the special case for no arguments
15:20lespeaOh okay that makes sense... certainly cleans up my code
15:21lespeaI'm still getting stack overflow though: (nth (last (take 1000 (iterate mkline [1]))) 25)
15:24kotaraklespea: I think you put lazy-seq on lazy-seq on lazy-seq ... Try putting a doall in mkline: (mkline [line] (doall (map ...)))
15:26Knekkwhere can I find a better REPL? command history and all that good stuff.
15:26lespeakotarak: Ah that worked perfectly! Thanks.
15:26kotarakKnekk: rlwrap
15:26lespeakotarak: I see now how that could cause an overflow... all those promises
15:26bsteuberknekk: Most use swank-clojure for emacs
15:27kotarakKnekk: or JLine or VimClojure's buffer Repl similar to SLIME thing, but if you are more into vi.
15:27KnekkI use swank-clojure as well, but sometimes I find it's easier to just fire up a repl for some quick commands
15:28bsteuberthen I use M-x slime instead of swank-clojure-project
15:28Knekkso, I am installing clojure/emacs on a brand new machine. Using ELPA I already downloaded clojure-mode/swank-clojure and all that. Using slime is now also downloading clojure itself, does that sound about right?
15:29lespeaI'm waiting for VimClojure to be updated for 1.1 compatability
15:29kotaraklespea: VimClojure is 1.1 compatible
15:29drockois there a guide to the best way to structure a compojure project?
15:30drockoi'm enjoying using it, but i realize i'm just putting code all willy nilly in the projects directory. if my experiments actually turn into something i'm going to need to organize things better...
15:30bsteuberlespea: my code for mkline looks like that
15:31bsteuber,(vec (concat [1] (map #(apply + %) (partition 2 1 [1 4 6 4 1])) [1]))
15:31clojurebot[1 5 10 10 5 1]
15:31mlehmanAny thoughts on the best way to document structmaps? Since defstruct does not currently take a doc-string and the resulting clojure.lang.PersistentStructMap$Def does not implement IObj (for meta). The best I have so far is just doing:
15:31mlehman(def #^{:doc "..."} mystruct (create-struct :name :description))
15:32derefedI have clojure/emacs set up using ELPA -- how do I change clojure's classpath? (setq swank-clojure-extra-classpaths (list ...)) doesn't do it
15:32lespeabsteuber: I was using apply but I switched it to reduce (don't remember why) -- is there a reason to use one over the other?
15:35bsteuberlespea: personally, I would use reduce for operations where apply doesn't work - so not for just adding two numbers
15:35bsteuberprobably not even for adding n numbers, as + already does the call to reduce for me
15:36lespeaso, in general, apply is better than reduce? In terms of speed/memory or is it just considered best practice?
15:36kotaraklespea: apply is good for str, because it works internally with StringBuilder
15:37bsteuberfor me, reduce feels a bit like loop - it's very powerful, but more complex to understand than other things
15:37Knekkslime failed to download Clojure jars :(
15:37kotaraklespea: but apply and reduce are in general fundamentally different operations. So it doesn't make sense to talk about best practice.
15:37bsteuberso I'd stick to other idioms unless necessary
15:38bsteuberand apply is definitely the simpler operation compared to reduce in general - as reduce is way more powerful
15:38bsteuberso I guess in your code, apply is easier to read
15:39lespeaOkay... I just remembered why I switched it... I didn't know if apply was causing my overflow so I switched it and never put it back
15:39bsteuberbecause when I see a reduce, I start trying to figure out what is combined through something where
15:39lespeamakes sense
15:39bsteuberah, I see
15:40kotaraklespea: apply holds onto the head. I still don't see a point to "compare" apply and reduce. They are completely different operations with a rather limited set of intersection.
15:40lespeabsteuber: Also, why did you cast the map to a vector?
15:41bsteuberto circumvent the stack bloating issue
15:41bsteuberbut maybe doall is cleaner
15:41bsteuberdunno
15:42bsteuberI usually cast things I don't want to be lazy to vec, but I have no idea if this is idiomatic
15:42bsteuberprobably not :)
15:42lespeahaha
15:42bsteuberI guess it just makes stuff slower, so thanks for pointing is out :)
15:42drockois this a crazy way to deploy and run a website with compojure? http://briancarper.net/blog/deploying-clojure-websites
15:45bsteuberdrocko: interesting, thanks for sharing :)
15:46drockobsteuber: it is interesting! i wonder if it works in production?
15:46drockolike does it scale
15:47bsteuberI don't have any experience using compojure (yet) or any java server stuff - but my feeling would be to use a more "enterprisey" way for production systems
15:48bsteuberlike war archives
15:48lespeaso, does overloading a function really slow down the algorythm? ex: (defn a ([x] 1)([] 2))
15:48bsteuberbut I like your way
15:48bsteuberlespea: no, this compiles to java overloads which will be resolved during compilation
15:49lespeabsteuber: okay I thought so but just wanted to be sure
15:50bsteuberdrocko: I'd be considering google appengine for highly scalable stuff - although you can't fire off your own threads with this
15:51bsteuberbut I'd be glad to hear about other approaches
15:51drockobsteuber: i had been considering GAE too, but it was a bit overcomplicated for me to get started on
15:51drockoi have enough to learn with clojure and compojure
15:51drockowith GAE you have to learn those things plus gae, plus a bunch of java build tools, etc
15:51bsteuberdrocko: yeah, I'll probably start exactly like you (so thx again :) )
15:52drockoclojure is freaking amazing though
15:52bsteuberand then later try to integrate compojure with GAE and swich to there datastore-stuff etc
15:52bsteuberit definitely is :)
15:52drockoi have been reading the "Programming Clojure" book. I think it's probably the 3rd computer book that i'll read cover to cover
15:53bmasonyeah Stuart did a great job on that
15:53drockodefinitely
15:53bmasonyou know, it actually touches on Compojure at the end
15:53lespeaI agree!
15:53bmasondunno if you're at that point yet :)
15:53derefedI'm reading that now too
15:53drockobmason: yeah i do know. i skipped ahead and read that stuff... i'm in the concurrency chapter now
15:53lespeaI'm reading that + attempting SICP right now (hence pascal's triangle)
15:54bsteuberdrocko: did you watch richs talks at clojure.blip.org yet? they even increased my excitedness...
15:54derefedwhat's sicp?
15:54kotarakIt's starts getting outdated, though.
15:54drockobsteuber: i have seen some...
15:54lespeaderefed: http://mitpress.mit.edu/sicp/
15:54bmasonbsteuber: yeah I've evangelized clojure some but really can't do it justice without Rich's explanations :)
15:54bsteuberkotarak: true, I was quite confused about the new sequence stuff at first, for example
15:55derefedoh yeah I've seen this one before
15:55derefedis it worthwhile reading for experienced programmers?
15:55kotarakbsteuber: and the annoying (. obj method args) syntax everyone is now using. :|
15:55lespeaThis is all in an effort to get smart enough to try and tackle some of Norvig's AI books
15:55derefedI started reading it but stopped cause it was doing beginner stuff
15:56drockoderefed: possibly. i think the sicp puts you in the right mindset
15:56drockomaybe you are there already
15:56lespeaderefed: I'm still in the first chapter... I'm completely new to functional programming so it's worth it for me haha
15:56derefedah okay
15:56drockolespea: have you read "the little schemer"?
15:56derefedlespea: even after 4 years of CS, norvig's AI is hard
15:56lespeadrocko: no, haven't even heard of it :(
15:56bsteuberlespea: do you know about sicpinclojure.com (though not really much there yet)?
15:57drockolespea: it's pretty cool. it will blow your mind
15:57lespeabsteuber: yeah I looked at it but, as you said, not much there yet haha
15:57drockowell perhaps. it's about recursion
15:57lespeawould you say it's better than SICP for being introduced to FP? or is there something even better than both of them?
15:58lespeaI've done almost all of my programming in Perl for the last 2 years so this is all a pretty big jump :S
15:58lespeabut I like it so far... a lot of Ooooh that's awesome moments
15:59kotarakRich's 0.02€ on SICP: http://groups.google.com/group/clojure/msg/be43ec191cd69869
15:59bmasonlespea: you have "Programming Clojure" ?
16:01bmasonlespea: I think Stuart's book does a good job of actually making FP in Clojure a practical, time saving and elegant practice
16:02bmasonI tried to learn Haskell before coming to Clojure, and found Clojure a far more digestible introduction to FP
16:03ska2342Just for the record: Practical Common Lisp by Peter Seibel is an excellent book, worth reading cover to cover and it will make you go Oooooh when you finally get macros. It doesn't cover Clojure, though. :-)
16:04derefedand it's free!
16:04lespeakotarak: oh that's sad :( I still think it's fun to try and tackle the problems... especially since it forces me to learn the clojure-way vs the scheme way. Though I see that I will run into walls later on :/ Do you have a better suggestion?
16:04lespeabmason: yeah I'm upto the concurency chapter
16:05lespeaska2342: oh sweet, I don't have that book -- maybe I'll have to get it. Can you download it online? (based off of derefed's comment)
16:05derefedyep I'll link you
16:05ska2342lespea: gigamonkeys.com/book
16:05derefedd'oh
16:05derefedbeat me to it
16:07ska2342I still remember the day when I read "Parsing Binary Files". Do yourself a favor and read the book slowly up to that chapter. Really.
16:08drockoisn't it crazy when you have these revelations?
16:08bmasonhmm... thanks for the link, I'll have to check that out too
16:08drockoyou read something and then suddenly everything looks different
16:08bmasonhah!
16:08bmasonthe one I loved was the 'select' syntax in clojure
16:08bmason(select predicate set)
16:08ska2342drocko: isn't that the case with all major constructs? Like, closures, macros, STM :-)
16:09drockoska2342: yes!
16:09drockoeven outside of programming though, 'aha' moments are awesome
16:09ska2342drocko: what's that "outside of programming"?
16:10drockoska2342: for instance when i was studying art history and I learned about the history of perspective in paintings
16:10bmasonska2342: I/O
16:10ska2342:-)
16:10drockoi read this book called 'changing images of pictorial space'
16:10drockoand suddenly every painting i looked at was different
16:10drockosame with when i read a book called 'what painting is' by james elkins
16:11ska2342like, quantum mechanics. Yes, those were the day at university. Hm, it's been quite a while....
16:11drockoyeah
16:11bmasonThe Pleasure of Finding Things Out, by Richard Feynman
16:11somniumwhen I read an abridged version of flatland...
16:11bmasonbrilliant series
16:11ska2342Ah, Feynman. Good, and a good read, too.
16:12bmasonhttp://www.youtube.com/watch?v=srSbAazoOr8
16:13ska2342Talking about books... anyone interested in a German Clojure book?
16:14derefedI would be
16:14derefedI've been studying german for a while
16:14kotarakska2342: me too, but no introductory stuff
16:15the-kennyska2342: If you seek some german-speaking clojure users, ask in #clojure.de ;) (Just a pointer)
16:16ska2342So I may as well pick this particular moment to humbly announce it? http://www.dpunkt.de/buecher/3372.html :-) Please excuse the self-plug
16:16lespeawow thanks for the book link guys :D I'll have to get to reading. Man my weekend is disappearing :o
16:18derefedska2342: hast du dieses buch geschrieben?
16:18ska2342derefed: I still do.
16:18derefedoh cool
16:18hiredmanhow do I upgrade swank-clojure?
16:18bsteuberausgezeichnet :)
16:19hiredmancan I change which version of clojure and contrib swank-clojure uses?
16:20kotarakhiredman: converting?
16:20bmasonit should just be a matter of your classpaths right?
16:20hiredmankotarak: I've been using emacs locally for a while now
16:21bmasonwon't lein let you create a swank server with whatever version you want?
16:21hiredmanbut I don't want a lein project
16:21bmasonwell :)
16:21hiredmanI just want a 1.2 repl, I don't want contrib or anything else
16:21bmasonI think you'd have to change your classpath another way then...
16:22hiredmanthe other issue is the clojure portion of swank-clojure is aot compiled
16:22bmasonthere's some functions to do that but I don't remember off the top of my head
16:23hiredmanso just changing the jars or the classpath to point to newer version of clojure most likely will not be enough because this swank stuff was built with 1.0 so most likely will be binary incompatble
16:23the-kennyhiredman: Try calling C-h v swank-clojure-<TAB>
16:24somniumhiredman: there was a slim version in the repo, though I have a lein project with 1.2 that works with swank-clojure from clojars
16:25Knekk,(doc apply)
16:25clojurebot"([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."
16:25hiredmansomnium: so I can get the slim version if I do a git checkout?
16:27somniumhiredman: maybe just checkout and jar it? the slim I had was from the ant days
16:32derefedif ELPA sets up my swank-clojure-classpath, how can I change it? it doesn't include the current directory and I need to add it
16:34derefedI threw a (setq swank-clojure-extra-classpaths) into my .emacs, but it didn't do anything
16:34derefedwell, along with the paths themselves but I omitted that here
16:36schizmhi there, trying out clojure...java newbie. Following getting started and apparently I am missing some basic info. trying to execute "(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))" and it just sits there...so I grab jline, put it's jar in the clojure dir..and execute 'java -cp jline-0.9.91.jar:clojure.jar jline.ConsoleRunner clojure.main' and I get it not finding jline/ConsoleRunner. What simple assumption am I missing here?
16:46schizmanyone alive? surely someone is
16:46Knekkkinda
16:46schizmthoughts on my question there? Just want to get started on it :)
16:47schizmbasically the first two items in 'getting started' 'fail on me
16:47Knekksorry, I am not advanced enough to help you with that one
16:48the-kenny,(System/getProperty "java.class.path")
16:48clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
16:51bsteuberschizm: I think everyone starting with clojure runs into some sort of classpath hazzle - expecially at the very beginning
16:51schizmbsteuber: it's kind of like a skill testing component? If you cannot figure this out, you are not worthy to run clojure? :P
16:52Knekkok, dumb question. What's the best way to check if \1 is in (\1 \2 \3) ?
16:52texodus,(#{\1 \2 \3} \1)
16:52clojurebot\1
16:53bsteuberschizm: no, sorry - that was not my intention. I just wanted to encourage you, but I don't know what's wrong with your setup
16:53schizmI am making the assumption that "." is searched for jars
16:53texodus,(#{\1 \2 \3} \4)
16:53clojurebotnil
16:53schizmit obviously is for clojure.jar, why would jline not ba found
16:53schizmI am not a java guy, was never drawn to it
16:53schizmso
16:53schizm*shrug*
16:53bsteuberI never used the JLine setup
16:54Knekktexodus: thanks. now to figure out how to do it using every?
16:54schizmbsteub: only reason I was trying was cause the first 'try this line' just sits there doing nothing
16:54schizm:)
16:55bsteuberschizm: so what setup do you usually have?
16:55schizm'do I usually have' meaning what?
16:55schizmI run on a variety of boxen, this one happens to be a win7x64 box w/ cygwin
16:55texodus,(doc every?)
16:55clojurebot"([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
16:56bsteuberschizm: I meant the way you talked to clojure when trying the example at first
16:57schizmjava -cp clojure.jar clojure.main, as per the 'getting started' pag
16:57schizmhttp://clojure.org/getting_started
16:57bsteuberok
16:57schizm2nd line it says to try is: (. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
16:57schizmI try that, assumption is a pop-up of some sort I imagine? nothing.
16:58schizmoh syntax file for vim, nice, that will make life easier
16:59lespeamake sure you turn on rainbow parens :)
16:59bsteuberschizm: I think most use emacs with swank-clojure, some vimclojure, some a netbeans plugin
16:59bsteuberwhatever you feel comfortable with
17:00schizmI used to be an emacs guy...once I decided to really learn VIM that changed :)
17:00schizmI used VI back in the early 90s, but never really 'learned' it
17:00lespeaI could never get vimclojure to compile :( I'm using slimv (which sorta sucks)
17:00lespeamaybe I should try it again...
17:00bsteuberI really love paredit in emacs
17:01texodus,(not (every? #(not (= \1 %)) [\4 \2 \3]))
17:01clojurebotfalse
17:01texodus,(not (every? #(not (#{\1} %)) [\1 \2 \3]))
17:01clojurebottrue
17:01texodusthats abusive
17:04bsteuberschizm: but it's very strange you didn't get a window popping up in the first place
17:04schizmbsteuber: I concur :)
17:06hiredmanugh
17:07hiredmanthat is lame, why instead there an IChunkBuffer
17:08itistodayanyone from japan here?
17:09somniumitistoday: I used to live in yokohama, but I guess thats a no
17:11itistodaysomnium: do you know any japanese immigrants that I could ask a few questions?
17:11somniumitistoday: not off hand
17:11kotaraklespea: if you have trouble with VC ask me
17:12somniumitistoday: I guess it would depend on the questions too O_o
17:12itistodaysomnium: just related to their reactions to America
17:18somniumitistoday: I heard some varied opinions when I was a translator, but I expect you could get the general spectrum from google.
17:19itistodaysomnium: the problem is finding something not written in japanese...
17:19defn"1240255294 foo #xyz http://www.youtube.com/&quot; -- Given a string like this what is the best way to get the last item in that list?
17:19defnthe url i mean
17:19defn(last (split-with)) maybe?
17:22somniumitistoday: 'people dont use umbrellas', 'trains are always late', and 'the squirrels are cute' were some of my favorites
17:22itistodaysomnium: hehe, all unrelated to american culture though
17:22bsteuberdefn: split-with only gives you two collections
17:23defnre-split maybe
17:23defnah yes
17:23defnthere we go
17:26defnnow to figure out what i should do with 7000 urls from #clojure
17:28bsteuber,(re-seq #"[^ ]*" "ab adsdjsk dsd")
17:28clojurebot("ab" "" "adsdjsk" "" "dsd" "")
17:28bsteuberor did you find anything better?
17:28defn(map #(last (re-split #" " %) urls))
17:29defnthen i convert it to a set to get uniques
17:29defn(set (map #(last (re-split #" " %) urls)))
17:30bsteuber`re-split
17:30bsteuber,`re-split
17:30clojurebotsandbox/re-split
17:30bsteuberI don't have re-split out of the box
17:31defnit's in str-utils
17:31StartsWithK(seq (.split "string" re-string))
17:31bsteuberic
17:32bsteuberI'm just too unexperienced in the Java world I guess
17:32defnbsteuber: i suggest getting a lame java book
17:32defnand then do all the examples with clojure
17:33defnit makes java not suck
17:35bsteuberhmm, maybe I really should :)
17:36bsteuberbut I need a book about the libraries, not the concepts
17:37somniumyeah, nothing like studying the visitor pattern and factory factories with a lisp
17:39technomancyI've wanted to write an introduction to JVM I/O for a while.
17:39technomancythat's the hardest JDK stuff to avoid in Clojure
17:39nteonis there a function that returns whether a symbol is defined?
17:40defntechnomancy: inputstreamreader and all of that?
17:41technomancy,(ns-resolve 'clojure.core 'undefined)
17:41clojurebotnil
17:41technomancynteon: ^^
17:41nteontechnomancy: fabulous! thanks
17:41technomancynteon: pedantry: symbols are not bound to values, vars are
17:41technomancybut vars are named with symbols
17:41technomancydefn: right
17:41defnyeah that was hard to understand at first
17:41defnvery foreign
17:41defnspecially coming from ruby
17:42technomancydefn: especially if you're used to a language that treats all strings as (ugh) byte arrays.
17:42technomancytook me a while to realize it really was more complex for a reason. =)
17:42nteontechnomancy: so what is the correct way to phrase what I asked?
17:42RaynesIs there a function like Haskell's 'group' which creates a list of lists of duplicate elements in a list? For example: (group "aabbbc") -> ((\a \a) (\b \b \b) (\c)) or something similar.
17:42technomancynteon: it would be checking whether a var is bound to a value.
17:43technomancydef forms create vars
17:43nteontechnomancy: let forms as well, right?
17:44bsteuber,(find-var `undefined)
17:44clojurebotnil
17:44defnjava is an estrogen language
17:44arbschtRaynes: maybe c.c.seq/partition-by
17:44technomancynteon: no, let forms only create locals
17:44defnhttp://www.stumbleupon.com/su/1YmbwB/enfranchisedmind.com/blog/posts/what-killed-lisp-could-kill-haskell-as-well//r:t
17:44bsteuberwhat's the difference between find-var and ns-resolve?
17:44technomancynteon: so actually ns-resolve might not be what you want if you want it to also look for locals.
17:45technomancybsteuber: ns-resolve takes the namespace as a separate arg; find-var takes a single namespace-qualified symbol
17:45nteontechnomancy: scratch that, I don't need to look for locals
17:45bsteubertechnomancy: ic, thanks
17:45technomancynteon: locals are a bit different since they're totally immutable
17:45tomojseq-utils was renamed to seq?
17:46bsteuber,(doc partition-by)
17:46defnis there any refactoring browser for clojure?
17:46clojurebot"([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of lazy seqs."
17:46SynrGwin 23
17:46SynrGmeh
17:46tomoj,(partition-by identity "aabbbc")
17:46clojurebot((\a \a) (\b \b \b) (\c))
17:47defn^cool
17:47tomoj,(let [group (partial partition-by identity)] (group "aabbbc"))
17:47clojurebot((\a \a) (\b \b \b) (\c))
17:48RaynesAwesome.
17:48somniumthey have to be in order though
17:48tomojyeah, that's what haskell's group does
17:49tomojif you were looking for a histogram it'd seem strange to me to return seqs of duplicates instead of just a map from values to counts anyway
17:49RaynesIoke's group does what I want, but doesn't preserve order. :(
18:05defnAnyone here use TDD with clojure?
18:06bsteuberdefn: yeah, just started and liked it
18:06defnusing clojure's testing tools
18:06defnor outside stuff?
18:06bsteuberdefault language and clojure-test-mode for emacs
18:06bsteuberis etc
18:06defncool
18:07defnive messed with it a bit but i never can get into doing it all the time
18:07tomojone thing that bothers me about clojure-test-mode is that are doesn't really work
18:07defni need some discipline!
18:07bsteuber,(is 42)
18:07clojurebotjava.lang.Exception: Unable to resolve symbol: is in this context
18:07tomojyou just see that the entire are template failed, but don't see which parts of it failed
18:07defn,(use clojure.test)
18:07clojurebotjava.lang.ClassNotFoundException: clojure.test
18:07defn,(use 'clojure.test)
18:07clojurebotnil
18:08defn,(is 42)
18:08clojurebotDENIED
18:08defnoops nvm
18:08bsteubertomoj: yeah, I ran into the same issue and therefore started to do one single (is call for each statement
18:08bsteuberwithoug generating is from functions or macros
18:08bsteuberthat worked pretty well
18:08tomojit's unfortunate, though
18:08defnive read rich's thoughts on TDD in clojure, that it is less necessary in a purely functional language
18:09tomojI wonder if it's feasible to make clojure-test-mode smarter about that stuff
18:09defnwhich i tend to agree with
18:09tomojor if it'd require a bunch of patching to clojure.test
18:09defnbut there are many situations where tests would be nice
18:09tomojI'm fine with clojure.test, where I am unhappy is with integration testing
18:10technomancytomoj: I actually never really got into the are clause
18:10tomojto the point that I will probably not write those tests in clojure
18:10technomancyclojure-test-mode was only designed to work with "is"
18:10technomancypatches welcome. =)
18:10tomojyeah, I just suspect it'd be very painful to make it work with "are" :(
18:10technomancypossibly
18:13defntomoj: it's only painful until it isn't!
18:13defn:)
18:15bsteubermaybe one could define a custom version of are which the source of all test data there
18:15bsteuberthere's a "tracks" missing
18:15defnbsteuber: have any simple examples of your work with clojure-test-mode?
18:15defnsimple code i mean
18:15bsteuberdefn: http://github.com/bsteuber/clj-go/blob/master/test/clj_go_test.clj
18:16defnawesome
18:16defnthanks :)
18:17bsteuber(though my lib itself is just at commit 3 at the moment, so don't expect anything non-trivial^^)
18:17defnnono that's good
18:17tomojso it looks like clojure-test-mode just jumps two spaces up the stack and grabs the line number from there
18:17defnim just curious to see how people are using it in practice
18:18bsteuberthe tests don't look lispy or DRY at all, but for the moment I'm fine with that
18:18tomojmaybe line numbers for macroexpanded code is bad?
18:20bsteuberactually the only repetition is (is (foo.. , so it's not that bad
18:20bsteuberhey, I also do Java projects ;)
18:22bsteuberdefn: there are some more examples at http://github.com/bsteuber/clj-go/blob/master/test/clj_go/board_test.clj
18:27defnbsteuber: thanks
18:49Scriptorbsteuber: does it support rule of Ko?
18:50Scriptorat least, that's what I think it's called, been a while
18:50RaynesKo? Is somebody writing Go?
18:50RaynesOh, should have read up.
19:01bsteuberscriptor: I just started the project, so it doesn't even support capture yet
19:01Scriptorah
19:02Raynesbsteuber: I've wanted to this for a long time, but I'm too stupid.
19:02Raynes:|
19:02RaynesMaybe I can contribute somewhere down the line.
19:03bsteuberraynes: that'd be great
19:03bsteuberbut as a clojure programmer I hardly believe you're too stupid :)
19:04bsteuberit just takes time to get all of that crazy stuff
19:04RaynesOh, I'm sure I could Get It Done(TM), but it would be an ugly mess.
19:05bsteuberI think I've got you wrong - so your problem is writing go algorithms, not playing go
19:06RaynesWell I suck at the game as well, but that's a different story.
19:06bsteuberI guess mine might become elegant but slow as hell :)
19:06Raynes;)
19:06bsteuberbut I don't plan to use it for AI at this point, so it doesn't matter
19:07bsteuberI'd rather roll my own Go problem website one day
19:11thearthurhow do I do this: (def [a b] [(first foo) (second foo)])
19:11thearthurbind two names with one def
19:16_atothearthur: def doesn't work that way, you'd need to do: (def a (first foo)) (def b (second foo))
19:16Scriptorwould it be possible to do that with a macro?
19:17_atoyes, you could write a macro to do it
19:22rem7how come you can do (first '(items in list)) and items (not a string,,, what is it?) but you can't do (= (first '(items in list)) items) --> Unable to resolve symbol
19:23rem7is that because the sequence is lazy and hasn't evaluated the elements inside?
19:23somnium,(= (first '(items in list)) 'items)
19:23clojurebottrue
19:24rem7huh... need to put the quote first
19:25hiredmanrem7: http://en.wikipedia.org/wiki/Lisp_%28programming_language%29#Self-evaluating_forms_and_quoting
19:25bmasonRaynes: awesome, I was thinking about writing a clojure Go board myself
19:25rem7hiredman: thanks
19:26bmasoner I guess that's bsteuber's :)
19:31bmasonso I'm making a web service in compojure, and I'd like to differentiate between web browsers and other clients, and give browsers a friendly HTML version
19:32bmasonnot sure how to determine the type of client though
19:35bmasonhmm ok, looks like I should be able to grab the User-Agent string from the HTTP headers
19:52Raynesbmason: Yes, that's definite bsteuber's :p
19:52bmasoni r bad reader
20:02drockohm
20:03drockomaybe i am just not getting this. how do i layout my project so i can use swank-clojure-project?
20:03drockodependency jars go in project_root/lib
20:03drockoi got that
20:03drockoand there is a src and a classes directory
20:03drockowhat goes in those?
20:10bmasonsrc = your clojure source, classes = compiled classes I think...
20:10bmasonlemme check
20:11bmasonI don't have anything in my classes directory... so not sure
20:11drockoi see
20:11drockook
20:11bmasondo you use lein?
20:12bmason"lein new myprojectname" will create the appropriate structure
20:14drockoah
20:14drockook
20:15bmasonI'm really not sure where swank-clojure-project fits in... I didn't see much use for it once I figured out lein
20:15bmasonI don't know if it's deprecated or just an alternate method of creating a swank server around a project
20:17hiredmanwhat does .dropFirst on a chunk do?
20:23rhickeyhiredman: returns a chunk without the first element
20:29technomancybmason: it's just an alt. (pure-elisp) method of starting a swank-server
20:29technomancy"lein swank" is a clj implementation of the same thing.
20:30bmasonok, so the net result is the same?
20:30technomancyyup
20:30bmasonmakes sense now, thanks :)
20:53hiredmanimplementing all the interfaces you need to do a clojure datastructure with reify is crazy
20:59rhickey_hiredman: vs waht?
20:59rhickey_what?
20:59clojurebotwhat is short for ,(doc ...)
21:01hiredmancrazy like oh my god there are a lot of them
21:01rhickey_hiredman: yeah
21:01rhickey_I'm working on macro-like mixins for reify and deftype
21:01hiredmanmmm
21:03hiredmanare transients to be superceded by cells? or will the transient interface stick around, implemented with cells?
21:05rhickey_there are two aspects to transients - the symbiotic relationship to a particular persistent data structure, which is what enables the O(1) to/from capability, and the single-threaded policy bit. The policy stuff may move to cells
21:05hiredmanhmmm, I guess I was only thinking of vectors
21:11Rayneshttp://www.dreamincode.net/forums/index.php?showtopic=160236&amp;view=findpost&amp;p=951227
21:17tomojhah
21:17tomoj"Programming Theoretician"
21:17fanaticoRaynes: I'm not sure you want to mess with that guy. He's an *expert* in 11 languages.
21:18Raynesfanatico: 'Expert' is just a badge on the site you get for helping people significantly.
21:19fanaticoI was being facetious.
21:20tomojI wonder what he wants to replace the doseq with
21:20tomojuh, "I use my vast experience in a plethora of programming languages to help those who seemingly can't be helped"
21:21tomojhe's also managed to run the gambit
21:23schizmI've never run a gambit :P
21:23somniummaybe its a clever scheme pun
21:24nteonanyone know why "extern? #(resolve '%)" works in a let statement, but "extern? #(not (resolve '%))" gives me:
21:24nteonjava.lang.IllegalArgumentException: No matching method found: intern
21:24nteonI'm plain old stumped.
21:26hiredmanerm
21:26hiredmanwhy are you quoting %?
21:29tomoj,(#(identity '%) 3)
21:29clojurebotp1__11550
21:29tomojhuh
21:30tomojoh, I see why that happens
21:30tomojcrazy
21:30nteonhiredman: I shouldn't be, thats the problem.
21:35nteontomoj: would you mind explaining? I understand the problem is with me trying to resolve a local, but don't get whats actually happening that gives an intern method not found
21:35tomojsorry, I didn't understand your problem
21:35hiredmando you know what #() is?
21:35tomojjust why (#(identity '%) 3) gives results like that
21:36nteonsure, its an anonymous function
21:36hiredman,(macroexpand-1 '#(identity '%))
21:36clojurebot(fn* [p1__11560] (identity (quote p1__11560)))
21:36hiredman,(macroexpand-1 '#(identity %))
21:36clojurebot(fn* [p1__11572] (identity p1__11572))
21:37tomoj,(#(get % '%) '{p1__11606 42})
21:37clojurebot42
21:40hiredman,((pl λx'x) 1)
21:40clojurebotx
21:41tomoj,(doc pl)
21:41clojurebot"([& forms]); replaces a $ b with (a b) walking right to left replaces a · b with (comp a b) left to right ⌽a with (uncurry a) left to right ↕a with (flip a) left to right"
21:41hiredman,(macroexpand '(pl λx x))
21:41clojurebot(do (fn [x] x))
21:42tomoj,['a'b'c]
21:42clojurebot[a b c]
21:42tomojweird
21:43hiredman,(prn 'a' 1)
21:43clojurebota 1
21:44tomojtricky
21:44tomojI envision a set of clojure koans
21:45RaynesYou know, that that I linked is actually one of the few really negative reviews I've seen for Clojure. Usually people just whine about the parentheses.
21:46tomojwell..
21:46tomojI think that's really what was happening there
21:46tomoj"readability"
21:47hiredmanI installed emacs starter kit for a setup I needed really fast last week, by default it sets some weird colors for the parens that aren't visible on a dark background
21:48hiredmannot having my parens freaked me out
21:48tomojI think the default is meant to be barely visible in a normal emacs
21:49hiredman:(
21:51tomojparentheses seem to be the main complaint I've heard from people as well
21:51tomojother than "java? ick"
21:52tomojI'm not even sure I can tell whether I like the way parentheses look
21:52tomojor if I've just brainwashed myself into loving them
22:05technomancyhiredman: yeah, unfortunately emacs in a screen session is usually limited to 8 colors
22:05technomancywhich is really lame. =\
22:05technomancyhiredman: M-x customize-face esk-paren-face will fix it
22:07technomancyor rather will allow you to fix it
22:08hiredmantechnomancy: oh, I just dug through some elisp file and ripped it out
22:08technomancythat also work
22:08hiredman(ironically editing it with vim)
22:08technomancyI should probably wrap that in a (when window-system)
22:09technomancythough you can still launch in a window system and connect to that instance from the terminal.
22:09hiredmanstarter kit is pretty nice though
22:09hiredmanI wish I had started with it for my actual ~/.emacs
22:09hiredman.emacs.d
22:09technomancyit's ok... I want to get rid of it though. =)
22:10technomancyactually I want to get package.el included in Emacs and then break it up into a number of smaller packages.
22:10hiredmanright, get rid of everything
22:10defni used starter kit as sort of my frankenstein kit
22:11defnleft it off to the side and grabbed pieces i agreed with
22:11technomancydefn: in a sense that's even better
22:11technomancysince you know what you're getting into
22:11defnyeah i think that worked better
22:11technomancyyou probably understand it better than most people who just take it wholesale
22:11defni wanted to understand what i was using, how to use it
22:12defni renamed it all defn-*.el to make it my own :)
22:12technomancyas long as you didn't miss ido-imenu. that's one of my favourites.
22:12technomancy(though not as necessary if you have slime actually)
22:12defnyeah that's great -- i definitely use that
22:13defni would have lost my mind with emacs if it weren't for the custom.el and the custom auto-save stuff
22:13defni go between two computers with this config so having custom.el was really nice
22:14defnnot to mention your loaddefs stuff, and then your elpa-to-submit had all sorts of fun things i have learned to love
22:15defngist.el, textmate.el, etc. etc.
22:15technomancyIt looks like package.el will be included in Emacs soon.
22:15defnall in all it gave me more of a framework for building my own emacs config -- which i think is the most important thing
22:15technomancyyep, teach a man to fish, etc. =)
22:15defnnow if i find myself adding a bunch of customization for, for instance, markdown
22:15defni create a defn-markdown.el and am able to split it off in a coherent way that makes sense to me
22:16defnthe starter kit is great though, in that i wasn't intimidated by it
22:16defni think just by virtue of the fact that it's named "starter kit" -- i felt more at ease with it
22:17defnif it was "phil's epic emacs config"
22:17defni would have probably have just stared at it...scared
22:18nteon,((fn [i j] (for [k (range (count i))] `(~(i k) ~(j k)))) '[a b c] '[x y z])
22:18clojurebot((a x) (b y) (c z))
22:18defnif you tell someone something is "basic" "simple" etc. I think they're more likely to dig into it after awhile
22:18nteondoes anyone know how to make that less awful?
22:19defn,(interleave [a b c] [x y z])
22:19clojurebotjava.lang.Exception: Unable to resolve symbol: a in this context
22:20defn,(interleave [:a :b :c] [:x :y :z])
22:20clojurebot(:a :x :b :y :c :z)
22:20defnsome variation on that maybe?
22:20nteondefn: close, but I need them to be paired
22:20defn,(partition 2 (interleave [:a :b :c] [:x :y :z]))
22:20clojurebot((:a :x) (:b :y) (:c :z))
22:20defn:)
22:20technomancydefn: yeah, I've had my dotfiles in public version control for years, but when I made the Emacs PeepCode I tidied them up and made it more fit for human consumption... and now it's on the top 10 forked projects on github.
22:20nteonah, partition!
22:21nteondefn: thanks :)
22:21defnnp
22:21technomancyso folks must be really finding it useful
22:21defntechnomancy: i am somewhat embaressed to admit that i tried to learn emacs probably 4-5 times before i got the starter kit and aliased vi/vim='emacs -nw'
22:22defnyour kit got me over the hump
22:22fanatico,(map vector [1 2 3] [4 5 6])
22:22clojurebot([1 4] [2 5] [3 6])
22:22defnfanatico: nice
22:24defntechnomancy: it was sort of a running joke with my friends that i had kept trying to learn emacs. many of them have switched now as a result of your dotfiles as well.
22:25defntechnomancy: like you said, the "teach a man to fish" aspect is very important. if you can show someone how to do some basic emacs configuration, most will discover what i did: it's not about bending to emacs' will -- it's about bending emacs to your own will
22:25defnwhich is what is so fun and cool about emacs IMHO
22:25defnyou can do the same sorts of customization in vi of course, just not to the same extent
22:25defnmacros FTW
22:26defnlearning clojure + emacs has been a great experience for me as a programmer -- you get to see the evolution
22:27defn</rant>
22:29fanaticotechnomancy: so we'll see package.el in 23.2? awesome.
22:29defnyeah that's awesome news
22:30defnnteon: as fanatico said you can also do:
22:31defn,(map list [1 2 3] [4 5 6])
22:31clojurebot((1 4) (2 5) (3 6))
22:31defnwhich is even sexier
22:31TheBusbysorry to ask an IRC related question here, but any idea why I can only see "/me" text?
22:32defnTheBusby: what do you mean by /me text?
22:32defnyour /me output shows up just fine
22:32technomancyfanatico: actually it's too late for 23.2, so it will need to wait for 24.1
22:32nteondefn, fanatico: oh that is sexy
22:33technomancyby "included in Emacs soon" I meant "included in Emacs source tree" rather than a release.
22:33defnhow big of a part does RMS play in emacs these days?
22:33technomancydefn: he's kind of like the Queen of England I guess.
22:33technomancyme mostly just meets with foreign dignitaries.
22:34defnto discuss their surrender?
22:34defn;)
22:34technomancyhehe
22:35defnI'm curious to see what happens with TextMate on this next release
22:35defnTM is very emacs-ish in a lot of ways
22:35defnnot enough customization for my taste, but still a very nice editor in many respects
22:36defnthe author has taken a lot of cues from emacs
22:37technomancywell, you don't customize it using the same tools that the author uses to write it... so it kind of misses the biggest point.
22:37defntechnomancy: yeah exactly
22:37fanaticoTM2 has a bad case of second-system syndrome. It'll be interest what, if anything, ever comes out of that.
22:37defni like the idea of bundles -- it's sort of like packages in emacs in certain respects
22:38defnbut again technomancy -- you are correct in that you can only take that abstraction so far before you need to get under the hood
22:40defnfanatico: yeah im not sure what he's doing with it these days.. i was a long time TM user but i was absolutely annoyed when i couldnt use it on linux at work. i mean, i knew what iw as getting into, but it underlined the biggest problem with the editor IMO
22:40defnit's all Mac, all GUI, and everything i learn to do inside of it is relegated to a very specific context
22:40defnthat sucks.
22:40fanaticoWhat TM did implement, it did it fairly well. Very good case for "worse is better". And it makes for an amazing demo.
22:41defni would kill to have an emacs that managed projects in the way TM does
22:42defnyou can get the same functionality in emacs, but it is clunky
22:42defni might just be doing it wrong. but it has never felt as smooth as project management did with TM
22:43fanaticotechnomancy: luckily we've got maintainers who'll release faster than once every six years.
22:45technomancywell, the biggest part is you can't fix it yourself or help out with the release of version 2
22:46fanaticohah, I was referring to Stallman and Emacs from 2001 - 2007, but TM fits as well.
22:47fanaticoMonnier and Yidong seem to have their act together.
22:48defnnteon: i should say that it has been my constant experience with clojure that you go from writing a macro to realizing what you want to do is built into the language in some other simple way
22:49defnnteon: luckily refactoring in clojure isn't as painful as other languages (see java)
22:50nteondefn: heh, I'm pretty new to it but that doesn't sound too off the mark. Anything in particular you were referring to?
22:51defnnteon: nah not really, just seeing your original question and watching me go : oh interleave + partition, and then someone else weighing in saying (map list [1 2 3] [4 5 6])
22:52defnthat is typical and not something to obsess over, but i like to flag stuff i write and then come back and say "okay, i know this is easier, just needs more study on my part"
22:52technomancyfanatico: right, but I was using Emacs 22 well before it was released in '07; no such luck with the secret development of TM.
22:53defnif you ever find something you think is "ugly", with rare exception there is probably a better way of doing it, that has been my experience
22:53defnjust saying...
22:53defntechnomancy: yeah it's highly annoying on that front
22:54defnRedCar is a cool piece of hackery. Dan Lucraft has worked some magic with that
22:54nteondefn: yea! I was just showing my friend how much shorter and simpler all of your solutions were
22:55defnnteon: it's fun to see how much you can express in a single function i think
22:56defnnteon: im used to just strining method calls along, so seeing some of these really elegant functions has been a revelation
22:56defnstringing
22:57defnanyway, im heading to bed after a 20oz steak and a few glasses of wine :)
22:57defngood night all
22:57nteondefn: hah, night
22:57hiredmanbraggart
22:58defn:) honestly i feel somewhat sick due to food overload
22:58defni wouldn't be jealous if i were you :)
22:58defnhaha good night
22:59tomojdefn gives me an idea
22:59Knekkhmm, what's the easiest way to obtain the X number of digits after the decimal point of an irrational number?
23:00tomojI think that question has no good answer
23:01tomojthe easiest way to obtain the digits of pi is likely not the easiest way to obtain the digits of other irrationals
23:01Knekkright, I am not concerned about pi specifically.
23:01tomojwell, you must have some specific concern, no?
23:02tomojotherwise I don't see how you could possibly make any progress
23:02Knekkplaying around with project euler. I need to find an irrational number with specific properties.
23:02Knekkthis one specifically http://projecteuler.net/index.php?section=problems&amp;id=26
23:02tomojok, but how are you going to tell the computer which irrational number you're talking about?
23:03Knekk1/d for 0 < d < 1000
23:03tomojhmm
23:03tomojthose look like rational numbers to me
23:04Knekkyes sorry, I misspoke
23:04tomojwell
23:04KnekkI meant unending decimal fraction parts
23:04tomojI think you'll be better off in #math
23:04hiredmanthat is going to be a problem, how are you getting the decimal representation of the numbers?
23:05tomojthe floating point types available don't have enough precision, I think
23:05Knekkright, my thinking is to first find the decimal representation and put it into a seq, then do a pattern match
23:05Knekkput the digits into a seq I meant
23:05Knekksorry, my brain's fried. Long day
23:06tomojwell, are you looking for something easier than long division, or..?
23:06Knekksomething that works...
23:06Knekkclojure converts to bignum automatically, but I can't get a good representation
23:09hiredmanhttp://www.cimt.plymouth.ac.uk/resources/res1/decimals.htm might be a good place to start
23:11hiredmanhmmm
23:12hiredmanthat might be problematic to solve for the exponents because java's log stuff is double based
23:13KnekkI've been looking at those approaches and keep thinking there must be an easier way.
23:13hiredmanthat would be #math
23:13Knekkyeah
23:14Knekkthanks
23:18fanaticoKnekk: I may be talking out of my ass, but couldn't you use a taylor series to find 1/x to some arbitrary number of decimal places?
23:18hiredman,(* (Math/pow 10 6) 1/7)
23:18clojurebot142857.1428571429
23:18tomojthat sounds strange to me
23:19Knekk,(* (Math/pow 10 12) 1/7)
23:19clojurebot1.428571428571429E11
23:19Knekk,(format "%100d" (* (Math/pow 10 12) 1/7))
23:19clojurebotjava.util.IllegalFormatConversionException: d != java.lang.Double
23:20Knekk,(format "%100f" (* (Math/pow 10 12) 1/7))
23:20clojurebot" 142857142857.142900"
23:20hiredman,(map #(* (Math/pow 10 %) 1/7) (range 10))
23:20clojurebot(0.1428571428571429 1.428571428571429 14.28571428571429 142.85714285714292 1428.5714285714291 14285.71428571429 142857.1428571429 1428571.428571429 1.4285714285714291E7 1.428571428571429E8)
23:21Knekk,(format "%100f" (* (Math/pow 10 16) 1/7))
23:21clojurebot" 1428571428571429.000000"
23:21Knekk,(format "%100f" (* (Math/pow 10 20) 1/7))
23:21clojurebot" 14285714285714290000.000000"
23:29tomojhttps://gist.github.com/2a98cc0267c47629b3f5 spoilers
23:29tomojthat's ugly, I'm sure it can be prettier
23:32tomojI almost like this better https://gist.github.com/015a51c3058c7e9d1f40
23:38_ato,(bigint 10000000000000000000000000000000/3)
23:38clojurebot9223372036854775807
23:39RaynesThat's a really bigint.
23:39clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
23:39_atoweird
23:40_ato,10000000000000000000000000000000/3
23:40clojurebot10000000000000000000000000000000/3
23:40_ato,(bigint 1000000000000/3)
23:40clojurebot333333333333
23:40_atoseems like there's a bug there
23:42hiredman,(bigdec 00000000000000/3
23:42clojurebotEOF while reading
23:42hiredmaner
23:42hiredman,(bigdec 100000000000000/3)
23:42clojurebotjava.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
23:42hiredman:P
23:42_ato,(.decimalValue 100000000000000/3)
23:42clojurebotjava.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
23:43tomoj_ato: what's the bug?
23:43_ato,(bigint 10000000000000000000000000000000/3)
23:43clojurebot9223372036854775807
23:44_ato^ that aint the right answer
23:44_atoit should be a whole bunch of 3s
23:44_atoand Clojure's not supposed to silently truncate numbers
23:45tomojoh, I see
23:46tomojhmm
23:46tomojlook at the source of bigint
23:46tomojif it's a number, it coerces to long before passing to BigInteger/valueOf
23:46tomoj,(long 10000000000000000000000000000000/3)
23:46clojurebot9223372036854775807
23:47tomoj,(long 10000000000000000000)
23:47clojurebotjava.lang.ExceptionInInitializerError
23:47tomojer, well, I get -8446744073709551616
23:48tomoj,(long 1000000000000000000000)
23:48clojurebotjava.lang.ExceptionInInitializerError
23:48tomojweird
23:49_ato,(.divide (java.math.BigDecimal. 1000000000000000000000) (java.math.BigDecimal. 3))
23:49clojurebotjava.lang.ExceptionInInitializerError
23:49_ato,(.divide (java.math.BigDecimal. 1000000000000000000000M) (java.math.BigDecimal. 3))
23:49clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.math.BigDecimal
23:50_ato,(.divide 1000000000000000000000M (java.math.BigDecimal. 3))
23:50clojurebotjava.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
23:51hiredman,(let [m 10000000000000000000000000000000/3] (.divide (.numerator m) (.denominator m)))
23:51clojurebot3333333333333333333333333333333
23:53hiredmanbigdec has a check for ratios
23:53hiredmanhmmm
23:54_atoI guess bigint should have one as well
23:54hiredman,(let [m 10000000000000000000000000000000/3] (/ (BigDecimal. (.numerator m)) (.denominator m)))
23:54clojurebotjava.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
23:55hiredman,(let [m 10000000000000000000000000000000/3] (/ (.numerator m) (.denominator m)))
23:55clojurebot10000000000000000000000000000000/3