#clojure logs

2012-03-08

00:00technomancyoh that's right; what you want is filter-indexed, but for some reason it doesn't exist
00:00tmciver,(apply + (take-nth 2 '(1 2 51 44 66 77)))
00:00clojurebot118
00:00technomancygood man
00:01tmciverthanks. I'm gettin' there.
00:01dreampeppers99great!
00:01dreampeppers99and for even elements
00:01dreampeppers99the take-nth won't work
00:02dreampeppers99(apply + (take-nth 2 (rest '(1 2 51 44 66 77))))
00:02tmciveryup
00:02dreampeppers99,(apply + (take-nth 2 (rest '(1 2 51 44 66 77))))
00:02clojurebot123
00:02dreampeppers99,(apply + (take-nth 2 (rest '(1 2 3))))
00:02clojurebot2
00:02dreampeppers99,(apply + (take-nth 2 ('(1 2 3))))
00:02clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
00:02dreampeppers99,(apply + (take-nth 2 '(1 2 3)))
00:02clojurebot4
00:02dreampeppers99perfect :D
00:05dreampeppers99why can't I apply the reduce function instead of + ?
00:05dreampeppers99,(apply + (take-nth 2 '(1 2 51 44 66 77)))
00:05clojurebot118
00:05dreampeppers99,(reduce + (take-nth 2 '(1 2 51 44 66 77)))
00:05clojurebot118
00:05dreampeppers99,(reduce + (take-nth 2 '(1 2 51)))
00:05clojurebot52
00:05dreampeppers99,(apply + (take-nth 2 '(1 2 51)))
00:05clojurebot52
00:05dreampeppers99,(apply + (take-nth 2 '(1 2)))
00:05clojurebot1
00:05dreampeppers99,(reduce + (take-nth 2 '(1 2)))
00:05clojurebot1
00:06dreampeppers99nevermind silliest of mine
00:06dreampeppers99once again thank you guys!
00:06dreampeppers99:D
00:07LajlaWhy can he dod that and not I?
00:07technomancyDid You Know™: it is actually possible to communicate with clojurebot via private /msg calls?
00:07dreampeppers99sorry for that!
00:07dreampeppers99I didn't know, my mistake.
00:07Lajladreampeppers99, do not let them take away your freedom
00:07technomancyno worries; not much going on in here anyway
00:07Lajlayour faith
00:08ibdknoxtechnomancy: what's the fun in that
00:08Lajlayour freedom to love, your freedom to hate, your freedom to worship His Divine Shadow
00:08ibdknoxtechnomancy: last time I did it, clojurebot was getting inappropriate
00:08tmciverlol
00:08dreampeppers99is this the "official" irc channel for clojure?
00:08ibdknoxyes
00:09tmciveribdknox: tell him he has to take you out to dinner first.
00:09technomancyibdknox: "get a room you two"?
00:09ibdknoxhaha
00:09ibdknoxtmciver: I did, but then he was trying to guilt me saying he's never been outside of #clojure
00:10tmciveribdknox: don't you fall for his tricks; you'll regret it in the morning (I know I did)
00:10ibdknoxlol
00:10ibdknoxtricksy little hobbitses, that one
00:11tmciverwhat's it doing?!
00:12ibdknoxcan one of you guys manufacture some more time for me?
00:13technomancyto the tardis!
00:13Null-Aibdknox: sure, don't sleep tonight.
00:14dreampeppers99just for the record I was trying to solve the Peasant Multiplication using Clojure. Since I'm a newbie for Clojure my solution is very poor coded. But, anyway thanks for your helping.
00:14ibdknoxhaha. Touche.
00:14Null-Athat's what separates from clojure hackers from the boys
00:15ibdknoxthat's what I wanna be when I grow up :D
00:16Null-Ayou will one day young grasshopper
00:16Iceland_jack·
00:24amalloytechnomancy: filter-indexed strikes me as annoyingly specialized (same with keep-indexed fwiw): don't clutter the stdlib with combinations of existing functions. i'd prefer to see mapcat-indexed added, and from that you can easily derive map-indexed, filter-indexed, keep-indexed, whatever you need for your actual problem
00:24technomancyor just ... indexed?
00:25amalloyi suppose. that was removed because it leads to a lot more consing, so i was assuming we keep it out
00:27technomancyI'd vote for keep the most general and the most efficient
00:28ibdknoxwhat's this?
00:28technomancyibdknox: indexed from contrib got promoted into a bunch of core functions: map-indexed, keep-indexed, and maybe another one?
00:29ibdknoxah
00:29amalloyi can't think of any others
00:29technomancywhich is annoying because they're complected, but apparently composing map and indexed is "too slow"
00:29technomancyso you're on your own if you want filter-indexed
00:30technomancyyou have to do something dumb like (filter f (map-indexed vector coll))
00:42rlbI'd like to partition a collection on boundaries defined by a predicate. i.e.:
00:42rlb(partition-foo #(re-matches "id:.*" %1) ["id: 1" "a" "b" "id: 2" "x"])
00:42rlb => [["id: 1" "a" "b"] ["id: 2" "x"]]
00:42rlbIs there already something like that?
00:42Iceland_jackseparate?
00:42clojurebotseparate is in clojure.contrib.seq-utils, but just use (juxt filter remove) instead
00:43sritchiepartition-by?
00:43sritchiehmm, not quite
00:43sritchie,(partition-by #(re-matches #"id:.*" %1) ["id: 1" "a" "b" "id: 2" "x"])
00:43clojurebot(("id: 1") ("a" "b") ("id: 2") ("x"))
00:44rlbI want the "id: .." line to be part of the group.
00:45amalloy(useful.seq/partition-between (fn [[a b]] (re-matches #"^id:.*" b)) coll), roughly
00:46amalloyhttps://github.com/flatland/useful/blob/develop/src/useful/seq.clj
00:46rlbamalloy: exactly -- thanks.
00:54gtuckerkellogg,(def foo "foo")
00:54clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
00:54gtuckerkellogg,(java.util.regex.Pattern/compile (def foo "foo")
00:54clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
00:54gtuckerkellogg,(java.util.regex.Pattern/compile "foo")
00:54clojurebot#"foo"
00:55gtuckerkelloggis that the best (only) way to create a regex from a string in Clojure? (supposing (def foo "foo")
00:56amalloyhm, it occurs to me there ought to be a cleverer way to implement partition-between, reusing pieces of the input sequence as the args to the split? function
00:56Raynesamalloy: It occurs to me that a lot occurs to you.
00:57amalloyi'm the occurrence nexus of the country
00:57RaynesHave you ever considered seeing if anything occurs to a doctor about how much occurs to you? Perhaps there is a medication for it.
01:04Null-Agtuckerkellogg: ,(re-pattern "foo")
01:04Null-A ,(re-pattern "foo")
01:04clojurebot#"foo"
01:08gtuckerkelloggthanks
01:34johnmn3What layout manager is most recommended to use with seesaw?
02:25gf3has anyone experience issues with validations in noir 1.2.2?
02:26gf3I get the following when I try to use validation/rule or validation/errors? →
02:26gf3ClassCastException clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref clojure.core/deref (core.clj:2078)
02:26gf3with any kind of input
02:29gf3example → http://cloud.gf3.ca/EqcH
02:44_ulisesmorning all
02:53seancorfieldif i have some-lib-1.4.2.jar and some-lib-1.4.3.jar on my classpath, is there some mechanism that chooses which one to load? (this question came up in another non-clojure context and after googling i'm not sure what the definitive answer is)
02:54raekI think that load-file will search the jars for the file in the order they appear on the classpath
02:54raekwhich can be really bad
02:56raek1.4.2 has foo, which uses bar and 1.4.3 has only bar, then if you have them ordered as 1.4.3, 1.4.2 on the classpath and try to load foo, version 1.4.2 of foo will load and cause version 1.4.3 of bar to load
03:00osa1can anyone verify that this code works on clojure 1.3 https://github.com/clojure/clojure-contrib/blob/b8d2743d3a89e13fc9deb2844ca2167b34aaa9b6/src/main/clojure/clojure/contrib/zip_filter/xml.clj#L88 ?
03:01osa1or is there a newer version of this?
03:04zamaterianosa1, read http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
03:09osa1zamaterian: ok, this doesn't work either https://github.com/clojure/data.zip/blob/master/src/test/clojure/clojure/data/zip/xml_test.clj
03:11georgekhi, I'm getting started with cljs and cljs/one, sometimes I kill the cljs/one repl for whatever reason, but if I want to restart the repl I get "BindException Address already in use: JVM_Bind java.net.PlainSocketImpl.socketBind", what's the right way to restart?
03:11zamaterianosa1, I have a project where i'm using zip xml from [org.clojure/data.zip "0.1.0"] together with clojure 1.3
03:13osa1zamaterian: is it on github? I could have a look
03:14zamaterianseancorfield, if you have one or mere lib with conficts in version in the same classpath you could use -Xbootclasspath with suns java bin
03:16zamaterianosa1, its in a private repository... 2 sek I will cut the relevant parts out into a gist
03:25zamaterianosa1, https://gist.github.com/1999613
03:28osa1zamaterian: great, thanks
03:47osa1does anyone know a function to build get data url for http from a map or vector?
03:50osa1whatever, I've just wrote one
03:53zamaterianosa1, (map slurp ["http://github.com&quot; "http://slashdot.org/&quot;]) :-)
03:57osa1zamaterian: sorry for my english. what I meant was, I need to generate URL's for from maps, for example {1 2 3 "a b"} should return me 1=2&3=a+b etc.
04:28gtuckerkelloggwhat's the easiest way to keep the non-nil members of a list?
04:29lucian,(filter (complement nil?) [1 2 3 nil 4 5 nil])
04:29clojurebot(1 2 3 4 5)
04:30gtuckerkelloggis that considered idiomatic?
04:30gtuckerkellogghow about
04:30luciani don't really know, tbh. but it works
04:30tomoj(keep identity coll) ?
04:31tomojand/or (filter identity coll)?
04:31gtuckerkellogg,(filter (fn [x] x) (1 2 3 nil 4 5))
04:31clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
04:31gtuckerkellogg,(filter (fn [x] x) '(1 2 3 nil 4 5 ))
04:31clojurebot(1 2 3 4 5)
04:32gtuckerkelloggalthough that's not exactly what I asked is it
04:32gtuckerkellogghmm
04:32tomojI sometimes imagine that keep has a one-arg version that is (keep identity coll)
04:32amalloy(remove nil? xs)
04:32lucianwhy bother with a fn? tomoj suggested identity
04:32tomojoh, right
04:32tomojif you really want "non-nil"..
04:32gtuckerkelloggok, thanks
04:32tomoj(remove nil? coll)
04:34tomojhmm is xs in fashion or is it just you amalloy
04:35luciantomoj: i've seen it a lot in haskell and ml, like x::xs
04:35amalloy*shrug* a list where each element is x, is xs
04:35tomojright
04:35lucian"a bunch of x -s" is what it sounds like to me
04:35amalloycoll is probably a better answer to this particular question, but i certainly didn't care
04:36tomojI often want to use that style but feel like it's not clojure idiom
04:37tomojbut would probably use it more if I saw it more..
04:39gf3hey guys, why would noir *not* use atoms here? https://github.com/ibdknox/noir/blob/1.3/src/noir/session.clj#L13
04:39clgvtomoj: 'coll is very descriptive as well^^
04:40zamateriangf3, look at line 83
04:40zamaterians/83/82
04:40clgvgf3: because this way you can have multiple request with different sessions at the same time in different threads - that wont be possible with an atom
04:41gf3clgv: ahh, makes sense
04:42gf3clgv: I'm running into issues where I try to access the session and it is unbound
04:42gf3which is why I asked
04:42clgvgf3: then you probably forgot to add a "middleware statement" like wrap-session or something similar
04:43clgvgf3: this one: https://github.com/ibdknox/noir/blob/1.3/src/noir/session.clj#L55
04:47gf3clgv: I don't think I am, hmm
04:47gf3clgv: it doesn't always fail, just sometimes
04:48clgvgf3: if that ring middleware wrap-noir-sessions is registered correctly and you are only accessing it from requests that should be fine
04:49clgvgf3: if you are in clojure 1.2(.1) then there might be an issue if you access it from a different thread than the request thread
04:49gf3clgv: it seems to fail when accessed from a model inside a partial
04:49gf3page → partial → partial → model
04:53osa1I have a map with names for keys and integers for values, how can I sort it's values?
04:55gf3osa1: (sort (vals your-map))
04:55osa1gf3: I also need keys of this vals after sorting :)
04:57osa1(sort #(compare (nth %1 1) (nth %2 1)) map)
04:57gf3osa1: (sort #(compare (last %1) (last %2)) your-map)
04:59y3dihey guys, im starting out with clooj. I defined a (coin-toss) function but when I try to run it in the repl I get this error
04:59y3dicompiling:(NO_SOURCE_PATH:1)
05:00y3diin full: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: coin-toss in this context, compiling:(NO_SOURCE_PATH:1)>
05:00vijaykirany3di: did you (use 'yournamespace) in the repl ?
05:01vijaykiranwhere yournamespace is where you defined your coin-toss
05:01y3dinope, thanks
05:02y3diso i tried this: (use 'gamble-core)
05:02y3dibut i get a file not found exception
05:03raeky3di: what is the file path of the namespace? gamble/core.clj or gamble_core.clj?
05:03y3dithis is what I have at the top of core.clj inside my 'gamble' folder: (ns gamble.core)
05:03raeky3di: then do a (use 'gamble.core) :-)
05:03raekperiod in name = subdirectory in file system
05:04raekhyphen in name = underscore in file path
05:04y3diok, thanks alot, not sure why i used hyphen in the first place..
05:14y3disorry for the newb questions but im getting the same error i was before when i try to run toss-score or t
05:14y3dihttps://gist.github.com/2000130
05:15y3dibut (coin-toss) works fine
05:19vijaykiranyou may need to reload the namespace after you added these functions
05:19vijaykiran(use 'gamble.core :reload)
05:24xkbHi
05:24vijaykirany3di: ^^
05:24xkbIm working on some 4Clojure problems, and my alternative to map blows the heap. Any idea why? code is @ https://gist.github.com/2000178
05:24vijaykiranxkb: Hi
05:25y3divijaykiran: thanks, I guess clooj doesn't auto reload on save
05:25xkbnever mind the strange list/cons action, was trying out some alternative list creation forms
05:26vijaykiranbtw - why pp is (def pp fn .. ) ? you can use (defn .. ) .. right ?
05:26xkbyes
05:26xkbbut in 4clojure you need to answer inline
05:27xkbas an anoymous function I suppose
05:28xkbsee http://www.4clojure.com/problem/118 for example
05:29xkbthat's the one I'm working on now
05:29pipeline4clojure is pretty awesome
05:30pipelinebut the "def is bad" thing drives me a little crazy since it means a bunch of copy/pasting
05:30xkbyep
05:30xkbmy whole emacs scatch file is filled with def's for 4clojure :P
05:31xkbI did like most of the challenges
05:31xkbI think my solution for this one is not lazy
05:31pipelineof course copy/pasting only drives me crazy because some combinatino of my firefox version and the rich text js in 4clojure breaks paste from emacs
05:31xkband that's why it blows
05:31xkbhehe
05:31xkbsame here
05:31xkbso I work the other way around
05:31pipelineyeah I think that's how they test for laziness: huge sequences
05:31xkbfrom 4clojure past to emacs
05:32xkbpaste*
05:32xkbreduce works on lazy seq's
05:32xkbso that can't be it
05:33xkbso that leaves the seq I'm building
05:34vijaykiranmay be use lazy-cons ?
05:35vijaykiranhttp://clojure.org/lazy
05:38xkbhmm good tip
05:38xkblet's see
05:43xkbhehe solved it
05:43xkbusing lazy-seq
05:44vijaykiranyeah .. sorry lazy-seq not lazy-cons :)
06:03y3diwhy does 'its' break the convention of possession using apostrophes? Is there a particular reason for this?
06:06loopsok, have spent 2 hours trying to figure out how to use leiningen, ready to set my hair on fire :oP
06:07loopsit says you need to run v1 lein install in "leiningen-core subproject directory" where is that directory?
06:08zamaterianloops, leiningen is only for lein 2
06:08loopszam.. yeah.. i kinda answered my own question.. i just dont have a v1 to use for bootstrapping
06:08zamaterianloops, ups leiningen-core is only for lein 2
06:09loopsso i was checking it out from git history, but of course that removes the v2 leiningen-core directory ;o)
06:10loopsbit of a catch-22, would be nice if old version wasn't needed for us noobs ;o)
06:13loopsjust checked out v1 and renamed the script to lein1... and used it for bootstrap.. easy once ya grok the problem
06:14loopsthx zama
06:15vijaykirany3di: I think the rule (or exception rather) is for all the possesive pronouns
06:17y3diyea i forgot that it was the same way for his, hers, whose, etc
06:44randomnameherehi ;)
06:45randomnamehereHow can I yield functions for each entry in a list ?
06:45randomnamehere("x" "y" "z") << delete (x) delete (y) delete (z) ... ?
06:45clgvrandomnamehere: example?
06:46clgvis (map delete '("x" "y" "z")) what you mean?
06:46clgv&(map inc [1 5 9])
06:46lazybot⇒ (2 6 10)
06:47randomnameheremaybe reduce?
06:47clgvcan you give input and epected output?
06:47thorwilmap is lazy, isn't it?
06:47clgvyes
06:48randomnamehereinput: ["people_9b59a761-f360-4e53-98b4-d2352b275a70" "people_a563d6e9-841b-4f2c-87c2-c7e697f9d104"]
06:48randomnamehereoutput should be function calls to (.delete ... )
06:48clgvah
06:48clgv(doseq [p people] (.delete p))
06:49clgvthat will call 'delete on each 'p from the 'people collection
06:49randomnamehereRepeatedly executes body (presumably for side-effects) with bindings and filtering as provided by "for" << "for" =
06:49clgvfor is lazy again^^
06:50randomnamehereI do not understand the documentation of that ;)
06:50randomnamehere(doseq [p people] (.delete p)) << where is the "for" ?
06:50raekrandomnamehere: doseq uses the same syntax as for
06:50clgvno for needed. you can use the same optional parameters as in 'for
06:50clgv(doseq [p people :when (.ugly p)] (.delete p)) ;)
06:51raek(for [p people] (.delete p)) yields a lazy sequence of the return values of the .delete calls
06:51randomnamehereis it also possible to use: (reduce (.delete p) [p people]) ?
06:51raekdoseq is similar, but does not create a sequence and is not lazy
06:52raekrandomnamehere: you cannot call reduce like that
06:52clgvrandomnamehere: if you dont want to return a value 'reduce is wrong.
06:52clgvrandomnamehere: what's your objection concerning 'doseq ?
06:52randomnameheredosseq documentation: Does not retain the head of the sequence. Returns nil.
06:53clgvyep. it's intended for side effects and not returning anything
06:53randomnameherenone objection clgv , I only really try to understand what I do
06:53clgvrandomnamehere: ok. doseq is more like a for-loop in c++ or java
06:53randomnamehereokay and if .delete returns futures which can tell if the delete happened i have to use some other things
06:54raek(doseq [p people] (.delete p)) expands into something like (loop [ps people] (when (seq ps) (.delete (first ps)) (recur (rest ps))))
06:54clgvrandomnamehere: than you could use (doall (map #(.delete %) people)) where 'doall is needed to force deletion immediately
06:54raekrandomnamehere: yes, if you care about the return values, use for or map
06:54clgv*then
06:54randomnamehereAhh,... but it does not happen in parallel ;(
06:55randomnamehereHow can I feed a list in and do parallel .delete actions?
06:55raekrandomnamehere: submit them to an ExecutionService
06:56raekrandomnamehere: you said that .delete returns a future. does that mean that the work of .delete is performed in another thread?
06:56randomnamehereis there no simple solution in clojure, like (doparallel [p people] (.delete p))
06:57raekwell, there is pmap, which is like map but performs some of the calculation in parallel
06:57randomnamehereAhh raek, you are right...
06:57raekbut only a fixed number of them at the same time
06:58randomnameherewow, nice. But it seem I do not need pmap cause the java library behind also creates threads
06:58randomnamehere(doall (map #(.delete %) people)) << this is more kind of functional style, isn't it?
06:58lucianyou could also use memfn, but it's not really a significant improvement
06:59raekif you want to block for all of them to return, you could do (doseq [f (map #(.delete %) people)] (.get f))
06:59raeksorry
06:59raek(doseq [f (doall (map #(.delete %) people))] (.get f))
06:59randomnamehereWhat does #( %) ?
07:00randomnamehere% is each item?
07:00raek#(.delete %) is a short form for (fn [x] (.delete x))
07:00raekyou cannot write just ".delete" since java methods are not clojure functions
07:00lucianyou could also do (map (memfn .delete) people)
07:00raek(memfn predates the #(...) shorthand syntax)
07:01lucianuh, without the dot. (memfn delete)
07:01randomnameherebut delete only tooks one value, not the whole keyset
07:01lucianof course, that's what map does
07:02lucianraek: you're right, i just found it more clear sometimes
07:03randomnamehere (doseq [p people :when (.ugly p)] (.delete p)) ;) << i like that one
07:03raekrandomnamehere: in case you need to do the threading yourself sometime: http://blog.raek.se/2011/01/24/executors-in-clojure/
07:04raekthe last example is the most relevant
07:04randomnamehere(doseq [f (doall (map #(.delete %) people))] (.get f)) << this one?
07:04raeksorry, the last repl example in the blog post :-)
07:05raekanyway, an explanation of (doseq [f (doall (map #(.delete %) people))] (.get f)):
07:05randomnameherefuture-call ?
07:05raekfirst it uses map to create a lazy sequence iof (.delete p1) (.delete p2) (.delete p3)...
07:05raekrandomnamehere: no the one before that
07:06randomnamehereahh ok
07:06raekthen 'doall' is used to make sure all .delete calls have been forced
07:06raekat this point all the .deletes are ticking in the background
07:06raekthen we iterate over all the futures they returned and wait for them to finish, one by one
07:07raekusing the doseq loop
07:07randomnamehereyeahh!
07:07randomnameheresuper-awesome
07:08raekassuming you have the java.util.concurrent.Future kind of futures
07:10randomnamehere"doseq should be a vector"
07:11randomnameherehmpf
07:13raekrandomnamehere: did you mean "doseq requires a vector for its binding"?
07:13randomnamehereyes
07:13randomnameherejava.lang.IllegalArgumentException: Parameter declaration doseq should be a vector
07:14randomnamehere(doseq [f (doall (map #(.delete %) (cget bucket)))] (.get f))
07:14randomnameheremh
07:14raekthe syntax of doseq requires you to first have a vector of name-expression pairs and then one or more body expressions
07:14randomnamehereisn't this the case?
07:14randomnamehere[f ...] (body)
07:14raekyes
07:15randomnamehereSo why doesn't clojure like it?
07:15raekrandomnamehere: that line parses for me
07:15raekdoes it look exactly like that in your code?
07:16randomnamehere(defn cremoveall "Removes all items from collection including the head node" (doseq [f (doall (map #(.delete %) (cget bucket)))] (.get f)))
07:16randomnamehereahh
07:17randomnameheremissed [bucket]
07:17raekyeah
07:17raekah, now I see
07:17raekyou can have variadic defns like this: (defn foo ([] ...) ([x] ...) ([x y] ...))
07:18raekand clojure tried to parse your (doseq ...) as a ([x y] ...)
07:18raekergo the "doseq should be a vector"
07:22randomnamehere(defn cdeleteall "Removes all items from collection including the head node" [bucket] (doseq [f (doall (map #(.delete (find-connection) %) (cget bucket)))] (.get f)))
07:22randomnameherenow i need to append the value of bucket to the list returned by cget bucket
07:23randomnameherethink conj will work
07:48tutysara_I am wanted to change the path to the lein executabe, I got this command from techomancy - (setq clojure-swank-command "/path-to-lein/lein jack-in %s"). I am putting this in the scratch bufffer and executing it (M-x eval-buffer). Is that the right way to do this?
07:48tutysara_*technomancy
07:49luciani'm assuming you have your real path there
07:51tutysara_lucian : yes you are right, i am using this - (setq clojure-swank-command "/cygdrive/c/cygwin/home/Administrator/bin/lein jack-in %s")
07:51lucianyou might want to put that in your ~/.emacs if you want it to happen when you open emacs
07:53tutysara_lucian : if i execute it from scratch buffer will it wont take effect immediately for that session, I am evaluating this command from scratch and the next thing I do is hit M-x clojure-jack-in and see if it works
07:54tutysara_lucian : if i execute it from scratch buffer will it wont take effect immediately for that session ?, I am evaluating this command from scratch and the next thing I do is hit M-x clojure-jack-in and see if it works
07:54lucianwhat you eval should take effect
07:56tutysara_lucian : any way i will try your suggestion, put that in .emacs and see if that works
07:59tutysara_lucian : same error buddy : (
07:59lucianwhat is the error?
08:06tutysara_start-process-shell-command: Spawning child process: invalid argument
08:17gf3ibdknox: am I wrong in thinking build-dirs should include (:src-dir opts)? https://github.com/ibdknox/noir-cljs/blob/master/src/noir/cljs/watcher.clj#L108
08:25clgvgf3: are you using noir with cljs? did you find a good guide for it?
08:25gf3clgv: I'm attempting to
08:26clgvgf3: will your project be on github?
08:26gf3clgv: and no, I haven't found a good guide, I am considering writing one
08:26clgvgf3: even better ^^
08:26gf3woo
08:27randomnamehereI want to remove a part from an entry in memcached...
08:27randomnamehereclojurestack.memcache=> (with-mc db-nodes (cgetmap "people")) #<HashMap {people_621a0f2c-9376-4476-b23f-57f99ac9c0de="hanna-lena" , people_dfa7df94-39ef-45b7-9cf1-22d3311507bd="martin" }>
08:28clgvI have build a little webapp that renders incanter charts for some timeseries. the app could be a little more responsive via js...
08:28randomnamehere(defn cdeleteitem "Removes item from collection" [bucket item] (let [bucketcontents (cgetmap bucket)] )
08:28randomnameherehow to find the item with (= ...) and get the key to remove?
08:30clgvrandomnamehere: do you know it's key?
08:30nachtalprandomnamehere: try to use filter maybe?
08:30gjuanyone else having problems installing swank-clojure via lein?
08:31clgvrandomnamehere: if not you can treat the map as collection of key-value-pairs
08:31randomnamehereyes clgv this should work
08:35randomnameherefilter + map
08:38randomnamehere(filter #(= "martin" (val %)) (with-mc db-nodes (cgetmap "people")))
08:38randomnamehere()
08:38randomnameheremhh
09:18gtuckerkelloggSo i have a big long vector, which I'd like to be able to modify in a concurrent fashion.
09:18gtuckerkelloggthere's no coordination needed
09:18gtuckerkelloggbut two thread should not modify the same element
09:19gtuckerkelloggas I undertand it (and I may not) my recommended option would be to creat this as a vector of atoms
09:20clgvgtuckerkellogg: the same element at the same time or the same element at all in the whole runtime?
09:20gtuckerkelloggi meean agents
09:20gtuckerkelloggthe same element at the same time
09:21gtuckerkelloggit's a non-deterministic algorithm where threads can modify individual elements of the array
09:22gtuckerkelloggso if it's a vector of agents, individual threads can modify them asynchronously and without coordination, and no collisions can ever happen
09:22clgvgtuckerkellogg: hm then vector of atoms sounds about right, if concurrent modifiations of the array at different elements are allowed
09:22gtuckerkelloggyes, they are
09:23gtuckerkelloggthey can be asynchronous, so it could be agents, right?
09:23clgvI dont understand the last question
09:24gtuckerkelloggwhy use atoms instead of agents?
09:26gtuckerkelloggthat's what I was asking in the last question
09:27chousergtuckerkellogg: you might consider a ConcurrentHashMap if performance is a goal. http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ConcurrentHashMap.html
09:27chouserNot sure how well a map will work for you instead of a vector.
09:27gtrak`atoms are much lighter-weight, if it's not worth the overhead of an STM and task processing consider atoms
09:28gtrak`your vector will effectively be a vector of AtomicReferences
09:28clgvgtuckerkellogg: it's a question what you want. atoms are just coordinating access to a value. an agent has a value that is modified by jobs in its eventqueue
09:29gtuckerkelloggthats' a helpful way of putting i
09:29gtuckerkelloggit
09:29randomnameherehow can I exclude something from a list
09:29randomnamehere["people_621a0f2c-9376-4476-b23f-57f99ac9c0de" "people_dfa7df94-39ef-45b7-9cf1-22d3311507bd" "people_fdd5e1f7-464a-4980-a691-d65e1c24a0fe"]
09:29gtrak`filter
09:31clgvfilter
09:31gtrak`,(take 5 (cycle 'filter))
09:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
09:32clgv&(take 5 (cycle ['filter]))
09:32clgv,(take 5 (cycle ['filter]))
09:32clojurebot(filter filter filter filter filter)
09:33gtrak`,(filter #(not (= % 'filter)) (take 5 (cycle ['filter])))
09:33clojurebot()
09:33gtrak`,(filter #(= % 'filter) (take 5 (cycle ['filter])))
09:33clojurebot(filter filter filter filter filter)
09:34lnostdali'm using locally generated snapshots; is there some way (an option or something) of making lein not look for updates from various external resources?
09:34lnostdale.g. stuff like "[INFO] snapshot org.clojure:math.numeric-tower:0.0.2-SNAPSHOT: checking for updates from clojars" .. i don't need or want that
09:35gtrak`there's the lein checkouts feature
09:36lnostdalso i just symlink a checkouts folder to ~/.m2/repository ?
09:37lnostdalkinda hard to tell whether it worked because sometimes lein doesn't "check for updates"
09:38lnostdalwho'd want to update random dependencies at random points in time while doing development? .... doesn't make sense
09:39clgvlnostdal: lein's checkouts feature is to link another lein project in the checkouts folder
09:40gtrak`lol mindspring
09:40gtrak`lnostdal, so basically you skip the part where you generate the snapshot and just link in the source
09:42lnostdalgtrak`, i've found that that stuff doesn't actually work; some projects have several directories with source .. which they install via mvn install or lein install as separate mvn projects etc.
09:42lnostdalring seems to do this i think
09:42gtrak`ah, yea, I think checkouts assumes just pure clojure source
09:43gtrak`lnostdal, I imagine for the ring subprojects you'd have to link in each individually
09:43lnostdalyes, something like that .. and it's just stupid; not gonna deal with that
09:44gtrak`yea, from looking at it, that's exactly what you'd do
09:44lnostdal..and i recall trying anyways, and it didn't work in some casess
09:50gtrak`i think it won't work if the project has custom tasks or plugins or hooks
09:53clgvgtrak`: checkouts works with java source as well
09:54gtrak`oh, nice, maven projects too?
09:54clgvgtrak`: afaik it uses the project.clj of the checkouts project
10:01randomnamehereyeah, finished.
10:01randomnameherehttp://goo.gl/0SYZX
10:04randomnamehereFeel free to improve :) If you have any hints what can be done better this is also welcome
10:05clgvrandomnamehere: what is memcached?
10:06randomnameherehttp://memcached.org/
10:06randomnamehereone of the fastest memory caching systems out there
10:07randomnamehereYou can use it as key value store with http://www.couchbase.com/couchbase-server/features
10:07randomnamehereThen it is persistent to disc, distributed and so on
10:07beffbernardQuestion: Anyone have success running a swt app on emacs + swank-clojure? It requires the java process run with this switch -XstartOnFirstThread
10:07dgrnbrgIn clojure.core.jdbc in clojure 1.3, if I have functions that use with-connection, and I call them within another function's with-connection to the same DB, will it reuse that connection?
10:08randomnamehereThe other NoSQL stuff is full of Logic, Query systems and so on. This makes this kind of systems very slow
10:08beffbernardI can run fine with lein run but I'd like to be more interactive and run it on emacs
10:09randomnamehereEven faster than sql databases, but memcached has outstanding performance. There are a lot of java applications which put a lot of data (HTTP-Sessions) to memcached instead of the sql-db
10:10raekbeffbernard: does it work to add that option to the project.clj file?
10:10beffbernardraek: I have this in my project.clj :jvm-opts ["-XstartOnFirstThread"]
10:14randomnamehereclgv: but memcached offers not functionality to store collections of items. The application has to implement such things itself. It works very well for small pieces of data. On Heroku for example you can store bigger data in EC2 buckets. I a solution like memcached + ec2 seems nice
10:19randomnamehereIf you have any ideas how to improve it, let me know ;)
10:19lpetitclgv: hello
10:19clgvlpetit: hi
10:20lpetitclgv: have you seen the announce for the new beta version of CCW today ?
10:20clgvlpetit: oh, not yet. thx
10:20randomnameherewhat is a CCW?
10:21lpetitclgv: it's really just a bunch of paredit/strict mode bug fixes, so really worth upgrading
10:21clgvrandomnamehere: eclipse plugin for clojure named counterclockwise
10:22lpetitclgv: and the leiningen support is going well. Not sure I'll be ready to release at the same time as leiningen 2, we'll see :)
10:22clgvlpetit: today I missed something like leiningen support. I had a bugfix in one of my basic libs that required me to alter 5 buildpaths ;)
10:23lpetitclgv: I intend to release leiningen support separately from ccw, so that life cycles are separate, until it's good enough to be shipped along ccw.
10:24lpetitclgv: and this will allow me to deliver something quicker, even if not feature complete
10:24lpetits/quicker/faster/
10:24clgvah ok
10:26lpetitclgv: first release either today, either next thursday, with a leiningen class path container, a button to enable/disable "leiningen support" (automatically adding the leiningen container to the build path + a builder re-computing the leinigen dependencies every time the project.clj file is touched) + a button to manually force the re-computation of the leiningen dependencies from the project.clj file.
10:27clgvlpetit: =)
10:28clgvlpetit: I get persuaded more and more that I need to hack CCW's repl view to support history search like in the bash
10:29lpetitclgv: I remember you talked about this earlier. Did you also file an issue for this? If not, would be great.
10:30clgvlpetit: no issue, yet.
10:30lpetitclgv: please, help yourself ;-)
10:31clgvlpetit: gotta find an easy way for a 3D plot in java first ;)
10:31lpetitclgv: "Take a pause, File an issue" :)
10:36dgrnbrgWhat's the best library for making a CLI program if I'm using lein-uberjar?
10:45clgvdgrnbrg: there is a with-command-line macro
10:45TimMcWhat does that do?
10:46dgrnbrgclgv: is that the easiest/slickest way? will it work w/ uberjar?
10:46TimMcdgrnbrg: Wait, do you want something like GNU GetOpt, or a shell-like interface?
10:47dgrnbrglike getopt
10:47TimMccheck out clojopts
10:47dgrnbrgI have a cli program I want to distribute
10:50TimMcdgrnbrg: Here's an example of clojopts in use: https://github.com/timmc/kpawebgen/blob/master/clj/src/kpawebgen/core.clj#L44
10:52clgvTimMc: looks similar to the with-command-line one. maybe some more features ^^
10:53TimMcclgv: Where does with-command-line live?
10:54clgvTimMc: good question. I found it via google a long time ago
10:54TimMcI see it in contrib...
10:55TimMcI'd trust clojopts more, since it is backed by GetOpt itself.
10:56TimMcAlso, I can verify that it uses juxt in at least one place.
11:05dgrnbrgI have a jar I depend on that's not in a maven repo
11:05dgrnbrghow do I make uberjar stop deleting it?
11:07TimMcdgrnbrg: Put it in a repo.
11:08TimMcdgrnbrg: s3-private-wagon will allow you to keep it in S3
11:08dgrnbrgTimMc: that's not an option. It's impossible for me to get maven to work/use a repo at work
11:08dgrnbrgcan I copy it somewhere to trick maven?
11:08dgrnbrgor is there another artifacts dir so I can check it into my reop?
11:08dgrnbrg*repo?
11:08TimMcOh, I remember this problem now... you've got this proxy problem.
11:08dgrnbrgYeah
11:09dgrnbrgI did solve that, but it's painful
11:09dgrnbrgand setting up a new repo is impossible (effectively)
11:09dgrnbrgI just need to get tools.jar from java7
11:09clgv lpetit: done
11:09clgvdgrnbrg: you can switch off implict cleans
11:10dgrnbrgclgv: how do I do that?
11:10clgvdgrnbrg: it's in the example on the leiningen readme
11:10dgrnbrggot it, thanks
11:11TimMcdgrnbrg: I think you can also add things explicitly to the classpath.
11:12dgrnbrginteresting...
11:12dgrnbrgI'll investigate all these things
11:13TimMcdgrnbrg: Always worth another skim through the sample project file.
11:13dgrnbrgTimMc: indeed it is :)
11:14dgrnbrgI just spend so much time looking up things that I get lazy sometimes ;)
11:15randomnamehere(= (list __) '(:a :b :c))
11:15randomnameherewhat might __ be?
11:15raek:a :b :c?
11:15Bronsawithout the question mark.
11:15raekit can't be just one value
11:16randomnamehereit works, but why?
11:17Bronsa,(list :a :b :c)
11:17clojurebot(:a :b :c)
11:18dgrnbrgdo you know any programmatic APIs to interact w/ the AST of java source? I'm using doclet, but it's really slow and crappy, and I'm concerned it'll be hard to use antlr
11:18clgvhumm clojars doesnt list my uploaded jar :(
11:18TimMcrandomnamehere: Doing 4clojure problems?
11:19randomnamehereyes TimMc
11:19randomnamehere,(:a :b :c)
11:19clojurebot:c
11:19randomnamehereWTF?
11:19TimMcYeah, I've complained in the past that it's not really clear that a blank can take multiple expressions.
11:20lucianrandomnamehere: unquoted lists are executed
11:20raekdgrnbrg: antlr is actually pretty painless to use from clojure
11:20TimMcrandomnamehere: Oh, *that* has to do with keywords acting as functions.
11:20raekcheck out the lein-antlr plugin
11:20lucianin this case :a is a function, and it's called with :b and :c as arguments
11:20randomnameherelucian: and they are quoted with list ?
11:20vijaykiranHow can I "replace" a value for key in a vector of maps .. ?
11:20Bronsarandomnamehere: thats kinda like (get :b :a :c)
11:20clgvwhat do I need to add to a jar to have it registered in clojars?
11:20Bronsait returns :c because it's not-found-value
11:20lucianrandomnamehere: (list :a :b :c) means calling the function list with :a :b :c as params
11:20Bronsa,(doc get)
11:20clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
11:20lucian,'(:a :b :)
11:20clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :>
11:20dgrnbrgraek: thanks
11:21lucian,'(:a :b :c)
11:21clojurebot(:a :b :c)
11:21randomnamehere,(list a b c)
11:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0)>
11:21randomnameherewhiy isn't this working?
11:21Iceland_jack,(list 'a 'b 'c)
11:21clojurebot(a b c)
11:21randomnameherequoting,.mhhh
11:21TimMcclgv: Nothing in particular. Just follow the clojars instructions.
11:21lucian,(= (list :a :b :c) '(:a :b :c))
11:21clojurebottrue
11:21dgrnbrgraek: is there a javac task as well?
11:21Bronsarandomnamehere: you have to (quote) or ' in order to prevent things to be evaluated
11:21randomnamehere,(list "a" "b" "c")
11:21clojurebot("a" "b" "c")
11:21clgvTimMc: hm ok, trying the "POM" wikipage now
11:21raekdgrnbrg: yes, that's built in leiningen
11:22randomnamehereokay, understood
11:22TimMcclgv: Huh? No, the instructions are here: http://clojars.org/
11:22randomnameherebut why does :a work when : does no quotation?
11:22TimMcclgv: Just `lein jar, pom` and `scp pom.xml mylib.jar clojars@clojars.org:`
11:22Bronsabecause symbols evaluate to themselves
11:22amro:a is a keyword
11:22Bronsa,(eval :a)
11:22clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
11:22amroit always evaluates to itself
11:22Bronsaoh :(
11:22clgvTimMc: it's a java dep not available in any maven repo
11:23Bronsauser=> (eval :a)
11:23Bronsa:a
11:23raekdgrnbrg: this is how my project.clj file looks like https://gist.github.com/2001893
11:23TimMcclgv: Ah! Yeah, you'll need to build a pom.xml for it and push both at the same time.
11:23raekwhen I have edited the grammar, I run "lein antlr && lein javac" and restart clojure from emacs by running clojure-jack-in
11:24dgrnbrgraek: awesome…that looks perfect/easy
11:24Bronsaclgv: use this https://github.com/ato/lein-clojars
11:24raekI was really surprised that it worked so well
11:24Bronsathen you just need to `lein push`
11:25TimMcYou'll still need a pom.
11:25raekit was way messier to get it working in an eclipse java project
11:25TimMcBronsa: That's for pushing from a lein project, not just some random jar, yeah?
11:25Bronsai think so
11:26clgvah well. seems it worked.
11:32TimMcclgv: Which?
11:32clgvTimMc: ?
11:32TimMcwhich worked?
11:32clgvah. I added it via the pom
11:32clgvlein-clojars didnt work for me in the past
11:33randomnamehere,(reverse "DLROW OLLEH")
11:33clojurebot(\H \E \L \L \O ...)
11:34Iceland_jack,(apply str (reverse "DLROW OLLEH"))
11:34clojurebot"HELLO WORLD"
11:34Iceland_jack(:
11:41fritoHi, any pointers to calling Java classes with main methods.
11:42fritoFor instance if I instantiate one, is main called implicitly or does it have to be explicit
11:42clgvfrito: main is a static method and is not called automatically
11:43fritoOK - thx
11:43TimMcfrito: You call Foo/main, not (.main (Foo.))
11:43TimMcWell, (Foo/main)
11:44randomnamehere(= (__ "Dave") "Hello, Dave!")
11:44randomnamehere,(= (str "Hello, " "Dave") "Hello, Dave!")
11:44clojurebotfalse
11:44TimMc&(str "Hello, " "Dave")
11:45TimMcRaynes: Can you restart lazybot?
11:45TimMc,(str "Hello, " "Dave")
11:45clojurebot"Hello, Dave"
11:45randomnameherehow to move the ! to the end?
11:46TimMcrandomnamehere: While it is possibleto solve this one by putting two expressions in the blank, you could also use an inline function.
11:46TimMcalso, there is a #4clojure channel, just so you know :-)
11:48clgvrandomnamehere: (format "Hello, %s!" "Dave")
11:48randomnameherejava.security.PrivilegedActionException: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0)
11:49randomnamehereahh seen it
11:49clgv,(#(str "Hello, " % "!") "Dave")
11:49clojurebot"Hello, Dave!"
11:49TimMcSo, kind of the point of 4clojure is to teach yourself this stuff.
11:50TimMcIt's kind of weird to ask for answers, or give them (without asking if spoilers are OK)
11:59clgvhow was the fast way to get a two dimensional vector in a 2-dim array?
11:59clgv*2-dim double array
12:03TimMcSome combo of map and into-array?
12:07clgvhmyeah (into-array (map double-array ...))
12:10lancerois there any online guide on installing clojure 1.3 / emacs 24 / swank / clojure-mode on windows?
12:10randomnameherelancero: good question ;)
12:12owain`Clojure box is a quick way to get set up if you're forced to use Windows for any reason. Not sure what version of Emacs. Might be 23
12:12owain`http://clojure.bighugh.com/
12:15llasramlancero: The first step is to realize that you don't "install" Clojure. To install something that gives you a Clojure environment, install Leiningen. lein supports windows, emacs supports windows, and everything else Should Just Work [1]
12:15llasram[1] Not tested myself. YMMV :-)
12:17lancerollasrm: well I could rephrase my questions to: any online guide to getting lein / clojure 1.3 / emacs 24 / swank / clojure-mode to just work on windows?
12:18llasramFollow the official instructions for installing each individual thing?
12:18llasramNot being facetious
12:35gf3is there something like (filter) but it stops after the first match?
12:35gf3like (some) but it returns the item, not a boolean
12:35RickInGA&(some odd? [1 2 3])
12:35TimMcgf3: (first (filter ...))
12:36RickInGAfilter is lazy, so you should be able to take 1
12:36RickInGA(take 1 (filter odd? [1 2 3]))
12:36gf3okay cool, thx
12:36RickInGA&(take 1 (filter odd? [1 2 3]))
12:36TimMcRickInGA: But that gives back a seq, not a value.
12:36RickInGAis lazybot sleeping, or am I doing something wrong?
12:36TimMc*the value
12:37TimMcYeah, botdown.
12:37dakrone,(take 1 (filter odd? [1 2 3]))
12:37clojurebot(1)
12:38RickInGA,(some odd? [1 2 3])
12:38clojurebottrue
12:38RickInGAdoh, I thought that returned the first item
12:39Bronsa,(first (filter odd? [1 2 3]))
12:39clojurebot1
12:42bpsm(some f xs) returns the first ( f x) which is truthy, not the first x for which (f x) is truthy.
12:43RickInGAbpsm: thanks
12:43bpsmPresumably there's some clever idiom that takes advantage of that behavior, but I don't know it.
12:45RickInGAdon't know if anyone on is in the Atlanta area, but a few from this channel are getting together at Harp Irish Pub in Roswell this evening.
12:46llasramRickInGA: Doh! I'm in Atlanta, but have other plans tonight
12:46llasramI didn't actualy realize this city hosted other Clojure users :-)
12:46gf3rude
12:47llasramIncipient users group?
12:48RickInGAllasram I think so. There is a Lisp meetup group, not sure how active it is.
12:48RickInGAgf3 rude?
12:49gf3(just kidding)
12:49RickInGAgf3: ok, :) You're invited too! where are you?
12:49gf3sadly I'm in Toronto
12:50llasramRickInGA: That'd be pretty cool. I'm definitely interested
12:50zawzeyHi, any idea why there's a bug here: https://gist.github.com/6a8fe84c110a54203937
12:50zawzeyThe number of items in the map is less than the input
12:50ibdknoxgf3, yeah that should be part of the watcher.
12:51gf3ibdknox: okay cool, 'cause I find things are getting a bit messy putting it all in "src/"
12:51ibdknoxgf3, haha you can tell which codepath I use ;)
12:52gf3ibdknox: :D
12:53dnolenredinger: think we can starting filling out the GSoC app today?
12:54zawzeyFormatted to make the code legible
12:54ibdknoxdnolen, I'm going to add a couple projects tonight
12:54llasramzawzey: I don't think sorted-map-by or comparators work the way you think they do
12:54dnolenibdknox: sweet! the more the merrier
12:55zawzeyllasram: and how would you explain that
12:55ibdknoxI think a good, pretty easy one would be to create noir-static. A little static site generator that reads Noir's route table
12:55zawzeyllasram: i'm aware usually for sorted-by keys are being compared, but i would like to sort based on the values
12:55jkkramerzawzey: you probably want a priority-map instead. sorted map items that compare as equal are considered the same item
12:55ibdknoxwe can have our own, much cooler jekyll :)
12:55zawzeyjkkramer: ahh, i see
12:55llasram,(apply sorted-map-by (constantly 0) (range 20))
12:56jkkramerzawzey: https://github.com/clojure/data.priority-map
12:56clojurebot{0 19}
12:56zawzeyjkkramer: but then again, if i compare the keys instead of the key-value sorted-map-by works
12:57gf3ibdknox: oh, another little issue I noticed, if the path contains "cljs" it fails to parse properly
12:57jkkramerzawzey: because the keys are distinct
12:57gf3ibdknox: for example the following files won't generate "src/my-app/cljs/core.cljs"
12:57gf3ibdknox: but this will: "src/my-app/js/core.cljs"
12:58ibdknoxgf3, weird
12:58ibdknoxgf3, as in it fails to watch it, or the compiler doesn't compile it?
12:58zawzeyjkkramer: i see, thanks...
12:58zawzeyllasram: gotcha, thanks
12:58ibdknoxoo
12:58gf3ibdknox: both I guess
12:59ibdknoxgf3, yeah don't do that
12:59ibdknoxhaha
12:59ibdknoxyou're replace cljs.core
12:59ibdknoxreplacing*
12:59llasramzawzey: You can just make sure the keys compared are unique: https://gist.github.com/ee28d4333002d516dffd
12:59gf3ibdknox: ruh roh
12:59llasrams,are unique,are distinct if the keys are actually distinct,
13:00ibdknoxit should be fine if it's cljs/something/core.cljs
13:00ibdknoxI think that path is hardcoded in the compiler
13:00ibdknoxyou might want to file a bug for it
13:00gf3ibdknox: indeed, just not the watcher
13:01jkkramerllasram: zawzey: if you assoc/dissoc that map, though, it will not be sorted by the new values
13:01llasramjkkramer: true
13:04zawzeyllasram: great, thanks
13:05zawzeyi should add that example to clojuredocs
13:10di-csuehsreminder to self: "for" list comprehension is lazy....still.
13:34rplevydoes anyone who uses cucumber-clojure (cucumber-jvm) know if reading tabular data is broken?
13:45jsabeaudryThe disadvantage of using send-off everywhere instead of send is higher resources usage?
13:45gtrak`is there a complement to the bean function?
13:46TimMcgtrak`: What would that do?
13:46gtrak`set properties from a map of keywords to vals on a bean
13:47TimMchmm
13:47TimMcAn existing bean object, existing class (instantiating and then pumping in vals), or creating a class for the vals?
13:48technomancy(doto (java.util.Properties.) (.putAll {"hello" "world"}))
13:49raekjsabeaudry: yes.
13:50raeksend uses a fixed size thread pool and send-off allocates new threads when needed
13:50raekif your functions don't block or take very long time to execute, it's safe to use send
13:51jonasendnolen: Time for another core.logic question?
13:51dnolenjonasen: shoot
13:51jonasenhttps://refheap.com/paste/972
13:51jonasendnolen: the first expression doesn't unify. Why?
13:52dnolenyou can't just use a dot like that
13:52dnolen(_ . _), (_ _ . _) etc are the only valid ways to use .
13:52jonasendnolen: ok
13:53gtrak`TimMc, yes, an existing class, for instance a spring bean
13:53dnolenjonasen: actually I guess (. _) currently works, not sure what I think about that.
13:53Lajlaraek, my love.
13:53LajlaLet us worship His Shadow together.
13:54dnolenjonasen: but no, the . only works with list syntax, I don't see an obvious issue at the moment with it working with vectors ... feel free to open a ticket.
13:54jonasenI would like to unify (fn [. ?x] (?fun . ?x)) with (fn [x y] (+ x y)) if you know what I mean
13:56Bronsawhat are the advantages of using core.logic's unifier over core.unify?
13:57jonasendnolen: core.logic is new territory for me... so expect a silly question daily.
13:59dnolenjonasen: why not (fn ?args (?fun . ?args)) ?
14:01jonasendnolen: That seems to work. Thanks!
14:01dnolenjonasen: out of curiosity whats kinds of features are you all adding?
14:02jonasendnolen: this rule is for suggesting (map inc [1 2 3]) instead of (map #(inc %) [1 2 3])
14:02gtrak`TimMc, I found a solution in setter-fn: https://bitbucket.org/kumarshantanu/clj-argutil/src/d4732e993c30/src/main/clj/org/bituf/clj_argutil.clj
14:02dnolenjonasen: ha, nice :)
14:03dnolenjonasen: do you all have a lein-kibit yet?
14:05dnolenjonasen: heh, I see that lein kibit already works.
14:07jonasendnolen: yes. It should work. You'll need to use master with lein 2.0 though.
14:08dnolenI haven't ventured yet into lein 2.0, does it just work? i.e. no breakage?
14:09technomancydnolen: most of the breakage is in 3rd-party plugins
14:09technomancyall the core changes are handled for you by lein-precate
14:10_uliseswhat's the preferred way of parsing (possibly broken) HTML? is it with enlive?
14:11technomancymost of the broken plugins are the more obscure ones; lein-ring and lein-midje are the only widely-used ones that still aren't compatible
14:13ibdknoxI should go fix mine, huh?
14:14chouser_ulises: I've used tagsoup successfully
14:14ibdknoxthere's a clj-tagsoup as well
14:14ibdknoxhttps://github.com/nathell/clj-tagsoup
14:15chouserdata.xml ought to work on top of tagsoup
14:15technomancyibdknox: lein-noir? would be cool to get it on newnew, yeah
14:15ibdknoxit technically is
14:15jkkramer_ulises: I've had best results with jsoup. no clojure wrapper, but it's an html5-compliant parser
14:15dnolenjonasen: ohpauleez emailed me about recursively applying rules, did you all sort this out?
14:16_ulisesinteresting
14:16_ulisesthanks for the responses, now I have to go and investigate
14:16dnolentechnomancy: hmm, Exception in thread "main" java.lang.NullPointerException when I try to run lein2
14:18technomancydnolen: there's a known issue when you first run it outside a project without any profiles
14:19technomancyfixed in master, but I haven't pushed an updated preview2 yet
14:21jonasendnolen: I think I know how to do it. Just got to read some prolog literature first :)
14:21dnolenjonasen: k, let me know if you all need more pointers
14:21dnolentechnomancy: thx, that works
14:23ivanis there any literature on dynamically scoped variables? when do you use them instead of passing things around?
14:24dnolenivan: it's instructive to see where Clojure uses them. They are awesome, but really should be used very sparingly. kinda like macros.
14:25randomnamehere ,(fn [x & y] (last (sort (y))) 1 8 3 4)
14:25clojurebot#<sandbox$eval27$fn__28 sandbox$eval27$fn__28@eb6899>
14:25randomnamehere,(fn [x & y] (doall (last (sort (y)))) 1 8 3 4)
14:25clojurebot#<sandbox$eval55$fn__56 sandbox$eval55$fn__56@4bddfd>
14:25ivandnolen: thanks, I'll take a closer look
14:27`fogus,((fn [x & y] (last (sort y))) 1 8 3 4)
14:27clojurebot8
14:37`fogustechnomancy: What service do you use to print Lein stickers?
14:37technomancy`fogus: I used psprint.com; they were fine.
14:38`fogusExcellent, thank you
14:38Raynes`fogus: Print me some fogus stickers. I'd wear those with pride.
14:42`fogusJust pretend this is me: http://www.zazzle.com/lucha_libre_mexican_wrestling_sticker-217976188315608984
14:43TimMc`fogus: I already do.
14:43RaynesWait, it isn't?
14:43tylergillieslolz
15:03randomnamehere,(apply (fn dx [x & y] (if-not (= nil (next y)) (dx y) y)) [1 2 3 4 5])
15:03clojurebotnil
15:03randomnameherewhy nil? hmpf
15:03randomnamehere,(apply (fn dx [x & y] (if-let [d (next y)] (dx y) y)) [1 2 3 4 5])
15:03clojurebotnil
15:05raekrandomnamehere: you're never doing anything with x
15:05randomnamehereraek: I know it is just to test
15:05raekrandomnamehere: what do you expect it to output?
15:06randomnameherethe last item
15:07raek,(apply (fn dx [x & y] (if-let [d (next y)] (apply dx y) y)) [1 2 3 4 5])
15:07clojurebot(5)
15:07raekrandomnamehere: ^
15:08raek,(apply (fn dx [x & y] (if (seq y) (apply dx y) x)) [1 2 3 4 5])
15:08clojurebot5
15:08randomnamehereahhh apply does the trick?
15:09raekyes
15:09randomnameherewhy do I need it?
15:09raekdx takes the input as separate arguments
15:09duck1123without apply, you'd only be passing one
15:09TimMcrandomnamehere: The same reason apply was used in the original call to dx
15:10raekif you do (dx y) you call it with only one argument - the items wrapped in a collection
15:10randomnameherebut It should be evaluated if it is in () TimMc ?!
15:10randomnamehereahhh raek understand ;)
15:10TimMcrandomnamehere: Yes... but apply isn't just "call"
15:12randomnamehereTimMc: what then?
15:13TimMcI mean, it ends up calling the function, but arranges the arguments differently.
15:16randomnamehereFound another solution
15:16randomnameherev
15:16randomnamehere#(nth % (dec (count %)))
15:17randomnamehereIt's better than just #(first (reverse %))
15:17randomnamehereisn't it`
15:17randomnameherereverse builds a new list in memory, count does not?!
15:17TimMc&(doc count)
15:17lazybot⇒ "([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps"
15:18randomnamehere&(doc reverse)
15:18lazybot⇒ "([coll]); Returns a seq of the items in coll in reverse order. Not lazy."
15:18randomnamehereI assume getting the index is better ^^
15:18TimMcrandomnamehere: count does a constant-time count when possible, but when given a seq it walks it (and realizes it)
15:18llasram&(count (range))
15:19lazybotExecution Timed Out!
15:19randomnamehereHow does the bots here work?
15:19TimMcllasram: Interestingly, (range) is no longer an infinite seq in 1.3.
15:19randomnamehereIs there anywhere the source of the bots
15:19TimMcrandomnamehere: Yeah, just look on github.
15:19llasramTimMc: You mean 1.4...?
15:20randomnamehereTimMc: which project?
15:20TimMcrandomnamehere: I don't know, use Google.
15:20TimMc(or DuckDuckGo, or Bing, or Altavista...)
15:20randomnamehereis it your bot? Have you written it?
15:20TimMcnope
15:21TimMcllasram: 1.3 switched to non-autopromoting arithmetic by default
15:21randomnamehereWTF DuckDuckGo
15:21llasramrandomnamehere: This is lazybot: https://github.com/flatland/lazybot
15:22RaynesHoly crap. lazybot has 65 watchers.
15:22Raynesamalloy: We're being watched.
15:22RaynesAct natural.
15:22llasramTimMc: Right... Oh! so therefore it's bounded by maxint!
15:23TimMc&(take 2 (range (- Long/MAX_VALUE 64) Double/POSITIVE_INFINITY))
15:23lazybot⇒ (9223372036854775743 9223372036854775744)
15:23TimMc&(take 2 (range (- Long/MAX_VALUE 1) Double/POSITIVE_INFINITY))
15:23lazybotjava.lang.ArithmeticException: integer overflow
15:25llasram&(take 2 (range (bigint (- Long/MAX_VALUE 1)) Double/POSITIVE_INFINITY))
15:25lazybot⇒ (9223372036854775806N 9223372036854775807N)
15:25llasramSo consistent, at least
15:25llasramThat makes complete sense to me
15:25jsabeaudry&(send-off (agent {}) (fn [a] (send-off (agent {}) (fn [b] (println "foo") b)) (Thread/sleep 5000) a))
15:25lazybotjava.lang.SecurityException: You tripped the alarm! send-off is bad!
15:26jsabeaudryCan anyone explain why "foo" takes 5 seconds to appear?
15:26llasramBut it is non-obvious what the correct behavior of (range) should be then :-/
15:26llasram(to me)
15:27jsabeaudryAre agents tasks only sent at the end of the current agent task or something?
15:27llasramjsabeaudry: the raison d'etre of agents is to serialize uncoordinated updates to a value
15:27TimMc&(take 3 (iterate #(+' % 1) (- Long/MAX_VALUE 1)))
15:27lazybot⇒ (9223372036854775806 9223372036854775807 9223372036854775808N)
15:28llasramjsabeaudry: So the second send-off queues the task right away, but it doesn't actually run until the first one finishes
15:29TimMcChange one to a send, see what happens.
15:29jsabeaudryllasram, even though they are two diffrent agents?
15:29llasramblarp
15:29llasramMy brain totally failed to parse that :-)
15:30jsabeaudryTimMc, no difference
15:33jsabeaudryThis looks like a bug to me
15:33RaynesIt's not a bug, it's a feature.
15:34TimMcYou're just saying that.
15:34RaynesI say that to all the bugs.
15:35llasramLooking at clojure.lang.Agent, it has explicit code to defer queue any other agent executions from within a given agent
15:37llasramThere's static thread-local holding persistent vector. If it's null when the agent action is enqueued, the action is sent to the executor queue right away
15:38llasramIf it's not null, the action is cons'd onto the vector
15:39TimMcllasram: How is action failure handled?
15:39llasramAnd when agent actions run the start by setting the thread-local to an empty vector, and finish by enqueueing actions in their thread-local queue to the pool
15:39TimMcIs the queue dropped?
15:39llasramAh! Yes
15:39llasramIf the agent fails, any queued agent actions are silently dropped
15:39TimMcSame with dosync and failure/retry
15:40llasramSlightly unexpected to me, but makes total sense
15:40jsabeaudryllasram, Ah that must be the reason why they arent dispatched immediately
15:42llasramAnd it is documented on clojure.org/agents: "If during the [action] function execution any other dispatches are made (directly or indirectly), they will be held until after the state of the Agent has been changed."
15:42jsabeaudryWell in this case, I can't use agents, I guess I'll go with good old locks
15:42llasramCool. Good to know.
15:43jsabeaudryllasram, Thank you very much for your help!
15:43llasramnp
15:43randomnamehereCan the bot be used to do any damage?
15:43randomnamehereor is it kind of sandboxed?
15:43TimMcDoubly sandboxed.
15:44TimMcrandomnamehere: The JVM sandbox prevents I/O, etc.
15:45TimMcrandomnamehere: The Clojure sandbox (clojail, for lazybot) prevents you from messing up the Clojure environment (redefining things, etc.)
15:45RaynesTimMc: You used the phrase 'doubly sandboxed' -- you must have watched my conj talk.
15:46TimMcNOPE.
15:46RaynesTimMc: We can't be friends.
15:46TimMcYEP.
15:47TimMcrandomnamehere: Oh, and clojurebot automatically restarts every 15 minutes, probably because it doesn't have very good Clojure environment sandboxing.
15:47brehautTimMc: lazybot throws out its sandbox too doesnt it?
15:48TimMcDon't ask me, I didn't watch Raynes' talk.
15:48randomnamehereI wanna watch the talk later
15:48tmciver zing!
15:48randomnamehereRaynes: is the bot from you?
15:48RaynesTimMc: No, it never throws out its sandbox.
15:48randomnamehereOr the jail?
15:48Raynesrandomnamehere: Both the jail and the bot are me and amalloy.
15:48TimMcIt just dies periodically and has to be restarted.
15:48randomnamehereI can't make HTTP Calls, IO or so from the bots? So how do the plugins do?
15:48TimMcrandomnamehere: clojurebot is run by hiredman
15:49RaynesThe bot was originally me with some amalloy on top. The jail was both me and amalloy equally, I'd think.
15:49TimMcrandomnamehere: The jailed eval thingy *is* a plugin.
15:49RaynesThe sandbox only applies to the code you execute via & and ##. It doesn't apply to the plugins.
15:49RaynesThe plugins are free to do whatever they like.
15:49randomnameherenice!
15:50randomnamehereI thought about also host a bot
15:50randomnamehereclojure is fun
15:50randomnameherebut I'm afraid of losing control and be part of a botnet :)
15:50dougok, i've got a freshly-developed clojure app that talks to a browser app via websockets
15:51randomnamehereRaynes: is there any documentation about the sandboxing?
15:51dougi'm trying to figure out what the best option for deployment is
15:51dougpackaging everything and running jetty?
15:51lakeI just created a hello_world.clj file, how do I run it?
15:51Raynesrandomnamehere: https://github.com/flatland/clojail
15:53dougi guess the first issue should be: do people actually use clojure in production?
15:53dougif not, i guess lein run is all that's needed
15:53RaynesOf course they do.
15:54TimMcbut lein run can be sufficient for a lot of use cases
15:54randomnamehereHahah Raynes nice text about security in the end
15:54randomnameheretechnicans tend to say, yes that is realistic
15:55randomnameherebusinessman will think, we will not but that :)
15:55randomnameheresecure-enough... :)
15:55TimMcRaynes: I think I've seen the slides, but not the video.
15:55lakei found my answer: java -cp /usr/share/clojure/clojure.jar clojure.main problem1.clj
15:55lakeseems long winded
15:56TimMclake: Use Leiningen, it is way easier.
15:57the-kennyAnyone using paredit with Emacs 24? I can't get it to work nicely with { and }
15:57TimMcDe facto clojure build/dev tool.
15:57the-kenny{} works fine in Fundamental mode + paredit, as soon as I enable clojure-mode or any other lisp-mode, curly braces are broken.
15:57randomnamehereIs anyone of you rich h. ?
15:58the-kenny{ inserts the closing } correcly, hitting DEL doesn't remove the matching } anymore. Typing } to move to the closing } is broken too.
15:59llasramthe-kenny: What does emacs say the } key is bound to?
15:59the-kennyllasram: } paredit-close-curly
16:00the-kenny{ is paredit-open-curly, as expected.
16:00TimMcrandomnamehere: Not as far as I know. He's only in here rarely, and uses his real name.
16:00randomnamehereHe can be proud about that big community
16:00randomnamehereand all that stuff like lein and so on
16:00the-kennyAs I said, it works fine in Fundamental Mode. The bindings look the same when I switch to lisp-mode, but there paredit-*-curly is broken. (Same in clojure-mode)
16:01VinzentHi. I wonder why flatten on sets always returns an empty seq?
16:02VinzentAs stated in its doc, it "Takes any nested combination of sequential things". Woudn't be better if it'd throw an exception when set is passed?
16:02tmciver,(doc flatten)
16:02clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence."
16:02tmciversets aren't sequential.
16:02TimMc~flatten
16:02clojurebotflatten just means you failed to use ->> and mapcat correctly
16:03TimMc~flatten
16:03clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
16:03TimMc&(sequential? #{})
16:03lazybot⇒ false
16:03tmciverTimMc: why does clojurebot give two different responses there?
16:03TimMcVinzent: ^ and ^^
16:03llasramthe-kenny: My elisp-fu is defeating me, but my spider sense is suggesting that your syntax table under clojure-mode doesn't have {} properly paired
16:03TimMctmciver: Multiple factoids stored under "flatten".
16:04Vinzenttmciver, yes, I know, I've written about it. The problem is that it doesn't throw an exception, but returns ().
16:04tmciverTimMc: so if you keep issuing a ~something it iterates through them?
16:04TimMctmciver: Random selection.
16:04TimMctmciver: Ask it ~paste repeatedly (in /query clojurebot of course)
16:05the-kennyllasram: Hm. But then I must have the same error in lisp-mode and lisp-interaction-mode as well. I haven't changed any variable in these modes.
16:05jlaskowskiHi
16:05VinzentTimMc, thanks, but I've asked the question not becuase I'm using flatten, I just found this strange behaviour by accident.
16:05tmciverVinzent: do you expect it to? The doc isn't specific about the behavior with sets.
16:05jlaskowskiWhy am I not able to set a :dynamic metadata for vars in clojure 1.3.0?
16:06Vinzenttmciver, well, sets are not sequentials, and flatten expects a sequential. It's pretty clear that sets are not correct input for this function.
16:06llasramthe-kenny: I think {} aren't usually considered paired in other lisp-modes
16:07llasramthe-kenny: AH, here we go: try having emacs evaluate (string (char-syntax ?\})) in a clojure-mode buffer
16:07the-kennyllasram: yup, but paredit ignores this. squared braces works fine there.
16:07tmciverjlaskowski: I can set :dynamic meta in my 1.3 repl.
16:07Vinzentjlaskowski, (def ^:dynamic *foo*) works for me
16:08jlaskowskiis ^:dynamic for unbound vars only?
16:08Raynesnopw.
16:08Raynesnope*
16:08jlaskowskiwhat's your (clojure-version)?
16:08jlaskowski"1.3.0"
16:09jlaskowskiuser=> (def ^:dynamic b 1)
16:09jlaskowski^{:ns #<Namespace user>, :name b, :line 1, :file "NO_SOURCE_PATH"} #'user/b
16:09jlaskowskiand binding form warns me about reassignment
16:09jlaskowski(I've even been looking at the source code of clojure :))
16:10Vinzentjlaskowski, maybe it's because you named it b, not *b*
16:10Vinzent(just a guess)
16:10jlaskowskinope
16:10tmciver,(source flatten)
16:10clojurebotSource not found
16:10jlaskowskiearmuffs just make the warning earlier when used in def
16:10tmciver&(source flatten)
16:10lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
16:11the-kennyllasram: Huh, wait. I just restarted Emacs, and now the curly braces work in clojure-mode, but still fail in other lisp-modes. Evaluating your code returns ")" in (not broken) clojure-mode and "_" in broken lisp-modes.
16:11jlaskowskiI've already spent almost half a day and am stuck
16:12tmciverVinzent: a look at the source for flatten has it using sequential? for the branch funtion to tree-seq. Looks like that's why it returns (). It doesn't throw for things that aren't sequential.
16:12Raynestmciver: https://refheap.com/paste/974
16:12RaynesMy favorite flatten.
16:12tmciverRaynes: Where's that from? Is it yours?
16:13RaynesIt's in clojail.
16:13RaynesMan, has nobody seen my talk?
16:13tmciverRaynes: I saw it . . . I was there. :)
16:13RaynesHahaha, oh.
16:13RaynesThis is the flatten-all I mentioned in said talk.
16:14tmciverRaynes: I haven't memorized that part yet.
16:14Vinzenttmciver, I understand it doesn't :) they definitely should start using trammel
16:14TimMcjlaskowski: Probably needs more context.
16:14RaynesThe reason for it is ##(flatten [[{:foo :bar}]])
16:14lazybot⇒ ({:foo :bar})
16:14RaynesIt doesn't flatten maps.
16:14Raynesflatten-all does
16:14TimMcRaynes: And that makes it hard to look for bad symbols, yes.
16:14TimMc<- hasn't seen the talk, though
16:15the-kennyllasram: Ah, now I why it doesn't work in *-lisp-mode. clojure-mode does some modifications to the syntax table in order to make { and [ work nicely. While this doesn't explain why M-{ (which didn't work in clojure-mode two hours ago) works flawlessly now, I'm happy. Thanks for your help :)
16:16VinzentRaynes, that makes sense (probably), thank you!
16:16RaynesHuh, did I help you?
16:16Vinzentdon't you?
16:17RaynesOh, were you the one asking about flatten?
16:17Vinzentyep
16:17RaynesOh, you're welcome. Come again.
16:18Bronsawhy is it seq and not just identity?
16:18amalloymore characters, bro. gotta trim down that source code
16:19RaynesBy using juxt.
16:19RaynesAmirite?
16:19Bronsalol
16:27randomnamehereRaynes: about RefHeap We aren't entirely satisfied with existing pastebins
16:28randomnamehereWhat is your problem with github gist?
16:28RaynesI think Gist is great, but there are some things we can do with refheap that they aren't doing with gist.
16:28RaynesFor example, simple code evaluation is coming soon.
16:29RaynesRevisions and such as well.
16:29randomnamehereRaynes: gist has revisions
16:29RaynesYes, I know.
16:29ibdknoxalso it's going to use the Angelina AI to turn your pastes into a game
16:29RaynesI also like our website better in general.
16:30RaynesI like the fact that it is open source and we can do whatever we want with it on a whim.
16:30RaynesIt is written in Clojure with an emphasis on Clojure, so if Clojure people want something, they can easily contribute.
16:30TimMcSuch as add and remove iguanas?
16:30technomancywhy would you remove an iguana?
16:30ibdknoxthat's just ridiculous
16:30doughow can i read an environment variable in clojure?
16:30TimMcI don't know, ask Raynes!
16:31TimMcdoug: System/getProperty ?
16:31RaynesI've done a bit of work on Pygment's Clojure lexer, so the Clojure highlighting is better in refheap than in gist (though once gist updates its pygments, that'll change).
16:31ibdknoxTimMc: professionalism and all that. Raynes is entering the working world soon, it's tainting him
16:31RaynesBut our highlighting is more complex in general.
16:31RaynesTimMc: Noooo
16:31dougmaybe System/getenv
16:31RaynesSystem/getenv
16:31TimMcAh, that's the one.
16:31ibdknoxSystem/doTheRightThing
16:32Raynesrandomnamehere: The biggest thing is that we can do whatever we want with refheap. Can't do that with gist.
16:32llasramthe-kenny: Cool. Glad to help!
16:32randomnamehereRaynes: yeah
16:32ibdknoxalso it's fun?
16:32ibdknoxthat should be enough
16:33RaynesRefHeap doesn't really stand out from other pastebins yet, but it will. We've got lots of ideas. The issue tracker has most of them.
16:33RaynesAnd as long as people like ibdknox are interested in it and using it, I'll still be motivated to work on it.
16:34dougnot sure i like this
16:34doug (if-let [dir (System/getenv "XDG_RUNTIME_DIR")] dir (System/getenv "HOME"))
16:34randomnamehereNice Raynes, I like it
16:35ibdknoxdoug: use or
16:35RaynesIt's also pretty awesome that it seems to have become the defacto pastebin for #clojure.
16:35ibdknox(or (System/getenv "X..") (System/getenv "HOME"))
16:35RaynesTimMc despises BrowserID but still recommends the site. :D
16:36ibdknoxRaynes: I think TimMc might actually be a robot controlled by clojurebot
16:36ibdknoxso I assume his motives are likely subversive
16:36dougibdknox++
16:38llasram(inc ibdknox)
16:38lazybot⇒ 7
16:39randomnamehereRaynes: I think the design is a bit dark
16:41RaynesHeh
16:41TimMc*beep*
16:41TimMcI mean
16:41ibdknoxClojure is akin to dark magic
16:41TimMc"hah hah"
16:41ibdknoxPROOF
16:41RaynesIt'll get even darker when I work in codemirror because I'll be using the same color theme as the pastes.
16:44randomnameherethat makes my eyes tired ;(
16:44ibdknoxhuh
16:45ibdknoxjust use gist then :)
16:45RaynesI wasn't aware that dark colors easily made eyes tired.
16:46ibdknoxit's a holy war
16:46Bronsait's proven
16:46RaynesNo colors I could ever choose would satisfy everybody.
16:47ibdknoxBronsa: source?
16:47ibdknoxevery time I've ever seen this come up, I've never seen anything even remotely close to definitive
16:47Bronsai remember an article posted on HN some months ago
16:47randomnamehereRaynes: dark, non dark skin, switchable with javascript shortcut and remembering function will be a big plus
16:47bigscouple of people did a science
16:48dan`bor just tell people to use greasemonkey :-)
16:48TimMcor Stylish
16:48randomnamehereWrite a URL shortener? Nice ?
16:48randomnamehereI've written an image hosting app
16:48amalloymy IRC client is light-themed, and just looking at this discussion makes my eyes tired. counterexample right there?
16:48dan`bI find dark text/light backgrounds easiest, but that's just as likely to be habit as anything else
16:48randomnameherebut for url-shortener you'll need a short domain
16:48technomancyit depends on the lighting of the room you're in, among other things
16:49tmciverAnd I want a pony, and a train set and a . . .
16:49ibdknoxrandomnamehere: huh?
16:49Raynesibdknox: He is talking about an issue.
16:49bigseww url shorteners
16:49Raynesibdknox: Where I mentioned I was considering writing a URL shortener.
16:49TimMcrandomnamehere: Ugh, don't bring another URL shortner into the world, unless you're prepared to maintain it and defend it against spam.
16:49ibdknoxoh
16:49RaynesTimMc: Me, bro.
16:49randomnameherewhich is easy to remember and short = $$$
16:49RaynesNot him.
16:49TimMcRaynes: That goes for you too.
16:50drostietmciver: rainbow dash is mine, get your own pony. :x
16:50ibdknoxtechnomancy: we did a basic study at MSFT, the overwhelming majority preferred a dark theme
16:50RaynesSwitchable colors on refheap are an idea. I'm just not sure people will ever spend so much time on the site as to have a chance to care.
16:51TimMcibdknox: Dark theme allows more colors, as far as I can tell.
16:51technomancythe color of the background isn't even really the deciding factor; it's how much contrast is present between the background and the text
16:51ibdknoxTimMc: significantly
16:51amalloyor notice. 75% of features on a website never get noticed by a user
16:51Raynesamalloy: That too.
16:51RaynesI would never use it.
16:52randomnameherethx technomancy
16:52RaynesRefHeap is bright enough that I can see it in sunlight.
16:52randomnameherethe contrast is the problem
16:52randomnameherehaven't known how to tell...
16:52RaynesI was using a higher contrast color theme for the actual code a few days ago.
16:52RaynesBut some guy opened an issue complaining about it, and it hurt my eyes as well.
16:53brehautthe tricky thing with contrast is that as active lit screens get better, it becomes harder to get a good contrast for everyone
16:53ibdknoxyeah, I don't sit there and stare at pastes all day that I would care about this
16:55amalloya real friend of Raynes would make the refheap browser window always-on-top
16:55RaynesOf course.
16:56randomnamehereRaynes: why do you have a checkbox and not a create private & create public button on it?
16:56randomnamehereDo not want to copy too much from gist? ;)
16:56RaynesBecause having two buttons to do the same thing in different ways is tacky.
16:56RaynesIn slightly different ways*
16:57RaynesPrivate vs non-private is a 'yes' or 'no' state, which is what a checkbox is for.
16:57RaynesI'd rather have a button there though. A toggle button.
16:57RaynesThat changes colors when clicked.
16:57RaynesBut I'm not good enough with design to do that.
16:57ibdknoxgo go JavaScript
16:57TimMcRaynes: And shape, too.
16:58Raynesibdknox: I think jquery ui has something like this.
16:58RaynesI haven't looked into it though.
16:58ibdknoxTimMc: it turns into a hypercube
16:58TimMcRaynes: I think like 10% of the population has some form of color vision defect or anomaly.
16:58RaynesIt could be an open padlock icon that when clicked turns into a closed padlock icon.
16:58randomnamehereI talked to many people who said it is an advantage not to have a checkbox when adding company code and you miss out the checkbox ;)
16:59randomnamehereMore common than clicking on the wrong button
16:59TimMcrandomnamehere: Umm... don't put company code on a public pastebin? o.O
16:59randomnamehereTimMc: only unsensitive things
16:59TimMc*shrug*
17:00RaynesMaybe instead of a checkbox or button at all, people can just cover up the pastebox with their hands to keep other people from seeing.
17:00ibdknoxthe troll gaze is strong with this one
17:00RaynesPrivate!
17:00TimMcRaynes: WORKS_FOR_ME
17:01technomancymore importantly, works for the TSA
17:01ibdknoxlol
17:01ibdknox~rimshot
17:02clojurebotBadum, *tish*
17:06randomnamehereTSA?
17:07ibdknox..
17:07Raynes$google TSA
17:07lazybot[TSA | Transportation Security Administration | U.S. Department of ...] http://www.tsa.gov/
17:07randomnameherenice
17:11ibdknoxthis is definitely going to attract good candidates: http://news.ycombinator.com/item?id=3681659
17:17technomancyanyone know enough about lein-ring to explain what the in-war-path does?
17:20llasramProvides a source of puns?
17:21technomancyyes, I can't help but think staring at all this code about wars is going to leave me with some violent tendencies
17:23pipelineibdknox: i don't see a problem
17:23ibdknoxmy initial reading of it was basically "not very good? You can do this then!"
17:24ibdknoxjust the headline
17:25TimMcIt looks cool on second glance only.
17:26randomnameherehave a look
17:26randomnameherehttps://refheap.com/paste/984
17:27jodarothat sounds like taskrabbi
17:27jodarot
17:35uvtcI'm finding that searching clojars for libs is not very fruitful, because the clojar pages I find only tell how to fetch the lib for my project. Very few seem to have a link back to their github page.
17:35ibdknoxjust use google/github search
17:35ibdknoxor ask here
17:36technomancyuvtc: if you can report bugs with libraries that don't have URLs, it would be helpful
17:36technomancybut 90% of them are easily found on github
17:36technomancyhow would I test if lein-ring uberwar worked?
17:36technomancydo I need tomcat or something?
17:36ibdknoxyeah
17:37technomancybooooooring
17:37ibdknoxlol
17:37ibdknoxI agree
17:37uvtctechnomancy, I can do that. Maybe the community as a whole should plan a day to just pore over Clojars packages looking for ones that don't have a link ...
17:37uvtcOr maybe that could be automated.
17:38technomancyit could and should be automated
17:38technomancythe clojuresphere codebase would make it easy
17:38technomancysounds like a great starter project for someone looking to learn Clojure! =D
17:38randomnamehereIs there a collection of useful clojure links?
17:38uvtcUnable to find clojuresphere on clojars search {ducks} :)
17:38technomancyhaha
17:39technomancyhttp://clojuresphere.herokuapp.com
17:45ibdknoxhttp://www.clojure-toolbox.com/
17:47jeffdikoff to the Greenville Java Users Group ... I really need to start a Clojure Users Group
17:48uvtcibdknox, thanks for that link. Didn't know about it.
17:48TimMcjeffdik: Subvert the acronym and turn it into a JVM Users Group
17:50uvtctechnomancy, will look into the source code for clojuresphere. Hopefully though someone will beat me to that project.
17:50uvtcs/someone/someone else/
17:53justicefriesla clojure vs enclojure vs emacs?
17:55TimMcEmacs if all else is equal.
17:55TimMcBut go with what you know.
17:55justicefriesI didn't catch that, I had to restart and my ZNC didn't catch me up
17:56TimMcjusticefries: Emacs if all else is equal, but go with what you know.
17:56technomancydon't learn emacs and clojure at the same time
17:56amalloyhe said if you don't use emacs you're lame
17:56justicefriesI'm a vim user. :D
17:56justicefriesbut SLIME seems wrong.
17:56TimMcamalloy and technomancy are both correct.
17:56TimMcjusticefries: You can use vim with Clojure!
17:57justicefriesI have the VimClojure plugin.
18:02gtrak`should new clojure users use lein 2 or stick to 1.7 for now?
18:05technomancygtrak`: probably best for them to stick with 1.x for now
18:06gtrak`that's what I figured
18:12gtrak`I emailed that riddell.us guy like two weeks ago to take his shit down, now I have a friend that got confused by him... grrrrr
18: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.grrrrr
18:33acagle /flush
18:36seancorfieldhey perezd !
18:36perezdhey there
18:38rfgpfeifferorg-babel clojure support still requires slime
18:43rfgpfeiffertechnomancy: can I run clojure-jack-in conditionally only when it is not connected yet?
18:45technomancysure, just check slime-connected-p first?
18:47rfgpfeifferthanks, i forgot that emacs uses -p on predicates
18:47sjlI've got two libraries I want to glue together: metrics-clojure and ring. What's the right way to structure this? A contrib.ring namespace in metrics-clojure? A separate metrics-clojure-ring project?
18:48ibdknoxsjl: separate project
18:48technomancyrfgpfeiffer: elisp tip: pretend it's the 80s
18:48sjlibdknox: yeah, that's what I was leaning toward
18:48brehauttechnomancy: replace everything with a 4GL?
18:49technomancybrehaut: pretend your language is to primitive to support non-alphanumerics in identifiers is what I was thinking
18:49brehauttechnomancy: thats probably less of a handicap
18:49sjlibdknox: unrelated, but where can I send pull requests for Noir's website/docs? I don't see a docs/ folder in the noir repo or a gh-pages branch...
18:50ibdknoxsjl: what's the bug? http://github.com/ibdknox/webnoir
18:51technomancyholy smokes; lein-ring is sloooooooow on lein1
18:51technomancywhat the heck
18:51sjlibdknox: I think the middleware page should give an example of using a middleware that takes arguments... had to hunt around to figure out it's not (add-middleware (foo "arg")) like it would be if you were using ->
18:53ibdknoxsjl: ah, looks like the add-middleware docstring could just use a little adjusting
18:54arohnerIf I have a fn that needs to use (locking), is there an idiom for the monitor to use that's similar to _ in variable names?
19:02technomancyweavejester: hey
19:03TimMcriddell.us 1 2 3 4 testing
19:03lazybotThe 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.testing
19:04TimMcamalloy: Why does lazybot append the last word of my msg there?
19:04qbgIt's too lazy to drop it?
19:07amalloyhuh
19:07amalloymy lazy regex, i guess
19:09sjlhmm, so I'm making a new project that I want to test. I symlinked it into checkouts, but leiningen is still trying to find it online, and I haven't uploaded it yet
19:09amalloyactualyl i have no idea. the regex looks fine, and the code for handling it looks fine too
19:09sjldo I need to do something special to make it look in checkouts/ for dependencies?
19:09TimMcsjl: I think it will still try to download it, even if it isn't going to be on the classpath.
19:09TimMcNot going to guarantee that, though.
19:09sjlhmm
19:09technomancyslj: do a lein install in the dependency
19:09TimMcOr rather, it is probably *shadowed* on the classpath.
19:10sjlso how do I develop the initial version?
19:10technomancythe source will still be preferred
19:11sjltechnomancy: ah, ok, thanks
19:13qbgMy persistent memory tables for core.logic are statistically significantly faster than rels by a hair. (thanks to criterium for benchmarking)
19:21sjlibdknox: is there any way to use Noir and cheshire at the same time? Right now it seems Noir requires clj-json which requires Jackson 1.5 and Cheshire requires Jackson 1.9.5...
19:22ibdknoxsjl: 1.3.0-alpha10 is stable despite the name and uses cheshire
19:22sjlibdknox: Hmm... how would I support people running earlier versions of Noir?
19:24TimMcsjl: You may be able to pin the version of Jackson to 1.9.5
19:25TimMcwhich *should* be backwards compatible, since it is the same major version
19:26ibdknoxI think I tried to do that and it failed epically
19:26ibdknoxI may have just been doing it wrong though
19:27technomancy(ns clj-json.core) (def encode cheshire.core/encode) (def decode cheshire.core/decode)
19:27ibdknoxactually, I think I just put them in the same project. I didn't force the jackson version
19:29johnmn3evenin'
19:53weavejestertechnomancy: Should we talk this over in IRC rather then in the GitHub issues?
19:54technomancyworks for me =)
19:54weavejestertechnomancy: ring-server depends on Ring 1.0.2, so the beta version of Hiccup 1.0 shouldn't be in your deps
19:55technomancyweavejester: oh, super
19:55technomancyweavejester: I guess it only would have been a problem if we moved run-server into ring-devel
19:56weavejestertechnomancy: I don't think it would have been a problem even then…
19:56weavejestertechnomancy: Is ring-server not working for you?
19:57technomancyweavejester: I played around briefly with moving it into ring-devel before I heard about ring-server, and it broke in my project that was using old-hiccup. I haven't tried ring-server
19:57weavejestertechnomancy: Oh, you were using the master branch of Ring?
19:58technomancyyeah
19:58weavejestertechnomancy: That's a 1.1 snapshot. I have a "1.0" branch for continuing version 1.0 stuff (patches etc.)
19:58technomancygotcha; cool
19:58weavejestertechnomancy: Mark's always been big on trying stuff as external libraries first, so although ring-server and lein-ring might end up in Ring (maybe 1.2), they'll be separate libraries first.
19:59weavejestertechnomancy: Can a plugin add a dependency to the project map before running eval-in-project?
19:59weavejestertechnomancy: i.e. inject a dependency
19:59technomancyweavejester: yeah, my WIP branch does that
20:00weavejestertechnomancy: Awesome. Okay so this weekend I'll finish off ring-server. It's nearly done anyway.
20:00technomancyweavejester: excellent
20:00weavejestertechnomancy: And then it's just a case of injecting the dep and running eval-in-project.
20:01technomancyweavejester: plus a couple other changes to avoid using :library-path
20:01technomancybut yeah, that's all hacked out
20:01weavejestertechnomancy: Do you have code to that effect?
20:01technomancyyeah, it's all together on the WIP branch
20:01technomancyfor the record, lein2 is waaaay faster to uberwar than lein1
20:02weavejestertechnomancy: Ah, awesome. I'll take a look when it's not 1am :)
20:02technomancyheh; sure =)
20:02weavejestertechnomancy: BTW, do you work for Heroku these days?
20:02technomancythe war/uberwar stuff works with my existing pull request + the data.xml one
20:02technomancyyeah
20:02technomancygot to spend the morning moving clojars off sha1 for passwords
20:02weavejestertechnomancy: I almost ran into Mark in London. He's at QCon, right?
20:03technomancydue to the npm breach
20:03technomancyoh yeah, I think so
20:03technomancytoo bad you missed him
20:03technomancyI can't make it to euroclojure this year but am looking forward to next time
20:04weavejestertechnomancy: I was just about to say hi when Rich's talk started, so I figured I'd wait until after, but he snuck out before the second talk
20:05weavejestertechnomancy: Hopefully I can catch him before he heads back and buy him a drink :)
20:08callentechnomancy: wait, people actually use sha1 for passwords? :(
20:08callenwho...why? :(
20:08technomancycallen: =(
20:08technomancycallen: it's amazing that clojars has survived for so long without a maintainer
20:09technomancyhttps://github.com/ato/clojars-web/graphs/impact <- last nontrivial work: nov 2011
20:09technomancy2010 rather
20:10devn:(
20:12technomancyanyway, as soon as I hear back from him I'm going to deploy the bcrypt branch
20:12technomancy...and possibly wipe out the existing sha1 hashes
20:20weavejestertechnomancy: Wouldn't that wipe out everyone's passwords?
20:21technomancyyes
20:21technomancybut you don't need your password to do anything except change your pubkey and add people to groups
20:21technomancybecause everything else goes through SSH
20:24weavejestertechnomancy: So how do I get into my account if the password is wiped?
20:24technomancythere's a password reset
20:24TimMctechnomancy: Would you consider a migration period? Logins match against SHA1 and generate new bcrypt.
20:25technomancywe have to wipe the old hashes anyway because not everyone still uses clojars
20:25TimMcWait... this isn't just for login passwords?
20:25technomancythis is just for the web ui
20:25technomancyoh crap
20:26technomancythe forgot password functionality emails it in cleartext
20:26weavejesterThe way I've seen migrations done is to add a "password type" column, and mark all the existing passwords as SHA1
20:26TimMctechnomancy: *nice*
20:26TimMcSo you can do the migration!
20:26gfrederickstechnomancy: email an immediately-expired password?
20:26weavejesterThen when a user logs in, convert the password to BCrypt and change the "password type"
20:27sritchieany core.logic experts around?
20:27weavejestertechnomancy: How can the forgot password mail it in cleartext if it's SHA1-hashed?
20:27gfredericksprobably a new password
20:27technomancyweavejester: yeah, it's a new one
20:27technomancystill horrible
20:27TimMcoh, OK
20:27weavejesterOh right
20:27gfrederickstechnomancy: ROT13!
20:28technomancyaw yeah
20:28weavejesterHorrible why? Because there's no time limit?
20:28weavejesterWith plaintext email you have to send something that can potentially be subverted.
20:29technomancyhmm... I was thinking it's horrible because it doesn't force you to change it once you log in
20:29weavejesterOhh
20:29technomancybut the fact that it's random is probably enough to convince you to change it =)
20:29TimMcweavejester: Best is a one-time login URL that allows password setting.
20:29gfrederickstechnomancy: nah, you just use gmail search whenever you need to enter your password
20:29TimMctechnomancy: I'd be more convinced to change it if it were "password123".
20:29weavejesterTimMc: With a time limit on the login
20:29TimMcweavejester: right
20:30weavejesterI had a neat scheme for sending emails over HTTPS...
20:30gfredericksdiffie-hellman?
20:31weavejesterI need to write it up at some point, even if plaintext email has too much momentum, it's an interesting theoretical exercise.
20:31technomancyI guess sending a plaintext fresh password is OK if you make it clear it needs to be changed once they log in
20:31technomancyit's not pratically any different from a reset token
20:32romanandreghas anyone had come with this issue on Clojurescript's `cljs.closure/build` function: java.lang.AssertionError: Assert failed: Can't recur here|frame
20:32romanandreg?
20:33romanandregtrying to figure out why is happening
20:34TimMcUgh, I've seen that. I think it's a compiler bug?
20:34romanandregdo you know what might cause it?
20:35TimMcNah, it's one of the reasons I gave up on writing try-cljs.com
20:35TimMcThat was a bit ago, though!
20:37romanandreghehe
20:38callentechnomancy: so you moved it to bcrypt or some equivalent...riiight?
20:38technomancycallen: yeah, just waiting to hear back from ato before I deploy
20:39technomancyhttps://mobile.twitter.com/technomancy/status/177863341371424768
20:39callentechnomancy: thank you, I've been trying to kill the "salts are fine" fallacy for several years now.
20:40callenor more specifically, fast hash algo + salt
20:40technomancyit's pretty cool to just tweak the work factor and watch the slowdown double
20:40callentechnomancy: >:password "fuuuuuu" \n lol
20:40clojurebotExcuse me?
20:41TimMcGood stuff.
20:53technomancyok, it turns out rehashing on successful login is easy
20:53callentechnomancy: I would hope so. you've already got the data, just re-encrypt with bcrypt and stash it.
20:54callentechnomancy: who is maintaining clojars?
20:54technomancynobody
20:54technomancywell
20:54technomancyI am, now.
20:54callendo you have control over the domainz/
20:54callendomain?
20:54technomancythe original author has agreed to let me move it to heroku once I port it to postgres and s3
20:54technomancybut that's still a ways away
20:55callenI always forget you're a heroku employee.
20:55technomancyI've got Big Plans for clojars
20:56alex_baranoskytechnomancy, do you have a list of those plans anywhere?
20:57technomancyalex_baranosky: the tl;dr: http://p.hagelb.org/clojars-todo.html
20:57technomancyI plan on drafting up a more concrete proposal soon
20:58technomancyonce we have HTTP deploy it will be a lot easier to hack on
20:58alex_baranoskytechnomancy, looks great.
20:59johnmn3technomancy looks great?
20:59alex_baranoskyjohnmn3, his list of changes to clojars that he posted
20:59technomancyheh
20:59johnmn3oh.. right...
21:00johnmn3sorry, I just came in on the tail end of that conversation. :)
21:00xeqi+1 for browse web interface / older versions
21:00xeqithat was gonna be one of the first things I looked at
21:00johnmn3I'm pretty stoked about the api
21:01johnmn3hoping to see it used in clooj in the future
21:01technomancywhich api?
21:01technomancyoh, leiningen-core?
21:01johnmn3yea
21:02technomancyhopefully!
21:03johnmn3Thing about clooj though, the source is straight up java written in clojure. I was thinking trying to move some of clooj to seesaw.
21:08johnmn3so I'm making a program that helps analysts operate a web interface that they use to process research items. and I'm thinking about what kind of licensing to use when selling the program to their organization.. per seat licensing or per resarch item.
21:09johnmn3essentially, the tool takes a ten minute per item processing time and brings it around 4 minutes.
21:10johnmn3So it more than doubles productivity, so I'd like to lean toward charging per item.
21:14johnmn3anyone have any experience with those kinds of contracts?
21:30amalloythat doesn't sound like a #clojure question at all. ask in #what-do-i-charge-for-software or something?
21:30qbgThey're called "lawyers"
21:30technomancyyeah, this is a hippie channel; none of this money stuff.
21:31qbgTort law is hard, get someone who is good at it.
21:32TimMctechnomancy: I wonder if it's kosher to bcrypt-hash the SHA1 hashes.
21:32gfredericksTimMc: I bet it is
21:32TimMcI know that double-encrypting can actually make encryption weaker in some circumstances, but I don't know if that applies to hashes.
21:33technomancyTimMc: I think with the rehash-on-login we can just hold off and wipe the sha hashes in a couple weeks
21:34TimMcOK, great.
21:36qbgdnolen: Persistent memory tables for core.logic are coming along great
21:37technomancyjohnmn3: kidding btw; I just doubt folks in here have much useful experience with that.
21:38dnolenqbg: whoa!
21:38dnolenqbg: awesome
21:38qbgquery performance is a hair faster than rels for the single index case
21:39qbg(as per criterium)
21:40qbgOnce try to improve on the update functions and maybe write a few more tests, it might be ready for an enhancement on JIRA
21:40dnolenqbg: excellent
21:40qbgI got a >100x speed up during dev by writing a macro :)
21:41dnolenheh
21:41qbgThey can also be faster than rels in the multiple index case because I do more aggressive query optimization
21:41qbgThough it does introduce an overhead
21:42qbgBefore I special cased the single index case, it was ~1.3x slower than rels
21:43gtuckerkelloggi bought the PDF rough cut of the forthcoming O'Reilly "Clojure Programming" book
21:43dhconnellyhow is it?
21:43dhconnellyi just preordered the print book
21:43gtuckerkelloggTERRIFIC
21:44gtuckerkelloggdamn it is great
21:44dhconnellyawesome
21:44gtuckerkelloggi became aware of it because there was a github repo with the code samples, and it pointed me to the book
21:44gtuckerkelloggbut now that i have the book, i can't find the github repo
21:44gtuckerkelloggD'oh!
21:45dhconnellythey have a twitter for the book
21:45dhconnellyif you haven't seen it
21:45technomancygo cemerick =D
21:47y3diguys im having trouble understanding this snippet of code from http://eddology.com/post/14592579289/busy-persons-clojure
21:47y3di(if-let [prev-count (results score)] (assoc results score (inc prev-count)) (assoc results score 1)))
21:47cemerickgtuckerkellogg: sample projects will be here once I get them cleaned up: https://github.com/clojurebook
21:48cemerickgtuckerkellogg: follow @ClojureBook or subscribe to the ML on http://clojurebook.com to be notified when it lands
21:48y3dispecifically, [prev-count (results score)] im not sure I underestand how prev-count works
21:48gtuckerkelloggbest IRC session ever
21:48johnmn3technomancy: okay, how about the eclipse license? What kinds of constraints to I have from a business perspective? If I deploy a gui, do I have to provide my source code?
21:48cemerickgtuckerkellogg: and, thanks for the kind words :-) Tell your friends. ;-)
21:49gtuckerkelloggcemerick, it's a great read. I'll be notified of its landing when the hard copy arrives on my doorstep :)
21:49TimMccemerick: What audiences does it target?
21:50tmcivery3di: [prev-count (results score)] is a binding form; results is a function call with arg score. The result of that function call are bound to the var prev-count.
21:50cemerickTimMc: The relevant part of the preface is excerpted at the top of http://clojurebook.com :-)
21:50TimMcthanks
21:50tmcivery3di: see the docs for let.
21:50cemericktl;dr: engaged Java devs + ruby/python devs
21:50TimMcinteresting
21:51cemericka.k.a. introduction to Clojure with no bullshit and high expectations
21:52cemerickChristophe put some killer generified maze generation and game of life impls in there.
21:52brehaut_it happens to have the best enlive introduction around
21:52brehaut_(not surprising)
21:52cemerick(just an example)
21:52gtuckerkellogg"introduction to Clojure with no bullshit and high expectations" should be the official subtitle
21:53gtuckerkelloggNo need cemerick. I'll shill
21:54cemerickI try to avoid it, esp. around here. People are subjected to my yammerings enough as it ls. :-)
21:54brehaut_cemerick: s/yammering/fondness for rhetoric/ ;)
21:56cemerickbrehaut_: hah; I think it was hiredman that said something like "oh, I saw a reply from cemerick, but knew I wouldn't be able to get through the wall of text" :-P
21:56brehaut_lol
21:57cemerick"let me add my 2¢, but first, I will thrill you with 'Ode to the Closing Parenthesis', in 7 parts"
21:58brehaut_haha
21:58gtuckerkellogghaha
21:58qbgdnolen: It also looks like if Rels are ported to persistent memory tables, a few outstanding JIRA issues could also be closed.
22:06dnolenqbg: excellent
22:30qbgb
22:30hugodqbg: written by a brit...
22:31qbgb
22:32qbg'optimisations' just looks weird to this American
22:32qbgBut strangely, labour does not
22:32brehautqbg: aluminium or aluminum ?
22:33technomancy'merikins; what do they know about spelling anyway
22:33qbgThey both look weird :)
22:34qbgOther than that, Criterium is very excellent
22:35amalloyfwiw i prefer optimisations to labour
22:35amalloybut i'm pretty tolerant of british spellings. i read a lot of their books
22:35hugodqbg: glad you are finding a use for it :)
22:36qbgIf I was writing it, the line would be "Warming up the JIT", but it isn't a deal breaker at all :)
22:36brehautabout the only american spelling that actually bugs me these days is 'mom'
22:37qbgWhat is the British version of mom again?
22:37brehautmum
22:38technomancyamalloy: they do have some good ones, don't they
22:38technomancymum is fine; mummy still weirds me out a bit
22:38qbgCookie vs biscuit is still something I can't fully comprehend
22:38jodarocrisps
22:39brehauttechnomancy: are we still talking the parential relationship, or the desiccated cloth wrapped corpse?
22:39amalloywhy can't it be both?
22:39qbgBe nice to your mother!
22:39qbg:p
22:42hugodI occasionally catch my self using gas, trunk, or hood, but not very often
22:43qbgb
22:43gfredericksc
22:43qbgWhy can't the cursor go where I'm looking? :(
22:44gfredericksqbg: you should use longer passwords
22:45qbgDon't edit cross VM
22:45qbgMore specifically, don't use Emacs cross VMs
22:45gfredericksqbg: two cursors blinking at the same time?
22:45qbgYep
22:46gfredericksshell into the vm!
22:46qbgI forget why I'm using IRC from Windows, when I could be using it from Linux instead
22:51brehauttime for the weekend. later!
22:52xandrewsis it possible to create an object if I am looking it up at run-time? for example (new (lookup-class :foo))
22:52qbgYes, using reflection
22:53qbgFor example, (.newInstance (Class/forName "java.util.ArrayList"))
22:54qbgFor ctor args you'll have to lookup the appropriate ctor first
22:54xandrewsah, didn't know about .newInstance
22:55xandrewsthat doesn't seem to work for records though
22:55qbg.newInstance is for zero arg constructors only
22:59qbg(.newInstance (.getConstructor (Class/forName "java.util.ArrayList") (into-array Class [java.util.Collection])) (into-array [[1 2 3]]))
22:59qbg(java.util.ArrayList. [1 2 3]) is so much easier :)
23:00xandrewsyeah... I could use multimethods, but the body of the method would just be repeated for each type
23:00qbg1.3 defines ctor functions for records
23:01qbg(defrecord Foo [a b c]) defines ->Foo
23:01qbgIt also defines map->Foo
23:02qbgMaybe you'll want to use those instead?
23:03xandrewsohh map->Foo is nice... not sure it helps in my case... I suppose i could store a reference to map->Foo instead of Foo itself
23:03qbgYou could reflect on the Clojure namespace
23:04qbg(resolve (symbol (str "map->" "Foo")))
23:04qbgor ns-resolve
23:05xandrewscool. so i have a couple of decent options now. thanks!
23:05xandrewsFor some reason .getConstructor is not defined for the record
23:06qbgAre you calling it on the class?
23:07xandrewsyeah. I also tried using class/forName like you did above
23:07qbg(.getConstructor Foo (into-array Class [Object Object Object])) works for me
23:10qbgAre you trying this at a REPL? Did you verify your classes are really classes?
23:10xandrewsoh my bad.. I guess the argument to getConstructor is the array of arguments?
23:10qbgYes
23:10qbgIt is varargs
23:10xandrewsok. that was my problem
23:10xandrewssorry. not a java guy
23:10qbgvarargs are nasty for interop
23:12romanandreghas anyone has had an issue with cljs/gclosure that the cljs.core.fn function is not defined?
23:14romanandregI'm doing development mode, and when I do require in an script tag of the webpage I get this failures https://skitch.com/romanandreg2/8etp1/cljs-issue-1
23:14romanandregsuper annoying
23:14romanandregalso when doing a goog.require('library') I get an error from FF
23:15romanandreghttps://skitch.com/romanandreg2/8etp5/cljs-issue-2
23:24dnolenhmm lein2 foo doesn't seem to work
23:26technomancydnolen: is it the NPE when you run outside a project?
23:26technomancyor something else I should fix before preview2?
23:26dnolentechnomancy: sorry I meant, lein2 new foo doesn't work
23:27technomancywhat's wrong?
23:28dnolenException in thread "main" java.lang.NullPointerException
23:28dnolen at leiningen.core.classpath$resolve_dependencies.doInvoke(classpath.clj:88)
23:28dnolen
23:28technomancyyeah, looks to be the same bug
23:28technomancyfixed on master, but I'll get preview2 out asap
23:28dnolenk, thx
23:29dnolenhas anyone got the datomic appliance to actually work?
23:39devndnolen: not i...yet
23:40devndnolen: where are you stuck at?
23:40dnolendevn: just doesn't work
23:41devnthat's vague. what's broken?
23:41devnlike you go to X, and Y never happens...
23:41dnolendevn: error starting up the image
23:41devnon AWS?
23:41technomancydnolen: "lein2 upgrade" should take care of you
23:41dnolendevn: no on my machine via virtual box
23:41dnolentechnomancy: thx
23:41devnOSX?
23:42dnolendevn: yes
23:42devndnolen: hm -- ill give it a try
23:43devndnolen: i finally got to watch the minikanren/ckanren talk from clojure/conj this past year
23:43dnolendevn: whadya think?
23:43devnI laughed out loud, man.
23:43devnfantastic talk. incredibly interesting ideas.
23:44devnand good people 'taboot 'taboot. :)
23:44devnkibitz is the beginning of the promise that has been core.logic, for me anyway
23:44devnand then ambrose tweeting about typed clojure
23:45devnthis community is wonderful.
23:47dnolendevn: haha, yeah the Friedman & Byrd talk is hilarious
23:48uvtcIs there a function naming convention regarding leading or trailing hyphens? I see that I'm supposed to use "-main" for the name of my project's "main" fn.
23:48dnolentechnomancy: thx, seems fixed now!
23:49dnolendevn: also agree that kibit looks neat
23:49technomancygreat
23:51technomancyuvtc: it means it's a java method
23:51technomancyor it's traditionally used in java method names anyway
23:51uvtctechnomancy, !
23:53uvtctechnomancy, when I write a "main-" fn in my core.clj, I also put a (:gen-class :main true) at the top...
23:54uvtc(in the `ns` call)
23:54devndnolen: it's thanks to you that kibit exists
23:54technomancyuvtc: yes, that's necessary to make an uberjar work
23:54technomancy(but not to use "lein run")
23:54uvtctechnomancy, Right -- I've seen that firsthand.
23:54devndnolen: i have grand plans for unifying all of the exploratory tools that have come to exist in clojure
23:54devndnolen: with some new ones for fun
23:54devnpardon me, fn
23:55uvtctechnomancy, I'm trying to understand what you mean by "it's a java fn"...
23:55uvtctechnomancy, sorry -- java method.
23:56dnolendevn: thx! but really thanks to lots of people!
23:56uvtcIn what other case would you write a method with a trailing hyphen?
23:57devndnolen: yeah, I don't mean to give all the credit, but it is a fact that without you core.logic wouldn't exist
23:57devnso...thanks, to you and everyone else
23:58uvtcSearching for "hyphen" at clojure.org isn't turning anything up for me.
23:59technomancyuvtc: by default, gen-class finds all defns with a - prefix to turn them into methods
23:59technomancy(this can be changed)