#clojure logs

2012-05-06

00:00BretzkyI guess clojure.pprint doesn't belong in dependencies because it's int he core?
00:00FrozenlockBut to give you an idea: I currently use lein 1.5.2 and clojure 1.3 in my projects without any problems
00:01FrozenlockYup. Since 1.2 if the source is right
00:01Bretzkywell, now I feel like an idiot
00:01clojurebotNo entiendo
00:02Bretzkyglad to have that sorted out though
00:27FrozenlockI'll write the solution to my problem here for future logging reference: class org.codehaus.jackson.smile.SmileParser overrides final method getBinaryValue.(Lorg/codehaus/jackson/Base64Variant;)[B
00:27Frozenlock [Thrown class java.lang.VerifyError] was because (I think) Noir uses clj-json. Both Cheshire and clj-json use Jackson. The solution is to simply use clj-json instead of Cheshire. See: https://github.com/dakrone/clj-http/issues/41
00:35robertstuttafordwhat's the way to convert a json string to clojure forms?
00:38gf3Chesire?
00:39technomancycheshire.
00:39robertstuttafordsuperduper, thank you
00:39gf3Sp, sorry
00:41FrozenlockWeeeeee, fun with bitcoins (json/parse-string (slurp "http://blockchain.info/rawaddr/1P8uWY8w3Y6nVWM1FYjC3z2Phmzgpi12vd")
00:47zakwilsonSlurp takes URLs?
00:47technomancyzakwilson: added in 1.2 IIRC
00:49zakwilsonHow did I not know this? I'm sure this would have saved me some time at some point.
00:52technomancydid someone port -> to elisp, or was it just the destructuring stuff?
00:54fhdIt seems to me that "(require '[namespace :as ns]) (ns/foo)" is usually preferred over "(use '[namespace :only (foo)]) (foo)", does anyone have some reasoning for this?
00:55Frozenlockfhd: I prefer it because I can instantly know form where is the function.
00:56fhdFrozenlock: True, but if you use :only, it's just a search away.
00:58FrozenlockSo near, yet so far at the same time.
00:59FrozenlockThere's also the possible name conflict if your `use' a lot of stuff.
01:03Raynesfhd: I don't think anyone minds :use (or the new require in 1.4) with :only (:refer in 1.4's require).
01:03leo2007technomancy: this patch https://gist.github.com/2614567 from the autodoc branch will stop clojure to drop connection to swank when slime-autodoc is accidentally called.
01:03FrozenlockAwww I'm just getting used to 1.3
01:05zakwilsonI still have a project that's on 1.2.
01:05Raynesibdknox: You around?
01:05Rayneszakwilson: This is why we can't have nice things.
01:08zakwilsonRaynes: well, it was using ClojureQL which didn't support 1.3, and I haven't finished moving over to korma.
01:15muhoois this really the only way to turn a map into a sorted map? ##(apply sorted-map (flatten (seq {3 "foo" 2 "bar" 1 "baz"}))
01:16muhoo&(apply sorted-map (flatten (seq {3 "foo" 2 "bar" 1 "baz"})))
01:16lazybot⇒ {1 "baz", 2 "bar", 3 "foo"}
01:18alandipert&(into (sorted-map) {2 :a 1 :b})
01:18lazybot⇒ {1 :b, 2 :a}
01:18alandipertmuhoo: ^
01:27robertstuttaforddoes anyone know of a more up to date tutorial than this? http://mmcgrana.github.com/2010/08/clojure-rest-api.html
01:34muhooalandipert: thanks!
01:56muhoorobertstuttaford: the stuff in clojurebook.com is pretty current
01:56muhooah, my favorite error message: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
01:56robertstuttafordcool. i'm actually reading that book right now. just haven't gotten there yet
01:57robertstuttafordjust managed to patch something together with ring, compojure, and cheshire
01:57muhoochapter 16
01:57robertstuttafordgreat book. i'm learning so much
02:01szxis there any way to rename/alias java classes, more specifically, static inner classes? this foo$bar business is so verbose...
02:05muhoohahahaah (not (= map hash-map))
02:05muhooi'm tired
02:08muhooszx: vars should work, i'd guess
02:08Raynes&(range 1000)
02:08lazybot⇒ (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81... failed to paste: Connection to http://localhost:8080 refused
02:08RaynesOops.
02:08RaynesMan, and I released that crap too.
02:08muhoo8080?
02:09szxmuhoo: they don't seem to work, at least with new - i guess because it's a macro?
02:09Raynesmuhoo: I just added the ability for refheap to return Clojure data structures in the API. I modified my Clojure client lib to use that feature, but I forgot to remove the testing stuff.
02:10muhooneat! is it pr-str'ing?
02:11Raynesmuhoo: Tis.
02:17forsakendaemonAnyone around today?
02:18forsakendaemonI've got an issue where I'm trying to parse command sentences, of the form '[cmd1] [cmd2] [cmd3] lots of other parameters', and match them to functions.
02:18forsakendaemonIt seems like the kind of problem that would have been solved for URL routing, but all the libraries that I can find are really tied into URLs.
02:18forsakendaemonAnyone have any ideas?
02:28muhoois there a non-painful way to get an iso-8601 date out of clojure/java?
02:29muhoohmm, nm, google to the rescue http://snipplr.com/view/61835/clojure-iso-8601-current-date/
02:33Raynesmuhoo: Oh man, dates in Clojure. You poor thing.
02:36muhoowat? it it a nasty evil thing?
02:36muhooi understand java dates are miserable, but i expect someone'd have made it nicer for clojure
02:37muhooauugh, joda
02:39muhoohuh, that first snippet just worked. no problem. oh well.
03:08fhdRaynes: Yeah, I think it's safe too, but people (including me) seem to prefer require, and I just wonder why. I don't have a very good reason myself, it adds a bit of clutter.
03:08Raynesfhd: Well, the different is irrelevant in Clojure 1.4. require can do the same thing use does.
03:09RaynesSo meh!
03:09Raynes:p
03:09fhdRaynes: Oh, didn't even know that. With refer?
03:09RaynesYep.
03:09Raynes&(require '[clojure.string :refer [join]])
03:09lazybotjava.lang.ClassNotFoundException: clojure.string
03:09RaynesBluh.
03:09RaynesYou get the point.
03:10fhdYeah. Still wondering why/when to use one style over the other though.
03:10fhdRaynes: :as vs :refer in 1.4
03:12fhdRaynes: I guess my reasoning for :as is that I prefer clarity in a local piece of code over saving a few bytes. Plus it's less ugly in Clojure than in C++ (which has pretty much the same mechanisms).
03:16Raynesfhd: I use :refer or use in situations where it'd look weird otherwise. For example, noir's defpage macro. You don't want to have (noir/defpage ..), you want (defpage ..)
03:17fhdRaynes: Through, same goes for clojure.test, forgot I do that :)
03:18fhdRaynes: Thanks, I think I've got a heuristic for this now. I always like to know why I'm doing something :)
03:19fhds/Through/True/, of course. I don't even...
03:20michaelr525hi
03:22michaelr525anyone knows which is the best way to setup emacs+slime to work with a remote host? Locally I use clojure-jack-in.
04:18hiredmanugh, dispatching through a multimethod grabs a lock, how disgusting
04:23amalloyhiredman: they're mutable things; not much you can do about it, right?
04:24hiredmanamalloy: well, I don't mutate them at runtime, so it is a drag to see all my threads fighting over that damn method
04:26amalloyyeah, that does seem like a nonoptimal approach
04:26amalloybut even if you don't mutate them, they are mutating themselves by caching the hierarchy as new dispatch values arrive
04:26hiredmanI am just dispatching on the type of the first arg, so switching to a protocol gets rid of the lock contention, but I hate to abandon the flexibility of multimethods
04:28hiredmanugh
04:29amalloyi agree with you it seems like there's a way to make it work, but it's hard to imagine what it would be
04:30hiredmanI've been trying to get this tree search to go faster by parallelizing it, but the parallel version was always slower (2.9 seconds vs. 800 millis) and as soon as I get rid of the multimethod the parallel version is now 200ms
04:31amalloyouch
04:44tomojmichaelr525: you can just create an ssh tunnel to swank on the remote machine and slime-connect to it
04:49scottjyou'd know that if you watched the first 10 minutes of slime.mov :)
05:02michaelr525tomoj: yeah, but I wonder whether there is something like 'clojure-jack-in' for this :)
05:04tomojdon't know of anything, you could maybe easily write a function that shells out to ssh and calls slime-connect?
05:04tomojgetting tramp set up properly is something I haven't figured out
05:07robermannHello, suppose I have this map: (def orders {:order1 ['a 'b 'c] :order2 ['x 'y 'z]}). Can I "decorate" the map's get method so that, for example, every call such (:order1 orders) could increase a counter or log the operation? Should I rebind any function?
05:14_KY_&(false ())
05:14lazybotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn
05:14_KY_&(false? ())
05:14lazybot⇒ false
05:14amalloynot really, robermann. you can do it if you're willing to put in an amount of work/code that's out of proportion to its usefulness
05:14_KY_That's weird isn't it?
05:15amalloyno. it's not false; it's not even falsey
05:15_KY_Ahhh right =)
05:16amalloy&(false? nil) is also false, because nil isn't false; it's just falsey (ie, treated as false in a boolean context)
05:16lazybot⇒ false
05:34_KY_I have some code where I do a "for" and it freezes but when I changed it to "doseq" it runs, why is that?
05:36tutysrainstalled auto-complete and ac-slime in emacs24 using elpa and marmalade. should I have to make any manual settings to use them?
05:48ben_hhi all, any textmate users here? i'm trying to get a decent editor/repl set up, but i can't find an up-to-date clojure tmbundle.
05:48ben_hthe ones i've found seem to be incompatible with recent cake.gem
05:52krunaldoben_h: Most just run vim or emacs now days
05:52ben_hheh, thought that might have been the answer :)
05:53ben_hany pointers on getting a decent repl set up via vim?
05:53ben_hi'm comfortable enough with vim that i might just give that a go
05:54krunaldoben_h: I use http://www.vim.org/scripts/script.php?script_id=2501
05:55ben_hcool, i'll check it out now. thanks
05:55krunaldoben_h: I've been thinking to switch to http://code.google.com/p/conque/ for a more general repl setup
05:55krunaldoso you may want to check that out.
05:56ben_hlooks interesting
05:56ben_hi guess it has shortcuts for writing the current selection/buffer/etc to the repl?
05:56krunaldoyes
05:57krunaldobut I'd still use vimclojure for the indent and stuff
05:58michaelr525ok, i got slime to connect to a remote swank! that was easy :)
05:58michaelr525but I still don'
05:59michaelr525t see arguments in stack traces
06:03michaelr525oh wait, it isn't supposed to work with repl evaluated code, right?
06:10michaelr525err, it's now working really well. when I try to slime compile a file it sends my local path to remote swank and of course it can't find it..
06:12tutysracopied the usage snippet from ac-slime.el to init.el and it worked, thx everyone
07:07wei_how do i run a regex in multiline mode?
07:17gfredericksyou have to include the multiline flag in the regex
07:18gfredericksI don't know off the top of my head what that is, but it's the same as java, so you cat try googling for that
07:39espeedHow do you see the form params submitted by clj-http? I'm running it with :debug true, but it just says ":body #<StringEntity org.apache.http.entity.StringEntity@714c7f58>"
07:40gfredericksespeed: you could use `nc -l 8080` to debug it
07:43Borkdudewhat is the best way to trace a recursive function?
07:43LicenserBorkdude recursively
07:43BorkdudeLicenser: explain?
07:45gfredericksBorkdude: https://github.com/clojure/tools.trace might help
07:49Borkdudegfredericks: I don't see any recursive functions tested in the tests
07:49LicenserBorkdude you can just put a print in there, perhaps make a wrapper fn to expose and a inner one with a counter that you can see recursion deepoth
07:50BorkdudeLicenser: println is the way I do it now, indeed
07:50gfredericksBorkdude: I was saying use that lib to do the printing instead
07:51Borkdudegfredericks: ok, will look at it
08:04_KY_Can someone help debug a piece of code, rather complex:
08:04_KY_https://www.refheap.com/paste/2601
08:05_KY_The program won't run to line 98
08:05_KY_Seems that the "for" loop at 96 is not running
08:06hiredman~for
08:06clojurebotfor is complected
08:06hiredman~for
08:06clojurebotfor is not a loop
08:06_KY_(Oops lines numbers are wrong)
08:06gfredericks_KY_: you know that for is lazy right?
08:07_KY_The "for" in line 56 is not executing as I expected
08:07espeedgfrenderick: thanks; is there not a way to view the request params in emacs?
08:07_KY_Yes I am aware of laziness of for
08:07gfredericksespeed: you could run nc from an emacs shell?
08:07_KY_But it already added "doall" in front of it
08:08Borkdude_KY_: the first thing I would do, after looking at that code, is taking the large function apart to pieces...
08:08espeedwell, I'm surprised that the clj-http debug mode doesn't display them in a viewable form
08:09_KY_I mean, there were "println" calls right below the "for", but I don't even see anything printed
08:10_KY_Which is weird, isn't it?
08:10gfredericks_KY_: what for are we talking about?
08:10gfredericksoh 56
08:10_KY_The for at 56
08:11gfredericks_KY_: the indentation here makes this terribly difficult to read
08:11Borkdude_KY_ this code doesn't invite the reader to read it
08:11_KY_Yes, the debug stuff is not indented so you can ignore them
08:11_KY_I deliberately put them to the leftmost
08:11_KY_Also, tab size should have been 4...
08:12Borkdude_KY_ my advise for what it's worth: divide it up into smaller pieces and test each piece separately
08:12gfredericks+1
08:12_KY_The formatting up to 56 is perfect....
08:13_KY_Let me paste again with tab size fixed...
08:16_KY_Ok.. hope it looks better:
08:16_KY_https://www.refheap.com/paste/2601
08:16_KY_So it's just a big "for", followed by "if", and then another "for"
08:17_KY_But the second "for" seems not running
08:21_KY_I mean, the println at 59 is not even printing...
08:23_KY_But I'm sure the "if" at 54 passes control to 56
08:29Borkdudewhat would be the most idiomatic to 'remove' an element from a vector, take the subvectors leaving out that one element and concat them?
08:29wei_to answer my question above: (?s) enables multiline
08:29wei_followup: how do you convert html encoding to unicode? e.g. Ferenc Juh&#225;sz > Ferenc Juhász
08:34_KY_(Back to my problem... I suspect it's sko laziness that causes the whole "for" to be skipped...?)
08:38Borkdudehmm, it's kind of nice that you can just write (def set1 #{1 2 3}), (def set2 #{3 4 5}) on one line in clojure
09:00chouserBorkdude: I'd do (into (subvec ...) (subvec ...))
09:01Borkdudechouser, why not concat?
09:03_KY_(Ok... found the bug... =))
09:03gfredericksBorkdude: into gives you a vector back; keep in mind what you're doing is one of the operations on vectors that is inefficient
09:04Borkdudegfredericks: I see
09:04Borkdudegfredericks: I never needed this btw, just wondering
09:06chouserThe main difference is concat returns a lazy seq instead of a vector.
09:06Borkdudegood point
09:07chouserif you wanted a lazy seq, you'd probably be better off with concat of take and drop, though it might be interesting to measure and find out
09:12espeedI'm having issues with clj-http not setting JSON form params properly -- I posted the details to SO http://stackoverflow.com/questions/10470643/why-isnt-clojures-clj-http-sending-the-json-form-params-properly -- any ideas?
09:28gfredericksespeed: why would you expect it to send escaped json?
09:28gfredericksespeed: what you're showing there is what I would expect it to do
09:37daniel,(range 0 63 9)
09:37clojurebot(0 9 18 27 36 ...)
09:37danielerm, doh
09:37danielanyway, why doesn't this include 63?
09:37daniel36, 45, 54, 63????
09:37danieli suppose it's up to and not including the second argument
09:38michaelr525yes, says so in the docs
09:39danielis there a reason for it though? seems logical to define a range between two points including those points
09:41AimHereWell if you start counting at 0, then this way means (count (range n)) is n; also it matches the usual C-style for... loop idiom
09:41danielok, thanks
09:50gfredericksdaniel: I've seen that style in a few different languages
09:51Borkdudedaniel: same in python
09:53Borkdudedaniel: from a python 'repl': >>> range(0,63,9)
09:53Borkdude[0, 9, 18, 27, 36, 45, 54]
09:53gfredericks&(take 8 (iterate (partial + 9) 0))
09:53lazybot⇒ (0 9 18 27 36 45 54 63)
09:56jonaskoelkerdaniel: I think scala has both forms, Haskell has only endpoints-included
09:56gfredericksruby/coffeescript have a range syntax that lets you do either...does python have that?
09:57jonaskoelkeryes, you use the ",1+" argument separator if you want both endpoints ;-)
09:57gfredericks:P
09:58jonaskoelkeralternatively, you can use the "_range=range; def range(x, y, z): return _range(x, y+1, z)" preprocessor pragma :D
09:59gfredericksthat couldn't possibly break anything
09:59jonaskoelkernah
10:00jonaskoelkerwell, in a _real_ language I'm sure you could do some clever macrobatics
10:00jonaskoelker;) [assert me.loves(python)]
10:00antoineBhello
10:00Borkdudewould be very confusing, since slicing also works 'exclusively': [0,1,2,3,4,5][0:2] => [0,1]
10:00jonaskoelkerBorkdude: have slices use range underneath
10:01jonaskoelkerproblem solved (or made worse, depending on perspective)
10:01jonaskoelkerhello, antoineB
10:01antoineBi can build function using number of arguments make distinctions, could i use some sort of precondition?
10:01Borkdudejonaskoelker: yes, "nice" solution =)
10:02BorkdudeantoineB you can use "dispatch on arty"
10:02Borkdudearity, stupid spelling correction
10:02antoineBi have (defn ([x y] ...) ([x] ...))
10:03jonaskoelkerantoineB: there seems to be a name missing
10:03BorkdudeantoineB insert a name after defn
10:03jonaskoelker(defn foo ([x] x) ([x y] y))
10:03antoineBi would had (defn ([x y :when (= y 12)] ...) ([x] ...))
10:04antoineB... mean any code you want
10:04BorkdudeantoineB: pattern matching?
10:04gfredericksoooh predicate dispatch
10:04jonaskoelkerah, similar to haskell's pattern match guards
10:04antoineByes
10:04antoineBjonaskoelker: more used to scala
10:04espeedgfredericks: This patch says, "If :content-type is set to :json, then :form-params is turned to a json string and set as the :body" https://github.com/dakrone/clj-http/pull/52
10:04daniellol ",1+" argument separator
10:04BorkdudeantoineB: hmm, there is some library for it https://github.com/clojure/core.match
10:04jonaskoelker=)
10:05jonaskoelker<--- smartass
10:05gfredericksespeed: my interpretation of that is consistent with what you're seeing
10:05Borkdudenever used it though
10:06gfredericksespeed: I expect you don't need it escaped
10:06jonaskoelkerhow does arity dispatch work? java method-name overloading?
10:07jonaskoelkeroh, wait, noh, IFn doesn't have infinitely many methods
10:07gfredericksjonaskoelker: it has up to 20ish I think
10:07jonaskoelkerso... unless you can only do it for up to some language-... oh
10:08jonaskoelkerso you can't do (defn foo ([x] x) ([a b ... z] z))?
10:08jonaskoelker(if ish = 5)
10:08gfredericksjonaskoelker: try it
10:08jonaskoelkerbut... that would be empirical =)
10:08gfrederickswell I don't know what it does and I want to
10:09jonaskoelkerCompilerException java.lang.RuntimeException: Can't specify more than 20 params, compiling:(NO_SOURCE_PATH:14)
10:09antoineBBorkdude: thanks, but i will stay with arity for now, i am new to clojure
10:10antoineBwhat is the diference between [a b] '(a b) ?
10:10jonaskoelkerone is a vector, the other a list
10:10jonaskoelkeralso, the list contains 'a and 'b (two symbols), whereas the vector contains whatever a and b evaluate to
10:10jonaskoelker&(let [a 1 b 2] [a b])
10:10lazybot⇒ [1 2]
10:11jonaskoelker&(let [a 1 b 2] '(a b))
10:11lazybot⇒ (a b)
10:11wmealing_antoineB, many operations work on both.
10:11wmealing_but they are different.
10:11jonaskoelker(= (list 1 2) (vector 1 2))
10:11jonaskoelker&(= (list 1 2) (vector 1 2))
10:11lazybot⇒ true
10:11jonaskoelker&(= '(1 2) [1 2])
10:11lazybot⇒ true
10:13antoineB&(= '(2 3) [(+ 1 1) (+ 1 2)])
10:13lazybot⇒ true
10:13antoineB&(= '((+ 1 1) (+ 1 2)) [2 3])
10:13lazybot⇒ false
10:13antoineBok
10:13wmealing_,(sequential? [1 2 3])
10:13clojurebottrue
10:14wmealing_,(sequential? '(1 2 3))
10:14clojurebottrue
10:14jonaskoelker(intstance? java.util.Collection ())
10:14jonaskoelker&(intstance? java.util.Collection ())
10:14lazybotjava.lang.RuntimeException: Unable to resolve symbol: intstance? in this context
10:14jonaskoelker&(instance? java.util.Collection ())
10:14lazybot⇒ true
10:14jonaskoelker&(instance? java.util.Collection [])
10:14lazybot⇒ true
10:14jonaskoelker,(counted? [])
10:14clojurebottrue
10:14jonaskoelker,(counted? ())
10:14clojurebottrue
10:14jonaskoelkero_O
10:14jonaskoelker,(counted? (list 1 2 3))
10:14clojurebottrue
10:15jonaskoelker,(counted (iterate (inc 0)))
10:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: counted in this context, compiling:(NO_SOURCE_PATH:0)>
10:15jonaskoelker,(counted? (iterate (inc 0)))
10:15clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$iterate>
10:15jonaskoelker,(counted? (iterate inc 0))
10:15clojurebotfalse
10:15wmealing_,(class? (list 1 2 3))
10:15clojurebotfalse
10:15jonaskoelker,(class? class?)
10:15clojurebotfalse
10:15jonaskoelker:-)
10:15wmealing_:P
10:16antoineBis there a macro that take a sequence and expand it exemple: it take '(a b) and return a b
10:17jonaskoelkera b isn't a value
10:17jonaskoelkerthere are macros which embed the elements of one list in another, in the context of producing a syntax tree
10:17jonaskoelkerwell, macro-stuff
10:17jonaskoelker`(list 1 2 ~@(list 3 4))
10:18jonaskoelker&`(list 1 2 ~@(list 3 4))
10:18lazybot⇒ (clojure.core/list 1 2 3 4)
10:18antoineBi have a function that return a sequence and i want proceed this sequence using matchin erity in another function
10:19antoineBis it possible?
10:19jonaskoelker,(apply (fn [x y] (+ x y)) (map inc [1 2))
10:19clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
10:19jonaskoelker,(apply (fn [x y] (+ x y)) (map inc [1 2]))
10:19clojurebot5
10:19jonaskoelkerlike this?
10:20jonaskoelker(apply + (list 1 2 3 4))
10:20antoineBhow works apply? is it loop through the result of (map ...) ?
10:20jonaskoelker,(apply + (list 1 2 3 4))
10:20clojurebot10
10:21jonaskoelker(apply f (list a b c)) ~ (f a b c)
10:21jonaskoelker,(apply + (cons 1 (cons 2 ())))
10:21clojurebot3
10:22jonaskoelkeri.e. it applies the function, using the elements of the list as the arguments
10:22antoineB&(apply (fn [a b c] (+ a (* b c)) [1 2 3])
10:22lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
10:22gfredericks$google github gfredericks misquote
10:22lazybot[fredericksgary/misquote · GitHub] https://github.com/fredericksgary/misquote
10:22jonaskoelker&(apply (fn [a b c] (+ a (* b c)) [1 2 3])))
10:22lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$apply
10:22jonaskoelker&(apply (fn [a b c] (+ a (* b c))) [1 2 3]))
10:22lazybot⇒ 7
10:22gfredericks^that library gives you unquoting without the other backtick stuff
10:23jonaskoelkerI should get an IRC client with parenthesis highlighting :-)
10:23jonaskoelker[yes, I know, emacs...]
10:24antoineB&(apply (fn ([a b c] (+ a (* b c))) ([a b] (+ a b))) [1 2 3]))
10:24lazybot⇒ 7
10:24antoineB&(apply (fn ([a b c] (+ a (* b c))) ([a b] (+ a b))) [1 2]))
10:24lazybot⇒ 3
10:26antoineBjonaskoelker: thank you apply is the function i need
10:26jonaskoelkermost welcome :)
10:26jonaskoelkerI was thinking about ClojureQL---wouldn't CloQL be a more... c'loquial name? =)
10:29wmealing_boom tish
10:29jonaskoelkerno laughter? Is everyone really so cloj-minded towards (my) puns?
10:29jonaskoelker=)
10:29wmealing_oh i got it
10:29jonaskoelker[sorry]
10:29wmealing_:)
10:29wmealing_it was just really bad
10:29wmealing_i love it.
10:30jonaskoelkeryay, a bad pun buddy :)
10:39jonaskoelkerbtw, hickey mentioned something about running clojure backwards in a talk on blip.tv; does anyone know what that was about?
10:45antoineBhow to loop through a list?
10:46tmciverantoineB: You're probably looking for the map function.
10:47tmciver,(doc map)
10:47clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); 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."
10:47tmciver,(map #(+ 1 %) [1 2 3 4 5])
10:47clojurebot(2 3 4 5 6)
10:48antoineB,(doc reduce)
10:48clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
10:48Robermann-mobhi, anyone had success in using a web REPL from an ipad ?
10:49antoineB,(reduce + ["a" "b" "c" "d"])
10:49clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
10:49wmealing_sounds way too trendy for me.
10:49antoineB,(reduce concat ["a" "b" "c" "d"])
10:49clojurebot(\a \b \c \d)
10:50antoineB,(reduce .append ["a" "b" "c" "d"])
10:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .append in this context, compiling:(NO_SOURCE_PATH:0)>
10:50antoineB,(reduce .concat ["a" "b" "c" "d"])
10:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .concat in this context, compiling:(NO_SOURCE_PATH:0)>
10:50Robermann-mobclojurebot: your-message
10:50clojurebotexcusez-moi
10:51pandeiro,(reduce str ["a" "b" "c" "d"])
10:51tmciverantoineB: reduce is also a good one for operating on a collection but really only if you need to 'accumulate' some kind of result as you go.
10:51clojurebot"abcd"
10:52wmealing_is there a good way to do IPC between clojure instances ?
10:52antoineBtmciver: thank you
10:52wmealing_i've been thinking 0MQ
10:52wmealing_but i'm not convinced yet.
10:53tmciverpandeiro: I'd prefer apply there ##(apply str ["a" "b" "c" "d"])
10:53lazybot⇒ "abcd"
10:53pandeirotmciver: sure, i just thought antoineB was trying to do that... but i'm curious what's the advantage of using apply?
10:54pandeiroi guess you just do one (str ...) whereas with reduce you do n-1?
10:54tmciverpandeiro: I just think apply is more apt there. I only use reduce to accumulate a result.
10:54wmealing_i think i ask all the wrong questions.
10:56pandeirotmciver: i'm actually very bad at understanding reduce fns... i'm trying to sort out a noir problem and the trail goes cold for me at a reduce i don't understand
10:57tmciverpandeiro: dito for me too, actually. I haven't had much occasion to use reduce :(
10:58pandeiroi think for more visual people recursion and some high order fns are just not as easy to reason about
11:00antoineB,(reduce (fn [a b c] (* a (+ b c)) [1 2 3 4])
11:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
11:00tmciverantoineB: for reduce the function must take only two args.
11:01antoineBtmciver: that is i want to check
11:01antoineBfor me i din't see any difference between apply and reduce (expect the number of arguments)
11:01pandeiro...and the reduce can optionally take an initial value to use instead of the first item in the seq
11:02pandeiroantoineB: i see apply as like 'this fn needs x args and i have a seq of x things'
11:03wootsanHow could I use Java's (>>>) unsigned right shift operator from Clojure?
11:03antoineBok
11:03jweissI'd like to be able to write (def x (something [(println "hi") (println "there")]) so that the forms inside the literal list are not evaluated until the list is consumed. sort of like lazy-seq but each item is separate. does something like this already exist?
11:04jweissi'm writing a data-driven test harness, i don't want test data to be evaluated until runtime, but i also don't want to have to wrap every piece of data in (fn [] ...)
11:05jweissi could write a macro to do it for me, but thought there may already be one. :)
11:11LauJensenIn lein/project.clj, how do I boost the heap size?
11:12LauJensencancel that, I got it :jvm-opts ["-Xmx1g" "-server"]
11:16raekjweiss: one way to do it is (lazy-cat [(println "hi")] [(println "there")])
11:17raekbut a macro like this would perhaps be more ideal: (lazy-literal-seq (println "hi") (println "there")) --> (lazy-seq (cons (println "hi") (lazy-seq (cons (println "there") nil))))
11:23jweissraek, thanks - I think lazy-cat might do it
11:24jweissoh wait, but i don't want them concatenated
11:24jweissi think i can just borrow lazy-cat's impl and leave off the "concat" :)
11:41dnolenmmarczyk: ping
11:53Borkdudeor (map println ["hi" "there"])
11:53Borkdudesince map returns a lazy seq
11:56antoineB(doc str)
11:56clojurebot"([] [x] [x & ys]); With no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args."
12:02Borkdude(+ 1 2 3)
12:02clojurebot*suffusion of yellow*
12:02mdeboard&(source +)
12:02lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
12:02mdeboard&(clojure.repl/source +)
12:02lazybot⇒ Source not found nil
12:02Borkdude,(source +)
12:02clojurebotSource not found
12:03Borkdude?
12:03mdeboard&(clojure.repl/source str)
12:03lazybot⇒ Source not found nil
12:03Borkdude,(+ 1 2 3)
12:03clojurebot6
12:09FullmoonI can't figure out how to tell lein to always use clj 1.4.0 - specific JVM options would be a bonus as well
12:12wmealing_i havn't done it but someone above said in projects.clj :jvm-opts ["-Xmx1g" "-server"]
12:13wmealing_and do you mean, for your project, or for lein itself ?
12:17winkywoostercan anyone point out examples of customizing the repl, such as always using pprint?
12:18Fullmoonwmealing_: lein itself, when I just use "lein repl" for example, outside of a project
12:18wmealing_that, i dont know.
12:19wmealing_i imagine perhaps you could set it up in the lein script
12:19xeqiFullmoon: what version of lein are you using?
12:20xeqinm, its just not something lein is setup to do
12:22gf3_ato: Hai?
12:27raekFullmoon: you can't control the version used in "lein repl" outside a project.
12:27raekFullmoon: create a scratch project and specify the version in the project.clj file
13:33muhooi guess nobody has made an extension to noir's wrap-exceptions function that sends an email with a stacktrace yet
13:36muhooif i make a custom exception handler, i hope there a way to replace noir's wrap-exceptions without actually having to patch noir
13:49pandeiromuhoo: what ns is wrap-exceptions in?
13:49dakroneespeed: I've seen your issue, I'll look at it, have to get on a plane now, check {:save-request? true} for more debug output in the meantime
13:49pandeironm found it
14:10EvanKThe Clojure talk on sequences listed in the Clojure podcast on iTunes and on the Screencasts page are both only 8 seconds long.
14:10cshellWhen writing clojure tests, what is the convention for the namespace of the tests themselves? Is it the same as the namespace being tested or something built on it?
14:12fliebelWhat do you use for RSS feeds? Just clj-http + clojure.data.xml? Some Java Mammoth? Or something made for the job?
14:12EvanKiTunes itself. I subscribed through the store and downloaded the lecture.
14:19wmealing_apparently, there isnt much to know on sequences.
14:19gfrederickscshell: I always map foo.bar.baz to foo.test.bar.baz
14:20gfredericksat least assuming the project is called foo
14:20gfredericksI guess if the project is foo.bar then foo.bar.baz => foo.bar.test.baz
14:20EvanKwmealing_: Oh? I thought they were pretty important.
14:20wmealing_:)
14:23kzarHow can I add a delay in Clojurescript? (Like Thread/sleep)
14:23dnolenkzar: there's no such thing.
14:24dnolenkzar: if you want to run something later, call js/setTimeout
14:24cshellgfredericks: thanks, that's what seems to be working for me - having it in the same ns seems to cause it problems
14:25gfrederickscshell: yeah two files with the same namespace will freak out the namespace-loader-thingy
14:25kzardnolen: ah right, hmm I did try that but I think I've gone wrong somewhere. (let [sound (js/Audio. "notification-beep.wav")] (dotimes [n 5] (js/setTimeout (.play sound), (* n 1000)))
14:26kzar(Was hoping it to play the sound once every second for 5 seconds)
14:26gfrederickskzar: probably you want #(.play sound)
14:26gfredericksso that it is a function
14:27gfredericksthe way you have it it calls (.play sound) and then passes the return value from that to setTimeout
14:27meiji11is there anything like a distinct-by function? as in, if I provide a predicate to group the elements of a sequence into equivalence classes, the 'distinct-by' function will return a sequence where each class is represented once, provided it appeared in the original?
14:28gfredericksmeiji11: (comp (partial map first) vals group-by)
14:28dnolenkzar: (js/setInterval #(.play sound) 1000)
14:29gfredericksmeiji11: maybe :)
14:29meiji11thanks gfredericks.
14:29dnolenkzar: if you only want it to run 5 times you need to call setTimeout again from the thunk.
14:29meiji11why I didn't come across group-by sooner.
14:29meiji11didn't I *
14:29gfredericksmeiji11: wait I don't think the code I gave does anything meaningful
14:29gfredericksbut I didn't quite understand what you were wanting anyhow
14:30kzargfredericks, dnolen: thanks
14:30meiji11well.. I wanted to filter out elements in a sequence that are equal under some predicate, and retain only the first element of each eqv. class in the original order.
14:30meiji11I guess.
14:31gfredericksoh that might actually be what it does
14:31gfredericksI retract my "doesn't do anything meaningful" claim
14:31meiji11yeah, group-by is definitely the right idea.
14:31gfredericks&((comp (partial map first) vals group-by) #(rem % 4) (range 99))
14:31lazybot⇒ (0 1 2 3)
14:32dnolen(defn play-sound [s n] (when-not (zero? n) (.play s) (js/setTimeout #(play-sound s (dec n)) 1000)))
14:32dnolenkzar: ^
14:32gfredericks&((comp (partial map first) vals group-by) #(first (str %)) (range 99))
14:32lazybot⇒ (0 1 2 3 4 5 6 7 8 9)
14:32fliebelIs there something like xpath for clojure.data.xml? Having a huge record tree is not all that useful.
14:33gfredericksmeiji11: though if you have a large dataset there would be more efficient ways to do it
14:35kzar(I can't believe how well Clojurescript and Clojurescript one work, when I tried playing a sound first time it just worked. Really cool, that with the new book that just came out has given me a kick up the arse to carry on learning Clojure again.)
14:35meiji11I'm not too concerned about that just yet. :)
14:36cshellclojure script one has a book?
14:36kzarcshell: Sorry I meant the new Clojure book
14:36cshellAh, clojure programming?
14:37hcumberdalehi ;)
14:37hcumberdalehttps://www.refheap.com/paste/2610
14:38hcumberdaleworks for single requests, multiple requests throw (80%) "java.io.IOException: Pipe not connected" exceptions
14:38hcumberdalewhat to do? (locking .... ?
14:39kzarWith clojurescript one can you connect to the repl using swank or do you have to use the console based repl?
14:40dnolenkzar: no support for swank, but it's easy to get inferior lisp working.
14:40kzardnolen: ok
14:40kzar(think I saw that in the video come to think of it)
14:40dnolenkzar: inferior lisp just needs a command to run at the shell and your good to go.
14:41dnolenkzar: (setq inferior-lisp-program "...")
14:42kzarWould you not need to change your .emacs for each new project though?
14:44dnolenkzar: so make a command call run-cljs which sets it then calls it
14:44dnolenkzar: actually sorry, you want run-lisp
14:45kzarok
14:45dnolenkzar: https://gist.github.com/2623705
14:45dnolenkzar: so just replace that with the command for starting the CLJS-one REPL
14:46EvanKWho's in charge of the screencasts?
14:54faust45any one around who manage clojure google group list?
15:21fliebelhuh, the Clojure website just showed me a wikispaces add
15:23kzarfliebel: Sure I heard someone talk about that ages back
15:28kzardnolen: I got it working thanks, commented on your gist with what I used. Had to tweak the script/repl file though to get the path right
15:29dnolenkzar: good to hear
15:29dnolenmmarczyk: ping
15:38pandeirowhat's the latest 'release' of cljs and where would i find that info besides searching the mailing list?
15:39dnolenpandeiro: r1011
15:40dnolenpandeiro: easiest way to get it is to just use lein cljsbuild
15:41pandeirodnolen: wait but then lein-cljsbuild would have to keep up as well, right? i'm using ibdknox's cljs-template for working with noir/cljs
15:41pandeirojust wondering if that info is made available anywhere other than the mailing list... say on clojure.org somewhere? or the official clojurescript repo?
15:42xeqihttps://oss.sonatype.org/content/repositories/releases/org/clojure/clojurescript/ ?
15:44dnolenpandeiro: or http://search.maven.org/#search%7Cga%7C1%7Cclojurescript
15:45pandeirocool thanks i'll bookmark those
15:45xeqiah, forgot they get premoted
15:45dnolenpandeiro: lein-cljsbuild does have to keep up, would be nice to be able to pick a particular release.
15:45dnolenpandeiro: a lot of people are using master since things are moving along very quickly these days.
15:46pandeirodnolen: yeah i am thinking about lifting that part out of cljs-one, so i can use master instead of a jar
15:46pandeiro(the lein github bit)
15:47pandeiroyah but then i look at the src here |6
15:47pandeirohttps://github.com/brentonashworth/one/blob/master/src/leiningen/git_deps.clj
15:48pandeiro...and jar seems a lot easier
15:49dnolenpandeiro: people aren't doing that to track CLJS master
15:50pandeirodoing what, jar or using the lein git repo from cljs one? i am still looking for the right workflow, spend a lot of time debugging the env still
15:55dnolenpandeiro: https://github.com/clojure/clojurescript/wiki/lein-cljsbuild
15:56pandeirodnolen: ahh gotcha, didn't realize lein-cljsbuild had that integrated. cheers.
15:57pandeirostill a lot of yak shaving ey, having to specify all of that for every new little throwaway project
15:58dnolenpandeiro: not much different Clojure and it scales.
15:58dnolenpandeiro: not much different from I mean.
15:59dnolenpandeiro: for little things, I just collect them inot one project with differnt subdirs inside.
16:00pandeirodnolen: that's an idea, yeah... but then why not just use the convention that the person has CLOJURESCRIPT_HOME set?
16:01dnolenpandeiro: I don't follow, I don't use CLOJURESCRIPT_HOME. I'd only expct CLJS lang or compiler hackers to bother with that.
16:01pandeirodnolen: when i started working with cljs, i was using cljs-watch, which just expected that env variable to be set
16:01dnolenpandeiro: yes it was yucky
16:01pandeirothen you only need one canonical cljs repo, keep it updated
16:02pandeiroso it's better to have to have a local cljs in every project?
16:02dnolenpandeiro: 90k jar.
16:02pandeiroright but then it's a jar, not master
16:02dnolenthere are more important things to care about.
16:05dnolenpandeiro: at some point in the future there'll be a very solid release - and you won't need to bother tracking master. I personally don't miss the cljs-watch days at all.
16:07RaynesIt's hard being around during the early days of a project of the scale of ClojureScript.
16:08RaynesIt's not like they can just release after every change, but damn it, you sure want them to.
16:23gfredericksRaynes: what would be the consequences if they did?
16:23hcumberdaledamn software ;(
16:24Raynesgfredericks: They'd get tired of doing it eventually and move to Africa.
16:24gfredericksI see
16:24xeqibut, but, post deploy hook
16:25gfredericksxeqi: but, but, africa
16:34pandeiroanyone know an elementary macros tutorial for beginners?
16:36Raynesmuhoo: Yoohoo.
16:37mdeboardpandeiro: The only decent one I've seen is in the Clojure Programming book tbh
16:38muhooRaynes: yo
16:38Raynesmuhoo: Before I release refheap.el, got anything that should be done?
16:39faust45if i need in loop assign elements to hash map, how i can do this?
16:39muhoonah, works fine to me after i changed to www.refheap.com
16:40muhooRaynes: it would be good to get that assoc out of there and move that logic server-side, but it'd mean an api change, and i'm slammed at the moment, doing heroic battle with jquery ui and css :-(
16:40Raynesmuhoo: I don't think a mode association would be appropriate for the server side. It would be specific to Emacs.
16:41pandeiromdeboard: cool, i look at it
16:44Raynesmuhoo: 0.0.2 released
16:50amalloypandeiro: i kinda feel like macros are one of those things you just have to absorb gradually. let it go (1) magic i don't even see the point of (2) okay, i can see why you'd want that (3) neat, i think i know how that works (4) hey, i bet i could do that too! (5) actually that was a dumb place for a macro, i'll just use a function
16:55hcumberdalejava.lang.ClassCastException: java.lang.Long cannot be cast to [Ljava.awt.image.BufferedImageOp;
16:55hcumberdaletrying (defn gen-thumbnail "returns input stream to image" [url x y]
16:55hcumberdale (let [in (javax.imageio.ImageIO/read (as-url url))
16:55hcumberdale out (org.imgscalr.Scalr/resize in x y)]
16:56hcumberdaleAPI: resize(BufferedImage src, int targetWidth, int targetHeight, BufferedImageOp... ops)
16:57pandeiroamalloy: i read your post http://amalloy.hubpages.com/hub/Clojure-macro-writing-macros - which is great - but i am not at stage 4 yet
16:58amalloyyeah, that's definitely not a general-macro tutorial; it was specifically for metamacros
16:58RaynesAnd IIRC was written because he worked at hubpages and they wanted him to write crap on it.
16:58Raynes;P
16:58pandeirohaha yeah specifically the second section was helpful
16:59cshellhow do i set javac options in leinengen? I'm trying :jvm-opts "-target 7" but it's not picking it up - still saying it's trying to compile to -source 1.5
17:00mmarczykdnolen: pong
17:00pandeiroright now i would like to use clojure.tools.macro/name-with-attributes to make noir's defpartial able to take a docstring, and i understand what defpartial is doing, but i don't see where the args to name-with-attributes should be coming from
17:01mmarczykdnolen: looking over your commits now -- very cool -- somehow next on a list just got a huge speedup :-)
17:02cshellAh, figured it out by finally finding the page with all the options: http://bit.ly/J7E5xC - the answer is :javac-options [:target "7"]
17:03dnolenmmarczyk: heh yes :) call seq on cons, list very cheap.
17:04amalloypandeiro: (defmacro defpage [& args] (let [[name & opts] (apply name-with-attributes args)] `(old-defpage-impl ~name ~@opts))), or some such
17:04dnolenmmarczyk: I tweaked protocols mask logic so we don't generate so many partitions
17:04mmarczykdnolen: ah yes, I was going to say thanks for that :-)
17:04mmarczykdnolen: I actually remember realizing that was nonsense somewhere along the way, then leaving it in to see if multiple partitions will be created properly... apparently I forgot again :-(
17:04technomancyis there a way in clojurescript to get actual js/this without having the compiler change it into this$?
17:04dnolenmmarczyk: also after some more playing around I think benching with node.js is a bad idea.
17:05dnolenmmarczyk: you should test with v8 directly, I also recommend testing with JavaScriptCore for sanity checking
17:05dnolentechnomancy: (js* "this")
17:05technomancydnolen: thanks
17:05mmarczyktechnomancy: see also this-as
17:06mmarczyktechnomancy: (this-as self (do-stuff self))
17:06dnolentechnomancy: yeah this-as probably better, (js* ...)
17:07dnolenonly in dire cases.
17:07dnolenmmarczyk: I also optimized default cases
17:07mmarczykdnolen: I've been using v8 and SpiderMonkey for tests, I'll wire it up for for benchmarking
17:07dnolenmmarczyk: they were paying.
17:07dnolenmmarczyk: ok cool
17:07mmarczykdnolen: I've seen some *weird* results on node recently -- e.g. I've got a patch lying around which seems to speed up satisfies?
17:08mmarczykdnolen: 60ms -> 45ms on some huge number of runs
17:08cemericksince we're on the subject of cljs noob questions: is there any hope of bridging vectors (or lists) to arrays, so that I can avoid wrapping things in js/Array, etc?
17:08mmarczykdnolen: but actually causes a hit on first/rest -- um, what?
17:08mmarczykdnolen: so, I don't really know what to think about it.
17:08dnolenmmarczyk: yeah I'm not sure what the deal is with node, they may tweak the VM settings a lot.
17:08cemerickmmm, that's probably a stupid question, actually
17:09dnolenmmarczyk: another big boost coming soon for idiomatic CLJS
17:10dnolenmmarczyk: direct dispatch to rest fns
17:10mmarczykdnolen: https://github.com/michalmarczyk/clojurescript/tree/or-free-satisfies
17:10mmarczykdnolen: *fantastic*
17:10mmarczyk!
17:10dnolenmmarczyk: can you point me to the relevant change?
17:11dnolencemerick: something more than into-array?
17:11mmarczykdnolen: sure, https://github.com/michalmarczyk/clojurescript/commit/ef872be54fef3833decc245dcbfed4c3aa10e421
17:12mmarczykdnolen: or in that position gets compiled into a function call -- if ((function () {...})()) ...
17:12dnolenmmarczyk: yeah that kind of stuff is nice for code readability
17:12dnolenmmarczyk: but doesn't matter in the end.
17:12dnolenmmarczyk: lambdas get lifted by GClosure
17:13hcumberdaleI do not understand the java interop
17:13hcumberdalefor variable argument lists
17:13mmarczykdnolen: ok, good to know
17:13dnolenmmarczyk: anytime you have a function to preserve expression semantics GClosure will optimize it away.
17:14cemerickdnolen: No. Ignore the Q. I'm just coping with not fundamentally caring about the interop issues in the case of cljs, so I'm being sloppy.
17:14dnolenmmarczyk: this is why the perf diff between simple and advanced is so big sometimes.
17:14mmarczykso GClosure basically allows us to get away with having a recursive decent compiler :-)
17:14dnolenmmarczyk: yep
17:16dnolenmmarczyk: check this out, on JSC rest fn optimization is only slightly slower than accessing arguments object it looks like :)
17:18mmarczykdnolen: hah :-)
17:22mmarczykdnolen: well, this is marvellous -- should be a tremendous boon for idiomatic cljs
17:23dnolenmmarczyk: and on v8 we can call rest fn 1e6 times in ~90ms instead of ~1100ms
17:23mmarczykdnolen: shall we say a noticeable improvement? ;-)
17:24mmarczykdnolen: so basically what I want to know now is when are you going to merge this in :-D
17:24dnolennow
17:25mmarczykwell that sounds like a great time
17:26dnolenrest fn optimization now in master
17:27mmarczyk:-)
17:27wootsanI tried marking a def with ^:const, but clojure screams at me that I "can't embed object in code, maybe print-dup not defined". What does this mean?
17:29dnolenmmarczyk: I've been wanting to optimize that an incredibly long time.
17:29dnolenmmarczyk: but we needed a fast satisfies? first :)
17:29mmarczykdnolen: :-)
17:30mmarczykdnolen: well that is going to be a *huge* win :-)
17:34mmarczykdnolen: I'll need to go and get some work done on a rather pressing project tonight; later though (tomorrow, I guess) I'll be putting together a benchmark runner -- 12x speed improvements on fundamental operations should be measured & tracked properly :-)
17:34brainproxydnolen: I'm getting close to having something truly useable with node-clojurescript ... going to start porting over the tooling from the coffee-script library for wrapping around the core build routine, and expose command line operations
17:35pandeiroamalloy: cheers, that makes sense
17:36brainproxycemerick: your pomegranate turned out to be very, very useful in the context of making cljs and nodejs runtime work well together
17:37RaynesWould anyone care if refheap's browserid authentication got replaced with github authentication?
17:37cemerickbrainproxy: That's surprising, but sounds like a nifty use case. :-)
17:38cemerickRaynes: whoa, that had a short lifespan. Where are you getting the github auth from?
17:38Raynescemerick: What had a short lifespan?
17:38brainproxycemerick: :) it allows cljs :require and nodejs/require to both work well
17:38cemerickthe browserid thing
17:39Raynescemerick: I'm simply entertaining other options. People keep complaining about browserid.
17:39dnolenbrainproxy: nice!
17:39dnolenmmarczyk: cool thanks for your all you help w/ this stuff.
17:39brainproxycemerick: i.e. i needed a way to modify classpath at runtime, on the clj side of node-clojurescript
17:39Raynescemerick: All two of the people who use konkeror can't sign in!
17:40mmarczykdnolen: not at all, thanks for all of your time and insight and very much looking forward to working on this a lot more
17:40brainproxyanyone know a good resource for learning lein ... keep in mind I'm also trying to get my head around java, maven, et al. at the same time
17:40cemerickRaynes: I'm contemplating using https://github.com/fernandezpablo85/scribe-java/ for oauth in friend.
17:41pandeirobrainproxy: `lein help tutorial` you did already?
17:41mmarczykbrainproxy: README + the docs directory in the repo -- *really* good documentation
17:41brainproxypandeiro: not yet, more like trying to just understand how it all fits together
17:42Raynescemerick: I don't like scribe. It invented it's own request type, so if you want to write a library for an oauth API, you have to use its special http client thingy.
17:42brainproxybut I guess experimentation and the docs directory as mmarczyk suggested will be the way to go
17:44cemerickRaynes: Good point. That said, it already supports so many (and it so widely used — thus maybe ~= reliable) that I'd be happy enough with it for a first cut.
17:44cemerickThere can certainly be more than one oauth workflow in the world.
17:45RaynesOh how I hate oauth.
17:45cemerickheh, course, there's no github API impl :-P
17:46Raynescemerick: You should rewrite refheap to use couchdb.
17:46cemerickAnyway, the list that *is* there is impressive enough that I can't really ignore it.
17:46cemerickhttps://github.com/fernandezpablo85/scribe-java/tree/master/src/main/java/org/scribe/builder/api
17:47cemerickRaynes: That's two couch mentions from you in the same afternoon. Wassup?
17:47Raynes*shrug*
17:47RaynesJust considering other options.
17:47RaynesPeople seem to think I'm retarded for using mongodb, so obviously I must be doing something at least slightly wrong.
17:47ibdknoxthere's absolutely nothing wrong with mongo
17:48RaynesCool.
17:49cemerickthere's absolutely nothing wrong with mysql, either.
17:49ibdknoxdefinitely. They're all viable tools
17:49Licenserthere was something wrong with mongo so - they refused to make it sparc compatible :(
17:49RaynesMan, nobody uses solaris. Go away.
17:49ibdknoxhrmpf, #python isn't being helpful
17:49LicenserRaynes I do!
17:50Licenseralso solaris != sparc
17:50cemerickibdknox: I was mostly trolling. There's a great deal wrong with both mongo and mysql, but yes, people can make just about anything work given enough effort and conditioning.
17:51ibdknoxcemerick: I dunno, it's all "right tool for the job", yeah? Engineers seem to be completely irrational when it comes to DB choices
17:51ibdknoxrather, data persistence choices
17:51ibdknoxwhich is funny to me
17:51Raynesibdknox: Well, to be fair, my decision to use mongo in refheap was "I know how to use congomongo. Let's go."
17:51cemerickSure, but all things being equal, there are reasonable defaults.
17:52cemerickI think it'd be hard to make a good case that mysql is preferable to postgres, for example.
17:52ibdknoxbrehaut: you're the resident pythoner. Is there a python equivalent to in-ns in for the python repl?
17:52ibdknoxcemerick: I agree, I knew you were trolling on that point :p
17:53brehautive forgotten what in-ns does
17:53brehaut(doc in-ns)
17:53clojurebot"([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."
17:53brehautnope
17:53ibdknoxbrehaut: I want my code to eval in a specific context
17:53ibdknoxseriously?
17:53brehautwell
17:53brehauttheres not a commonly used trick
17:53ibdknoxthat's dumb
17:54brehautthe eval functions let you pass in locals and globals
17:54ibdknoxis there a way to get the locals from a module?
17:54brehautbound to be
17:55brehautdir(module) would work
17:55brehautbut you are never supposed to rely on its behavior
17:55brehaut(even though that behavior hasnt changed noticably in the 12 years ive used python)
17:55ibdknoxpython's AST stuff is so nice, but its facilities for actually executing code are terrible
17:56brehautyeah, you might find you have to do a bunch of munging
17:57ibdknoxmeh. Ok. Hackery it is. Thanks brehaut
17:57brehautno worries. i hope my advice is ok ;)
18:16pandeiro,(let [args '(1 2 3 4)] (take (dec (count args)) args))
18:16clojurebot(1 2 3)
18:17pandeiro,(let [args '(1 2 3 4)] (pop args))
18:17clojurebot(2 3 4)
18:17pandeiro,(let [args '(1 2 3 4)] (pop (vec args)))
18:17clojurebot[1 2 3]
18:33dnolenk I think apply will be the next CLJS perf victim. Seems like a near 10X speed bump is possible there as well.
18:33amalloy&(doc butlast) ;; pandeiro
18:33lazybot⇒ "([coll]); Return a seq of all but the last item in coll, in linear time"
18:37pandeiroamalloy: that's it, thanks... still working on defpartial :-/
18:42zanesSo, I'm very new to Clojure and am trying to get started with a new project.
18:42zanesAll I have is a single ns declaration that requires a few libraries.
18:42zanesWhen I C-c C-k to compile the file I get a bunch of errors of the form:
18:43zanesWarning: *format-str* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *format-str* or change the name.
18:43zanesThen the compilation errors out.
18:43zanesIs this a problem with the library I'm using?
18:46brehautzanes: are you using clojure-contrib ?
18:46zanesNot that I know of.
18:46brehautwhat libraries are you using?
18:47brehautbecause pre clojure 1.3 vars were dynamic by default.
18:47brehautthey need to be annotated specifically in 1.3+
18:47zanestwitter-api and clj-oauth.
18:48zanesLooks like clj-oauth is the offender.
18:48brehautlooks like it
18:49brehautlast release was feb last year
18:49brehautwheres Raynes
18:49brehautim sure he was complaining about oauth recently
18:49brehautzanes: perhaps have a look at oauth-clj ?
18:50cemerickshouldn't everyone always be complaining about oauth?
18:50brehauthaha
18:50zanesHaha
18:50brehautprobably
18:50brehauti was just thinking that if he had suffered under it recently, he might know the least bad library to use
18:51brehautunless friend is relevant here?
18:53brehauthow did i not know that use allowed :as
18:55brehaut(dec brehaut)
18:55lazybotYou can't adjust your own karma.
18:55brehaut,(print "(dec brehaut)")
18:55clojurebot(dec brehaut)
18:55lazybot⇒ 6
18:55brehautthanks clojurebot
18:55zanesbrehaut: Not relevant. I'm just talking to the twitter API.
18:56zanesI'm excited about friend, though. Hope to use it for something else.
19:04devn,(print "(inc devn)")
19:04clojurebot(inc devn)
19:04lazybot⇒ 3
19:04devn,(print "(inc devn)")
19:04clojurebot(inc devn)
19:04lazybot⇒ 4
19:05devnbrehaut: heh brehaut
19:05brehautits pretty poor form to use that trick to inc yourself :P
19:05devni didn't believe it worked :)
19:06devn(read-string "(inc brehaut)")
19:06devn,(print (read-string "(inc brehaut)"))
19:06clojurebot(inc brehaut)
19:06lazybot⇒ 7
19:06brehautlol
19:06brehautthanks
19:06devn:)
19:13lazybotI feel so violated.
19:25zanesSpeaking of libraries, it appears that parsley is the least painful pure-Clojure parser generator?
19:31devnzanes: there are a few options
19:32devnhttps://github.com/youngnh/parsatron
19:32zanesdevn: I wa slooking at parsley, or potentially just ANTLR.
19:33zanesShould I not be alarmed if the project is still on Clojure 1.2.0?
19:33devnzanes: looks like you have some commits on it
19:34zanesWhich? Parsley?
19:34devnyeah, is that right or just a coincidence?
19:34devnhttps://github.com/cgrand/parsley/network
19:34zanesI submitted a pull request to bring it up to Clojure 1.4.0.
19:34zanesOr what I think will bring it up to 1.4. I'm just getting started with Clojure.
19:34devnlaurent has work to get it to 1.3
19:35devnperhaps you should submit your patches to him?
19:35zanesYeah, unclear.
19:36zanesI get the impression it's not exactly being actively maintained. : )
19:36ibdknoxnone of cgrand's libs really are last I saw
19:36devnyeah :(
19:36devnreason #10 to not use enlive
19:37devnit's funny, because laurent has a dozen commits that arent submitted back to cgrand
19:37devncgrand has a commit which is a couple months old
19:38devnwhy the crazy divergence?
19:38zanesYeah. parsley was simply the parser generator that seemed easiest to port to 1.4.0.
19:38zanesdevn: Not only that, but he branches away several times without any merges back.
19:39yoklovmaybe they were bad ideas?
19:39devnif they're bad ideas, delete them
19:40yoklovoh, yeah, that's probably the thing to do
19:40devnim not the most organized guy ever though so i can see how they might be hanging out there
19:40zanesI mean, they just appear to be patches to maintain compatability with recent versions of Clojure.
19:40yoklovi do that a lot but i'm not very good at git, nor am i very organized
19:40devnzanes: idk, fwiw my advice is to just act like you own it
19:40devnrelease to clojars, etc.
19:41devnmake your fork the good fork
19:41devnleave mediocrity behind
19:41yoklov(the branch without returning, not the maintaining compat. w/ clojure versions)
19:41zanesYeah. That makes sense. Just trying to be a good citizen with the pull request.
19:42devnzanes: yeah i understand -- he should too though if he's not addressing your requests in a timely fashion
19:43_KY_If I want multiple binding in
19:43_KY_If I want multiple binding in "for"
19:44_KY_I do (for [ [x y] [[1 2] [3 4] ]...., right?
19:45_KY_,(for [[x y] [[1 2] [3 4]] (print x y))
19:45clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
19:45_KY_,(for [[x y] [[1 2] [3 4]]] (print x y))
19:45clojurebot(1 23 4nil nil)
19:46_KY_It doesn't seem to bind correctly if I have variables in place of 1,2,3,4...
20:01mdeboard&(clojure.repl/source if-let)
20:01lazybot⇒ Source not found nil
20:02brehaut(source if-let)
20:02brehauthuh. i thought that had some magic applied to it
20:03mdeboardtrying to write an if-let for emacs :P
20:04mega_should not be to hard
20:06dgrnbrghello clojurians
20:06dgrnbrgi have a weird issue w/ reevaluating namespaces in the same repl
20:06dgrnbrgI am :useing a namespace which redefines a lot of clojure primitives, like not=, =, >, <, +, -
20:07dgrnbrgwhen I reevaluate the unit tests for that namespaces, it fails on the ns macro, saying that not= is already defined in that namespace.
20:07dgrnbrgWhat is going on?
20:08brehauti dont really know what im talking about here, but have you done a refer-clojure in the test ns?
20:08dgrnbrgbrehaut: I have not
20:09dgrnbrgI want to use most of clojure's symbols, except for the ones I'm redefining
20:09amalloy~source if-let
20:09dgrnbrglike algo.numeric-tower
20:10brehautim pretty sure you can specify which core vars you want to refer
20:11dgrnbrgbrehaut: do you know what the syntax is for doing that?
20:11amalloy(:refer-clojure :as core :exclude [+ - ...]), iirc
20:11amalloythen you still have access to them under core/+
20:12dgrnbrgso that would just exclude those few symbols?
20:12brehautgo with what amalloy suggests; i only know about the feature in theory
20:12amalloybut really, just read ##(doc refer), and apply whatever the syntax is; refer-clojure takes the same args
20:12lazybot⇒ "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symb... https://www.refheap.com/paste/2618
20:12dgrnbrgActually, I don't think that's the problem
20:13dgrnbrgThe root error is:
20:13dgrnbrgnot= already refers to: #'myns.math/not= in namespace #'myns.test.math
20:14dgrnbrgI have multiple :use clauses in the ns macro
20:14dgrnbrgcould that cause a problem
20:15dgrnbrgIt appears to be related to the fact that it's re-using the symbol
20:16dgrnbrgAnd it's only happening for not=, not for any of the other vars (which are defined earlier in the source file)
20:18gfredericksdgrnbrg: you've excluded not= from clojure.core?
20:18dgrnbrggfredericks: I referred clojure.core to clj
20:19gfredericksoh gotcha
20:19dgrnbrgit doesn't want to re-refer the same var
20:19dgrnbrgbecause it's already been defined
20:20dgrnbrgI'll be back in a moment to discuss it, but the bus just arrived at a rest stop
20:34wkmanireGood evening
20:34wkmanire:)
20:56mebaran151can a lein checkout override a project plugin?
20:56mebaran151I'm trying to debug my Windows issues with lein-cljsbuild and play with all the cool new toys
20:58emezeskemebaran151: I am not aware of a way to do that (although I don't claim to know for certain that it can't be done)
20:59rhcwhat does it mean when I get "Evaluation aborted" in the repl?
21:00dreishThe form being evaluated threw an exception.
21:01rhcah, ok, thanks dreish
21:02rhcstrange, when i ran it a second time i got a stack trace. bit more useful :)
21:02gfredericksrhc: it's messing with you
21:03mebaran151emezeske: ah thanks, btw do you have any ideas what could npe'ing on the repl tasks; it looks like an eval-in-project issue
21:05emezeskemebaran151: Hard to say; I'd probably look at the leiningen code indicated in the exception to see what it's doing at that point
21:07mebaran151it looks like it's swallowing an exception and trying to parse out an exit code
21:07emezeskemebaran151: Is an exception thrown if you leave out the "trampoline"? The repl won't work right without it, but it should start
21:07mebaran151which apparently doesn't exist
21:08mebaran151emezeske: not using trampoline won't let me start it: gives an error that all repl tasks must be started from trampoline
21:08emezeskemebaran151: Derp, I forgot I added that check :)
21:09emezeskeI wonder if other trampoline tasks work? Like "lein trampoline run" ?
21:10mebaran151there might be an error in my setup too: is there a good example cljsbuild project that I coudl clone just to test and see if it's just some nonsense on my part setting up the build
21:10emezeskemebaran151: https://github.com/emezeske/lein-cljsbuild/tree/master/example-projects/simple
21:10emezeskeerr
21:10emezeskeYeah, that should work for e.g. "lein trampoline cljsbuild repl-rhino"
21:11mebaran151hmm, emezeske good call: lein trampoline repl also blew up
21:11nybbleswhats the best way to make it so that a macro is syntax-highlighted as a keyword in clojure-mode? i.e. i want defconstrainderecord from trammel to be syntax-highlighted
21:11mebaran151I've been having trampoline issues with lein on windows anyway: thought I'd solved them but it seems like they need more thwacking
21:11emezeskemebaran151: Doh :/
21:15mebaran151it looks like the task actually starts, which is the weirdest part; I would have thought with trampolining, once the task was running, everything was setup alright
21:16emezeskemebaran151: Is this lein 1.7?
21:21uvtcIs it ok to have both ~/bin/lein and ~/bin/lein2 , and to use them both? Or will they interfere with eachother?
21:21mebaran151emezeske: I'm trying to get lein 2.0 running :/
21:22uvtcActually, I meant, "hi #clojure", then the rest. :)
21:22gfredericksuvtc: I'm 98% sure it's fine
21:22emezeskeuvtc: Yeah, I have that same setup going and it's just fine
21:23emezeskemebaran151: Ah
21:23uvtcthanks :)
21:23uvtcOh, shoot. Actually, I just checked the lein2.0.0-preview3 release announcement, and it says "Note that this does not conflict in any way with Leiningen 1.x; you can
21:23uvtckeep the two of them installed side-by-side."
21:25mebaran151I might try and port the whole launcher script to a nice saner language like powershell
21:25mebaran151but now that I'm reading how trampoline works, it's pretty trippy, what with generating a script file to then try and call
21:26emezeskemebaran151: For troubleshooting, I definitely recommend taking a look at that generated script, and running it by itself
21:29mebaran151emezeske: I'm checking it right now
21:29uvtcThe lein 2 preview 3 release announcement (<http://groups.google.com/group/clojure/browse_thread/thread/91079a531ee1f1c8#&gt;) says "Highlights include the ability to show a full dependency tree a la "mvn
21:29uvtcdependency:tree"". How do I tell lein to show me that?
21:31gfredericksuvtc: try `lein pom` then `mvn dependency:tree`
21:31gfredericks....if you have maven installed
21:31uvtcgfredericks, Ah, I see. You've got to have maven installed. Thank you.
21:32xeqiuvtc: `lein deps :tree`
21:32uvtcWell, I'm guessing lein installs what it needs on its own, but I have no mvn command available on my system.
21:32uvtcxeqi, thanks!
21:33gfredericksis that a lein2 thing?
21:33uvtcxeqi, `lein help deps` doesn't mention anything about that.
21:33amalloygfredericks: yes
21:33amalloyalso, the lein standalone jar includes a copy of maven
21:33xeqifeel free to make an issue and we'll see if we can git to it for preview4 or 5
21:34gfredericksamalloy: you have explained two things in a row
21:34amalloydoes "yes" ever count as explaining something?
21:34gfrederickshmm
21:34gfredericksyes
21:35brainproxyis the idea with string-print in clojurescript to output a string and have a line break ( \n ) automatically appended, or to just send the bare string to stdout?
21:37brainproxyreason i ask is that in the nodejs.cljs that ships with clojurescript string-print is pointing at sys.puts, but the latter is deprecated
21:37brainproxyand I'm wondering whether it would be better to point string-print at console.log
21:37brainproxyor process.stdout.write
21:38brainproxyconsole.log appends \n
21:38brainproxyprocess.stdout.write does not
21:38mebaran151emezeske: in proper trampolining, do you know what is supposed to be passed to the -main function?
21:39uvtcxeqi, created an issue. Thanks.
21:41ForSparePartscan anyone point me to good (newbie) resources for building data structures in clojure?
21:42ForSparePartsAlmost all my experience so far is in imperative languages, but I've done some haskell, too -- I'm looking for something like the user data types in haskell, any good idiomatic way to build composite data structures.
21:44brehautthe default choice in clojure is to not define your own data type; just use maps and vectors
21:44brehautlater on you might find something like defrecord useful, but you can safely ignore it for now
21:45yoklovblargh
21:45amalloyi don't remember who said it, but i like the suggestion to regard defrecord as an "advanced feature"
21:45yoklovmod works different in clojure and clojurescript
21:45yoklov:/
21:46yoklovand if it were fixed it would be slower :(
21:46brehauti think the number of records ive defined in real programs could be counted on one hand
21:46ForSparePartsOK. So, what's the right way to organize data together? Just make a map containing several types of data?
21:47brehautyes. keywords make convenient keys
21:47amalloyyeah, more or less. maps for "object-y" things, vectors for lists
21:47amalloy(or seqs for lists. i don't mean to imply there's some reason to use vectors specifically)
21:50ForSparePartsOK. Thanks!
21:52yoklovvectors are more idiomatic imo
21:52mebaran151emezeske: I'm not sure if the trampoline is supposed to pass itself as an argument in the generated bat file
21:56amalloyyoklov: that's a silly opinion imo. i mean, if you're typing them in by hand, sure; but in real life you use whatever list-analogue makes most sense for your need. probably that winds up being a lazy-seq more often than a vector, but i don't actually know
22:00uvtcgfredericks, I was just looking at flatland/useful. There appears to be a lot of good stuff in there.
22:00mebaran151anybody know if technomancy is around? I'd like to confirm one or two things before I mail him a patch
22:00yoklovamalloy: i primarially meant if you're typing by hand, all other things being equal. And yeah it's silly but usually fast random access is better than what lists/seqs offer
22:00technomancymebaran151: briefly. what's up?
22:01yoklovat least for what i end up doing
22:02technomancyuvtc: thanks for opening that issue; would you be up for submitting a patch?
22:02mebaran151technomancy: I think I found the actual heart of the trampoline bug, but just to confirm, when a task trampolines, it creates a bat that re passes the entire command string (including the trampoline part) to leiningen/-main
22:02technomancymebaran151: more or less
22:03uvtctechnomancy, sure. I only just learning Clojure, but I can submit a pull request for a doc patch. :)
22:03technomancyI don't know if the thing it creates should be considered a bat or just a file full of commands
22:03uvtcs/I only/I'm only/
22:03technomancyuvtc: we don't discriminate =)
22:03mebaran151and if you pass -main a string like "trampoline repl" it would construe that as a single command right?
22:04technomancymebaran151: depends on the context, I think, but that could be the case
22:05mebaran151anyway, I think I misdiagnosed my trampoline issue previous: it was less that the wrong path was being taken and more that \"%*\" expanded to "all commands in a single string"
22:06technomancyyeah, quoting in this context is fraught with peril
22:06technomancyso easy to get wrong
22:06mebaran151oh man, tell me about it :)
22:07mebaran151btw, is there any particular reason the repl task would timeout if launched from a trampoline?
22:19mebaran151sweet it looks like cljs repl is working now. thanks for the help technomany; I suppose I just resubmit a patch with my updated fixes?
22:29technomancymebaran151: that'd be great; thanks
22:29technomancythe repl might time out if it expects there to be a leiningen process and a project process present, since trampoline means there's only one process
22:33mebaran151technomancy: ah okay, I just wanted to make sure I wasn't breaking anything else while fixing something, heh
22:37uvtctechnomancy, I issued a pull-request for that doc patch (lein deps), but it went and created a new issue. I think I forgot to include "#562" my the commit message.
22:38uvtc(I mean, I think that's what I was *supposed* to do. :) )