#clojure logs

2015-04-16

00:07amalloyTEttingernans are never .equal, though
00:07amalloyer, equals
00:08TEttinger,(let [nana (identity Double/NaN)] [(.equals nana nana) (= nana nana) (== nana nana)])
00:08clojurebot[true true false]
00:08TEttingeramalloy, uh you sure about that?
00:08amalloyhuh
00:09TEttinger,(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana)])
00:09clojurebot[true false false]
00:09TEttingerI did not expect that
00:09amalloyTEttinger: it gets boexed twice, is why
00:09amalloyor, man, i dunno, my brain is all over the place today and i am probably saying false things
00:09TEttingerthe second time though is especially weird
00:09TEttingerwe still like you amalloy
00:10TEttinger,(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana) (.equals Double/NaN Double/NaN) (= Double/NaN Double/NaN) (== Double/NaN Double/NaN)])
00:10clojurebot[true false false true false ...]
00:11TEttinger&(let [nana Double/NaN] [(.equals nana nana) (= nana nana) (== nana nana) (.equals Double/NaN Double/NaN) (= Double/NaN Double/NaN) (== Double/NaN Double/NaN)])
00:11lazybot⇒ [true false false true false false]
00:11TEttingeryeah that one shouldn't... how is that happening
00:11TEttinger(.equals Double/NaN Double/NaN)
00:12TEttingerthat one is true, but = on the same args is false
00:12TEttingerI thought = used .equals
00:16TEttinger&(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)])
00:16lazybot⇒ [true false false true false false]
00:16TEttingeroh come on
00:16TEttingerthey're even different there!
00:18danielcomptonI'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?
00:19TEttingercfleming, can cursive's debugger inspect threads?
00:26cflemingTEttinger: Yep
00:26cflemingdanielcompton: You probably want to start with a thread dump when you're deadlocked
00:27danielcomptoncfleming: ooh how do I use cursive for this?
00:28cflemingdanielcompton: You can run your process under the debugger. When it deadlocks, you can take a thread dump from the debugger.
00:29cflemingdanielcompton: You should be able to pause the process in the debugger, and inspect the state of all the threads individually too.
00:30cflemingdanielcompton: 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.
00:33danielcomptoncfleming: thanks, I think I've got it debugging correctly
00:34cflemingdanielcompton: 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 :)
00:42danielcomptonI 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?
00:54Bruce_Wayneanyone know why you can’t use (read-string …) within the browser in reagent?
00:54tomjackdanielcompton: I don't guess you have a small isolated example which reproduces it?
00:55danielcomptontomjack: if I don't figure it out soon I'll put together something
00:56tomjackI don't think you should be able to deadlock
01:01danielcomptoncfleming: how can I put a watch on a promise value in the debugger?
01:03cflemingdanielcompton: 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)
01:04danielcomptonWhat 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
01:05cflemingIf it's a local, I don't think you can do that - IIRC watches are always evaluated in the local context
01:05cflemingHmmm
01:06cflemingSo 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.
01:06cflemingI'll have to add support for that.
01:07cflemingIf 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.
01:08cflemingI'll try to add support for that tomorrow.
01:13danielcomptoncfleming: cool thanks!
03:35BarleyHas 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)
03:37BarleyJust 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
03:37BarleyThis if cleaned first. If I kill that process and run it again, it builds fine.
03:46luxbockI'm doing The Little Schemer in Clojure, only using the primitives introduced in the book
03:46luxbockso addition is defined recursively by inc'ing (or add1 as its called), and multiplication is defined recursively in terms of addition and so on
03:47NiacHow to bounding something in let?
03:48mavbozo,(let [x 1] (+ x 2))
03:48clojurebot3
03:48Empperi,(let [foo "bar"] (println foo"))
03:48clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
03:48Empperi,(let [foo "bar"] (println foo))
03:48clojurebotbar\n
03:49luxbockI was pretty surprised that the version of the C function, as defined here: https://gist.github.com/6ee01a0fd51367e14380
03:49luxbockruns almost the same speed in both of my versions
03:49luxbockI guess it's just the JIT of HotSpot doing its magic?
03:50NiacEmpperi: i mean can i bounding something in a let form
03:51EmpperiI don't understand what you mean
03:51NiacEmpperi: def a function in let
03:52Empperi,(let [foo (fn [] "bar")] (foo))
03:52clojurebot"bar"
03:52Empperi,(let-fn [foo ([] "bar")] (foo))
03:52clojurebot#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 [...
03:52Empperi,(letfn [foo ([] "bar")] (foo))
03:52clojurebot#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...
03:52Emppericrap
03:52Empperinever use that one
03:52Empperiright
03:52luxbock,(letfn [(foo [] "bar")] (foo))
03:52clojurebot"bar"
03:53NiacEmpperi: (my-handler (let [url "http://www.2114.com&quot; html (slurp url) body (re-seq #"2114" html)] url body))
03:53mavbozoluxbock, i'm interested seeing detailed differences using criterium
03:54EmpperiNiac: so, what would you like that to do?
03:54NiacEmpperi: (defn my-handler [{:keys [url body]}] (println url "has a count of" (count body)))
03:54luxbockmavbozo: I've only used quick-benchmark with criterium, what do you mean by detailed differences?
03:55Empperi,(let [{:keys [foo bar]} {:foo 1 :bar 2}] [foo bar])
03:55clojurebot[1 2]
03:55Empperiyou mean that?
03:55Empperidefn uses the exact same destructuring syntax as let
03:56EmpperiNiac: read this http://blog.jayfields.com/2010/07/clojure-destructuring.html
03:59mavbozoluxbock, is the C* version consistently faster?
04:00luxbockmavbozo: https://gist.github.com/luxbock/1b5765f98127c2b35da5
04:00NiacEmpperi: define a function in let ,then call it
04:01luxbocklooks pretty identical to me
04:02luxbockI would've expected the version defined in terms of add1 and sub1 to be much slower
04:02mavbozoluxbock, your C version is faster
04:02mavbozoluxbock, that surprised me
04:05EmpperiNiac: well that's what my example did?
04:05Empperi,(let [foo (fn [] "bar")] (foo))
04:06clojurebot"bar"
04:06NiacEmpperi: that's it
04:07luxbockmavbozo: I updated the gist to include the definitions of the functions used in C
04:08luxbockalso 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
04:12luxbockerr.. looks like C* was actually calling C instead of itself
04:15mavbozoluxbock, :) i see that
04:15luxbockI fixed it, but C is still faster, though now they are practically identical to each other
04:30mavbozoluxbock, both version might be faster if you recur
04:34luxbockmavbozo: updated again with recur versions: https://gist.github.com/luxbock/1b5765f98127c2b35da5
04:34luxbockthere appears to be a fair amount of variance in the performance
04:35luxbockI 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
04:48ulsahi Katarina
04:52Katarinahi, 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.
04:53broquaintKatarina: What version of lein are you using?
04:54KatarinaLeiningen 2.5.1 on Java 1.8.0 Java HotSpot(TM) 64-Bit Server VM
04:54NiacEmpperi: (defn my-handler [{:keys [url body]}] (println url "has a count of" (count body)))
04:54NiacEmpperi: how to pass args
04:57justin_smithKatarina: you can use "lein upgrade" to ensure you are using the same lein version as a colleague
04:58justin_smithKatarina: also, you may want to check if you have the same plugins defined in ~/.lein/profiles.clj
04:58oddcullyNiac: as a map with the keys :url and :body
05:00Niacoddcully: (my-handler (let [url "http://www.2114.com&quot; html (slurp url) body #(re-seq #"2114" html)] {:url url :body body}))
05:00Niacnot work
05:01NiacUnsupportedOperationException count not supported on this type: user$eva dy__1559 clojure.lang.RT.countFrom (RT.java:556)
05:02justin_smithNiac: you can't count a function
05:02justin_smith#() creates a function
05:02justin_smith,(count #())
05:02clojurebot#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...
05:04Niacjustin_smith: i just can't get things in the clojure way
05:04justin_smithNiac: what did you want body to be?
05:05Niacjustin_smith: body (re-seq #"2114" html)
05:05Niaci change it ,and pass
05:06mbacdebian wants to install openjdk
05:06mbacis this still a mistake
05:06justin_smithmbac: the nice thing about debian is that you can install as many jdks and jres as you want
05:06justin_smithand no, openjdk will work fine, not a mistake
05:07mbacam i smart enough to select a different one? is it just the /etc/alternatives system to switch?
05:07oddcullyis there even any difference any more?
05:07mbaci don't know
05:07justin_smithmbac: that's exactly it, yeah
05:07mbackk
05:07mbacis 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
05:08mbacsorry if this is a FAQ
05:08schmirmbac: no, install java, then install leiningen
05:08mbacwhoops
05:08justin_smithmbac: I would not use apt-get to install clojure or even lein
05:08mbackk
05:08mbachttps://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Debian_GNU.2FLinux_and_Derivatives
05:08mbacshould club that into submission i guess
05:09mbacclojure documentation is complete but surprisingly disorganized in some spots, based on what google pops on
05:09mbacpops up
05:10mbac(this is a trivial example)
05:10justin_smithmbac: what kind of documentation are you looking for?
05:10mbacat the moment nothing
05:10schmirmbac: https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
05:11justin_smithmbac: your repl should map clojure.repl/find-doc and clojure.repl/apropos to your initial namespace, and both are nice ways to find things
05:11mbacbut 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
05:11justin_smithmbac: now it's cider
05:11mbacthe actual API docs are good. the 'getting started...' stuff can be hard to navigate
05:11mbacright
05:13mbaci think the actual problem is google returns results that are out of date
05:14mbacotoh this channel is one of the best resources for any language i've ever seen
05:14mbacso, balances out i guess :P
05:38KatarinaSame 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?
05:42justin_smithKatarina: I wonder if you are getting a newer (broken) version of the template
05:42justin_smithone drawback with lein new is that you cannot explicitly pick a template version
05:43mbachey 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
05:43hyPiRionjustin_smith: that's going to be an arg for that in 2.5.2
05:44justin_smithhyPiRion: that's great news
05:44justin_smithmbac: hehe
05:45oddcullyKatarina: other/no template work? e.g. `lein new app`?
05:50Katarinaoddcully: just tried "lein new" and "lein new app", does not work either (same error). so seems to be unrelated to quil template
05:50justin_smithKatarina: maybe there is an issue with your ~/.lein/self-installs
05:54Katarinajustin_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.
05:54oddcullyor the indices there?
05:55justin_smithhmm
05:55oddcullymv indices into /tmp if you want to be sure. but i would assume, they get created automagically?
05:56justin_smithKatarina: yeah, if it isn't your m2, or self-installs, it would have to be your vm
06:00Katarinaoddcully: where should I find the indices? in my ~/.lein I only have self-installs (and right now a copy of my colleagues profiles.clj).
06:00oddcullyKatarina: yeah in ~/.lein
06:01Katarinaoddcully: ok, is it strange that I don't have indices there or that should be ok?
06:02justin_smithanother thing to check is $LEIN_HOME
06:03justin_smithif that's set, it could be that your config is coming from somewhere other than ~/.lein/
06:07Katarinajustin_smith: $LEIN_HOME is not set. ~/.lein/ should be the default then?
06:09mbacis aborting when (.contains path "..") enough to protect you from docroot escape attacks on the JVM ecosystem?
06:11KatarinaI'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
06:11oddcullyKatarina: 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`?
06:16Katarinaoddcully: `lein repl` works fine, seems to be a problem with `lein new` only (as far as I know)
06:19luxbockmavbozo: so I AOT compiled the benchmark to see how that'd change things
06:19luxbockand surprisingly, the Little Schemer version without recur is the fastest
06:19luxbockit might be just variance and they are all the same
06:20luxbockmy 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
06:20luxbockI don't really understand how things work at the lower levels
06:20dysfunhow big is the clojure runtime? if i use shimdandy or classlojure, am i going to end up eating tons of memory?
06:20luxbockhere's the gist in case anyone else wants to take a look: https://gist.github.com/luxbock/1b5765f98127c2b35da5
06:23dysfunluxbock: it's very hard to predict how code will perform once hotspot has been at it
06:23dysfunbenchmarking is really hard, ask the JMH guys
06:24dysfunthey 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
06:24luxbockwhat is JMH?
06:24dysfunJava Microbenchmarking Harness
06:24luxbockah
06:24dysfun(i'm on a mailing list about java performance stuff, Alexei posts a lot)
06:25mbacusing ImageIO to resize thumbnails sure is underwhelming, performance wise. i wonder if i should just shell out to convert
06:27puredangerluxbock: all of your code is using boxed numbers, instead of primitives, which is slow
06:28luxbockpuredanger: right, but I'm not trying to make it run as fast as possible
06:29luxbockI 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
06:29mavbozoluxbock, i'm curious too.
06:30puredangeryou're also benchmarking map, which is lazy
06:30puredangerso you're not actually doing the work
06:31puredangertry wrapping that one in dorun
06:31luxbockah, yeah I'll try that
06:33puredangerI would expect with primitive typehints that this would be ~100x faster
06:35luxbockyeah it appears that dorun was the key here
06:35puredangerI would expect the recur version to be better, as that creates a tight highly optimizable loop rather than a stack consuming recursion
06:36luxbockbecause the benchmark is still running and I haven't got any output back yet
06:36luxbockyeah now the Little Schemer version is taking almost twice as long
06:37puredangerthe 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
06:38noncomis 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 \"
06:38noncom(sry, missed the closing parenthesis after whatever)
06:38luxbockpuredanger: yeah I appreciate all of these tips, but like I said earlier I was just curious about the performance difference between the two implementations
06:41puredangerI understand, just trying to point out that the vast majority of the time used in this program will be boxed math and computations
06:42puredangernoncom: you must be stringifying something before you pr-str it
06:43puredanger,(pr '(1 2))
06:43clojurebot(1 2)
06:43puredanger,(pr (str '(1 2)))
06:43clojurebot"(1 2)"
06:44noncomuh, that must be an effect, layed over by (gloss/string) data type or whatever you call it
06:44puredangerdunno, never used it
06:45noncomwell, thanks for the hint, at least it gives an idea :)
06:49noncompuredanger: yes, it was double stringification. i have replaces the pr-str encoder with identity, now it works fine
06:49weiwhat’s a nice way to cycle an atom through three values?
06:49noncomwei: what do you mean?
06:49noncomlike a finite state machine?
06:50TEttingermbac: I currently shell out to convert for gif creation in C#, it's by far the slowest part of my program
06:50weinoncom: actually, it doesn’t have to be an atom
06:51wei(let [v :c] (next a [:a :b :c])) => :a
06:51wei(implement next)
06:51puredangerwei: why do you need an atom? you could just lazily take from a sequence made with cycle
06:51puredanger,(take 5 (cycle [:a :b :c]))
06:51clojurebot(:a :b :c :a :b)
06:51mbacTEttinger: creating processes on windows is expensive though
06:52TEttingermostly 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
06:52weipuredanger: where did the 5 come from? you’re only given the current value in the sequence
06:53TEttingercycle is infinite, wei
06:53puredangeroh, well that's a different problem then
06:53noncomthe first thing i managed to coin:
06:53noncom(let [coll [:a :b :c]
06:53noncom i (inc (.indexOf coll :b))
06:53noncom i (if (>= i (count coll)) 0 i)]
06:53noncom (nth coll i))
06:54noncomvery straight-forward-stupid one :D
06:54puredangeryou could create a map from n to succ n, then just look it up in the map
06:54TEttinger,(take 5 (iterate #(condp = % :a :b :b :c :c :a) :a))
06:54clojurebot(:a :b :c :a :b)
06:55puredanger,(def m (let [vals [:a :b :c]] (zipmap vals (rest (cycle vals)))))
06:55clojurebot#'sandbox/m
06:55puredangerm
06:55puredanger,m
06:55clojurebot{:a :b, :b :c, :c :a}
06:56puredangerthen just invoke the map with a val to get the succ
06:56puredanger,(m :b)
06:56clojurebot:c
06:56TEttinger(inc puredanger)
06:56lazybot⇒ 43
06:56noncomthat's really cool
06:56puredangerthis all assumes a reasonable number of vals of course :)
06:57weithanks noncom, puredanger. both those solutions seem to work
06:57weii 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)))))
06:58noncomwei: well, pls try rewriting with the -> macro :)
06:58weii think puredanger’s solution is the fastest (not that it’s critical for my particular use case)
06:59puredangerI'm trading memory for perf :)
06:59noncomyeah, very neat solution
06:59puredangeryou could also memoize your next-in-seq and do the same on demand
07:00noncomi am adding it to my "The Book of Wonderful Things Seen on #clojure" :D
07:00puredanger,(doc memoize)
07:00clojurebot"([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."
07:00weimy solution would look a lot nicer if there were a drop-until fn
07:00puredangerwei: yeah, there's an enhancement ticket for that in jira
07:00puredangerI think there are versions in flatland and some other places
07:01weiwell, thanks all.
07:01wei(inc puredanger)
07:01lazybot⇒ 44
07:01TEttinger(inc noncom)
07:01lazybot⇒ 1
07:01wei(inc noncom)
07:01lazybot⇒ 2
07:01TEttingerwhile we're at it :)
07:01noncom:D
07:40TEttinger,(class (.class String))
07:40clojurebot#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" ...
07:41noncom, (class (class (class String)))
07:41clojurebotjava.lang.Class
07:42TEttingerit's class all the way down!
07:42opqdonut,(class (.class "string"))
07:42clojurebot#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...
07:42opqdonuthmm misremembered
07:42oddcully.getClass ?
07:42opqdonutyeah
07:43noncom,(.getClass (.getClass String))
07:43clojurebotjava.lang.Class
08:13katarinahi, 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?
08:13TEttingerwhat lein script is this?
08:14katarinaI'm on mac osx 10.10.2 if that could have any relevance
08:16mbacException in thread "main" java.lang.ClassNotFoundException: clojure.java.shell, compiling:(pho/thumb.clj:19:3)
08:17mbacoh gnoes! is this not supported if i build an uberwar? :(
08:17mbac(for tomcat?)
08:23katarinaTEttinger: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
08:24TEttingerkatarina, could you try: javac --version
08:24TEttingerI'm wondering what the default it's using is
08:24oddcully-version ;P
08:25TEttingerah ok
08:25TEttingerI thought java was -version and javac was -- for some reason
08:25oddcullyi hate them with passion everytime i enter it wrong
08:25oddcullyand that every time!
08:27katarinaTEttinger: javac -version -> javac 1.7.0_51 (right now, have also tried with 1.8.0)
08:28TEttingerI 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
08:30TEttingerare you depending on core.cache at all, katarina?
08:30katarinaTEttinger: don't remember but I probably downloaded it before I upgraded to 10.10
08:32katarinaTEttinger: 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)
08:33katarinaTEttinger: I'm in a new empty folder
08:33TEttingerI wonder if the quil template uses an outdated core.cache
08:33TEttingerthat would explain the lru thing
08:33puredangerlein depends on core.cache too I think
08:33TEttingeryep
08:33puredangerso conflict could be between lein and the template
08:33oddcullylein new app also fails
08:34TEttingerif the dep is for an olde version, then lein's version might call something with 1 arg when it should 2
08:34oddcullyseems not to be a problem specific to quil
08:34puredangerdependencies are why we can't have nice things
08:34TEttingerhm
08:34TEttingerand .m2 is cleared...
08:34puredangerwhich lein is this? lein -v
08:35TEttingeryes
08:35puredangerlein upgrade
08:35puredangermight help. or hurt.
08:35oddcullysee backlog. all aready tried
08:36puredangersorry :)
08:36puredangerhow about setting DEBUG ?
08:36puredangerlein will go into debug mode with that env var set to anything
08:37puredangermight give more clues
08:37oddcullyyeah a stacktrace would be helpful
08:37katarinalein -v -> Leiningen 2.5.1
08:37puredangerexport DEBUG=true
08:38puredangerthen try again to see if you get more output
08:39katarina`lein new app` after DEBUG set to true gives the following stack trace:
08:39puredangermaybe put that in pastebin or gist or something
08:40katarinaok, I'll do that
08:40puredangerthx. stack trace seems useful :)
08:41puredangerhaven't read the back chat but might check ~/.lein/cache or if anything is in ~/.lein/profiles.clj
08:42ulsapuredanger: ~/.lein has been removed
08:42puredangerthx
08:43katarinastacktrace found at: https://gist.github.com/katarinahallberg/696902721134936673e0
08:43puredangerah, helpful
08:43puredangerwhich java version?
08:43puredangerjava -version
08:44puredangerjust out of curiosity - don't think that's the issue
08:45katarinaright now, java -version -> 1.8.0
08:45puredangerinteresting that grinder.jar is on your classpath
08:45puredangerdo you have CLASSPATH set to something?
08:46oddcullyyeah, that grinder thingy looks odd
08:46puredangergrinder jar contains core.cache
08:47puredangerso that's the likely conflict
08:47puredangerexport CLASSPATH=
08:47puredangerwould probably clear that out and let things work
08:47katarinaclasspath: /Users/katarinahallberg/tools/grinder-3.11/lib/grinder.jar:
08:48katarinaok, I'll remove grinder from classpath
08:48puredangerthat's a new one on me :)
08:48puredangerand I can see why it was hard to debug.
08:49katarinathat was it! wow, thanks a lot you all!!!
08:49puredangerno problem!
08:50puredangeroh, also you'll want to: export DEBUG=
08:50puredangerto clear out the debug flag so leiningen isn't annoying
08:50oddcully(inc puredanger)
08:50lazybot⇒ 45
08:50oddcullyand no moaning! you are far enough away from 42 now!
08:51puredangerI give up
08:51katarinaI'll do that to. thanks again :-)
08:52puredangerthe meta question is whether lein could have done more to help you avoid coming here in the first place
08:52oddcullytell the user about the DEBUG in the error message?
08:53oddcullythis is what gradle, grails, ... does
08:53ulsaoddcully: that would be very nice
08:53oddcully"something went fubar, maybe try to run with --debug" etc
08:54puredangerI'm not sure exactly what to file, but lein issues go here: https://github.com/technomancy/leiningen/issues
08:55puredangerI need to get kids off to school but maybe someone could put something there with this scenario (CLASSPATH was set, caused conflict, etc)
08:55oddcullyit would help to have to original errors (like presented to the user) for a ticket
08:56oddcullykatarina: 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
09:02TEttingerwow, I'm glad that got solved, that was a crazy issue
09:02TEttingerhad anyone seen that core.cache issue before?
09:02katarinaoddcully: any suggestion on title for the issue? enhancement issue "suggest running with debug on failure"
09:02TEttingerthat sounds reasonable, or maybe some sort of specifics
09:03oddcullykatarina: yeah. something along: help/guide user in the event of an ultimate failure
09:03TEttingerlike failure to... instantiate template? since that should always work
09:03mavbozowhat could possibly set the CLASSPATH in the first place?
09:04oddcullymavbozo: .profile ;P
09:05mavbozoi never encounter clojure lib that manipulates my .profile, .bash_profile, or .bashrc
09:05TEttinger(inc oddcully)
09:05lazybot⇒ 2
09:05TEttinger(inc puredanger)
09:05lazybot⇒ 46
09:06TEttinger(inc katarina) ; for sticking with this!
09:06lazybot⇒ 1
09:06oddcullymavbozo: i guess that tool just wants to hook in early. like springloaded or such
09:06oddcully(inc katarina)
09:06lazybot⇒ 2
09:06mavbozoor maybe there's a plugin that manipulates CLASSPATH env variable
09:06oddcullyand for filing the bug
09:07oddcullymavbozo: .lein was empty in that case
09:09puredangerthe grinder getting started suggests adding it's (uberjar) to the CLASSPATH - http://grinder.sourceforge.net/g3/getting-started.html
09:09tsdhWhen 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.
09:09puredangeras an uberjar it contains core.cache and other common libs as well
09:09puredangertsdh: yes, you need to require first
09:11tsdhpuredanger: 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.
09:12puredangerIFn require = Clojure.var("clojure.core", "require");
09:12puredangerrequire.invoke(Clojure.read("my.ns"))
09:13puredangerexample here: http://clojure.github.io/clojure/javadoc/clojure/java/api/Clojure.html
09:14tsdhpuredanger: Ah, yes. :-)
09:17sm0ke,(keyword "a b")
09:17clojurebot:a b
09:17sm0kehow do you write this keyword directly?
09:17puredangeryou don't
09:17sm0kethen why is it allowed
09:18puredangerkeywords can be created and consumed programatically
09:18puredangerthose keywords may or may not be readable by the reader
09:18sm0kenot if you are exporting them as edn?
09:18puredangerwell then don't do that :)
09:18puredangeryou'll need to create some sort of munging scheme for that case
09:18ulsa(inc katarina)
09:18lazybot⇒ 3
09:18sm0ke,(binding [*print-dup* true] (pr-str (keyword "a b")))
09:18clojurebot":a b"
09:19sm0kehurmm
09:19puredangerwe'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
09:19sm0kei Think edn representation of keyword should be something like #=Keyword(...)
09:20puredangerthat's not going to happen
09:20puredangeryou could create your own tagged literal though that handled this
09:20puredangerand created real keywords on the other side
09:21puredangeror you could just use strings
09:21sm0kei had a hard time for tagged literals of primitives http://dev.clojure.org/jira/browse/CLJS-1181
09:21sm0keit causes problems with all sort of frameworks
09:23puredangerwhy not just use strings? seems like that's what you want.
09:23sm0kei 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
09:25puredangerit might be useful to have a function that validated or told you whether something was a readable keyword
09:25sm0kei will try again by having a tagged literal for keywords and overwrite only print-dup method and see if it still is causing problem
09:25sm0kepuredanger: yep that also makes sense
09:26puredangerI don't think you want to muck with print-dup for keywords
09:26sm0kehurmm any specific reason, i am not sure if many frameworks would be bining *print-dup* ?
09:27sm0ke+
09:29puredangerClojure itself binds it
09:29puredangerand uses it when printing data
09:30timvishe_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. :)
09:32katarinaI 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.
09:33puredangerthanks!
09:37sm0ke,(read-string "#=(clojure.lang.Keyword/intern \"1\")")
09:37clojurebot#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...
09:38sm0keonly if I could somehow force this representating while exporting as edn!
09:38sm0keit could solve my problem
09:39Bronsasm0ke: #= is not edn
09:40sm0keits the representaion which comes out with pr-str
09:40Bronsasm0ke: pr-str doesn't output edn
09:40sm0keif print-dup is bound to true
09:40sm0kehow do you write end then?
09:41sm0kehttp://stackoverflow.com/questions/18476049/what-is-the-correct-way-to-write-an-edn-file-in-clojure-as-of-august-2013
09:41BronsaI don't think there's any printer that guarantees valid edn output
09:42sm0keanyways, edn or not it works as clojure data representation well for me with pr-str and read-string
10:11oddcullyis 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:41sm0kei think it reads your .inputrc
11:05sdegutisApparently Boot uses the Shimdandy lib for faster Clojure environment isolation than separate JVMs. I wonder if Leiningen could benefit form this too.
11:12sobelwould that replace any more than trampoline?
11:14sdegutisDunno.
11:17oddcullysm0ke: yes, that works (as good as it gets). but i can not find a reference, that this is a readline feature
11:21justin_smithsdegutis: I think lein does some things that are not friendly to sharing multiple clojures in one vm
11:25sm0kesdegutis: very interesting library indeed
11:25sm0kemy only concern is not being able to run it from clojure
11:26justin_smithoddcully: that would be a great feature to have, and it could be done via an nrepl middleware
11:27justin_smithoddcully: or if you are not using nrepl, it could be done by making a custom repl function wrapping read / eval / print
11:27justin_smithyou provide the L
11:28sm0kejustin_smith: the effort required to make it work would not be worth. One could just connect to repl from vim/emacs etc
11:28oddcullyjustin_smith: so you think/know, that right this does not work?
11:29justin_smithoddcully: definitely not an existing feature
11:29oddcullysm0ke: for testing something without anything (SO comes to mind) this would be nice to have
11:29justin_smithsm0ke: when it comes to editing / development workflow, only the one who wants to use it knows if it is worth it or not
11:29oddcullyi just wanted to know, if i miss something
11:29justin_smithit's not like keeping track of each form before it is evaluated, and than calling clojure.java.shell/sh is all that hard
11:31sm0keoddcully: actually pressing 'v' in vi mode when i non edit mode IS a readline feature
11:31sm0kebut it done not seems to work for me too
11:31sdegutisThe 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:31sm0kedid you try rlwrap?
11:31sdegutisI don't think that can easily be done in Leiningen, or at least without starting many separate JVMs.
11:31justin_smithsm0ke: nrepl does not use readline, it uses a java imitation
11:32sm0kejustin_smith: yes jline
11:32justin_smithsm0ke: oddcully: though now that you bring it up, you could use rlwrap around a clojure.main repl
11:32sm0keits tries to simute readline closely
11:32justin_smiththen the v feature would work
11:32oddcullyyeah no biggy
11:33oddcullydidn't know about `v` in readline
11:33oddcullyseems not to work at least in lein and zsh
11:33justin_smithit's when you are in "normal mode" with vi readline bindings
11:33sm0keyep not working with rlwrap too
11:34justin_smithoh, OK then
11:34sm0keI remeber lein seems to have some problem with rlwrap, i cannot quite remeber
11:34oddcullyalso not in psql
11:34justin_smithsm0ke: probably related to it's problem with nohup, or being asked to run while backgrounded
11:34oddcullysm0ke: have you configured this in your inputrc?
11:35sm0keconfigured what?
11:35oddcullystarting $VISUAL with v
11:35sm0kevi mode has 'v' feature by default
11:35oddcullyhmm. not for me as it seems
11:36oddcullyyeah well, thanks anyway
11:36oddcully(inc sm0ke)
11:36lazybot⇒ 9
11:36sm0kehttps://gist.github.com/kul/be3a88c8aa7393a25646
11:36oddcully(inc justin_smith)
11:36lazybot⇒ 243
11:36sm0kehere is my inputrc if it helps
11:39justin_smithyou have to set EDITOR not VISUAL
11:39justin_smithI think
11:40oddcullyi have set them all
11:40oddcullyto may grey hairs from nano popping up
11:40oddcullys/may/many/
11:41justin_smithsm0ke: oddcully: after I do "set -o vi" I can open $EDITOR with v
11:42oddcullywell could that be just your shell?
11:42oddcullymy guess is, that zsh does not use readline but rolls its own
11:42oddcullyeasiest in the shell is `fc` for me anyway
11:42justin_smithoddcully: 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:48oddcullyjustin_smith: it works in bash
11:48oddcullyfrom the trillion commands that show in command mode of readline, nothing indicates something to open an editor... at first glance
11:49justin_smithoddcully: "rlwrap -m" will open your editor if you do C-^
11:49justin_smithyou need the -m switch (it may be something you can set with readlinerc)
11:50oddcullyok, thanks, will emerge that and try
11:51justin_smithso the command would be "rlwrap -m lein repl" I guess
11:51justin_smithwhich has the disadvantage of two readline-like layers
11:52justin_smithor "rlwrap -m lein run -m clojure.main" which is a mouthfull
11:52oddcullyi'd alias it
11:53zactsI like pronouncing clojure like eigor would on young frankenstein
11:53zactsit really fits that accent
11:53justin_smithoddcully: yeah, that makes sense
11:55sobelit doesn't rhyme with cloture?
11:55oddcullyzacts: MMMH!
12:07oddcullyjustin_smith: works like a charm and boots alot faster too
12:08oddcullyjustin_smith: do you know by chance, what key would start the last line in editor?
12:08justin_smithoddcully: C-^
12:09justin_smithwell, that's for current line
12:09oddcullyright
12:09justin_smithbut up-arrow will give you the previous line...
12:09oddcullyand man page says nothing else
12:09oddcullybut thats fine
12:09justin_smithyeah. last line might not be a thing.
12:09oddcullyyeah that much is clear. (its k in my case)
12:10oddcullynow... what other non-vi cli tools can i wrap...
12:17justin_smithed, socat, telnet...
12:37justin_smithoddcully: 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:53J_ArcaneWoo. I might actually have a job working in Clojure this summer.
13:00TimMcJ_Arcane: Welcome to the club, maybe!
13:01TimMcHere is your provisional membership card: "^:pending ($)"
13:13J_ArcaneI 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:23J_ArcaneOh wow, Hoplon looks cool.
13:29sdegutisJ_Arcane: it's an interesting all-in-one alternative to something like ClojureScript + Reagent
13:32doritostainslein repl is suddenly taking 20 minutes to start. Nothing's change in the project. could clojars be slow or something?
13:33mavbozodoritostains, RAM almost fully used?
13:33doritostainsnope, even rebooted
13:34saik0is there a n-ary fn in core that always returns nil?
13:34hiredman_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:34hiredman_(and lein repl annoyingly insists on loading code)
13:35hiredman_(constantly nil)
13:35mavbozodoritostains, even if you tried `lein repl` outside a project dir?
13:35doritostainsi'll try that now
13:36saik0,(inc hiredman_)
13:36clojurebot#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:36doritostainsmavbozo: that starts up right away
13:36saik0dont mind me <_<
13:37saik0(inc hiredman_)
13:37lazybot⇒ 1
13:37hiredman_you have a top level form like (connect-to-database-with-20-minute-timeout) or something
13:38johnmendoncaleksah
13:39doritostainshiredman_: nope, the repl doesn't start anything. everything gets initialized in core -main
13:40hiredman_doritostains: have you dump the stack durring those 20 minutes?
13:40hiredman_dumped
13:40hiredman_have you checked to see when in the twenty minutes the second jvm is spun up?
13:40hiredman_(lein runs a jvm and then spawns a second for your project)
13:41saik0how about a higher-order fn that returns a fn that constantly returns the nth arg?
13:41doritostainshiredman: how do I check that?
13:41hiredmanps
13:41hiredmanjstack
13:41hiredmanjps
13:44pmonksIf you're at the point of investigating thread dumps, Thread Dump Analyser (TDA) is very handy: https://java.net/projects/tda
13:46bjais 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:47timvisheris there a version of environ that does passthrough of string var lookups?
13:48timvisher
13:48bjapassthrough?
13:49bjalike (get env "foo")?
13:49timvisherso in enviorn `(env "A_KEY")` is a fail, because environ translates all environment variables to keywords
13:49oddcullybja: DEBUG=true lein compile ?
13:50timvisherso 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:50bjaoddcully, tried that. It didn't give me enough verbosity.
13:51bjatimvisher, you could with-redefs environ.core/keywordize
13:53bjaand 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:53bjait might be better to just fork environ rather than do all of that nasty stuff with private fns and with-redefs though
14:27sritchiedo checkout dependencies not work in lein if the lplugin’s not been installed?
14:27sritchiesorry - if the project that’s symlinked in `checkouts` has never been installed before
14:27sritchieI’m getting a “could not find artifact” in a multi-module project
14:29nooniani'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:29noonianin the checkout project
14:30justgageHey 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:30justgageSo I guess I'm polling for ideas
14:32justin_smithsritchie: checkouts require lein install to be run once
14:32sritchieokay
14:32justin_smithafter that they see all the updates
14:33justin_smith(without needing to re-run install)
14:34lodinWould you say that prismatic/schema is *the* validation library? What other options are there?
14:35sveriHi, 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:35bjalodin, well. it's pretty easy to roll your own
14:35lodinbja: I specifically do not want to roll my own. :-)
14:35doritostainshiredman: 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:35sverilodin: core.typed ;-)
14:36hiredmandoritostains: interesting, I guess the datomic reader literal stuff bypasses the comment macro
14:37lodinsveri: If core.typed would implement refinement types and support proof for key existance in maps, I would never look back. Probably. ;-)
14:38sverilodin: you mean (HMap :mandatory {:key String})
14:42arohnersveri: I think the error comes from core.typed not being able to validate that (first (second col)) returns the correct type
14:42sveriarohner: yea, that's my assumption too, but I am not experienced enough to tell
14:42sveriambrosebs: ping
14:43arohnersveri: looking at the types, I think it's correct
14:44sveriMaybe I just put a no-check inside
14:44arohnersveri: I think your types are inconsistent
14:44sveriand wait for ambrosebs comment on this
14:44sveriarohner: thanks for stating what I was thinking :-)
14:44J_Arcanesdegutis: 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:45arohnersveri: your (t/fn []..) doesn't specify a return type. that could help
14:45arohnersveri: also, I'm pretty sure (first (second col)) as typed will never return HVec [html-label html-form]
14:47sdegutisJ_Arcane: yep sure
14:48sveriarohner: 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:49sverihowever, this is a defmulti, so it should specifiy what the defmethod implementations return
14:49sverihm, maybe thats the problem
14:51arohnerI don't think I've typed a defmulti before
14:51lvhman, defmulti's defonce behavior is really biting me
14:52lvhcan someone remind me why that's the default?
14:52arohnerlvh: the defonce behavior is a side-effect of the implementation
14:52lvhthat doesn't sound like a very good reason :(
14:52arohnerlvh: I didn't claim it was :-)
14:53arohneryou asked why :-p
14:53lvhsure
14:53lvhi know, i know
14:53Empperiyeah, that kinda sucks, defmultis defonce behavior that is
14:53Empperiyou need to restart everything if you decide to change something
14:53sveriEmpperi: I don't have to do that
14:55sveriat least not if I change the implementation of defmulti or add another defmethod
14:55dnolenEmpperi: you can unmap the defmulti var and re-eval
14:55arohner$(doc 'ns-unmap)
14:55arohner,(doc ns-unmap)
14:55clojurebot"([ns sym]); Removes the mappings for the symbol from the namespace."
14:57Empperinice, but would be even more nice if I could just reload stuff in a namespace to repl :)
14:57sveriEmpperi: I do that all the time with cursive in intellij
14:57Emppericursive here, doesn't help with multimethods
14:58Empperibut I don't mind that much
14:58EmpperiI don't use multimethods all that often
14:58sveriDid you try with tools.namespace?
14:59Empperiyup, been using it for quite some time
14:59Empperisometimes it doesn't work though
14:59sveristrange
14:59Emppericomplains about missing namespaces which don't even exist and they aren't referred from anywhere
14:59Empperihave few projects with that problem
15:00Empperiso since I can't rely on it I haven't been using it all that much lately
15:00Empperiand yes, those projects work perfectly fine in all other cases
15:00sverireally strange
15:01sveribut I am repeating :d
15:01Empperihehe
15:05FrozenlockIs there a function to replace the value of :key in a map? (for all instances of :key)
15:06EmpperiFrozenlock: map or nested maps?
15:06amalloythere is only one possible instance of a key in a given map
15:06Frozenlocknested maps
15:08Empperi(clojure.walk/prewalk (fn [x] (if (:key x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"]])
15:08Empperi,(clojure.walk/prewalk (fn [x] (if (:key x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"]])
15:08clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
15:08Empperidarn, never type code directly to irc
15:08Empperi,(clojure.walk/prewalk (fn [x] (if (:key x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"}})
15:08clojurebot#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:08Empperiok, I give up
15:10Empperi,(clojure.walk/prewalk (fn [x] (if (:foo x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"}})
15:10clojurebot#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:10Empperibah, that *does* work
15:10amalloy,(require 'clojure.walk)
15:10clojurebotnil
15:10Empperi,(clojure.walk/prewalk (fn [x] (if (:foo x) (assoc x :key "foo") x)) {:bar "bar" :foo "asdf" :blergh {:foo "eieie"}})
15:10clojurebot{:bar "bar", :foo "asdf", :blergh {:foo "eieie", :key "foo"}, :key "foo"}
15:10EmpperiFrozenlock: anyway, there you go
15:11Empperiin that usage scenario replaces all :foo values to "foo"
15:11amalloyis 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:12Empperiyeah, I was so used to the old way
15:13FrozenlockEmpperi: thanks
15:13EmpperiFrozenlock: lol, there is a slight bug still in that example :)
15:14Empperibut guess you see it
15:14EmpperiI pass wrong keyword to assoc
15:14FrozenlockYeah, that was pretty obvious :-p
15:14deanmanWhat most people using for dev env for clojure, is it emacs+cider? Windowed emacs looks terribly bad
15:14Empperiwalk api is pretty nice for all kinds of things
15:14Empperideanman: I personally currently use IntelliJ Idea + Cursive
15:15amalloydeanman: "looks terribly bad"? what do you mean?
15:15Empperiand I haven't been a big fan of emacs myself either
15:15Empperieven if I learned to program with it
15:15EmpperiC++ lol
15:15EmpperiI started the hard way
15:16deanmanamalloy: 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:17sverideanman: cursive user too here
15:17pbxdeanman, i think aquamacs is a step up http://aquamacs.org/
15:18amalloy~aquamacs
15:18clojurebotTitim gan éirí ort.
15:18tbaldridgedeanman: I do most of my Clojure development in Cursive these days, emacs if i'm in a odd mood
15:18clojurebotPardon?
15:18amalloyreally? don't we have a factoid for that? "aquamacs is probably the problem" or something?
15:21arav93I'm doing typed clojure annotations, so for an input '[1 2 3] , clojure.lang.PersistentVector java.lang.Long would do , right?
15:22nooniani'd recommend regular emacs on mac osx, otherwise normal emacs installation and configuration mehtods don't always apply
15:22noonianbut you can definitely get it to look pretty hehe
15:22sveriarav93: looks reasonable
15:23arav93But, when I test, I get the following error
15:23arav93Domains: (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:24arav93What does it look like? sveri
15:24sveriarav93: I am learning core.typed right now myself... I have a look, but cannot promise anything ;-)
15:25sveriarav93: you know what (t/U means?
15:25arav93Yes
15:25arav93That's union :)
15:26arav93sveri:
15:26sveriYou might as well use Seq or someting similar then, however, thats not the problem I guess
15:26arav93Yeah
15:28sveriHVec means an heterogeneous vector that you are passing in, but with : (clojure.lang.PersistentVector java.lang.Long) you expect a homogenuous vector
15:28sveriarav93: that should be a problem here
15:29arav93Oh
15:29sverimaybe try (HSeq [t/Any *]) to start with
15:29sveriand then refine
15:29arav93sveri, yes that might be the problem
15:43lemonodordeanman: 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:44deanmanlemonodor: Thanks ill have a look
15:47sdegutisI just realized this is wicked fast: java -cp ~/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar clojure.main
15:50oddcullysdegutis: don't forget the rlwrap ^_^
16:06kaiyinhow 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:07amalloykaiyin: just call (first (filter ...))
16:07kaiyinamalloy: oh, filter is lazy?
16:07amalloykaiyin: could it be lazy?
16:09adereth,(doc filter)
16:09clojurebot"([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:11arohnergive a java resource, is it possible to determine which jar it came from?
16:12arohneror whether it even came from a jar?
16:12arohnerhrm, .getFile is interesting, but will require parsing
16:12puredangerif you got it from a classloader, you can ask the classloader
16:16kaiyincool
16:24sdegutisAny tips on using Clojure without Leiningen?
16:30kaiyinhow do you get all elements of a vector except for the nth?
16:30amalloyvectors aren't very good at that operation
16:30kaiyini.e. (get-except 2 [1, 2, 3, 4]) should return [1, 3, 4]
16:30amalloyare you sure there's not some better way to solve your problem?
16:31kaiyinamalloy: i see, i think i can figure some other way.
16:31kaiyinfigure out.
16:35arohnerpuredanger: I'm getting it from io/resource
16:40Shayanjmre-optimized my algo
16:41cflemingarohner: https://www.refheap.com/99700
16:41cflemingarohner: Excuse the Java, it's what I have to hand
16:41Shayanjmhttp://puu.sh/hgjVv/9898b83ca3.png
16:41Shayanjm~3k lat/long coordinates for the circle packing generated in less than a second
16:41clojurebotExcuse me?
16:41cflemingarohner: Sorry, missing a bit, one sec
16:51cflemingarohner: 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:52arohnercfleming: thanks
16:52arohnercfleming: I'm mainly interested in non-class resources, i.e. just files that happen to be in the jar
16:52arohnerlooks like I can just parse the output of (.getFile (io/resource ...))
16:53cflemingarohner: I think that should work for that, it's just looking up resources after all
16:53arohnerbut they don't have a class?
16:53cflemingarohner: That is very true :-)
16:53cflemingarohner: in that case I generally just use another class that I know is co-located in the same jar
17:40arohnergiven 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:42danielglauserarohner: I don't think so. Have you looked in the metadata?
17:42sidharthais there a way to stop cider from compiling at start up when i start cider in a leinengen project directory ?
17:42arohnerdanielglauser: the metadata gives you the source file it was originally compiled from. doesn't tell you if the .class was loaded
17:43danielglausergotcha
17:50mavbozosidhartha, use :init-ns in project.clj :repl-options
17:53mavbozosidhartha, in my project, i put :repl-options {:init-ns user}.
17:54tomjackwat. you're saying :init-ns disables some crazy magic in cider?
17:55tomjackI 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:55tomjackprobably not :(
17:56mavbozotomjack, i don't know :)
17:57mavbozois there some crazy magic that cider's do when i do `cider-jack-in` in emacs?
17:57akkads/in/off yes
18:03mavbozoif 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:07mavbozoand i can enter the repl eventhough some of project's source files failed in compilation.
18:22jdeisenbergWhen using atoms to save state, is it normal to have one atom with a map that holds the pertinent information, or several atoms?
18:22amalloyone atom with a map
18:23jdeisenbergOK. I thought so; thanks.
18:23amalloysynchronizing multiple atoms via swap! is impossible in a multi-threaded scenario, which makes it unpleasant
18:23jdeisenbergAh, good point.
18:28jdeisenbergThanks again!
18:40brehaut~ask
18:40clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
18:41brehaut(not directed at anyone. just wanted the quote)
18:49danielcomptonHow do we add new quotes to Clojurebot?
18:51darthdeusis there a more idiomatic way of doing this? (update-in {} [:foo] #(if % (inc %) 1))
18:53tomjack,(update-in {} [:foo] (fnil inc 0))
18:53clojurebot{:foo 1}
18:54TimMcdanielcompton: Unintentionally, mostly.
19:01mavbozo~clojure
19:01clojurebotclojure is left as an exercise for the reader
19:01mavbozo~clojure
19:01clojurebotclojure is not groovy
19:08brehautdanielcompton: the is operator
19:08brehautdanielcompton: + complication syntax i cant remember but dont have my stick note for
19:09brehautdanielcompton: you address clojure bot and say 'X is something'
19:09brehautwithout the quotes
19:09danielcompton~ask2ask is The ~ask command wastes more bandwidth than any version of the Ask To Ask protocol, so just ask your question.
19:09clojurebotc'est bon!
19:09brehautinvariably you get it wrong, and then trying to make the bot forget causes 3 variants to be created
19:10brehautoh, and it does inference
19:10brehautand can store multiple factoids for any ke
19:12hiredman~clojurebot is <reply> You are in a maze of twisty factoids, all alike.
19:12clojurebotAck. Ack.
19:13noonian~clojurebot
19:13clojurebotclojurebot is pretty cool
19:13brehaut(inc hiredman)
19:13lazybot⇒ 76
19:14brehauthiredman: how many factoids does the bot have these days?
19:21hiredmana very modest 2004
19:21cddrIs there a way to get the name of the current lein profile so you can conditionally run code only in certain environments?
19:25martinjungblutanyone using vim for writing clojure?
19:26arrdemI did
19:26lampd1i have
19:26arrdemthen I switched to emacs because of better tooling
19:26arrdemfireplace.vim is nice tho
19:27martinjungblutyeah, been thinking about going the emacs way lately...
19:27martinjungblutI noticed VimClojure is no longer maintained
19:28martinjungblutnot sure if this is OT or not
19:35mullrmartinjungblut: spacemacs is where it's at, if you're into vim keybindings and clojure
19:36martinjungblutspacemacs
19:36martinjungblutholy cow
19:40j201martinjungblut: currently using fireplace, vim-clojure-static, and paredit
19:41martinjungblutthanks for the help guys :)
19:45darthdeushey guys, any idea what would cause this? https://gist.github.com/darthdeus/dec7031fd870f54b7528
19:46noonianthats basically a syntax error, its saying it cant read a form (s-expression)
19:46darthdeusnoonian: but how can that happen?
19:47darthdeusi mean, i'm not doing any metaprogramming or anything
19:47darthdeusjust playing around with compojure
19:48noonianwell, 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:48noonian,<>
19:48clojurebot#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:49noonianeh, i don't know how to get that particular reader exception though
19:49nooniancan you post the compojure code you are playing around with?
19:58weimartinjungblut: I use emacs, evil and monroe. pretty minimal emacs + vim bindings setup.
20:05bucketh3adI 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:12danielcomptonbucketh3ad: 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:13bucketh3adLet's say I have a map sorted by value: {"thing1" 10, "thing2" 10, "thing3" 5, ...}
20:14bucketh3adI 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:15bucketh3adso the function would return ["thing1" "thing2"]
20:15bucketh3ador 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:16mullrhow about (-> my-sorted-map (partition-by second) (map first))
20:16mullrmaybe?
20:16mullrerr, (->> my-sorted-map (partition-by second) (map first))
20:17mullrok, that's wrong. but partition-by can get you the first chunk
20:18bucketh3ad(first (partition-by second my-sorted-map)) does what I need. Thanks!
20:42WickedShellstupid 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:43amalloyWickedShell: (-> x (min 0) (max 100)) would be the simplest thing. ie, "constraining" is just a call to min and a call to max
20:43amalloyexcept i think i got min/max reversed there
20:49szatzhey, 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:53TimMcamalloy: That always bugs me.
20:54TimMc,(map #(-> % (min 0) (max 100)) [-5 0 50 100 105])
20:55clojurebot(100 100 100 100 100)
20:58WickedShellamalloy, that seems to have pointed me along enough to get started, thanks
21:00TimMc,(map #(-> % (max 0) (min 100)) [-5 0 50 100 105])
21:00clojurebot(0 0 50 100 100)
21:07TimMc,(defn mm [a b] (fn [x] (-> x (min (max a b)) (max (min a b))))) ;; amalloy_ this somehow feels better
21:07clojurebot#'sandbox/mm
21:12WickedShellso 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:12WickedShelland constrain as a macro seems to work just fine if I stick with more normal calls like (constrain 5 0 100)
21:13TimMcWickedShell: You almost certainly do not want a macro.
21:13WickedShelloh? if you can enlighten me... as you may guess this is initial transition from C/java land :P
21:15TimMc(defn constrain [x lo hi] (max lo (min hi x)))
21:15TimMc,(defn constrain [x lo hi] (max lo (min hi x)))
21:15clojurebot#'sandbox/constrain
21:15TimMc,(map #(constrain x 0 100) [-5 0 50 100 105])
21:15clojurebot#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:15TimMcugh
21:16TimMc,(map #(constrain % 0 100) [-5 0 50 100 105])
21:16clojurebot(0 0 50 100 100)
21:16WickedShellyeah as a function it seems to work all the way through
21:16TimMcWickedShell: ^ It's really, really rare that macros are the right answer. Totally a last resort thing.
21:18TimMc~macros
21:18clojurebotBarking spiders!
21:18TimMc~macros
21:18clojurebotmacros are just a game with symbols
21:18WickedShelllol
21:19TimMcYou also never *need* macros.
21:19TimMcMacros produce code for you; you could just write that code.
21:27Niachow can i save the webpage concurrency
21:45jcornelihello, 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:45jcornelifor example, (import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation)
21:46jcornelibut I can see /home/joe/flow/FlowData/jars/stanfordJars/stanford-corenlp-3.5.0.jar is in the classpath
21:47jcorneliCan anyone offer insight? I've been googling for some time trying to figure it out
21:48jcorneliThe JARs are added via the :resource-paths entry in Leiningen
21:49jcornelias suggested here: http://stackoverflow.com/a/14070422/821010
21:49TimMcNiac: I don't think that's a well-formed question.
21:50NiacTimMc: Concurrent to crawl the page
22:02cflemingjcorneli: 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:35nuwanda_cfleming: working with clojure and being able to actually debug code, step by step is amazing
22:35nuwanda_whenever you actually start charging for cursive you have a guaranteed client
22:36nuwanda_,(inc cfleming)
22:36clojurebot#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:36cflemingnuwanda_: Great, I'm glad to hear it!
22:37cflemingnuwanda_: I'm actually working on the debugger for the next release, lots of nice features
22:39cflemingnuwanda_: Check it out - locals painted in the editor as you debug: http://imgur.com/2dPsxYK
22:40cflemingnuwanda_: 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:43nuwanda_nice, specially the inline debugging, seems incredibly useful
22:44cflemingnuwanda_: Here's the in-editor expression evaluation: http://imgur.com/LQyOEIK
22:45nuwanda_looking forward to trying it all out :)
22:46cflemingnuwanda_: Hopefully out in a day or two
22:55IgorHello 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:48Rayneshttp://weknowmemes.com/wp-content/uploads/2013/08/most-interesting-bear-in-the-world-meme.jpg
23:50TEttingerRaynes. There was some question I had for you about one of your many projects, but I can't remember it now