#clojure logs

2011-10-21

00:00amalloytechnomancy`: we should DDoS riddell.us
00:00technomancy`mwahaha
00:00technomancy`actually I wonder if clojurebot could be triggered to warn people upon any mention of those tutorials in a given line.
00:02amalloytechnomancy`: lazybot recently got a regex-matching autoreply feature. i didn't add a user-facing way to add new replies, but i guess that's a good idea
00:03amalloybut ugh, actually kinda hard. maybe i'll just tell him about riddell.us myself
00:07amalloy$google lein tutorial
00:07lazybot[Tutorial - GitHub] https://github.com/ato/clojars-web/wiki/tutorial
00:08technomancy`=(
00:12amalloytechnomancy`: there. hopefully this saves a few souls from riddell.us
00:12lazybotThe riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.
00:13technomancy`lazybot: absolut botsnack
00:13technomancy`or barring that just a regular one
00:13technomancy`$botsnack
00:13lazybottechnomancy`: Thanks! Om nom nom!!
00:14technomancy`amalloy: nicely done
00:14amalloytechnomancy`: of course, it already worked for people who were like: omg is this tutorial from two years ago any good??
00:14lazybotamalloy: What are you, crazy? Of course not!
00:21jcromartieI have to say, I installed Clojure via Leiningen on my Windows (Cygwin) box today. It was harder to get rlwrap than to get Clojure running.
00:22jcromartie1. Download lein 2. chmod +x lein && mv lein /usr/bin && lein repl
00:23jcromartieI <3 technomancy`
00:23jcromartieand lein of course
00:23technomancy`schweet
00:23jcromartieI was kind of surprised it just worked™ on Win7 + cygwin
00:30amalloyclojurebot: how does technomancy make stuff Just Work?
00:30clojurebottechnomancy is to blame for all failures
00:31jcromartiethat's ominous
00:31jcromartielike, *all* failures?
00:31jcromartiepast, present, and future?
00:34amalloycounterexamples welcome
00:38fmwI'm trying to let a value in a macro, but I seem to have something wrong, because this works in a small test macro, but not in the larger actual one: http://paste.pocoo.org/show/495909/
00:38fmwany idea what I'm doing wrong?
00:40fmwI suppose this is not the best time of the day to ask ;)
00:41scottjnot sure if `(let [~'params is always bad form but I think normally it should be `(let [params#
00:42nappingis the "if" supposed to be at runtime?
00:42fmwscottj: doesn't the hash create a gensym (e.g. params__6622__auto); i.e. isn that meant for internal use within the macro?
00:43nappingIf you want it to fail when the macro expands, the ` needs to go inwards
00:43scottjfmw: yes
00:43fmwnapping: which one?
00:45nappingThe if-not
00:45fmwnapping: I think this has to happen at runtime, if I understand everything correctly, but I'm not sure I do. I'm new to clojure macros.
00:45nappingright now, the macro makes one giant piece of syntax
00:45nappingYou should be able to count the number of clauses
00:46fmwyes, I ran macroexpand-1 over it, to figure out what is going wrong, and that syntax looks correct
00:46nappingas it is, all the bodies evaluat when they are spliced into list
00:46hiredmanso I have this macro for generating deftypes for tuples, up to 10 elements
00:46hiredmanhttps://gist.github.com/1303118
00:46nappingand the rest of it is just picking out one of the values
00:46hiredmanit's kind of fast
00:47hiredmanI haven't checked to see if the storage requirements are much smaller than for a vector
00:47amalloyhiredman: aw, you should have just used JavaTuples
00:47hiredman(and all the interfaces aren't filled in yet)
00:47hiredmanamalloy: meh
00:47amalloy(not a real suggestion. those are awful)
00:47nappingfmw, one red flag is that you are not actually splicing body inside the let
00:48fmwnapping: maybe its best if I explain what I'm trying to do: it is basically a (cond) replacement, but with the params variable as the result of the uneven arguments and available to the body of the even arguments (so I can write (handle-this-uri-function (:feed params)) to supply the feed from the uri to that function)
00:50nappingit's not working like a cond replacement. Look at the macroexpand-1 results again
00:50fmwthe (routes-match ...) function either returns false or a map of params
00:50fmwnapping: ok, let me compare a macroexpand-1 of cond to this
00:51hiredmanhttps://github.com/hiredman/tuples/blob/master/src/tuples/core.clj
00:52fmwnapping: ah, yes, I see the difference
00:52hiredmanaccess via nth is about on par with pvectors
00:52jcromartiehiredman: what's the advantage of a tuple over a vector?
00:52fmwI started with the source for cond for my first version, btw, and worked from that, but dropped it for this recursive version
00:53hiredmanjcromartie: (get0 a-tuple) is faster than (nth a-vector 0)
00:53jcromartieand (nth a-vector 0) is already O(1) isn't it?
00:53hiredmanI have not confirmed yet, but I believe they'll take up less memory then the equivalent vector
00:54hiredmanjcromartie: log_32(n) because of the tree sharing
00:54jcromartieah
00:54jcromartieOK so tuples don't do any sharing
00:55hiredmanright
00:55hiredmana tuple is really O(1)
00:56hiredmanand you don't have the machinery that is used to back pvectors
00:56jcromartieIf I wanted to implement a super simple tuple, I'd use a function, though
00:56jcromartiewell, a macro
00:56hiredmanhow so?
00:57hiredmanthese tuples implement most of the interface of pvectors
00:57hiredman(or will, once I get to the rest)
00:57hiredmana macro is not a datastructure
00:58hiredmanyou can make a macro that expands to [x y], but as I said, accessing the elements of a tuple via get[0-9] is faster than nth on a vector
00:59amalloyi think jcromartie is thinking of the way you can implement cons cells as just closures. doesn't really work well in clojure because you need to implement the various interfaces if you want to make them seqable etc
00:59chewbrancaanyone have any ideas on this error when running lazybot "Map literal must contain an even number of forms" http://paste.lisp.org/display/125422
01:00amalloyhaha is that still checked in? chewbranca: in ~/.lazybot/info.clj there's probably a map that looks like {true}
01:00jcromartieyah it would be very primitive
01:00jcromartiebut here
01:00jcromartie(defmacro tuple [& xs] `(fn [idx#] (case idx# ~@(mapcat list (range (count xs)) xs))))
01:00jcromartiethat's my O(1) tuple :)
01:01hiredmanjcromartie: nah, it's going to be slower
01:01jcromartiewith casE?
01:01jcromartiecase
01:01hiredmancase requires computing hashses
01:01jcromartie"Unlike cond and condp, case does a constant-time dispatch"
01:01amalloyjcromartie: a thousand years is constant time too
01:01jcromartie:P sure
01:01chewbrancaamalloy: let mecheck it out, didn't realize it used ~/.lazybot as opposed to ./lazboy/.lazybot/info.clj
01:01Chousukethe hash function isn't very complex though
01:01hiredmanwould you like me to link you too the compiler source?
01:02amalloychewbranca: it copies ./lazybot to ~ the first time it runs
01:02hiredmanChousuke: sure, and is fact a method call, and if you are indexing using numebrs it is likely to inline
01:02hiredmanbut I think performance wise it might come out as a wash, and my tuples have a nicer interface
01:03jcromartieyes, absolutely :)
01:03amalloyhiredman: are you storing N fields, or one N-sized array?
01:03jcromartieI just thought it would be fun :P
01:03hiredmanamalloy: N fields
01:03chewbrancaamalloy: yeah was editing the local .laazybot/info.clj, but yes, there is a {true} in there lol
01:03hiredmanbut I only generate tuples up to size 10
01:03fmwnapping: ok, I've been experimenting a bit and looking at macroexpand-1 output, but I'm afraid I'm not getting much further
01:04amalloyhiredman: you could make nth quite fast if you also used an n-sized array, i suspect, as long as the memory tradeoff doesn't matter
01:04fmwnapping: the macro itself works perfectly, btw, just not the variable assignment
01:04fmwalthough the (let params [...]) is in the macroexpand-1
01:04amalloysince i assume you'd want to keep the N fields for fast getN
01:05nappingdon't the bodies end up outside that?
01:05fmwnapping: let me paste the macroexpand-1
01:06hiredmanactually my nth is already implement via case like jcromartie suggested, but it wasn't fast enough
01:06jcromartieoh really?
01:06hiredman(which is why I added TuppleAccess)
01:06hiredmanyeah
01:07hiredmanit performed very similarly to nth on pvectors
01:07chewbrancaamalloy: good call, the {true} was the issue, fixing that has led me to the next error :/
01:07amalloyright, case would be my first effort too. but an array access is nearly as fast as a field lookup, if you don't mind storing everything twice
01:08hiredmanI'd rather not, I'd like to keep these fast and light
01:09hiredmansince it is a macro you could conceivably tell it what strategy to use and it would just generate the tuples you want
01:10amalloy*nod*
01:10fmwnapping: http://paste.pocoo.org/show/495919/
01:11fmwnapping: its a bit messed up there - all in one line
01:12fmwlet me format that a bit more pleasantly
01:13amalloyhiredman: is this in a repo anywhere yet? i'd like to poke at the bits and see how the various tradeoffs behave
01:14hiredmanhttps://github.com/hiredman/tuples/
01:15chewbrancaamalloy: good call on {true}, I commented that out and the weather and markov plugins and it worked
01:15amalloychewbranca: yeah, info.clj tends to get neglected. send us a pull request with the fixes you made, if you don't mind?
01:15hiredmanthe inability of (deftype Foo ...) to call (new Foo ...) in its methods is a real drag
01:16fmwnapping: http://paste.pocoo.org/show/495920/ still pretty horrible to read, but a lot better
01:16amalloyhiredman: really? it's always worked for me
01:16hiredmanI seem to get all kinds of classloader issues
01:16hiredmanwith 1.3?
01:16amalloyhiredman: haven't tried in 1.3
01:17chewbrancaamalloy: sure, just commented and deleted stuff but I'll get out a pull request
01:17hiredmanhmmm
01:17hiredmanactually it works at the repl, I wonder why it isn't working in my macro
01:18hiredmanah, I was doing it wrong of course
01:19fmwnapping: and here is the macroexpand-1 of the simpler macro that does work: http://paste.pocoo.org/show/495921/
01:20nappingfmw: looks where the arguments ended up - inside the calls to list
01:20fmwnapping: the body is different in those expands
01:21fmwthe working one expands the body fully, the one that doesn't work lists the gensym var for body
01:22nappingthe working one expands to a let that has the body spliced into it
01:22nattohas anybody watched Hickey's strangeloop presentation?
01:22nattohttp://www.infoq.com/presentations/Simple-Made-Easy
01:22nattoI've a question about "queues" that he says around 55:20
01:22nappingthe broken one expands to a loop that iterates over a list made from the spliced arguments, and has inside that a let whose body is the gensym variable named from "body"
01:23nattoif you have A calling B, and B is called whenever A calls it, you should "stick a queue in there" -- what does he mean by that and what's the clojure example?
01:23nappingI'm not explaining it very well at all, but you need to move the division between what's done in the macro and what's done at runtime
01:23fmwnapping: how do you mean? I only see one call to list: (clojure.core/list ["admin" :feed "edit"] but it doesn't seem to be inside that
01:24chewbrancaamalloy: https://github.com/flatland/lazybot/pull/31
01:24nappingthat's the one - that's all the arguments
01:24amalloyhiredman: should this perform the same as https://gist.github.com/1303118? i only see get0 about twice as fast as vector-nth
01:24napping(next line gets the body :foo)
01:25chewbrancaso debugging question for you guys, how would I determine that there was an error in info.clj from http://paste.lisp.org/display/125422 ?
01:28scottjchewbranca: I'd C-c C-k info.clj then re run the code that caused that error and hopefully NO_SOURCE_FILE:1 would be replaced with info.clj and the line number
01:28hiredmanamalloy: yes, that is the same code
01:28hiredman(I think I am on the osx preview release of java 7)
01:28amalloyinteresting
01:29nappingfmw: maybe more like this http://paste.pocoo.org/show/495926/
01:29amalloymy computer is much older and creakier, and using java 1.6
01:29chewbrancascottj: well that's the issue, I had no idea the issue was info.clj until I came in here and asked, just wondering if there is a better way to track it down that ask in here
01:29amalloybut for 1e9 iterations i get 28s and 41s respectively for tuples and vectors
01:30fmwnapping: ah, I thought that list call was the list call I had in the function
01:30fmwbut I removed that and it is still there
01:30nappingwell, it was all inside the `
01:30amalloyanyway, i'll fiddle with it some, just wanted to make sure i was working with the same code you were when you got those numbers
01:30hiredmansure
01:30nappingso your pretty much everything in the defmacro was copied into the call
01:30scottjchewbranca: yeah, make sure your code was compiled with C-c C-k not entered at the repl or C-x C-e that way functions not prefixed with clojure should have the right file and line number
01:31scottjchewbranca: you can setup emacs to highlight the function calls that are yours and dim builtin clojure ones
01:32hiredmanamalloy: yeah, the times I get for both are still within a second of what is in the gist for each
01:33chewbrancascottj: nice, I'll check that out
01:35fmwnapping: when I run that I get java.lang.Exception: No such var: vix.core/body (NO_SOURCE_FILE:20)
01:35fmw
01:37fmwnapping: I modified your code before running it though, into http://paste.pocoo.org/show/495929/ (just removed the (count) check)
01:37nappingoh, it needs a splice on body (not sure which kind, or if you need a do, etc)
01:38nappingwhy do you want to only get the count error when the code actually runs?
01:39fmwnapping: having that at compile time would be better indeed, but I removed it altogether for now to make it simpler
01:39nappinghmm, the base case is also wrong
01:42fmwnapping: ah, when I splice that with ~ it works (i.e. ~body)!
01:44fmwnapping: what do you mean about the base case being wrong, btw?
01:46mvidi dont really understand this error:
01:46mvidlib names inside prefix lists must not contain periods
01:47mvidwhat should i be looking for?
01:49amalloymvid: broken ns form
01:50amalloyit will look like (ns foo (:use (bar [baz.bang ...])))
01:50amalloyor the same thing with require/import
01:52nappingfmw: I think the recursion might run one step too many, or maybe I'm wrong about that
01:53nappingNo, it should be fine - if the size is even and cases is nonempty you'll get a body and a route pattern (other than nil)
01:54mvidamalloy thanks
01:54fmwnapping: I think so too, ~body is returned if that if clause is true. if it would run again it wouldn't execute correctly and it does
01:55fmwnapping: thanks a lot for your considerable help, I really appreciate it, as I was completely stuck (this was my first non-trivial macro)
01:56nappingGreat, I'm glad I made some sense
01:56fmwnapping: I don't fully understand what I did wrong yet, but I've got a clearer picture of it thanks to your code
01:57fmwnapping: basically, splitting the operation between compile time and run time (the first if-let at compile time, the second at run-time)
01:59fmwI think I also have a general idea of why the need to happen at their specific times, but I guess I'll have to dive deeper into macros before I will grok it completely
02:00fmwI guess they're hard to explain in this form, and the best way ahead is just to experience a sequence of "eureka moments" by rereading the macro chapters in my clojure books and writing a few more ;)
02:01nappingDo you know how macroexpansion works?
02:07nappingIt might be easier to understand if you write more as a function
02:11fmwnapping: I think I do, yes
02:12fmwalthough I still have to figure out the finer details of splicing etc (understand it generally, but need to learn about the specifics)
02:12fmwbut got some good books for that, thankfully
02:13nappingWell, then it's just the hard stuff you already mentioned
02:14nappingStill, it might help to write a defn rather than a defmacro, then you can call it with quoted things and see what happens without bothering with macroexpand-1
02:14nappingand make a defmacro that calls the function, to be able to actually use it in code
02:14fmwthe problem is that I've been fine without macros so far, so even if I read the relevant chapters in the clojure books I have that was months ago and I didn't use that information, so I've got to refresh it a bit
02:15fmwthe problem is that writing code without macros tends to give some less than elegant code sometimes (i.e. a lot more typing than when using a macro)
02:15fmwso started to refactor that
02:16fmwah, now I understand what you mean by writing more as a function
02:18fmwbtw, I might've said it already, but I really appreciate all the effort you've put into helping me understand my macro problem. I keep getting surprised by the helpfulness of this community :)
02:18nappingI'm pretty new myself :)
02:19fmwhow long have you been using clojure?
02:20nappingHmm, a few weeks? I looked over the design a while ago, though
02:20napping(mostly learned about macros in Scheme)
02:20fmwnapping: did you have a lisp background?
02:21fmwI've been using clojure for a couple of months now, but still have to explore some aspects of the language
02:21fmwah, yes, I'm planning to learn Scheme and Common Lisp soon as well
02:22fmwworking my way through SICP and the little schemer books, slowly ;)
03:03georgekhi, I just set up things for the first time in Emacs on Windows, and after clojure-jack-in I got this error, http://pastebin.com/wQej4hT4; lein swank works OK from the command line though
03:03georgekI used these instructions for set up, http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
03:33georgekOK, these additional instructions do the trick, http://sourceforge.net/apps/wordpress/codesounding/2011/09/29/installing-emacs-24-and-clojure-mode-on-windows-7-step-by-step/, the key is making sure you can run sh
03:45Blktgood morning everyone
04:58ejacksonmorning all
06:11ejacksonRaynes: you ever sleep ?
07:34G0SUBI think this new numeric tower changes is 1.3 are confusing a lot of people (not me)...
07:34G0SUBmay be we should document all the changes and the new semantics somewhere and widely circulate it.
07:35G0SUBthe current docs in the wiki are not clear enough, apparently
07:37ChousukeThere is a lot of reference-style documentation for Clojure but in-depth tutorials/explanations, essays or case studies seem a bit scattered
07:39ChousukeYou can find it on the interwebs but it requires some google-fu :P
07:56ljosIs there an easy way to do this in parallel? : (take 10 (repeatedly #(rand-int 100))) . This is a really trivial example, but if the function that is run by repeatedly is going to take some time, but is not affected by the other values I think it should be doable. I could do (pmap (fn [n] (rand-int 10)) (range 0 10)), but then I have to create a collection first. In my case, I do not care about the order of the resulting collection.
07:59raekljos: one way could be to use the .invokeAll method of ExecutorService (the underlying class that 'future', 'send', 'pmap', and others use)
08:00cemerickljos: use pcalls, and repeat instead of repeatedly
08:01raek(->> #(rand-int 100) (repeat 10) (.invokeAll exe) (map #(.get %)))
08:02raekljos: nevermind... :-) what cemerick said does the same thing, but with existing clojure functions
08:02ljos:)
08:02ljosThanks guys.
08:13ljos...mhm.. how do I pcalls to run on the return of the repeat? It is a collection and pcalls doesn't run on collections. I came up with this, but it seems excessive: (eval `(pcalls ~@(repeat 5 #(rand-int 10))))
08:20jcromartieljos: apply?
08:20jcromartie(apply pcalls (repeat 5 #(rand-int 10)))
08:20jcromartie,(apply pcalls (repeat 5 #(rand-int 10)))
08:20clojurebot(3 5 8 5 5)
08:21ljosI just found that :P
08:22ljosThank you though.
08:22jcromartieyeah :)
08:25babilenHi all. I am looking for a library for path manipulations that supports multiple OSs. In particular I want things like (for example) (expand-user "~") → "/home/babilen" (unix) or (path/join ["foo" "bar" "baz"]) → foo/bar/baz (unix) ... etc. Essentially os.path (python) in clojure ;)
08:26raekbabilen: clojure.java.io/file can join path segments in a OS-independent manner
08:26raek,(apply clojure.java.io/file ["foo" "bar" "baz"])
08:26clojurebot#<File foo/bar/baz>
08:26Chousukesee the documentation for Java Class library's File class too
08:28babilenOk, I'll investigate that ... thanks raek, I found file before but wasn't aware that you can use it like that. Hopefully Java's file class has something like expanduser
08:28babilenthanks for the pointers
08:29raek,(System/getProperty "user.home")
08:29clojurebot#<AccessControlException java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)>
08:30raekthat will give you the equivalent of ~, but I don't know how to get the home dir of any user...
08:33babilenraek: Well, that would be a start. But I still have to check if the string I am handed contains a ~ at the beginning and normalise it. I would have hoped that there is a comprehensive path manipulation library for clojure or java already. If something else crosses your mind just let me know. :)
08:46MasseR7win 21
08:47bhenry1i need some good resources on appending to a file. my data is too big to do it all in one shot
08:51cemerickbhenry1: FileOutputStream, clojure.java.io/output-stream, and clojure.java.io/writer can all append to a file instead of overwriting it.
08:51raekbhenry1: you can use an java.io.OutputStream (binary) or a java.io.Writer (text). the clojure.java.io namespace contains useful functions for constructing these objects
08:51bhenry1i am reading that spit appends if you set :append true
08:51bhenry1is that true?
08:51raekspit, c.j.io/writer, and c.j.io/output-stream takes an :append option
08:52raekbhenry1: yes
08:52bhenry1cool.
08:52raekbhenry1: one alternative is to use 'print' instead of 'spit'
08:52bhenry1that might work then. thanks for the info
08:52bhenry1print with *out* set to a file?
08:52raekyes
08:53bhenry1i think i'll try the spit append first.
08:53raek(with-open [out (io/writer "my_text_file.txt")] (binding [*out* out] (doseq [line some-lines-here] (println line))))
08:54raek*or*
08:54bhenry1raek: copied that into scratch in case i need it
08:55raek(with-open [out (io/writer "my_text_file.txt")] (doseq [line some-lines-here] (.write out line) (.newLine out)))
08:56bprcan i use the version of slime in marmalade with swank-clojure 1.4.0?
08:57raeka point: .write is far more lightweight than spit
08:58bpri updated swank-clojure last night, and now (after shutting down and restarting my system) it seems swank and slime aren't getting along.
09:47jcromartiewhat's the best way to read all of the bytes from a stream and throw away the results?
09:47jcromartiebecause, in true mutable OO fashion, this actually requires me to do so
09:47jcromartieI have a loop right now
09:47jcromartieand a buffer
09:47jcromartieI guess the buffer is non-negotiable
09:48jcromartie(doseq (take-while #(not= -1 %) (repeatedly (.read stream buffer)))
09:48jcromartieor something like that
09:49raekjcromartie: loop/recur is fine here
09:49jcromartieyeah https://gist.github.com/5ac9951ec2f012212580
09:50jcromartieseems to be pretty clear
09:50raek(loop [i (.read stream buffer)] (when-not (= i -1) (recur (.read stream buffer))))
09:51jcromartieyup
09:53TimMcjcromartie: THere's no way to just advance the buffer, or maybe read a known length out?
09:54jcromartieI don't think so
09:54TimMcjcromartie: InputStream.skip?
09:55TimMc s/buffer/stream/
09:55jcromartieah ha
09:55jcromartieInputStream.skip is the thing
09:55jcromartieinternally, it does read
09:55jcromartieinto a buffer (according to the docs)
09:56TimMcBy default, yes.
09:57TimMcSubclasses will do fancier things.
09:57jcromartieof course, calling (.skip stream Long/MAX_VALUE) might read it into a buffer of that size
09:57jcromartieso it's not a one-off operation
09:57jcromartieor it shouldn't be
09:58G0SUBcemerick, Howdy!
09:58jcromartieand calling skip more than once might reallocate the buffer each time
09:59cemerickG0SUB: :-)
09:59raekjcromartie: note that skip returns the number of bytes actually skipped.
09:59cemerickI always forget that that's a zero, not an 'o'.
09:59jcromartieyes
09:59G0SUBcemerick, I hope you got my email...
09:59fhdI bet someone here has a clever piece of code that sets the inferior-lisp-variable depending on whether this is a Leiningen, Maven, cake etc. project?
09:59cemerickG0SUB: I did; no worries :-D
09:59jcromartienow... here's something I have always wondered: when people do operations involving buffers, they usually pick a power-of-2 size
09:59jcromartieis that just habit?
09:59jcromartieI know there are reasons to align memory in C
09:59jcromartiebut in Java...
09:59jcromartie?
09:59G0SUBcemerick, that's due to historical reasons, when I registered the nick, O was taken.
09:59cemerickSorry for not replying, I'm lacking bandwidth these days.
09:59pjstadigjcromartie: we like round numbers
09:59jcromartie:P
10:00G0SUBcemerick, I completely understand that. That's why I didn't bug you further.
10:00cemerickG0SUB: you'll be at the Conj, I trust?
10:00G0SUBcemerick, can/should we do something to explain the new numeric tower changes to the masses?
10:00G0SUBcemerick, absolutely!
10:01G0SUBcemerick, I fear this might be a PR disaster...
10:01cemerickThe maths stuff is the PR disaster?
10:01G0SUBcemerick, no, the lack of docs explaining the rationale.
10:01G0SUBcemerick, I am personally fine since I have taken the time to understand the implications
10:03cemerickThere's lots of material out there, including http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics
10:03G0SUBcemerick, the current thread is making me uneasy...
10:03cemerickheh
10:03G0SUBcemerick, I know, but apparently that's not clear enough
10:03cemerickThere was one a while back that was 100's of messages long :-)
10:04stuarthallowaymy conj talk will cover the numerics stuff
10:04stuarthallowayand if nobody writes good docs before then I will
10:04G0SUBcemerick, true, and I read that too. and now this, with Nathan "proposing" certain very broad and breaking changes.
10:04cemerickI think few people understand the complexities of JVM numerics, prims / boxed, etc etc.
10:04stuarthallowaybut I would be thrilled if somebody else did it
10:04G0SUBstuarthalloway, I wish I were qualified enough to do that...
10:05G0SUBpeople are not understanding that new semantics are actually simpler and way better than the one before.
10:05`fogusG0SUB: One way to become qualified is to write about it. :-)
10:05cemerickI take this as similar to immutable data structures. Clojure provides them, there is a (pleasant) degree of interop, but it's not going to buy into broken semantics wholesale.
10:06G0SUB`fogus, ;-)
10:06cemerickG0SUB: All of the books coming out after 1.3 will address it, presumably.
10:06stuarthallowayI don't think it belongs in an intro book
10:06jcromartieyay for long and double
10:06jcromartiethat's a step in the right direction
10:07G0SUBcemerick, yeah, that'd be great.
10:08cemerickstuarthalloway: I don't like the intro / advanced dichotomy.
10:09cemerickI think you can do gentle-come-hither, talk turkey on tools and practical libraries, and do fuck-you-hardcore all in one book.
10:09G0SUBcemerick, all in < 500 pages?
10:09cemerickor, I hope that's practical, or we're going to bomb
10:09ziltiIs clojure slime really as broken as it seems? (As broken as in "type an expression in the slime REPL and get half-a-minute pc-beeps and error messages")
10:10cemerickG0SUB: I hope so, 'cause I'm not writing any more pages. :-P
10:10G0SUBzilti, not in here.
10:10G0SUBcemerick, hehe
10:10zilti"error in process filter: Wrong type argument: characterp, nil"
10:10jcromartiezilti: nope
10:10cemerickI guess people's definitions of hardcore will vary, but *shrug*
10:10jcromartiezilti: sounds like an Emacs lisp error
10:11G0SUBzilti, could be related to the encoding system of swank
10:11`foguscemerick: So you have a chapter on Fexprs then?
10:11ziltihmm
10:11`fogus;-)
10:11G0SUBzilti, (setq slime-net-coding-system 'utf-8-unix)
10:11cemerickdammit
10:12cemerick`fogus: OK, 3 more pages, just for you ;-)
10:12`fogusSweet!
10:12G0SUBzilti, try evaluating this and try again.
10:13ziltiG0SUB, evaluate in *scratch* didn't help - will try it in SLIME repl as soon as it stops beeping
10:14G0SUBzilti, eval this in *scratch*
10:14G0SUBzilti, and then reconnect
10:14G0SUBzilti, of course, this could be completely unrelated.
10:15ziltiOh. Have to restart emacs first. Emacs is acting completely weird now. M-x results in error message.
10:16G0SUBzilti, ah, somehow your emacs is borked.
10:16ziltiHad to sigkill it now
10:17ziltiG0SUB your setq didn't help - now autopair works in REPL but I'm still getting the same errors
10:18G0SUBzilti, hmm, strange. which emacs is this? which OS?
10:18ziltiEmacs 23.3 on Linux 3
10:18zilti(Opensuse Tumbleweed)
10:19G0SUBzilti, you shouldn't face any problems with that.
10:19ziltiThat's the theory, yes
10:20ziltiI even changed my slime version - I first used the "frozen slime for clojure compatibility" and now switched to the current cvs version. No difference. Btw the REPL still shows "20100404"
10:20G0SUBzilti, really unfortunate. It has always worked flawlessly for me/us.
10:20G0SUBzilti, the current slime won't work with clojure.
10:21G0SUBzilti, you'll need the forked slime IIRC.
10:21simardzilti: remove anything related to slime in your .emacs
10:21simardthen get clojure-mode from marmalade
10:21simardthat did it for me yesterday
10:22simardI also removed the (setq inferior-lisp-program...) part
10:22simard(from my .emacs file)
10:22ziltiI don't have that in my .emacs
10:23simardare you doing a (require 'slime) in your .emacs ?
10:23G0SUBzilti, you can also try using my emacs system. it has built-in support for clojure. but then you'll have to throw away your own .emacs temporarily.
10:23G0SUBzilti, https://github.com/ghoseb/dotemacs
10:23AWizzArd2I could suggest to use the Emacs Starter Kit. There install just clojure-mode and install Leiningen. Then you can simply double click one of your code files so that Emacs opens and do M-x clojure-jack-in and you will have a running slime session that works.
10:24ziltiStill get the same problems.
10:24G0SUBzilti, with my setup, you won't need to do anything. just get the submodules.
10:26simardzilti: I also did a lein upgrade, lein plugin install swank-clojure 1.3.3, removed anything related to slime from my .emacs file and restart it, then M-x clojure-jack-in worked..
10:26ziltiG0SUB where's the clojure config part?
10:26G0SUBzilti, config/slime.el & config/clojure.el
10:27ziltisimard: It's not that clojure-jack-in doesn't work - the slime repl doesn't
10:29ziltiG0SUB: And where to get the compatible slime again?
10:29G0SUBzilti, https://github.com/technomancy/slime
10:32G0SUBzilti, Clojure mode is here https://github.com/technomancy/clojure-mode
10:33ziltiI have clojure mode already
10:33bprdoes anyone know why i'd get a FileNotFoundException in sldb when hitting C-c C-l in a file? I am able to do C-c C-k on that file just fine...
10:33bprswank-clojure 1.3.3
10:34zilti"Versions differ: 2009-10-15 (slime) vs 20100404 (swank). Continue?"
10:34ziltiAnd still having the same problem.
10:34G0SUBzilti, yes.
10:35G0SUBzilti, which swank-clojure do you have?
10:35zilti1.3.3
10:35bprbtw, the message on that exception is: /home/brian/projects/rd-web/src/rd (Is a directory)
10:36G0SUBzilti, I have no idea why that's not working
10:38ziltiWhat about that it's still even now "SLIME 20100404"? Is that the correct version?
10:39bpri have 20100404.1 and swank-clojure 1.3.3 and things are working (largely)
10:39ziltihmm
10:41AWizzArd2Slime is not required anymore with a current setup.
10:41AWizzArd2clojure-jack-in will download a working slime automatically.
10:44arohnerhas anyone seen java.lang.ExceptionInInitializerError when using midje?
10:44ziltiAWizzArd2: Obviously it is downloading a broken slime
10:45AWizzArd2On my compi it works.
10:45AWizzArd2Together with Emacs 24, the Emacs Starter Kit and clojure-mode and Leiningen.
10:46bprAWizzArd2: iirc insalling clojure-mode with elpa pulls slime 20100404.1 in as a dependency
10:46bprinstalling*
10:47bpri could be wrong though... i have other things installed that might have listed slime as a dependency. so take that with a large grain of salt
10:47AWizzArd2in my elpa folder I have nothing that looks like slime. But: when I do c-j-i then in my .emacs.d I will get a folder swank/ into which two slime files get downloaded.
10:48bprall I have to say is thank god for technomancy
10:48bprAWizzArd2: ok, i must be wrong
10:48AWizzArd2Better let's thank his parents, I guess those exist :-)
10:48bprhaha
10:49AWizzArd2Now I just need to find a sane way to use Midje with Leiningen.
10:49AWizzArd2Writing tests and constantly going to the command line to run "lein midje" is too time consuming.
10:56arohnerAWizzArd: are you an emacs user?
10:57arohnerAWizzArd: https://github.com/marick/Midje/wiki/Midje-mode
10:58arohnerAWizzArd2: ping the right username
11:02AWizzArd2arohner: oh good, that looks like the thing I wanted
11:17AWizzArd2Whenever I do clojure-jack-in a buffer *Compile-Log* opens which tells me that it is compiling the two files in ~/.emacs.d/swank/. How can I turn this feature off, if those files already exist in compiled form in that folder?
11:27AWizzArd2arohner: how can I enable midje-mode by default? What the wiki describes (using require) doesn't work for me. Slime is not present when Emacs is started, only after clojure-jack-in was done. How can I add a hook so that after c-j-i was successful the midje-mode will be entered?
11:28arohnerAWizzArd2: I have (require 'midje-mode) (add-hook 'clojure-mode-hook 'midje-mode) in my .emacs
11:28arohnerso it's enabled any time you're in clojure mode
11:29AWizzArd2Unfortunately this require thing doesn't work for me.
11:29arohnerif require midje-mode doesn't work, it's probably not installed in the right location
11:29arohnerwhere did you put it?
11:30tylereIs Programming Clojure still the recommended beginner book? It seems like it would be a bit out date by now
11:30tylereI bought the pdf a while back but never really got in to it
11:30AWizzArd2I did a M-x package-install midje-mode ==> that downloaded it from the Marmalade repository and installed it into ~/.emacs.d/elpa/midje-mode/
11:30tsdhWhat's the right maven syntax to specify in my leiningen deps that I want clojure 1.3.0 or better, but less than 1.4.0?
11:31AWizzArd2And I can activate it manually, after c-j-i via M-x midje-mode
11:31arohnertry putting (require 'clojure-mode) (require 'swank-clojure) before the (require 'midje-mode)
11:33AWizzArd2I can also not require clojure-mode.
11:34AWizzArd2For example, to get paredit working on Clojure I did: (autoload 'paredit-mode "paredit") (add-hook 'clojure-mode-hook (lambda () (paredit-mode +1)))
11:34tsdhAh, got it: [org.clojure/clojure "[1.3.0,1.3.9999)"]
11:35arohnerAWizzArd2: is there anything in your .emacs about loading elpa or the clojure starter kit?
11:35arohneror (package-initialize)?
11:35AWizzArd2The .emacs file doesn't exist. All configs are in ~/.emacs.d
11:35tsdhAnother thing: is it possible to query leiningen (or maven) what package pulled in some dependency?
11:35AWizzArd2Today many emacs user seem to not use the .emacs style anymore.
11:35arohnertsdh: lein pom && mvn dependency:tree
11:36tsdharohner: Excellent, thank yeu.
11:37tsdharohner: mvn dependency:tree seems to download the complete internet...
11:37arohnertsdh: yeah, it only does that occasionally...
11:37arohnerlike the first time you use it that day
11:37tsdharohner: Well, it's never bad to have a backup, right? ;-)
11:38jcromartiehow can I write the dispatch value for a multimethod on a byte array?
11:38jcromartie[B doesn't work
11:38jcromartieah
11:38jcromartie,(Class/forName "[B")
11:38clojurebot[B
11:40gfredericksdoes anybody know the url to use for maven central in the lein repositories definition?
11:41gfredericksit is apparently hard to google for :/
11:41cemerickgfredericks: it's implied, you don't have to have it in there
11:42arohnergfredericks: like cemerick said, you shouldn't have to specify it, but if you're curious, http://repo1.maven.org/maven2
11:42gfrederickscemerick: but when I add a special repo it now asks for everything from there rather than maven central
11:42AWizzArd2It would be interesting for me to know the ips of all repos. So I could configure my firewall correctly…
11:42gfredericksarohner: thanks
11:42arohnerit's in leiningen/core.clj
11:42gfredericksit took 3 minutes to download mysql-connector :(
11:42gfredericksarohner: noted
11:42AWizzArd2I saw that my Leiningen tried to contact "jboss" and something with "sonatype" in the name.
11:43AWizzArd2grepping the Leiningen sources didn't reveal any mappings
11:43cemerickgfredericks: Ah, sure. Easy way to specify your local proxy repo, that is.
11:43cemerickI think that was along the lines of a lein patch I got in a while back, though I don't know if it's been rolled into a release yet.
11:44tsdhamalloy_: Why does ordered-0.3.0 depend on clojure-contrib-1.2.0? It doesn't use anything of it at all. And probably the dependency on ordered-set-0.2.2 only for benchmarking purposes might not be warranted.
11:50bprwhat's the best way to cause the slime repl to dump a namespace and reload it from source?
11:57jcromartieI want to get a SHA-1 hash of a Clojure map
11:57jcromartieis that feasible?
11:58jcromartieobviously everything needs to be sorted
12:00raekjcromartie: then you first need to define a mapping from clojure maps to sequences of bytes
12:00jcromartieyeah that is the tricky
12:00jcromartiepart
12:01jcromartieespecially if I want (= (sha-1 {:x 1 :y 2}) (sha-1 {:y 2 :x 1}))
12:01raekif you just want _a_ hash value that's consistent within the JVM instance, you could use .hashCode
12:01bpri don't know if you'll find it helpful, but gloss is a great way to define a mapping from clojure data to bytes
12:02bprhttps://github.com/ztellman/gloss
12:02raekthere is of course the _very_ naive (-> m (pr-str) (.getBytes "UTF-8"))
12:02bprbut of course as raek alluded, there's also clojure.core/sorted-map and clojure.core/hash
12:03bpryup
12:04raekjcromartie: one idea is to define your own Hashable protcol and implement it for clojure data structures
12:04jcromartieyah
12:04fliebelTalking about Gloss, can it do little endian and padding?
12:06raek(extend-protocol Hashable IPersistentMap (sha-1 [m] (let [ks (sort (keys m))] (reduce combine-hashes initial-hash (apply concat (for [k ks] [(sha-1 k) (sha-1 (m k))])))))
12:06bprfliebel: it can def do padding
12:06raekthen you could define this "sha-1" recursively
12:07bprfliebel: as far as little endian, i'm not sure how easy that will be. It uses java.nio.ByteBuffer so it's def possible
12:07fliebelbpr: How? I need to have some things 16-bit aligned.
12:07CozeyHello. which appengine library would you recommend? appengine-clj, appengine, appengine-magic ?
12:07bprfliebel: I just don't know whether the endianness is exposed via the api
12:08bprCozey: I've had good success with appengine-magic
12:08raekso the sha-1 of a collection would be based on the sha-1 of its elements in some specific way
12:08Cozeybpr: thanks, i'll try it
12:09opqdonutraek: making that as good as SHA-1 is probably nontrivial
12:09opqdonutand if the "good" properties of SHA-1 aren't needed then .hashCode is the right thing, I guess
12:11jcromartieopqdonut: well I already have a sha-1 function that can hash it's own output (byte arrays)
12:11jcromartieso it's well on it's way
12:12opqdonutI mean making the combine-hashes be robust against collisions etc
12:12jcromartieit's not a protocol but it's multimethods
12:12jcromartieopqdonut: what if the hash of, for example, a seq was the hash of the concatenation of all of it's members?
12:12jcromartieits
12:12opqdonut_that's_ fine
12:13opqdonutas long as you only hash once you're safe, I think
12:13bprfliebel: I would recommend checking on the aleph google group, but it seems that 16-bit alignment could be achieved using finite-blocks
12:13fliebeljcromartie: you could have a look at how String does it
12:13jcromartieI mean
12:13jcromartiethe hash of the concatenation of the hashes of its members :)
12:13opqdonutthat's probably less fine
12:13fliebelbpr: aleph? for gloss?
12:13opqdonutbut I guess my point is What Do You Want To Do?
12:13jcromartielike, (sha-1 (mapcat sha-1 some-vector))
12:13bprwell, the aleph group discusses gloss, lamina, and aleph
12:14jcromartieopqdonut: actually, I don't have a purpose for this yet :P
12:14bprbut the software library you'd be using would be gloss
12:14jcromartieI just started writing a sha-1 multimethod for streams, strings, files
12:14cemerickIs there a corollary to *e in Ruby/irb?
12:14jcromartiewhich I do have a use for
12:14jcromartiecemerick: $!
12:15opqdonutI mean, if you're doing something security-related, hashing hashes isn't okay a priori
12:15opqdonutif you just want to do content-based addressing or something, then it is
12:15jcromartieit's not security related
12:15jcromartiebut maybe the Clojure/Java hash of the object is good enough?
12:15jcromartieI mean, is that supposed to be a perfect hash?
12:16jcromartieit's good enough for Clojure's comparison operators, right?
12:16opqdonutit's supposed to be a hash
12:16opqdonut:)
12:16opqdonut.hashCode tends to work well for hash tables in practice, for instance
12:16jcromartiebut Clojure's ##(hash {:x 1 :y 2}) is decent
12:16lazybot⇒ 2027824014
12:17opqdonutin general, if you combine hashing functions (i.e. first apply one, then the second), the resulting hash is as weak as the weaker of the hashing functions
12:18opqdonutbut this is getting slightly academic. do whatever you want.
12:18jcromartie##(map hash [(range 10) [0 1 2 3 4 5 6 7 8 9] '(0 1 2 3 4 5 6 7 8 9)])
12:18lazybot⇒ (-1631921466 -1631921466 -1631921466)
12:19jcromartieanyway, I'm out of my league here... I don't have a specific need for this quite yet
12:19jcromartieI *do* have a need for quick polymorphic hashing of strings and streams
12:19jcromartiewhich I've got
12:19jcromartieso
12:19jcromartieoff I go!
12:20cemerickjcromartie: Thanks :-)
12:20cemericksimilar, but doesn't persist outside of the rescue block, it seems.
12:20jcromartiehm
12:21jcromartieBTW cemerick I always keep this on hand when doing Ruby http://www.zenspider.com/Languages/Ruby/QuickRef.html
12:21jcromartieI don't know if it's out of date but it's usually very handy
12:22cemerickjcromartie: I think it's accurate. $! just seems to be reset once you clear the rescue block. Useful for catching all errors, I guess.
12:22jcromartieyeah
12:23jcromartieor on the REPL
12:23jcromartieI believe
12:23jcromartieor, not... never mind!
12:23cemerickheh :-)
12:23cemerickseeing that reference page really drives home how perl-inspired ruby is
12:23cemerickor, perl-influenced
12:25jcromartie$> << $!.to_s
12:25cemerickOf course, why didn't I think of that! :-P
12:25`fogusjcromartie: highly useful. Thanks!
12:26jcromartieactually just $> << $! is enough to print the message :P
12:26jcromartieyuck
12:26cemerickI still don't know what it does
12:26cemerickeval'd to #<IO:0x100178b98>
12:27jcromartieit will return the output stream, but print the exception
12:28jkkramerbut it's so *easy*!
12:29cemerickNo. No, it's not. :-)
12:29ejacksonand its so FUN,FUN,FUN
12:29jcromartiehah
12:29cemerickMy brain does not have a gem-shaped hole, it turns out.
12:29jcromartieI do whip up Ruby scripts to do stuff
12:29jcromartiebuild tasks, etc.
12:29jcromartiea messy language for messy projects
12:30cgrayis it possible to show other people your solutions to problems on 4clojure?
12:30jcromartieI use Rake to run builds, DB migrations, and generate config files for a .NET web app
12:30ejacksonhah, I've spent the last few days translating mathematica into matlab, you wanna talk messy with me.
12:30jcromartieheh yes
12:31jcromartiematlab is insane
12:31ejacksonbring a mop buddy :)
12:31jcromartieit drove my wife to tears in school
12:31jcromartieand she did fine in C++
12:31jcromartieactually, no, that was tears too
12:31jcromartiebut less tears
12:31cemerickejackson: That sounds absolutely soul-crushing
12:31ejacksonwe
12:31ejacksondoes what we must to pays the rent
12:32ejacksoni might get a reduction in rent if there is one less soul present, you think ?
12:34jcromartieejackson: that's the opposite of how it usually works, isn't it?
12:34jcromartieejackson: with various souls splitting the rent
12:34ejacksonon a rent per soul basis, yes :)
12:37ejacksoni was especially tickled by being sortof forced to use a for loop, using i as the index, and then discovering that i was no longer sqrt(-1) for the rest of the surrounding scope. hahaha. keep eyes open in the dark forest of mutability.
12:39TimMcAssignment leads to mutation. Mutation leads to pointers. Pointers lead to suffering!
12:40ejacksonha ! yes indeed.
12:41jcromartie(inc TimMc)
12:41jcromartie(does that still work?)
12:41TimMc(from http://www.ccs.neu.edu/home/matthias/)
12:43ejacksonits good to relearn your lessons from time to time. like playing scales. in this case on a keyboard of needles.
12:43ejacksonnot that i'm whining :)
12:44jcromartieso
12:44jcromartiethere's this debate over wether SHA1(SHA1(SHA1(... SHA1(x)))) is good enough right?
12:44jcromartien times
12:45jcromartiefor login purposes, I can just take the 500,000th hash of a password, which takes about a second on my machine
12:46ejacksonbest lest n approach infinity to be sure.
12:46raekjcromartie: git also uses some SHA alorithm for something that looks like what you're doing
12:46jcromartieso I just made cracking salted SHA-1 passwords half a million times slower
12:46jcromartier
12:46jcromartieight
12:46jcromartie?
12:46jcromartienow this is the security realm
12:46jcromartienot the file content index realm
12:48simardis there a reader syntax for floats ? ie.: (type 0.5) evals to double, and 0.5f will not work
12:48stuarthallowaysimard: clojure 1.3 does not use floats internally
12:49simardok so I should use gl*d instead of gl*f by default then
12:49simard(opengl)
12:50simardstuarthalloway: btw, I like your book.
12:52TimMcjcromartie: bcrypt!
12:52TimMcWhy use a fast hash when you can use a slow one?
12:53tolstoyRead through the whole core api last night. Probably a good thing to do every other day while learning. Lots of stuff there I keep re-inventing!
12:54tolstoyBut then I saw "seque". What's it about?
12:54jcromartieTimMc: why use a slow when when you can use a fast one many times?
12:54tolstoyI read http://clojuredocs.org/clojure_core/clojure.core/seque, but I'm not sure why seque is any different than lazy-seq or just list or something.
12:54jcromartieI really don't understand why (nth (iterate sha-1 x) 500000) isn't sufficient
12:54jcromartieI mean
12:54jcromartieam I missing something?
12:55technomancy`jcromartie: at the very least you're missing the fact that you're not cryptographically qualified to know whether you're missing something. =)
12:55llasramtolstoy: Realizes the backing seq in a different thread. Could allow parallelizing different steps of serial processing pipelines implemented in terms of lazy seqs
12:56jcromartietechnomancy`: no, I know that
12:56tolstoyllasram: Ah. Doesn't say anything about an additional thread in the doc-string.
12:56jcromartietechnomancy`: I'd like to know what's going on though
12:57tolstoyllasram: Ah, I see, "in the background" is the clue.
12:58chewbrancaI find it funny that people are absolutely freaking out that he's using iterated sha over bycrypt, when the really security issue at hand, is don't make your database public..
12:59technomancy`weeeeeell it never hurts to have multiple lines of defense
12:59pjstadigit doesn't?
13:00llasramtolstoy: Yeah, might be obscure. If found it crawling through source, so I saw how it used an agent :-)
13:01chewbrancaabsolutely, iterated sha is another line of defense, but my point is that the people responding are acting like its going to be the end of the world that he's not using bcrypt; just too much troll bike shedding for my tastes
13:01tolstoyllasram: Might be a cool way to wrap a rabbitmq-consumer.
13:04jcromartieyeah, pretty much chewbranca
13:04cemerickyikes, switching to a namespace stomps all over any vars whose names match those usually referred in from clojure.repl
13:05technomancy`well, the only reason he was inventing his own crypto scheme over bcrypt was to avoid pulling in another dependency.
13:06raekcemerick: are you using 'ns' instead of 'in-ns'?
13:07cemerickraek: no
13:07cemerickI wonder if it has always been thus
13:13stuarthallowaycemerick: has been thus since clojure.repl was added
13:13stuarthallowayrhickey finds it irritating too, but the semantics are consistent. There is no stomping
13:14jcromartiehttps://gist.github.com/3bac44cdcdbb27fbb75b
13:14stuarthallowaythe goal of having the repl vars at hand competes with the goal of getting the repl vars out of core
13:14jweissdoes slime-who-calls work well for emacs users here? For me, i get different results depending on which reference i run it from (even if they're calls to the same fn)
13:15jcromartie(depends on an unlisted sha-1 function but... you get the idea)
13:15technomancy`jweiss: the heuristic it uses is very naive. I wouldn't trust it much over a fancy jar-aware grep.
13:15jcromartiethat's bcrypt, basically
13:16jweisstechnomancy`: if you want to change a fn's arguments, what do you use to find references?
13:16jcromartieOK I've gotta stop
13:16jcromartieI'm out of my depth and this is silly
13:16cemerickstuarthalloway: If my source file's namespace defines doc, I can load it, and evaluate evaluate somens/doc. If I switch to somens, doc and somens/doc both resolve to repl/doc. Seems like complete stompage.
13:16jweissjust plain grep (even though that gets false positives)?
13:16technomancy`jweiss: yeah
13:16jweissok
13:17technomancy`it occurs to me that the new dynamicity changes require functions to store references to the defns they use to support redef
13:17technomancy`which could possibly be leveraged to create badass refactorisms
13:18hiredmantechnomancy`: hmmm?
13:19nickmbaileythat might be the best word i've ever heard
13:19technomancy`cemerick: maybe that too; the possibilities are endless.
13:19technomancy`hiredman: well, each downstream consumer of a non-dynamic defn must be updated when the defn is recompiled, yes?
13:19hiredmanno
13:20hiredmanthat's not how non-dynamic vars work
13:20cemericktechnomancy`: you're thinking of the defunct ^:static
13:20hiredmanit just removes the need to check for a threadlocal binding
13:20technomancy`cemerick: no, this was from the conj
13:21technomancy`something about keeping track in a static field that hotspot inlines better than standard var lookup
13:21hiredmanno, you are mixing it up
13:22hiredmanif a var is not dynamic, the compiler emits a call to getRawRoot on the var
13:24hiredmanvars are always stored in the "constant pool" of a fn
13:24hiredman(a bunch of static fields)
13:24hiredmanand have been since at least 1.2
13:24technomancy`hiredman: ok, so you're saying this isn't necessarily new
13:24technomancy`gotcha
13:25hiredmanjavap mode some aot'ed fns
13:25technomancy`either way doesn't it seem ripe for a refactoring tool?
13:26hiredmanI dunno, what kind of refactorings?
13:27technomancy`I was thinking specifically of arglist changes like jweiss was doing
13:29hiredmantechnomancy`: don't see how having a list of vars works with arglists
13:29technomancy`not necessarily automated refactoring, but "I'm gonna change this defn; please to identify the spots that will need to be updated."
13:29technomancy`though things like the removal of an argument would be trivial to automate
13:30jweissi would think this should be possible today in theory, since slime-edit-definition works reliably
13:31jweissbut then again my theory might require every symbol to be analyzed
13:33simardis it possible to use (apply) on a static class function ?
13:34jweisssimard: you mean static method?
13:34simardjweiss: yes
13:34jweissi believe the answer there is no
13:35jweissmethods aren't fns
13:35jweisssomeone with better java-integration fu than me can tell you the way it's done :)
13:35technomancy`is it just me, or is the number of hits per page on lein search too small?
13:37stuarthallowaycemerick: I am not seeing the stompage you report. Is it possible that some tool is trying to help you by automatically using clojure.repl on your behalf
13:37stuarthallowaysounds like the kind of convenience that technomancy might add :-)
13:38technomancy`what's that? cemerick switched to Emacs?
13:38stuarthallowaytechnomancy: not that I know of, just poking fun
13:39technomancy`oh you know me; I love a good unsubstantiated rumour.
13:40jcromartieoh look http://www.infoworld.com/d/application-development/microsofts-roslyn-reinventing-the-compiler-we-know-it-176671
13:41jcromartiea REPL
13:41jweissi saw that ^ didn't sound that revolutionary to me either
13:41jcromartienext year it will be persistent data types
13:41jcromartieor STM
13:42technomancy`nah they already tried an STM and couldn't make it work
13:44tncardosowhy 4 clojure block nth? http://www.4clojure.com/problem/21
13:44jweissi wonder when will be the last time someone claims as new something lisp has had for decades... probably still decades away
13:46jcromartietncardoso: to make you implement nth yourself :)
13:46tncardosojcromartie: ok :)
13:47tncardosojcromartie: the message is "nth is bad!", i thought it was a bad practice
13:47sridthat problem doesn't block nthnext though
13:47sridthen, a solution could be: #(first (nthnext % %2))
13:48sridor, #(first (drop %2 %))
13:53llasramHuh. Apparently running `pmap' over a chunked seq causes futures for the operations to be realized 32 at a time, no matter how many CPUs you have
13:53llasramWell, I guess 64 at a time if you have >32 CPUs, etc
13:54llasramI wonder if that would be considered a bug?
13:54dnolenllasram: you can defeat chunking by wrapping in a lazy-seq that enforces one at a time.
13:54llasramdnolen: Oh, sure. I've got my `seq1' handy
13:55llasramdnolen: Was just surprised pmap didn't do it implicitly.
13:56dnolenllasram: worth bringing up on the clojure-dev ML
13:56llasramkk. Will-do
14:12TimMcjweiss: Never.
14:13jweissTimMc: you may be right
14:21TimMcMaybe the average age of LISP-reinventors will decrease. :-)
14:22amalloyTimMc: increase, as time progresses and the same things are reinvented
14:29bprCan someone tell me what I'm doing wrong: https://gist.github.com/1304564
14:29jweissbpr - you can't type hint as bytes
14:29bprthe last line is the compiler's error message
14:30bprwhat's the hint?
14:30bpri thought ^(type)s meant an array of that type
14:30jweissoh maybe i'm wrong, but that didn't look right to me
14:31jweissyeah i guess that is correct
14:32TimMcThere is a bytes function...
14:32dnolen,(class (byte-array))
14:32clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$byte-array>
14:32dnolen,(class (byte-array []))
14:32clojurebot[B
14:32dnolen^"[B"
14:32dnolenis what you want
14:32bproh rly?
14:33bprthanks!
14:33dnolennp
14:33TimMc,(prn (class (into-array ["foo"])))
14:33clojurebot[Ljava.lang.String;
14:33TimMc&(prn (class (into-array ["foo"])))
14:33lazybot⇒ [Ljava.lang.String; nil
14:35TimMc,(.getName (class (into-array ["foo"]))) there we go
14:35clojurebot"[Ljava.lang.String;"
14:35bprhrm, now the compiler says: java.lang.NoClassDefFoundError: java/lang/[B
14:36TimMc,(doc shorts)
14:36clojurebot"([xs]); Casts to shorts[]"
14:37TimMcbpr: You didn't put quotes around it.
14:38bpryes i did
14:38TimMchmmm...
14:38TimMcYou're right... that's a different error!
14:39TimMc,^"[B" (byte-array 0)
14:39clojurebot#<byte[] [B@2ad3e6>
14:39TimMc&^"[B" (byte-array 0)
14:39lazybot⇒ #<byte[] [B@14aa3df>
14:39bprare clojurebot and lazybot running 1.3?
14:39bpri'm using 1.2.1
14:39TimMcOne of each.
14:40bprah
14:40TimMc,*clojure-version* ##*clojure-version*
14:40clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
14:40TimMc&*clojure-version*
14:40lazybot⇒ {:major 1, :minor 2, :incremental 0, :qualifier ""}
14:44TimMcbpr: I see, it only errors once you try to reify.
14:45TimMcbpr: http://dev.clojure.org/jira/browse/CLJ-737
14:46bsod1anyone knows why while editing clojure files with vimclojure, `o` in normal mode takes too much time? A<enter> is instant, but `o` takes about a second on my machine?
14:48TimMcbpr: Fails in 1.2.1, works in 1.3.
14:48bprTimMc: ok. thanks
14:57ghiuhi, i defined *db* like this (def *db* {:classname "org.sqlite.JDBC" :subprotocol "sqlite" :subname "/Users/gu/dev/org.github.pistacchio.deviantchecker/resources/data/data.sqlite"}) the file exists and has the correct table
14:57ghiuwhen i try to access it like this (sql/with-connection (sql/with-query-results res ["select * from galleries"] (into [] res)))
14:58ghiuthis is what i get
14:58ghiujava.lang.Exception: no current database connection (NO_SOURCE_FILE:0)
14:58ghiuhow come it can't find it?
14:58amalloyTimMc: lazybot's ## is a bit quirky (on purpose) - it only activates if the thing you're trying to eval is a collection of some kind, like ##(list *clojure-version*)
14:58lazybot⇒ ({:major 1, :minor 2, :incremental 0, :qualifier ""})
14:59amalloythat is, if the form you want to eval is a collection. the eventual value doesn't have to be. so eg ##'1 works because (quote 1) is a collection, but ##2 doesn't
14:59lazybot⇒ 1
15:00amalloythis is basically to prevent him from annoying people who are trying to talk about ##java or whatever
15:05amalloyghiu: i don't think just defining *db* does anything. you need to pass it to some sql function/macro, probably sql/with-db or sql/with-connection or something
15:05zackmarilLet's say I am using clojure-jack-in and evaling a file. If I am trying to :use clojure.contrib.math and I am getting an class path error, what could be going wrong?
15:07raekzackmaril: and you have added contrib as a dependency in project.clj?
15:08zackmarilYes. Is this right? [org.clojure/clojure-contrib "1.2.0"]
15:11raekzackmaril: yes. have you run lein deps since you added that?
15:11raek(and restarted the swank server)
15:11zackmarilAh! That could be key
15:12zackmarilThat did it!
15:12zackmarilThank you
15:18ghiuamalloy: i use with-connection, if you read a couple of rows after the definition :D
15:18amalloyghiu: you didn't pass *db* to with-connection
15:19ghiuoh, you're right, but i just past the wrong line, this is the one still not working: (sql/with-connection *db* (sql/with-query-results res ["select * from galleries"] (into [] res)))
15:20gar3thjon3shas anyone noticed that the *slime-repl* buffer does get created in emacs-starter-kit v2 and emacs 24? (im using outside of a lein project, starting ~/.lein/bin/swank-clojure and doing M-x slime-connect in emacs)
15:21gar3thjon3s*does not
15:21seancorfieldquick Q about *ns* - if i'm in a function inside ns foo.bar should I expect *ns* to be foo.bar or the namespace from which the function is called?
15:23chouserI'm not sure *ns* has any real meaning at runtime
15:23chouserI think It's the namespace being compiled at the moment, which is the current REPL namespace when you're in a REPL.
15:24hiredmanseancorfield: it will most likely be clojure.core
15:24hiredman(when running in production)
15:26seancorfielda quick repl experiment shows it's the namespace that originated the "request"... so, is there something that yields the actual "current" (compiled) namespace?
15:27opqdonutyou can get it load-time
15:28seancorfieldi'm using tools.logging and i want to pass in the "current" namespace and i was hoping not to have to hardcode it in each namespace...
15:30seancorfieldi can put (def ^:private my-ns *ns*) into each namespace and then (log my-ns my-data) i guess... is this not a use case folks have run into? just curious
15:31opqdonut(defmacro log [thing] `(really-log ~*ns* ~thing))
15:31opqdonutor something to that effect
15:44simardhum, what is reify actually used for ?
15:45jweisssimard: creates a one-off impl of an interface
15:46seancorfieldi've used it to create an instance of java.io.FilenameFilter that matches a given regex
15:47seancorfieldhttps://gist.github.com/1304756
16:46bendlasHey, do you know a good way to kill a running embedded swank server, without restarting the JVM?
17:32jcromartieWTF is Gosu
17:32jcromartieI mean, obviously, a language
17:32RaynesA programming language with hostile creators.
17:33jcromartieweird
17:34jcromartieyeah "not lisp" isn't usually part of a feature matrix
17:34jcromartiea
17:34jcromartieand when I look at Gosu code... it just looks like Java without semicolons
17:34technomancy`it shouldn't be too surprising that there are all these languages attempting to do nothing more than be slightly better than java
17:34technomancy`considering "better than java" is so easy a goal to attain
17:36fliebelI'm aiming for more interesting than dart.
17:36RaynesDart is as interesting as a tracfone.
17:36fliebelw/me googles
17:36jcromartieah, apparently Gosu stems from some insurance industry software company?
17:37jcromartieit's about that exciting
17:37jcromartieDart make me cringe
17:37RaynesTracfone is a prepaid wireless service with plastic feature phones from the 90s.
17:37jcromartiethey made JavaScript worse
17:38fliebelRaynes: Check my phone: http://www.excellentmobiles.com/images/philips_files/philips162_b.jpg real dutch.
17:38RaynesYeha, those kinds of phones.
17:39Raynesyeah*
17:39jcromartieas far as I can tell Dart adds type checking, the "class" keyword, and importing libraries
17:39fliebelRaynes: Awesome!
17:40technomancy`next time I buy a phone I am totally visiting excellentmobiles.com
17:41fliebeltechnomancy`: You'll love these: https://www.johnsphones.com/
17:41technomancy`classy
17:42fliebelHow did we end up talking about phones...
17:43fliebelYou can write clojure on the johnsphone btw, booklet and pencil included.
17:44RaynesThat thing is $100?
17:44RaynesSeriously? Psh.
17:44technomancy`well, it doesn't exactly have any competition.
17:44fliebelonly the gold one
17:49jcromartieI guess there's no way to read a stream twice without loading it all into memory
17:49fliebeljcromartie: Why do you read it twice?
17:50jcromartieto copy a file and get its SHA-1
17:50jcromartiebut I have a solution, actually
17:50jcromartieDigestInputStream
17:50jcromartieit updates the message digest as the stream is read
17:51jcromartiehm
17:51jcromartienever mind, there's really not a good way to do this, since I need the digest before I write the file, and there's no native way to move files in Java
17:51TimMcFile is named after its digest?
17:52jcromartieyes
17:52TimMchmm
17:52fliebeljcromartie: I thought Nio fixed that?
17:52jcromartiemaybe?
17:52jcromartieI'm using clojure.java.io
17:52TimMcjcromartie: c.j.io doesn't have a file mover?
17:53jcromartieit's not a native OS move (i.e. rename)
17:53jcromartieit has to copy the data
17:53jodaronice
17:53jodarothe repl is a great way to spend time
17:53jodaroi just played around with -> vs. comp vs. juxt for a while
17:53TimMcjcromartie: That's kind of terrible.
17:53jcromartiethat's just the JVM
17:54jcromartieit implements a very small set of features over files
17:54jcromartieinput and output streams at the core
17:54jcromartieexists, creation, mkdir, etc.
17:54jcromartiebut no copy or move
17:54TimMcjcromartie: File.renameTo(File)
17:54jcromartiewut
17:55jcromartieDERP!
17:55hiredmanthere exists a patch to make copy use nio's FileChannel's transferTo for copy
17:55jcromartiehow did I miss that
17:55TimMc:-)
17:55jcromartie:P
17:55TimMcc.j.io doesn't have it, but I guess it only fills in gaps in j.io
17:55jcromartieOK so I can use the digest stream to write to a temp file, get the final digest, then rename the temp file after the digest
17:55jcromartieperfect
17:56TimMcAs long as you never try to write to the same temp file from multiple threads.
17:57TimMcFile/createTempFile with the desired directory
17:57dnolenok being able to remotely debug mobile WebKit devices w/ browser REPL - AWESOME
17:58TimMcWhen do we get FireClj?
17:58TimMcFijreBug
17:58RaynesI'd kill myself if someone named a project that.
17:58RaynesSeriously. I've got the rope ready.
17:58amalloyTimMc: just FjreBug
17:58TimMc:-(
17:58TimMchaha
17:59amalloythe J is...i dunno, swedish or something
17:59scottjyou have the ropjure ready?
17:59Raynesfjrebug is one thing. fijrebug is another.
17:59TimMcMotto: "You can't spell FijreBug without JRE"
18:01TimMc...and I'm going home.
18:02amalloyTimMc: keep an eye out for rabid "fans" who want to dismember you
18:02TimMc?
18:05amalloybig fans of fijrebug
18:05amalloyi was implying that someone here (probably Raynes) would follow you home with evil intent
18:06scottjdnolen: you mentioned debugging js on phones is pain, have you seen http://phonegap.github.com/weinre/
18:09scottjactually looks to be just a repl not a real debugger
18:13dnolenscottj: I have not seen that! Thanks.
18:21sdboHi, does anyone know a trick to ensure read-string reads a string inside some dynamically evaluated namespace? I want to execute serialized code on a different machine to implement a work queue.
18:34tolstoyHm. Autodoc broken for lein + clojure 1.3? Alas.
19:57yy#haskell
19:57yyoops wrong window
19:58technomancy_~guards
19:58clojurebotSEIZE HIM!
20:29technomancy_dakrone: clj-http doesn't have any built-in support for trusting self-signed certs, does it?
22:03devnIf clojure fails to succeed I think I will probably just quit programming.
22:07duck1123devn: what do you consider succeeding? Hasn't it already?
22:08duck1123Even if it's not the #1 language, it's still fairly successful by this point.
22:14dnolendevn: ha, you still got Racket and Haskell, could be worse.
22:15brehautim not frightened by the languages that historically have succeeded. you can keep your C++ thanks
22:15brehauts/not/more/
22:17dnolendevn: but honestly, I think the future of Clojure is really brightened with ClojureScript. It's Clojure's trump card over all the other popular functional langs.
22:18alandipertalso, people will be solving hard problems on the jvm until the end of time. and when they call us, we have clojure
22:19brehautdnolen: have you seen websharper for F#?
22:20dnolenbrehaut: I have not, is it any good?
22:20brehautdnolen: ive not used it, but it does look impressive
22:21brehautyou can write your javascript in F# with just a handful of annotations
22:21brehauthttp://www.websharper.com/samples/HelloWorld
22:22dnolenbrehaut: does it have a browser REPL? ;)
22:22scottjopa is also interesting, as an ml that works on server and web client, though license is questionable
22:23dnolenscottj: anything designed specifically for the web is doomed.
22:23brehautdnolen: F# has a nice repl, no idea how websharper integrates with it.
22:24brehautdnolen: i think clojurescript is more likely to be successful, im just pointing out a tool that does look like a reasonable choice
22:24dnolenbrehaut: I don't doubt that. Devil is in the details of course.
22:25brehautdefinately
22:25brehautand web has a lot of details
22:25dnolenargh
22:26dnolenI actually got my first excuse to use ClojureScript today - debugging an HTML5 app locked/trapped inside a iOS WebKitView
22:26dnolenbrowser REPL to the rescue
22:27brehautdnolen: http://www.webkit.org/blog/1620/webkit-remote-debugging/
22:28brehauthowever i think you may need a ios dev account to actually make use of it in the iphone
22:28dnolenbrehaut: heh yeah I'm aware of that, more work to setup than browser REPL :)
22:28brehauthah yeah :)
22:29alandipertdnolen: sweet!
23:05maxalwingsNew to clojure, I am using lein swank and I am getting this exception | http://pastebin.com/bkhQW7YB
23:05maxalwingsHelp!
23:08maxalwingsI really could use your help.
23:49scottjmaxalwings: when you run lein swank?