#clojure log - Apr 16 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:07 amalloy: TEttingernans are never .equal, though

0:07 er, equals

0:08 TEttinger: ,(let [nana (identity Double/NaN)] [(.equals nana nana) (= nana nana) (== nana nana)])

0:08 clojurebot: [true true false]

0:08 TEttinger: amalloy, uh you sure about that?

0:08 amalloy: huh

0:09 TEttinger: ,(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana)])

0:09 clojurebot: [true false false]

0:09 TEttinger: I did not expect that

0:09 amalloy: TEttinger: it gets boexed twice, is why

0:09 or, man, i dunno, my brain is all over the place today and i am probably saying false things

0:09 TEttinger: the second time though is especially weird

0:09 we still like you amalloy

0:10 ,(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana) (.equals Double/NaN Double/NaN) (= Double/NaN Double/NaN) (== Double/NaN Double/NaN)])

0:10 clojurebot: [true false false true false ...]

0:11 TEttinger: &(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana) (.equals Double/NaN Double/NaN) (= Double/NaN Double/NaN) (== Double/NaN Double/NaN)])

0:11 lazybot: ⇒ [true false false true false false]

0:11 TEttinger: yeah that one shouldn't... how is that happening

0:11 (.equals Double/NaN Double/NaN)

0:12 that one is true, but = on the same args is false

0:12 I thought = used .equals

0:16 &(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana) (.equals Double/NaN (* -1 Double/NaN)) (= Double/NaN Double/NaN) (== Double/NaN Double/NaN)])

0:16 lazybot: ⇒ [true false false true false false]

0:16 TEttinger: oh come on

0:16 they're even different there!

0:18 danielcompton: I've got a program that I think is getting deadlocked, what's the best way to inspect the state of the threads to find out?

0:19 TEttinger: cfleming, can cursive's debugger inspect threads?

0:26 cfleming: TEttinger: Yep

0:26 danielcompton: You probably want to start with a thread dump when you're deadlocked

0:27 danielcompton: cfleming: ooh how do I use cursive for this?

0:28 cfleming: danielcompton: You can run your process under the debugger. When it deadlocks, you can take a thread dump from the debugger.

0:29 danielcompton: You should be able to pause the process in the debugger, and inspect the state of all the threads individually too.

0:30 danielcompton: but if the JVM can detect the deadlock automatically it'll print that in the thread dump, so that's probably the best place to start.

0:33 danielcompton: cfleming: thanks, I think I've got it debugging correctly

0:34 cfleming: danielcompton: Nice, let me know if you have more questions. I was actually planning a release today with nice debugger enhancements, I'll try to get that out for tomorrow in case you don't find it quickly :)

0:42 danielcompton: I was using a list in an atom to keep track of session tokens for making requests, it looks like I'm deadlocking on access to the atom. I assumed that I couldn't deadlock on access to atoms, but perhaps not?

0:54 Bruce_Wayne: anyone know why you can’t use (read-string …) within the browser in reagent?

0:54 tomjack: danielcompton: I don't guess you have a small isolated example which reproduces it?

0:55 danielcompton: tomjack: if I don't figure it out soon I'll put together something

0:56 tomjack: I don't think you should be able to deadlock

1:01 danielcompton: cfleming: how can I put a watch on a promise value in the debugger?

1:03 cfleming: danielcompton: You should be able to just add the watch expression, so @my-promise, although that will block until the value is delivered. You might want to do something like (if (realized? my-promise) @my-promise)

1:04 danielcompton: What if it was created by a thread in an http request? I can see its name in a trace, but not sure what to type to get it

1:05 cfleming: If it's a local, I don't think you can do that - IIRC watches are always evaluated in the local context

1:05 Hmmm

1:06 So IntelliJ provides a way to mark a specific instance of an object, and then refer to that instance in expressions. That's what you really want, but I don't think that works in Clojure.

1:06 I'll have to add support for that.

1:07 If you right-click a value in the debugger, you can add it to the watches from there. I'm not sure if that will correctly evaluate the right instance, though.

1:08 I'll try to add support for that tomorrow.

1:13 danielcompton: cfleming: cool thanks!

3:35 Barley: Has anyone recently had trouble compiling reagent apps? Our build currently gets stuck for ~45 minutes on reagent's interop.cljs and debug.cljs (which are empty namespaces btw)

3:37 Just says "Reading analysis cache for jar:file:/.m2/repository/reagent/reagent/0.5.0/reagent-0.5.0.jar!/reagent/debug.cljs" and hangs there

3:37 This if cleaned first. If I kill that process and run it again, it builds fine.

3:46 luxbock: I'm doing The Little Schemer in Clojure, only using the primitives introduced in the book

3:46 so addition is defined recursively by inc'ing (or add1 as its called), and multiplication is defined recursively in terms of addition and so on

3:47 Niac: How to bounding something in let?

3:48 mavbozo: ,(let [x 1] (+ x 2))

3:48 clojurebot: 3

3:48 Empperi: ,(let [foo "bar"] (println foo"))

3:48 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

3:48 Empperi: ,(let [foo "bar"] (println foo))

3:48 clojurebot: bar\n

3:49 luxbock: I was pretty surprised that the version of the C function, as defined here: https://gist.github.com/6ee01a0fd51367e14380

3:49 runs almost the same speed in both of my versions

3:49 I guess it's just the JIT of HotSpot doing its magic?

3:50 Niac: Empperi: i mean can i bounding something in a let form

3:51 Empperi: I don't understand what you mean

3:51 Niac: Empperi: def a function in let

3:52 Empperi: ,(let [foo (fn [] "bar")] (foo))

3:52 clojurebot: "bar"

3:52 Empperi: ,(let-fn [foo ([] "bar")] (foo))

3:52 clojurebot: #error{:cause "Unable to resolve symbol: let-fn in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: let-fn in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: let-fn in this context", :at [...

3:52 Empperi: ,(letfn [foo ([] "bar")] (foo))

3:52 clojurebot: #error{:cause "Don't know how to create ISeq from: clojure.lang.Symbol", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)", :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]} {:type java.lang.IllegalArgumentException, :message "Don't know how to cre...

3:52 Empperi: crap

3:52 never use that one

3:52 right

3:52 luxbock: ,(letfn [(foo [] "bar")] (foo))

3:52 clojurebot: "bar"

3:53 Niac: Empperi: (my-handler (let [url "http://www.2114.com" html (slurp url) body (re-seq #"2114" html)] url body))

3:53 mavbozo: luxbock, i'm interested seeing detailed differences using criterium

3:54 Empperi: Niac: so, what would you like that to do?

3:54 Niac: Empperi: (defn my-handler [{:keys [url body]}] (println url "has a count of" (count body)))

3:54 luxbock: mavbozo: I've only used quick-benchmark with criterium, what do you mean by detailed differences?

3:55 Empperi: ,(let [{:keys [foo bar]} {:foo 1 :bar 2}] [foo bar])

3:55 clojurebot: [1 2]

3:55 Empperi: you mean that?

3:55 defn uses the exact same destructuring syntax as let

3:56 Niac: read this http://blog.jayfields.com/2010/07/clojure-destructuring.html

3:59 mavbozo: luxbock, is the C* version consistently faster?

4:00 luxbock: mavbozo: https://gist.github.com/luxbock/1b5765f98127c2b35da5

4:00 Niac: Empperi: define a function in let ,then call it

4:01 luxbock: looks pretty identical to me

4:02 I would've expected the version defined in terms of add1 and sub1 to be much slower

4:02 mavbozo: luxbock, your C version is faster

4:02 luxbock, that surprised me

4:05 Empperi: Niac: well that's what my example did?

4:05 ,(let [foo (fn [] "bar")] (foo))

4:06 clojurebot: "bar"

4:06 Niac: Empperi: that's it

4:07 luxbock: mavbozo: I updated the gist to include the definitions of the functions used in C

4:08 also realized I had accidently used the Clojure definition of less-than in `div`, though after I changed it to use `lt` then the results are still the same

4:12 err.. looks like C* was actually calling C instead of itself

4:15 mavbozo: luxbock, :) i see that

4:15 luxbock: I fixed it, but C is still faster, though now they are practically identical to each other

4:30 mavbozo: luxbock, both version might be faster if you recur

4:34 luxbock: mavbozo: updated again with recur versions: https://gist.github.com/luxbock/1b5765f98127c2b35da5

4:34 there appears to be a fair amount of variance in the performance

4:35 I think they all perform pretty much the same, and if I ran each of them multiple times I would probably get a different order for them

4:48 ulsa: hi Katarina

4:52 Katarina: hi, I am a clojure beginner and have a problem I don't know how to solve. I am trying to create a new quil project using 'lein new quil drawing', but get an exception: clojure.lang.ArityException: Wrong number of args (1) passed to: cache/lru-cache-factory. My colleague can run the command successfully.

4:53 broquaint: Katarina: What version of lein are you using?

4:54 Katarina: Leiningen 2.5.1 on Java 1.8.0 Java HotSpot(TM) 64-Bit Server VM

4:54 Niac: Empperi: (defn my-handler [{:keys [url body]}] (println url "has a count of" (count body)))

4:54 Empperi: how to pass args

4:57 justin_smith: Katarina: you can use "lein upgrade" to ensure you are using the same lein version as a colleague

4:58 Katarina: also, you may want to check if you have the same plugins defined in ~/.lein/profiles.clj

4:58 oddcully: Niac: as a map with the keys :url and :body

5:00 Niac: oddcully: (my-handler (let [url "http://www.2114.com" html (slurp url) body #(re-seq #"2114" html)] {:url url :body body}))

5:00 not work

5:01 UnsupportedOperationException count not supported on this type: user$eva dy__1559 clojure.lang.RT.countFrom (RT.java:556)

5:02 justin_smith: Niac: you can't count a function

5:02 #() creates a function

5:02 ,(count #())

5:02 clojurebot: #error{:cause "count not supported on this type: sandbox$eval25$fn__26", :via [{:type java.lang.UnsupportedOperationException, :message "count not supported on this type: sandbox$eval25$fn__26", :at [clojure.lang.RT countFrom "RT.java" 632]}], :trace [[clojure.lang.RT countFrom "RT.java" 632] [clojure.lang.RT count "RT.java" 604] [sandbox$eval25 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler ev...

5:04 Niac: justin_smith: i just can't get things in the clojure way

5:04 justin_smith: Niac: what did you want body to be?

5:05 Niac: justin_smith: body (re-seq #"2114" html)

5:05 i change it ,and pass

5:06 mbac: debian wants to install openjdk

5:06 is this still a mistake

5:06 justin_smith: mbac: the nice thing about debian is that you can install as many jdks and jres as you want

5:06 and no, openjdk will work fine, not a mistake

5:07 mbac: am i smart enough to select a different one? is it just the /etc/alternatives system to switch?

5:07 oddcully: is there even any difference any more?

5:07 mbac: i don't know

5:07 justin_smith: mbac: that's exactly it, yeah

5:07 mbac: kk

5:07 is apt-get install clojure1.4 really the right thing to do? it seems like lein can do a local install/upgrade of clojure as well

5:08 sorry if this is a FAQ

5:08 schmir: mbac: no, install java, then install leiningen

5:08 mbac: whoops

5:08 justin_smith: mbac: I would not use apt-get to install clojure or even lein

5:08 mbac: kk

5:08 https://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Debian_GNU.2FLinux_and_Derivatives

5:08 should club that into submission i guess

5:09 clojure documentation is complete but surprisingly disorganized in some spots, based on what google pops on

5:09 pops up

5:10 (this is a trivial example)

5:10 justin_smith: mbac: what kind of documentation are you looking for?

5:10 mbac: at the moment nothing

5:10 schmir: mbac: https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome

5:11 justin_smith: mbac: your repl should map clojure.repl/find-doc and clojure.repl/apropos to your initial namespace, and both are nice ways to find things

5:11 mbac: but in the past i spent a lot of time looking at a page to set up my environment with, say, swank and/or slime and only months later learned this was deprecated

5:11 justin_smith: mbac: now it's cider

5:11 mbac: the actual API docs are good. the 'getting started...' stuff can be hard to navigate

5:11 right

5:13 i think the actual problem is google returns results that are out of date

5:14 otoh this channel is one of the best resources for any language i've ever seen

5:14 so, balances out i guess :P

5:38 Katarina: Same lein version (2.5.1) and same (no) ~/.lein/profiles.clj as my colleague, still I get "clojure.lang.ArityException: Wrong number of args (1) passed to: cache/lru-cache-factory" when running "lein new quil drawing" while my colleague can run it with no problem. I also emptied my ~/.m2 repository. Any suggestions on what to try or check next?

5:42 justin_smith: Katarina: I wonder if you are getting a newer (broken) version of the template

5:42 one drawback with lein new is that you cannot explicitly pick a template version

5:43 mbac: hey wow clojure is fast when you don't run it on a 5 year old laptop and/or a shell server shared by 70 other users

5:43 hyPiRion: justin_smith: that's going to be an arg for that in 2.5.2

5:44 justin_smith: hyPiRion: that's great news

5:44 mbac: hehe

5:45 oddcully: Katarina: other/no template work? e.g. `lein new app`?

5:50 Katarina: oddcully: just tried "lein new" and "lein new app", does not work either (same error). so seems to be unrelated to quil template

5:50 justin_smith: Katarina: maybe there is an issue with your ~/.lein/self-installs

5:54 Katarina: justin_smith: my ~/.lein/self-installs/ contains only the leiningen-2.5.1-standalone.jar file. with -rw-r--r-- rights. seems ok? I'll compare with my colleague as soon as he is back from lunch.

5:54 oddcully: or the indices there?

5:55 justin_smith: hmm

5:55 oddcully: mv indices into /tmp if you want to be sure. but i would assume, they get created automagically?

5:56 justin_smith: Katarina: yeah, if it isn't your m2, or self-installs, it would have to be your vm

6:00 Katarina: oddcully: where should I find the indices? in my ~/.lein I only have self-installs (and right now a copy of my colleagues profiles.clj).

6:00 oddcully: Katarina: yeah in ~/.lein

6:01 Katarina: oddcully: ok, is it strange that I don't have indices there or that should be ok?

6:02 justin_smith: another thing to check is $LEIN_HOME

6:03 if that's set, it could be that your config is coming from somewhere other than ~/.lein/

6:07 Katarina: justin_smith: $LEIN_HOME is not set. ~/.lein/ should be the default then?

6:09 mbac: is aborting when (.contains path "..") enough to protect you from docroot escape attacks on the JVM ecosystem?

6:11 Katarina: I'll try some different java versions and also compare more with my colleague and see if I can find anything that differs from his environment. thanks for your help

6:11 oddcully: Katarina: was either created by an older version then or when the first successfull run is done. since `lein` alone and `lein upgrade` seem to work. what about `lein repl`?

6:16 Katarina: oddcully: `lein repl` works fine, seems to be a problem with `lein new` only (as far as I know)

6:19 luxbock: mavbozo: so I AOT compiled the benchmark to see how that'd change things

6:19 and surprisingly, the Little Schemer version without recur is the fastest

6:19 it might be just variance and they are all the same

6:20 my naive assumption would have been that the Little Schemer version would be doing a lot more work, and thus be slower when the JIT is not helping it, but I guess not

6:20 I don't really understand how things work at the lower levels

6:20 dysfun: how big is the clojure runtime? if i use shimdandy or classlojure, am i going to end up eating tons of memory?

6:20 luxbock: here's the gist in case anyone else wants to take a look: https://gist.github.com/luxbock/1b5765f98127c2b35da5

6:23 dysfun: luxbock: it's very hard to predict how code will perform once hotspot has been at it

6:23 benchmarking is really hard, ask the JMH guys

6:24 they have to do all sort of things in JMH to make sure they're performing fair tests, and even still, they only advise you to use JMH if you already know what you're doing

6:24 luxbock: what is JMH?

6:24 dysfun: Java Microbenchmarking Harness

6:24 luxbock: ah

6:24 dysfun: (i'm on a mailing list about java performance stuff, Alexei posts a lot)

6:25 mbac: using ImageIO to resize thumbnails sure is underwhelming, performance wise. i wonder if i should just shell out to convert

6:27 puredanger: luxbock: all of your code is using boxed numbers, instead of primitives, which is slow

6:28 luxbock: puredanger: right, but I'm not trying to make it run as fast as possible

6:29 I was just curious why a version that seemingly does a lot more work (all of the numeric operations are defined in terms of inc and dec is performing better

6:29 mavbozo: luxbock, i'm curious too.

6:30 puredanger: you're also benchmarking map, which is lazy

6:30 so you're not actually doing the work

6:31 try wrapping that one in dorun

6:31 luxbock: ah, yeah I'll try that

6:33 puredanger: I would expect with primitive typehints that this would be ~100x faster

6:35 luxbock: yeah it appears that dorun was the key here

6:35 puredanger: I would expect the recur version to be better, as that creates a tight highly optimizable loop rather than a stack consuming recursion

6:36 luxbock: because the benchmark is still running and I haven't got any output back yet

6:36 yeah now the Little Schemer version is taking almost twice as long

6:37 puredanger: the other thing here is that I don't think you're doing anything to induce using doubles - you're probably using integer math and ratios

6:38 noncom: is there a way to print a datastructure without quotes? when i use pr-str or println and send the string over aleph, the acceptor receives "\"(whatever\"", i want to avoid \"

6:38 (sry, missed the closing parenthesis after whatever)

6:38 luxbock: puredanger: yeah I appreciate all of these tips, but like I said earlier I was just curious about the performance difference between the two implementations

6:41 puredanger: I understand, just trying to point out that the vast majority of the time used in this program will be boxed math and computations

6:42 noncom: you must be stringifying something before you pr-str it

6:43 ,(pr '(1 2))

6:43 clojurebot: (1 2)

6:43 puredanger: ,(pr (str '(1 2)))

6:43 clojurebot: "(1 2)"

6:44 noncom: uh, that must be an effect, layed over by (gloss/string) data type or whatever you call it

6:44 puredanger: dunno, never used it

6:45 noncom: well, thanks for the hint, at least it gives an idea :)

6:49 puredanger: yes, it was double stringification. i have replaces the pr-str encoder with identity, now it works fine

6:49 wei: what’s a nice way to cycle an atom through three values?

6:49 noncom: wei: what do you mean?

6:49 like a finite state machine?

6:50 TEttinger: mbac: I currently shell out to convert for gif creation in C#, it's by far the slowest part of my program

6:50 wei: noncom: actually, it doesn’t have to be an atom

6:51 (let [v :c] (next a [:a :b :c])) => :a

6:51 (implement next)

6:51 puredanger: wei: why do you need an atom? you could just lazily take from a sequence made with cycle

6:51 ,(take 5 (cycle [:a :b :c]))

6:51 clojurebot: (:a :b :c :a :b)

6:51 mbac: TEttinger: creating processes on windows is expensive though

6:52 TEttinger: mostly I'm creating 16-frame gifs from 16 source images, and generating the source images (including parsing a voxel model in very inefficient fashion, writing out 16 images per gif, etc.) is at most a quarter of the runtime

6:52 wei: puredanger: where did the 5 come from? you’re only given the current value in the sequence

6:53 TEttinger: cycle is infinite, wei

6:53 puredanger: oh, well that's a different problem then

6:53 noncom: the first thing i managed to coin:

6:53 (let [coll [:a :b :c]

6:53 i (inc (.indexOf coll :b))

6:53 i (if (>= i (count coll)) 0 i)]

6:53 (nth coll i))

6:54 very straight-forward-stupid one :D

6:54 puredanger: you could create a map from n to succ n, then just look it up in the map

6:54 TEttinger: ,(take 5 (iterate #(condp = % :a :b :b :c :c :a) :a))

6:54 clojurebot: (:a :b :c :a :b)

6:55 puredanger: ,(def m (let [vals [:a :b :c]] (zipmap vals (rest (cycle vals)))))

6:55 clojurebot: #'sandbox/m

6:55 puredanger: m

6:55 ,m

6:55 clojurebot: {:a :b, :b :c, :c :a}

6:56 puredanger: then just invoke the map with a val to get the succ

6:56 ,(m :b)

6:56 clojurebot: :c

6:56 TEttinger: (inc puredanger)

6:56 lazybot: ⇒ 43

6:56 noncom: that's really cool

6:56 puredanger: this all assumes a reasonable number of vals of course :)

6:57 wei: thanks noncom, puredanger. both those solutions seem to work

6:57 i just came up with this one, explaining the problem to you guys helped. (defn next-in-seq [v s] (last (take 2 (drop-while #(not (= v %)) (cycle s)))))

6:58 noncom: wei: well, pls try rewriting with the -> macro :)

6:58 wei: i think puredanger’s solution is the fastest (not that it’s critical for my particular use case)

6:59 puredanger: I'm trading memory for perf :)

6:59 noncom: yeah, very neat solution

6:59 puredanger: you could also memoize your next-in-seq and do the same on demand

7:00 noncom: i am adding it to my "The Book of Wonderful Things Seen on #clojure" :D

7:00 puredanger: ,(doc memoize)

7:00 clojurebot: "([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."

7:00 wei: my solution would look a lot nicer if there were a drop-until fn

7:00 puredanger: wei: yeah, there's an enhancement ticket for that in jira

7:00 I think there are versions in flatland and some other places

7:01 wei: well, thanks all.

7:01 (inc puredanger)

7:01 lazybot: ⇒ 44

7:01 TEttinger: (inc noncom)

7:01 lazybot: ⇒ 1

7:01 wei: (inc noncom)

7:01 lazybot: ⇒ 2

7:01 TEttinger: while we're at it :)

7:01 noncom: :D

7:40 TEttinger: ,(class (.class String))

7:40 clojurebot: #error{:cause "No matching field found: class for class java.lang.Class", :via [{:type java.lang.IllegalArgumentException, :message "No matching field found: class for class java.lang.Class", :at [clojure.lang.Reflector getInstanceField "Reflector.java" 271]}], :trace [[clojure.lang.Reflector getInstanceField "Reflector.java" 271] [clojure.lang.Reflector invokeNoArgInstanceMember "Reflector.java" ...

7:41 noncom: , (class (class (class String)))

7:41 clojurebot: java.lang.Class

7:42 TEttinger: it's class all the way down!

7:42 opqdonut: ,(class (.class "string"))

7:42 clojurebot: #error{:cause "No matching field found: class for class java.lang.String", :via [{:type java.lang.IllegalArgumentException, :message "No matching field found: class for class java.lang.String", :at [clojure.lang.Reflector getInstanceField "Reflector.java" 271]}], :trace [[clojure.lang.Reflector getInstanceField "Reflector.java" 271] [clojure.lang.Reflector invokeNoArgInstanceMember "Reflector.java...

7:42 opqdonut: hmm misremembered

7:42 oddcully: .getClass ?

7:42 opqdonut: yeah

7:43 noncom: ,(.getClass (.getClass String))

7:43 clojurebot: java.lang.Class

8:13 katarina: hi, still no luck with running `lein new` (get the error “clojure.lang.ArityException: Wrong number of args (1) passed to: cache/lru-cache-factory”). so far I’ve removed and reinstalled lein 2.5.1 (manually), emptied ~/.m2/repository, removed ~/.lein/, java version 1.8.0 and 1.7.0_51. any suggestions on what to check or do next?

8:13 TEttinger: what lein script is this?

8:14 katarina: I'm on mac osx 10.10.2 if that could have any relevance

8:16 mbac: Exception in thread "main" java.lang.ClassNotFoundException: clojure.java.shell, compiling:(pho/thumb.clj:19:3)

8:17 oh gnoes! is this not supported if i build an uberwar? :(

8:17 (for tomcat?)

8:23 katarina: TEttinger: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein

8:24 TEttinger: katarina, could you try: javac --version

8:24 I'm wondering what the default it's using is

8:24 oddcully: -version ;P

8:25 TEttinger: ah ok

8:25 I thought java was -version and javac was -- for some reason

8:25 oddcully: i hate them with passion everytime i enter it wrong

8:25 and that every time!

8:27 katarina: TEttinger: javac -version -> javac 1.7.0_51 (right now, have also tried with 1.8.0)

8:28 TEttinger: I don't know how you got 1.7 tbh, I thought mac 10.10 only had a version 6 download from apple and an 8 from oracle

8:30 are you depending on core.cache at all, katarina?

8:30 katarina: TEttinger: don't remember but I probably downloaded it before I upgraded to 10.10

8:32 TEttinger: I'm just trying to create a totally new project with `lein new` (or `lein new app`), so I don't have any dependencies at all right now. or do I not understand your question? (I'm a beginner)

8:33 TEttinger: I'm in a new empty folder

8:33 TEttinger: I wonder if the quil template uses an outdated core.cache

8:33 that would explain the lru thing

8:33 puredanger: lein depends on core.cache too I think

8:33 TEttinger: yep

8:33 puredanger: so conflict could be between lein and the template

8:33 oddcully: lein new app also fails

8:34 TEttinger: if the dep is for an olde version, then lein's version might call something with 1 arg when it should 2

8:34 oddcully: seems not to be a problem specific to quil

8:34 puredanger: dependencies are why we can't have nice things

8:34 TEttinger: hm

8:34 and .m2 is cleared...

8:34 puredanger: which lein is this? lein -v

8:35 TEttinger: yes

8:35 puredanger: lein upgrade

8:35 might help. or hurt.

8:35 oddcully: see backlog. all aready tried

8:36 puredanger: sorry :)

8:36 how about setting DEBUG ?

8:36 lein will go into debug mode with that env var set to anything

8:37 might give more clues

8:37 oddcully: yeah a stacktrace would be helpful

8:37 katarina: lein -v -> Leiningen 2.5.1

8:37 puredanger: export DEBUG=true

8:38 then try again to see if you get more output

8:39 katarina: `lein new app` after DEBUG set to true gives the following stack trace:

8:39 puredanger: maybe put that in pastebin or gist or something

8:40 katarina: ok, I'll do that

8:40 puredanger: thx. stack trace seems useful :)

8:41 haven't read the back chat but might check ~/.lein/cache or if anything is in ~/.lein/profiles.clj

8:42 ulsa: puredanger: ~/.lein has been removed

8:42 puredanger: thx

8:43 katarina: stacktrace found at: https://gist.github.com/katarinahallberg/696902721134936673e0

8:43 puredanger: ah, helpful

8:43 which java version?

8:43 java -version

8:44 just out of curiosity - don't think that's the issue

8:45 katarina: right now, java -version -> 1.8.0

8:45 puredanger: interesting that grinder.jar is on your classpath

8:45 do you have CLASSPATH set to something?

8:46 oddcully: yeah, that grinder thingy looks odd

8:46 puredanger: grinder jar contains core.cache

8:47 so that's the likely conflict

8:47 export CLASSPATH=

8:47 would probably clear that out and let things work

8:47 katarina: classpath: /Users/katarinahallberg/tools/grinder-3.11/lib/grinder.jar:

8:48 ok, I'll remove grinder from classpath

8:48 puredanger: that's a new one on me :)

8:48 and I can see why it was hard to debug.

8:49 katarina: that was it! wow, thanks a lot you all!!!

8:49 puredanger: no problem!

8:50 oh, also you'll want to: export DEBUG=

8:50 to clear out the debug flag so leiningen isn't annoying

8:50 oddcully: (inc puredanger)

8:50 lazybot: ⇒ 45

8:50 oddcully: and no moaning! you are far enough away from 42 now!

8:51 puredanger: I give up

8:51 katarina: I'll do that to. thanks again :-)

8:52 puredanger: the meta question is whether lein could have done more to help you avoid coming here in the first place

8:52 oddcully: tell the user about the DEBUG in the error message?

8:53 this is what gradle, grails, ... does

8:53 ulsa: oddcully: that would be very nice

8:53 oddcully: "something went fubar, maybe try to run with --debug" etc

8:54 puredanger: I'm not sure exactly what to file, but lein issues go here: https://github.com/technomancy/leiningen/issues

8:55 I need to get kids off to school but maybe someone could put something there with this scenario (CLASSPATH was set, caused conflict, etc)

8:55 oddcully: it would help to have to original errors (like presented to the user) for a ticket

8:56 katarina: would you file an issue there? would be easiest for you to do with the terminal outputs etc. at hand. if not, i would do it with a recollection of events from here

9:02 TEttinger: wow, I'm glad that got solved, that was a crazy issue

9:02 had anyone seen that core.cache issue before?

9:02 katarina: oddcully: any suggestion on title for the issue? enhancement issue "suggest running with debug on failure"

9:02 TEttinger: that sounds reasonable, or maybe some sort of specifics

9:03 oddcully: katarina: yeah. something along: help/guide user in the event of an ultimate failure

9:03 TEttinger: like failure to... instantiate template? since that should always work

9:03 mavbozo: what could possibly set the CLASSPATH in the first place?

9:04 oddcully: mavbozo: .profile ;P

9:05 mavbozo: i never encounter clojure lib that manipulates my .profile, .bash_profile, or .bashrc

9:05 TEttinger: (inc oddcully)

9:05 lazybot: ⇒ 2

9:05 TEttinger: (inc puredanger)

9:05 lazybot: ⇒ 46

9:06 TEttinger: (inc katarina) ; for sticking with this!

9:06 lazybot: ⇒ 1

9:06 oddcully: mavbozo: i guess that tool just wants to hook in early. like springloaded or such

9:06 (inc katarina)

9:06 lazybot: ⇒ 2

9:06 mavbozo: or maybe there's a plugin that manipulates CLASSPATH env variable

9:06 oddcully: and for filing the bug

9:07 mavbozo: .lein was empty in that case

9:09 puredanger: the grinder getting started suggests adding it's (uberjar) to the CLASSPATH - http://grinder.sourceforge.net/g3/getting-started.html

9:09 tsdh: When I use clojure.java.api.Clojure.var("my.ns/my-fn") do I need to require my.ns beforehand? Using just that, I get IllegalStateException: Attempting to call unbound fn: #'my.ns/my-fn when invoking the returned IFn.

9:09 puredanger: as an uberjar it contains core.cache and other common libs as well

9:09 tsdh: yes, you need to require first

9:11 tsdh: puredanger: But then I can's just use the Clojure class but have to import Symbol, too, because require wants a symbol. Isn't that defeating the purpose of clojure.java.api? At least it should have a Clojure.require(String ns) method then.

9:12 puredanger: IFn require = Clojure.var("clojure.core", "require");

9:12 require.invoke(Clojure.read("my.ns"))

9:13 example here: http://clojure.github.io/clojure/javadoc/clojure/java/api/Clojure.html

9:14 tsdh: puredanger: Ah, yes. :-)

9:17 sm0ke: ,(keyword "a b")

9:17 clojurebot: :a b

9:17 sm0ke: how do you write this keyword directly?

9:17 puredanger: you don't

9:17 sm0ke: then why is it allowed

9:18 puredanger: keywords can be created and consumed programatically

9:18 those keywords may or may not be readable by the reader

9:18 sm0ke: not if you are exporting them as edn?

9:18 puredanger: well then don't do that :)

9:18 you'll need to create some sort of munging scheme for that case

9:18 ulsa: (inc katarina)

9:18 lazybot: ⇒ 3

9:18 sm0ke: ,(binding [*print-dup* true] (pr-str (keyword "a b")))

9:18 clojurebot: ":a b"

9:19 sm0ke: hurmm

9:19 puredanger: we've talked about a way to "escape" the contents of a symbol or keyword based on similar in Common Lisp but that has its own set of problems

9:19 sm0ke: i Think edn representation of keyword should be something like #=Keyword(...)

9:20 puredanger: that's not going to happen

9:20 you could create your own tagged literal though that handled this

9:20 and created real keywords on the other side

9:21 or you could just use strings

9:21 sm0ke: i had a hard time for tagged literals of primitives http://dev.clojure.org/jira/browse/CLJS-1181

9:21 it causes problems with all sort of frameworks

9:23 puredanger: why not just use strings? seems like that's what you want.

9:23 sm0ke: i guess it only makes sense to avoid these kind of keywords but edn export is the only thing i cannot prevent even if want to

9:25 puredanger: it might be useful to have a function that validated or told you whether something was a readable keyword

9:25 sm0ke: i will try again by having a tagged literal for keywords and overwrite only print-dup method and see if it still is causing problem

9:25 puredanger: yep that also makes sense

9:26 puredanger: I don't think you want to muck with print-dup for keywords

9:26 sm0ke: hurmm any specific reason, i am not sure if many frameworks would be bining *print-dup* ?

9:27 +

9:29 puredanger: Clojure itself binds it

9:29 and uses it when printing data

9:30 timvishe_: so my issues yesterday with uberjars were two fold. 1. we were relying on slothcfg as a plugin and then using it in our code, which doesn't make much sense to me. and then 2. that lein issue where tools.nrepl isn't passed through to the uberjar. I _think_ I've got both worked out now. :)

9:32 katarina: I filed an issue: https://github.com/technomancy/leiningen/issues/1883. I was not able to label it as enhancement though. Hope I got all the needed information in there.

9:33 puredanger: thanks!

9:37 sm0ke: ,(read-string "#=(clojure.lang.Keyword/intern \"1\")")

9:37 clojurebot: #error{:cause "EvalReader not allowed when *read-eval* is false.", :via [{:type java.lang.RuntimeException, :message "EvalReader not allowed when *read-eval* is false.", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [[clojure.lang.Util runtimeException "Util.java" 221] [clojure.lang.LispReader$EvalReader invoke "LispReader.java" 1091] [clojure.lang.LispReader$DispatchReader in...

9:38 sm0ke: only if I could somehow force this representating while exporting as edn!

9:38 it could solve my problem

9:39 Bronsa: sm0ke: #= is not edn

9:40 sm0ke: its the representaion which comes out with pr-str

9:40 Bronsa: sm0ke: pr-str doesn't output edn

9:40 sm0ke: if print-dup is bound to true

9:40 how do you write end then?

9:41 http://stackoverflow.com/questions/18476049/what-is-the-correct-way-to-write-an-edn-file-in-clojure-as-of-august-2013

9:41 Bronsa: I don't think there's any printer that guarantees valid edn output

9:42 sm0ke: anyways, edn or not it works as clojure data representation well for me with pr-str and read-string

10:11 oddcully: is there a way to open the last statement in $VISUAL in lein repl. like e.g \e in psql or fc in a shell?

10:41 sm0ke: i think it reads your .inputrc

11:05 sdegutis: Apparently Boot uses the Shimdandy lib for faster Clojure environment isolation than separate JVMs. I wonder if Leiningen could benefit form this too.

11:12 sobel: would that replace any more than trampoline?

11:14 sdegutis: Dunno.

11:17 oddcully: sm0ke: yes, that works (as good as it gets). but i can not find a reference, that this is a readline feature

11:21 justin_smith: sdegutis: I think lein does some things that are not friendly to sharing multiple clojures in one vm

11:25 sm0ke: sdegutis: very interesting library indeed

11:25 my only concern is not being able to run it from clojure

11:26 justin_smith: oddcully: that would be a great feature to have, and it could be done via an nrepl middleware

11:27 oddcully: or if you are not using nrepl, it could be done by making a custom repl function wrapping read / eval / print

11:27 you provide the L

11:28 sm0ke: justin_smith: the effort required to make it work would not be worth. One could just connect to repl from vim/emacs etc

11:28 oddcully: justin_smith: so you think/know, that right this does not work?

11:29 justin_smith: oddcully: definitely not an existing feature

11:29 oddcully: sm0ke: for testing something without anything (SO comes to mind) this would be nice to have

11:29 justin_smith: sm0ke: when it comes to editing / development workflow, only the one who wants to use it knows if it is worth it or not

11:29 oddcully: i just wanted to know, if i miss something

11:29 justin_smith: it's not like keeping track of each form before it is evaluated, and than calling clojure.java.shell/sh is all that hard

11:31 sm0ke: oddcully: actually pressing 'v' in vi mode when i non edit mode IS a readline feature

11:31 but it done not seems to work for me too

11:31 sdegutis: The killer feature that draws me to want to try Boot is that it lets you combine tasks, even streaming ones, so that I can just run `boot dev` and it'll start an auto-watcher for ClojureScript, start my Clojure web app, start running my test suite with an auto-watcher, and start other processes I may need (i.e. Sass or Stylus autowatchers, etc).

11:31 sm0ke: did you try rlwrap?

11:31 sdegutis: I don't think that can easily be done in Leiningen, or at least without starting many separate JVMs.

11:31 justin_smith: sm0ke: nrepl does not use readline, it uses a java imitation

11:32 sm0ke: justin_smith: yes jline

11:32 justin_smith: sm0ke: oddcully: though now that you bring it up, you could use rlwrap around a clojure.main repl

11:32 sm0ke: its tries to simute readline closely

11:32 justin_smith: then the v feature would work

11:32 oddcully: yeah no biggy

11:33 didn't know about `v` in readline

11:33 seems not to work at least in lein and zsh

11:33 justin_smith: it's when you are in "normal mode" with vi readline bindings

11:33 sm0ke: yep not working with rlwrap too

11:34 justin_smith: oh, OK then

11:34 sm0ke: I remeber lein seems to have some problem with rlwrap, i cannot quite remeber

11:34 oddcully: also not in psql

11:34 justin_smith: sm0ke: probably related to it's problem with nohup, or being asked to run while backgrounded

11:34 oddcully: sm0ke: have you configured this in your inputrc?

11:35 sm0ke: configured what?

11:35 oddcully: starting $VISUAL with v

11:35 sm0ke: vi mode has 'v' feature by default

11:35 oddcully: hmm. not for me as it seems

11:36 yeah well, thanks anyway

11:36 (inc sm0ke)

11:36 lazybot: ⇒ 9

11:36 sm0ke: https://gist.github.com/kul/be3a88c8aa7393a25646

11:36 oddcully: (inc justin_smith)

11:36 lazybot: ⇒ 243

11:36 sm0ke: here is my inputrc if it helps

11:39 justin_smith: you have to set EDITOR not VISUAL

11:39 I think

11:40 oddcully: i have set them all

11:40 to may grey hairs from nano popping up

11:40 s/may/many/

11:41 justin_smith: sm0ke: oddcully: after I do "set -o vi" I can open $EDITOR with v

11:42 oddcully: well could that be just your shell?

11:42 my guess is, that zsh does not use readline but rolls its own

11:42 easiest in the shell is `fc` for me anyway

11:42 justin_smith: oddcully: checking now if I can replicate this with rlwrap, this is a new machine (just started a new job) so it will take a moment

11:48 oddcully: justin_smith: it works in bash

11:48 * sobel grumbles at java with a lot of unsafe reflection, when it would have been so easy to implement an interface everywhere this pattern was needed.

11:48 oddcully: from the trillion commands that show in command mode of readline, nothing indicates something to open an editor... at first glance

11:49 justin_smith: oddcully: "rlwrap -m" will open your editor if you do C-^

11:49 you need the -m switch (it may be something you can set with readlinerc)

11:50 oddcully: ok, thanks, will emerge that and try

11:51 justin_smith: so the command would be "rlwrap -m lein repl" I guess

11:51 which has the disadvantage of two readline-like layers

11:52 or "rlwrap -m lein run -m clojure.main" which is a mouthfull

11:52 oddcully: i'd alias it

11:53 zacts: I like pronouncing clojure like eigor would on young frankenstein

11:53 it really fits that accent

11:53 justin_smith: oddcully: yeah, that makes sense

11:55 sobel: it doesn't rhyme with cloture?

11:55 oddcully: zacts: MMMH!

12:07 justin_smith: works like a charm and boots alot faster too

12:08 justin_smith: do you know by chance, what key would start the last line in editor?

12:08 justin_smith: oddcully: C-^

12:09 well, that's for current line

12:09 oddcully: right

12:09 justin_smith: but up-arrow will give you the previous line...

12:09 oddcully: and man page says nothing else

12:09 but thats fine

12:09 justin_smith: yeah. last line might not be a thing.

12:09 oddcully: yeah that much is clear. (its k in my case)

12:10 now... what other non-vi cli tools can i wrap...

12:17 justin_smith: ed, socat, telnet...

12:37 oddcully: I had to fix a fubared homebrew install on this machine, but yeah, between rlwrap as a line editor, and being able to pop up vim for editing a line, and the snappy startup of clojure.main, this is pretty nice

12:53 J_Arcane: Woo. I might actually have a job working in Clojure this summer.

13:00 TimMc: J_Arcane: Welcome to the club, maybe!

13:01 Here is your provisional membership card: "^:pending ($)"

13:13 J_Arcane: I have an urge to make one of those clicker/incremental games. Think I might warm up for the second interview by trying to actually make one in CLJS.

13:23 Oh wow, Hoplon looks cool.

13:29 sdegutis: J_Arcane: it's an interesting all-in-one alternative to something like ClojureScript + Reagent

13:32 doritostains: lein repl is suddenly taking 20 minutes to start. Nothing's change in the project. could clojars be slow or something?

13:33 mavbozo: doritostains, RAM almost fully used?

13:33 doritostains: nope, even rebooted

13:34 saik0: is there a n-ary fn in core that always returns nil?

13:34 hiredman_: my I guess is you have some top level operation some where that runs when coded is loaded that is taking 20 minutes for some reason

13:34 (and lein repl annoyingly insists on loading code)

13:35 (constantly nil)

13:35 mavbozo: doritostains, even if you tried `lein repl` outside a project dir?

13:35 doritostains: i'll try that now

13:36 saik0: ,(inc hiredman_)

13:36 clojurebot: #error{:cause "Unable to resolve symbol: hiredman_ in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: hiredman_ in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: hiredman_ in this contex...

13:36 doritostains: mavbozo: that starts up right away

13:36 saik0: dont mind me <_<

13:37 (inc hiredman_)

13:37 lazybot: ⇒ 1

13:37 hiredman_: you have a top level form like (connect-to-database-with-20-minute-timeout) or something

13:38 johnmendonca: leksah

13:39 doritostains: hiredman_: nope, the repl doesn't start anything. everything gets initialized in core -main

13:40 hiredman_: doritostains: have you dump the stack durring those 20 minutes?

13:40 dumped

13:40 have you checked to see when in the twenty minutes the second jvm is spun up?

13:40 (lein runs a jvm and then spawns a second for your project)

13:41 saik0: how about a higher-order fn that returns a fn that constantly returns the nth arg?

13:41 doritostains: hiredman: how do I check that?

13:41 hiredman: ps

13:41 jstack

13:41 jps

13:44 pmonks: If you're at the point of investigating thread dumps, Thread Dump Analyser (TDA) is very handy: https://java.net/projects/tda

13:46 bja: is there a way to get a more detailed debug view or log when using `lein compile`? I'm getting a NPE in my ns form and was hoping to find the actual ns that's failing without turning everything off and enabling 1 at a time.

13:47 timvisher: is there a version of environ that does passthrough of string var lookups?

13:48

13:48 bja: passthrough?

13:49 like (get env "foo")?

13:49 timvisher: so in enviorn `(env "A_KEY")` is a fail, because environ translates all environment variables to keywords

13:49 oddcully: bja: DEBUG=true lein compile ?

13:50 timvisher: so what i'm wondering is is there something that lets me do (env :a-key) and (env "A.Key-That-I'd-rather-stay-weird")?

13:50 bja: oddcully, tried that. It didn't give me enough verbosity.

13:51 timvisher, you could with-redefs environ.core/keywordize

13:53 and then build your own env with (def my-env (with-redefs [environ.core/keywordize (fn [k] ....)] (merge (#'environ.core/read-end-file) (#'environ.core/read-system-env) (#'environ.core/read-system-props)))

13:53 it might be better to just fork environ rather than do all of that nasty stuff with private fns and with-redefs though

14:27 sritchie: do checkout dependencies not work in lein if the lplugin’s not been installed?

14:27 sorry - if the project that’s symlinked in `checkouts` has never been installed before

14:27 I’m getting a “could not find artifact” in a multi-module project

14:29 noonian: i'm not sure, but setting :offline? true in project.clj might help (prevent it from trying to find artifacts on clojars). You probably need to at least call lein deps or lein build to pull in the checked out projects deps

14:29 in the checkout project

14:30 justgage: Hey everyone, I'm getting my bachelor's degree in computer science and I was looking for a senior project. I would like to do somthing with Clojure that people could benifit from but I wasn't sure what people would find useful.

14:30 So I guess I'm polling for ideas

14:32 justin_smith: sritchie: checkouts require lein install to be run once

14:32 sritchie: okay

14:32 justin_smith: after that they see all the updates

14:33 (without needing to re-run install)

14:34 lodin: Would you say that prismatic/schema is *the* validation library? What other options are there?

14:35 sveri: Hi, I have a problem with core.typed: http://pastebin.com/P66YnQ28 I pass in (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) and then do (if (vector?... but core.typed still complains about that. I thought that (if expression would solve that problem... any ideas on how to do it correct?

14:35 bja: lodin, well. it's pretty easy to roll your own

14:35 lodin: bja: I specifically do not want to roll my own. :-)

14:35 doritostains: hiredman: the boot time problem was in a (comment) block with a bunch of datomic connect/db statements. Making them regular ";" comments fixed the startup issue. thanks for all the tips!

14:35 sveri: lodin: core.typed ;-)

14:36 hiredman: doritostains: interesting, I guess the datomic reader literal stuff bypasses the comment macro

14:37 lodin: sveri: If core.typed would implement refinement types and support proof for key existance in maps, I would never look back. Probably. ;-)

14:38 sveri: lodin: you mean (HMap :mandatory {:key String})

14:42 arohner: sveri: I think the error comes from core.typed not being able to validate that (first (second col)) returns the correct type

14:42 sveri: arohner: yea, that's my assumption too, but I am not experienced enough to tell

14:42 ambrosebs: ping

14:43 arohner: sveri: looking at the types, I think it's correct

14:44 sveri: Maybe I just put a no-check inside

14:44 arohner: sveri: I think your types are inconsistent

14:44 sveri: and wait for ambrosebs comment on this

14:44 arohner: thanks for stating what I was thinking :-)

14:44 J_Arcane: sdegutis: I was looking for something to do a nice simple client side only game/app, and this looks like it'll fit the bill nicely. Really easy, single file design. I can dig it.

14:45 arohner: sveri: your (t/fn []..) doesn't specify a return type. that could help

14:45 sveri: also, I'm pretty sure (first (second col)) as typed will never return HVec [html-label html-form]

14:47 sdegutis: J_Arcane: yep sure

14:48 sveri: arohner: yea, that might be. I fell a few times for the trap to check the arguments of a function instead of the return values

14:49 however, this is a defmulti, so it should specifiy what the defmethod implementations return

14:49 hm, maybe thats the problem

14:51 arohner: I don't think I've typed a defmulti before

14:51 lvh: man, defmulti's defonce behavior is really biting me

14:52 can someone remind me why that's the default?

14:52 arohner: lvh: the defonce behavior is a side-effect of the implementation

14:52 lvh: that doesn't sound like a very good reason :(

14:52 arohner: lvh: I didn't claim it was :-)

14:53 you asked why :-p

14:53 lvh: sure

14:53 i know, i know

14:53 Empperi: yeah, that kinda sucks, defmultis defonce behavior that is

14:53 you need to restart everything if you decide to change something

14:53 sveri: Empperi: I don't have to do that

14:55 at least not if I change the implementation of defmulti or add another defmethod

14:55 dnolen: Empperi: you can unmap the defmulti var and re-eval

14:55 arohner: $(doc 'ns-unmap)

14:55 ,(doc ns-unmap)

14:55 clojurebot: "([ns sym]); Removes the mappings for the symbol from the namespace."

14:57 Empperi: nice, but would be even more nice if I could just reload stuff in a namespace to repl :)

14:57 sveri: Empperi: I do that all the time with cursive in intellij

14:57 Empperi: cursive here, doesn't help with multimethods

14:58 but I don't mind that much

14:58 I don't use multimethods all that often

14:58 sveri: Did you try with tools.namespace?

14:59 Empperi: yup, been using it for quite some time

14:59 sometimes it doesn't work though

14:59 sveri: strange

14:59 Empperi: complains about missing namespaces which don't even exist and they aren't referred from anywhere

14:59 have few projects with that problem

15:00 so since I can't rely on it I haven't been using it all that much lately

15:00 and yes, those projects work perfectly fine in all other cases

15:00 sveri: really strange

15:01 but I am repeating :d

15:01 Empperi: hehe

15:05 Frozenlock: Is there a function to replace the value of :key in a map? (for all instances of :key)

15:06 Empperi: Frozenlock: map or nested maps?

15:06 amalloy: there is only one possible instance of a key in a given map

15:06 Frozenlock: nested maps

15:08 Empperi: (clojure.walk/prewalk (fn [x] (if (:key x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"]])

15:08 ,(clojure.walk/prewalk (fn [x] (if (:key x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"]])

15:08 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

15:08 Empperi: darn, never type code directly to irc

15:08 ,(clojure.walk/prewalk (fn [x] (if (:key x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"}})

15:08 clojurebot: #error{:cause "clojure.walk", :via [{:type java.lang.ClassNotFoundException, :message "clojure.walk", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366] [java.net.URLClassLoader$1 run "URLClassLoader.java" 355] [java.security.AccessController doPrivileged "AccessController.java" -2] [java.net.URLClassLoader findClass "...

15:08 Empperi: ok, I give up

15:08 * Empperi grabs repl

15:10 Empperi: ,(clojure.walk/prewalk (fn [x] (if (:foo x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"}})

15:10 clojurebot: #error{:cause "clojure.walk", :via [{:type java.lang.ClassNotFoundException, :message "clojure.walk", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366] [java.net.URLClassLoader$1 run "URLClassLoader.java" 355] [java.security.AccessController doPrivileged "AccessController.java" -2] [java.net.URLClassLoader findClass "...

15:10 Empperi: bah, that *does* work

15:10 amalloy: ,(require 'clojure.walk)

15:10 clojurebot: nil

15:10 Empperi: ,(clojure.walk/prewalk (fn [x] (if (:foo x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"}})

15:10 clojurebot: {:bar "bar", :foo "asdf", :blergh {:foo "eieie", :key "foo"}, :key "foo"}

15:10 Empperi: Frozenlock: anyway, there you go

15:11 in that usage scenario replaces all :foo values to "foo"

15:11 amalloy: is it just me, or does the new #error printing make it harder to find the actual error message? like maps are unordered, and i don't know whether the key i am looking for will be printed first or last

15:12 Empperi: yeah, I was so used to the old way

15:13 Frozenlock: Empperi: thanks

15:13 Empperi: Frozenlock: lol, there is a slight bug still in that example :)

15:14 but guess you see it

15:14 I pass wrong keyword to assoc

15:14 Frozenlock: Yeah, that was pretty obvious :-p

15:14 deanman: What most people using for dev env for clojure, is it emacs+cider? Windowed emacs looks terribly bad

15:14 Empperi: walk api is pretty nice for all kinds of things

15:14 deanman: I personally currently use IntelliJ Idea + Cursive

15:15 amalloy: deanman: "looks terribly bad"? what do you mean?

15:15 Empperi: and I haven't been a big fan of emacs myself either

15:15 even if I learned to program with it

15:15 C++ lol

15:15 I started the hard way

15:16 deanman: amalloy: Im using stock cocoa emacs on macosx and the graphics look like 2 decades back. Okey i get it that might be a very powerfull environment it's just that i kinda hoped that there is a way to make it more appealing

15:17 sveri: deanman: cursive user too here

15:17 pbx: deanman, i think aquamacs is a step up http://aquamacs.org/

15:18 amalloy: ~aquamacs

15:18 clojurebot: Titim gan éirí ort.

15:18 tbaldridge: deanman: I do most of my Clojure development in Cursive these days, emacs if i'm in a odd mood

15:18 clojurebot: Pardon?

15:18 amalloy: really? don't we have a factoid for that? "aquamacs is probably the problem" or something?

15:21 arav93: I'm doing typed clojure annotations, so for an input '[1 2 3] , clojure.lang.PersistentVector java.lang.Long would do , right?

15:22 noonian: i'd recommend regular emacs on mac osx, otherwise normal emacs installation and configuration mehtods don't always apply

15:22 but you can definitely get it to look pretty hehe

15:22 sveri: arav93: looks reasonable

15:23 arav93: But, when I test, I get the following error

15:23 Domains: (t/U (clojure.lang.PersistentList java.lang.Long) (clojure.lang.PersistentVector java.lang.Long)) Arguments: (t/HVec [(t/Value 1) (t/Value 2) (t/Value 3)]) (t/HVec [(t/Value 1) (t/Value 2)])

15:24 What does it look like? sveri

15:24 sveri: arav93: I am learning core.typed right now myself... I have a look, but cannot promise anything ;-)

15:25 arav93: you know what (t/U means?

15:25 arav93: Yes

15:25 That's union :)

15:26 sveri:

15:26 sveri: You might as well use Seq or someting similar then, however, thats not the problem I guess

15:26 arav93: Yeah

15:28 sveri: HVec means an heterogeneous vector that you are passing in, but with : (clojure.lang.PersistentVector java.lang.Long) you expect a homogenuous vector

15:28 arav93: that should be a problem here

15:29 arav93: Oh

15:29 sveri: maybe try (HSeq [t/Any *]) to start with

15:29 and then refine

15:29 arav93: sveri, yes that might be the problem

15:43 lemonodor: deanman: if you’re talking about the emacs toolbar icons (are there any other graphics?), yeah, they look pretty retro. you don’t really need them, though… :) you might try something like ohai-emacs https://github.com/bodil/ohai-emacs

15:44 deanman: lemonodor: Thanks ill have a look

15:47 sdegutis: I just realized this is wicked fast: java -cp ~/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar clojure.main

15:50 oddcully: sdegutis: don't forget the rlwrap ^_^

16:06 kaiyin: how do you get the first element that satisfies a predicate in a sequence? e.g. (filter pos? [-1 -2 -3 0 1 -2 -3]), but without going through the whole sequence, i.e. return 1 immediately without checking -2 and -3.

16:07 amalloy: kaiyin: just call (first (filter ...))

16:07 kaiyin: amalloy: oh, filter is lazy?

16:07 amalloy: kaiyin: could it be lazy?

16:09 adereth: ,(doc filter)

16:09 clojurebot: "([pred] [pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects. Returns a transducer when no collection is provided."

16:11 arohner: give a java resource, is it possible to determine which jar it came from?

16:12 or whether it even came from a jar?

16:12 hrm, .getFile is interesting, but will require parsing

16:12 puredanger: if you got it from a classloader, you can ask the classloader

16:16 kaiyin: cool

16:24 sdegutis: Any tips on using Clojure without Leiningen?

16:30 kaiyin: how do you get all elements of a vector except for the nth?

16:30 amalloy: vectors aren't very good at that operation

16:30 kaiyin: i.e. (get-except 2 [1, 2, 3, 4]) should return [1, 3, 4]

16:30 amalloy: are you sure there's not some better way to solve your problem?

16:31 kaiyin: amalloy: i see, i think i can figure some other way.

16:31 figure out.

16:35 arohner: puredanger: I'm getting it from io/resource

16:40 Shayanjm: re-optimized my algo

16:41 cfleming: arohner: https://www.refheap.com/99700

16:41 arohner: Excuse the Java, it's what I have to hand

16:41 Shayanjm: http://puu.sh/hgjVv/9898b83ca3.png

16:41 ~3k lat/long coordinates for the circle packing generated in less than a second

16:41 clojurebot: Excuse me?

16:41 cfleming: arohner: Sorry, missing a bit, one sec

16:51 arohner: actually probably easiest just to link to the source https://upsource.jetbrains.com/ideac/file/21d3fc746af4430445bce0663fe8e7c189393a70/platform%2Futil%2Fsrc%2Fcom%2Fintellij%2Fopenapi%2Fapplication%2FPathManager.java?nav=13650:13668:focused

16:52 arohner: cfleming: thanks

16:52 cfleming: I'm mainly interested in non-class resources, i.e. just files that happen to be in the jar

16:52 looks like I can just parse the output of (.getFile (io/resource ...))

16:53 cfleming: arohner: I think that should work for that, it's just looking up resources after all

16:53 arohner: but they don't have a class?

16:53 cfleming: arohner: That is very true :-)

16:53 arohner: in that case I generally just use another class that I know is co-located in the same jar

17:40 arohner: given a var, is it possible to determine where that var was loaded from? i.e. loading out of a .clj file, or from a .class?

17:42 danielglauser: arohner: I don't think so. Have you looked in the metadata?

17:42 sidhartha: is there a way to stop cider from compiling at start up when i start cider in a leinengen project directory ?

17:42 arohner: danielglauser: the metadata gives you the source file it was originally compiled from. doesn't tell you if the .class was loaded

17:43 danielglauser: gotcha

17:50 mavbozo: sidhartha, use :init-ns in project.clj :repl-options

17:53 sidhartha, in my project, i put :repl-options {:init-ns user}.

17:54 tomjack: wat. you're saying :init-ns disables some crazy magic in cider?

17:55 I wonder if that's related to my seeing a bunch of .java source code printed out seemingly randomly from a cider repl process in a project with .java code...

17:55 probably not :(

17:56 mavbozo: tomjack, i don't know :)

17:57 is there some crazy magic that cider's do when i do `cider-jack-in` in emacs?

17:57 akkad: s/in/off yes

18:03 mavbozo: if the repl initially loads a namespace with zero dependencies on project files, then those project files are not loaded. it makes repl start times quicker.

18:07 and i can enter the repl eventhough some of project's source files failed in compilation.

18:22 jdeisenberg: When using atoms to save state, is it normal to have one atom with a map that holds the pertinent information, or several atoms?

18:22 amalloy: one atom with a map

18:23 jdeisenberg: OK. I thought so; thanks.

18:23 amalloy: synchronizing multiple atoms via swap! is impossible in a multi-threaded scenario, which makes it unpleasant

18:23 jdeisenberg: Ah, good point.

18:28 Thanks again!

18:40 brehaut: ~ask

18:40 clojurebot: The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.

18:41 brehaut: (not directed at anyone. just wanted the quote)

18:49 danielcompton: How do we add new quotes to Clojurebot?

18:51 darthdeus: is there a more idiomatic way of doing this? (update-in {} [:foo] #(if % (inc %) 1))

18:53 tomjack: ,(update-in {} [:foo] (fnil inc 0))

18:53 clojurebot: {:foo 1}

18:54 TimMc: danielcompton: Unintentionally, mostly.

19:01 mavbozo: ~clojure

19:01 clojurebot: clojure is left as an exercise for the reader

19:01 mavbozo: ~clojure

19:01 clojurebot: clojure is not groovy

19:08 brehaut: danielcompton: the is operator

19:08 danielcompton: + complication syntax i cant remember but dont have my stick note for

19:09 danielcompton: you address clojure bot and say 'X is something'

19:09 without the quotes

19:09 danielcompton: ~ask2ask is The ~ask command wastes more bandwidth than any version of the Ask To Ask protocol, so just ask your question.

19:09 clojurebot: c'est bon!

19:09 brehaut: invariably you get it wrong, and then trying to make the bot forget causes 3 variants to be created

19:10 oh, and it does inference

19:10 and can store multiple factoids for any ke

19:12 hiredman: ~clojurebot is <reply> You are in a maze of twisty factoids, all alike.

19:12 clojurebot: Ack. Ack.

19:13 noonian: ~clojurebot

19:13 clojurebot: clojurebot is pretty cool

19:13 brehaut: (inc hiredman)

19:13 lazybot: ⇒ 76

19:14 brehaut: hiredman: how many factoids does the bot have these days?

19:21 hiredman: a very modest 2004

19:21 cddr: Is there a way to get the name of the current lein profile so you can conditionally run code only in certain environments?

19:25 martinjungblut: anyone using vim for writing clojure?

19:26 arrdem: I did

19:26 lampd1: i have

19:26 arrdem: then I switched to emacs because of better tooling

19:26 fireplace.vim is nice tho

19:27 martinjungblut: yeah, been thinking about going the emacs way lately...

19:27 I noticed VimClojure is no longer maintained

19:28 not sure if this is OT or not

19:35 mullr: martinjungblut: spacemacs is where it's at, if you're into vim keybindings and clojure

19:36 martinjungblut: spacemacs

19:36 holy cow

19:40 j201: martinjungblut: currently using fireplace, vim-clojure-static, and paredit

19:41 martinjungblut: thanks for the help guys :)

19:45 darthdeus: hey guys, any idea what would cause this? https://gist.github.com/darthdeus/dec7031fd870f54b7528

19:46 noonian: thats basically a syntax error, its saying it cant read a form (s-expression)

19:46 darthdeus: noonian: but how can that happen?

19:47 i mean, i'm not doing any metaprogramming or anything

19:47 just playing around with compojure

19:48 noonian: well, compojure uses macros, so i would guess that you have some routes defined incorrectly and a compojure macro is expanding to something Clojure can't read

19:48 ,<>

19:48 clojurebot: #error{:cause "Unable to resolve symbol: <> in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: <> in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: <> in this context", :at [clojure.lang...

19:49 noonian: eh, i don't know how to get that particular reader exception though

19:49 can you post the compojure code you are playing around with?

19:58 wei: martinjungblut: I use emacs, evil and monroe. pretty minimal emacs + vim bindings setup.

20:05 bucketh3ad: I have a map with string keys and number values that I have sorted by value from max to min. What function could I use with take-while to get all of the keys responding to max values?

20:12 danielcompton: bucketh3ad: can you post some sample data and what you're hoping to get back? I don't quite understand what you're looking for

20:13 bucketh3ad: Let's say I have a map sorted by value: {"thing1" 10, "thing2" 10, "thing3" 5, ...}

20:14 I want all the keys that match the max value (10 in the example) and figured since the map is sorted, I could use take-while, but I can't quite figure out what function I should pass as the pred

20:15 so the function would return ["thing1" "thing2"]

20:15 or it could return the key value pairs if that's easier, though I don't really need the value since they should all be equal

20:16 mullr: how about (-> my-sorted-map (partition-by second) (map first))

20:16 maybe?

20:16 err, (->> my-sorted-map (partition-by second) (map first))

20:17 ok, that's wrong. but partition-by can get you the first chunk

20:18 bucketh3ad: (first (partition-by second my-sorted-map)) does what I need. Thanks!

20:42 WickedShell: stupid question, I'm very very new to clojure, but is there a math function somewhere for constraining a number within a provided min/max?

20:43 amalloy: WickedShell: (-> x (min 0) (max 100)) would be the simplest thing. ie, "constraining" is just a call to min and a call to max

20:43 except i think i got min/max reversed there

20:49 szatz: hey, all. i'm reading in quite a bit of image data. after reading in two files that take about a minute apiece, the third just runs without completion, even after several minutes. is there a way around this sort of problem?

20:53 TimMc: amalloy: That always bugs me.

20:54 ,(map #(-> % (min 0) (max 100)) [-5 0 50 100 105])

20:55 clojurebot: (100 100 100 100 100)

20:58 WickedShell: amalloy, that seems to have pointed me along enough to get started, thanks

21:00 TimMc: ,(map #(-> % (max 0) (min 100)) [-5 0 50 100 105])

21:00 clojurebot: (0 0 50 100 100)

21:07 TimMc: ,(defn mm [a b] (fn [x] (-> x (min (max a b)) (max (min a b))))) ;; amalloy_ this somehow feels better

21:07 clojurebot: #'sandbox/mm

21:12 WickedShell: so I implemetned the range stuff as a macro, which seems to work but if I pass it the result of a function it seems to be exploading in my face... the call of (constrain (Math/sin (Math/toRadians 34.57)) 0 100) gives the error ClassCastException clojure.lang.PersistentList cannot be cast to java.lang.Number clojure.lang.Numbers.gt (Numbers.java:227)

21:12 and constrain as a macro seems to work just fine if I stick with more normal calls like (constrain 5 0 100)

21:13 TimMc: WickedShell: You almost certainly do not want a macro.

21:13 WickedShell: oh? if you can enlighten me... as you may guess this is initial transition from C/java land :P

21:15 TimMc: (defn constrain [x lo hi] (max lo (min hi x)))

21:15 ,(defn constrain [x lo hi] (max lo (min hi x)))

21:15 clojurebot: #'sandbox/constrain

21:15 TimMc: ,(map #(constrain x 0 100) [-5 0 50 100 105])

21:15 clojurebot: #error{:cause "Unable to resolve symbol: x in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: x in this context", :at [clojure.lang.Ut...

21:15 TimMc: ugh

21:16 ,(map #(constrain % 0 100) [-5 0 50 100 105])

21:16 clojurebot: (0 0 50 100 100)

21:16 WickedShell: yeah as a function it seems to work all the way through

21:16 TimMc: WickedShell: ^ It's really, really rare that macros are the right answer. Totally a last resort thing.

21:18 ~macros

21:18 clojurebot: Barking spiders!

21:18 TimMc: ~macros

21:18 clojurebot: macros are just a game with symbols

21:18 WickedShell: lol

21:19 TimMc: You also never *need* macros.

21:19 Macros produce code for you; you could just write that code.

21:27 Niac: how can i save the webpage concurrency

21:45 jcorneli: hello, I'm just getting started with clojure. I have numerous JARs on my classpath, but when I try to import the relevant objects on the REPL I get ClassNotFoundExceptions

21:45 for example, (import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation)

21:46 but I can see /home/joe/flow/FlowData/jars/stanfordJars/stanford-corenlp-3.5.0.jar is in the classpath

21:47 Can anyone offer insight? I've been googling for some time trying to figure it out

21:48 The JARs are added via the :resource-paths entry in Leiningen

21:49 as suggested here: http://stackoverflow.com/a/14070422/821010

21:49 TimMc: Niac: I don't think that's a well-formed question.

21:50 Niac: TimMc: Concurrent to crawl the page

22:02 cfleming: jcorneli: That looks like an inner class. To import those, you need (import edu.stanford.nlp.ling.CoreAnnotations$SentencesAnnotation), which is how the JVM actually refers to that class

22:35 nuwanda_: cfleming: working with clojure and being able to actually debug code, step by step is amazing

22:35 whenever you actually start charging for cursive you have a guaranteed client

22:36 ,(inc cfleming)

22:36 clojurebot: #error{:cause "Unable to resolve symbol: cfleming in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: cfleming in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: cfleming in this context",...

22:36 cfleming: nuwanda_: Great, I'm glad to hear it!

22:37 nuwanda_: I'm actually working on the debugger for the next release, lots of nice features

22:39 nuwanda_: Check it out - locals painted in the editor as you debug: http://imgur.com/2dPsxYK

22:40 nuwanda_: Also: expression evaluation from the editor by alt-clicking on any expression, proper lazy sequence rendering and (hopefully) being able to evaluate expressions with tagged object instances

22:43 nuwanda_: nice, specially the inline debugging, seems incredibly useful

22:44 cfleming: nuwanda_: Here's the in-editor expression evaluation: http://imgur.com/LQyOEIK

22:45 nuwanda_: looking forward to trying it all out :)

22:46 cfleming: nuwanda_: Hopefully out in a day or two

22:55 Igor: Hello I have httpkit websocket handler https://gist.github.com/anonymous/d31ee72648f40e7ddf0c In process/new connection I add connection to atom, in process/close-connection - delete conn from atom. But some connections accamulates in atom and not removed.. Any ideas?

23:48 Raynes: http://weknowmemes.com/wp-content/uploads/2013/08/most-interesting-bear-in-the-world-meme.jpg

23:50 TEttinger: Raynes. There was some question I had for you about one of your many projects, but I can't remember it now

Logging service provided by n01se.net