#clojure log - Jul 26 2015

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

1:35 elvis4526: Are atoms more expensive than vars ?

1:35 Seylerius: Hrm. I've got a formula that turns an integer representing the index of a new moon (first in 2000 is 0, increment from there) into the date of that new moon. Is it more sensible to have it generate a lazyseq of new moon dates (starting at an arbitrary point), or something else? I'm just not sure.

1:44 ebzzry: is there a way to convert a string to an InputStream?

2:04 arrdem: ebzzry: StringReader is what you want

2:04 http://docs.oracle.com/javase/7/docs/api/java/io/StringReader.html

2:04 ebzzry: arrdem: thanks

3:04 arrdem: ebzzry: sure

3:05 justin_smith: arrdem: sometimes I have found I want string -> .getBytes -> ByteArrayInputStream.

3:05 when you really need InputStream, not Reader

3:10 arrdem: It would be an interesting thought experiment to look at all the Java base classes and go "Ok, so what went wrong and what would Java2 look like".

3:10 'course like Clojure2 it's an exercise in futility...

3:22 jefelante: Would anyone be so kind as to help me figure this out? I'm pulling my hair out trying to extract this data https://gist.github.com/anonymous/b840211c8ce0088d79da

3:24 justin_smith: jefelante: your outer call should be a mapcat, not a map

3:24 jefelante: that would give you the result you expect

3:24 (the outer call being the one you don't show in the gist (mapcat (that anon fn) input)

3:24 )

3:25 domokato: there must be a better way to write this clamp function? http://pastebin.com/Bn3Rxj69

3:25 jefelante: justin_smith: awesome, thanks

3:25 justin_smith: jefelante: the principle to remember is if you want an arbitrary number of output elements for each input, use mapcat instead of map, and make sure your function returns a sequence inside

3:26 mmeix: ,(defn clamp [min-x max-x x] (min (max min-x x) max-x))

3:26 clojurebot: #'sandbox/clamp

3:27 jefelante: okay cool

3:27 mmeix: (clamp 2 5 7)

3:27 domokato: mmeix: I want min-x and max-x to be optional (omitted by passing nil)

3:27 mmeix: ,(clamp 2 5 7)

3:27 jefelante: oddly enough i'd been wondering what mapcat did and why i'd use it

3:27 clojurebot: 5

3:27 mmeix: how would your clamp function know between what to clamp?

3:28 domokato: mmeix: if min or max is omitted, clamp only the other

3:28 ,(min 1 nil)

3:28 clojurebot: #error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.lang.Numbers ops "Numbers.java" 1013]}]\n :trace\n [[clojure.lang.Numbers ops "Numbers.java" 1013]\n [clojure.lang.Numbers lt "Numbers.java" 221]\n [clojure.lang.Numbers lt "Numbers.java" 3812]\n [clojure.lang.Numbers min "Numbers.java" 4087]\n [sandbox$eval72 invoke "NO_SOURCE_FILE" 0]\n [...

3:29 justin_smith: ,(defn clamp [min-x max-x x] (min (max (or min-x x) x) (or max-x x)))

3:29 clojurebot: #'sandbox/clamp

3:29 justin_smith: ,(clamp nil -1 10)

3:29 clojurebot: -1

3:29 justin_smith: ,(clamp 5 -1 nil)

3:29 clojurebot: #error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.lang.Numbers ops "Numbers.java" 1013]}]\n :trace\n [[clojure.lang.Numbers ops "Numbers.java" 1013]\n [clojure.lang.Numbers gt "Numbers.java" 229]\n [clojure.lang.Numbers max "Numbers.java" 4027]\n [sandbox$clamp invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval145 invoke "NO_SOURCE_FILE" 0]\n [clo...

3:29 justin_smith: oops

3:29 ,(clamp 5 nil -1)

3:29 clojurebot: -1

3:29 justin_smith: ,(clamp nil 5 -1)

3:29 clojurebot: -1

3:30 justin_smith: ,(clamp 1 5 -1)

3:30 clojurebot: 1

3:30 justin_smith: looks good to me (shamelessly derived from mmeix 's version of course)

3:30 mmeix: :-)

3:30 domokato: or!

3:30 mmeix: I'm honored!

3:30 domokato: <- Java programmer

3:31 mmeix: <- aspiring clojure beginner

3:31 domokato: thanks :)

3:31 justin_smith: ,(or nil false 1)

3:31 clojurebot: 1

3:31 mmeix: another way would be to use :keys

3:31 I think

3:32 justin_smith: mmeix: you mean :or defaults in destructuring?

3:32 mmeix: yes

3:32 https://clojurefun.wordpress.com/2012/08/13/keyword-arguments-in-clojure/

3:32 justin_smith: yeah, but the spec has no datastructures...

3:33 mmeix: ok

3:33 domokato: i would have to pass a map in?

3:33 justin_smith: to do it the way mmeix is suggesting, yeah

3:33 domokato: yeah, not worth it. no better way other than passing nils, huh?

3:33 mmeix: but positional arguments in this case is readable enough I guess

3:34 justin_smith: ,(defn clamp [min-x max-x x] (let [min-x (or min-x x) max-x (or max-x x)] (min (max min-x x) max-x)))

3:34 clojurebot: #'sandbox/clamp

3:34 justin_smith: when you spread that out properly I think it's mor readable

3:35 mmeix: or multi-arity would be another possibility

3:36 domokato: but clamping max only and clamping mix only have the same arity, that's the problem

3:36 mmeix: if the use case lends to it (if this is acorrect english sentence, not sure)

3:37 I find justin's last version rather neat

3:39 domokato: it would be nice to write it objective-c style: (clamp x :min 0 :max 12)

3:39 mmeix: :keys

3:39 no?

3:39 clojurebot: no is tufflax: there was a question somewhere in there, the answer

3:40 domokato: oh, so i don't have to pass a map

3:40 nice!

3:40 justin_smith: ,(defn clamp ([{:keys [min-x max-x x] :or {min-x x max-x x}}] (min (max min-x x) max-x)) ([min-x max-x x] (clamp {:min-x min-x :max-x max-x :x x}))

3:40 mmeix: you would have to

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

3:40 justin_smith: oops

3:41 ,(defn clamp ([{:keys [min-x max-x x] :or {min-x x max-x x}}] (min (max min-x x) max-x)) ([min-x max-x x] (clamp {:min-x min-x :max-x max-x :x x})))

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

3:42 justin_smith: mmeix: yeah, :or defaults cannot refer to other bindings inside the same map I don't think

3:45 mmeix: another possibility (depending on use case): two functions: clamp-above and clamp-below

3:45 and clamp for both

3:45 would depend on context, I guess

3:47 ,(defn clamp-below [min-x x] (max min-x x))

3:47 clojurebot: #'sandbox/clamp-below

3:47 mmeix: ,(defn clamp-above [max-x] (min max-x x))

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

3:48 mmeix: oops

3:48 ,(defn clamp-above [max-x x] (min max-x x))

3:48 clojurebot: #'sandbox/clamp-above

3:49 justin_smith: mmeix: (def clamp-above min) (def clamp-blow max) :P

3:49 mmeix: ,(map (partial clamp-below 3) [2 7 4 78])

3:49 clojurebot: (3 7 4 78)

3:49 mmeix: LOL

3:50 I shoulg get me some coffee, I guess

3:51 ,(map (partial min 3) [2 7 1 42])

3:51 clojurebot: (2 3 1 3)

3:51 mmeix: right you are

3:52 didn't think of that

3:52 thanks

3:53 so: lot of options here

3:54 although (partial min ...) doesn't read intuitively, I find

3:57 domokato: hm...i must be doing something wrong

3:57 mmeix: just playing around with Day8/re-com, they do everything with named parameters

3:57 domokato: ,(defn clamp [x & {:keys [min max] :or [min nil max nil]}] (clojure.core/min (or max x) (clojure.core/max (or min x) x)))

3:57 clojurebot: #'sandbox/clamp

3:57 domokato: ,(clamp -1 :min 0 :max 19)

3:57 clojurebot: 0

3:58 domokato: ,(clamp -1 :min 0)

3:58 clojurebot: -1

3:58 domokato: ?

3:58 mmeix: min or :min?

3:58 ah, sorry

3:58 justin_smith: domokato: that :or clause doesn't do anything

3:58 domokato: doh!

3:58 ,(defn clamp [x & {:keys [min max] :or {min nil max nil}}] (clojure.core/min (or max x) (clojure.core/max (or min x) x)))

3:58 clojurebot: #'sandbox/clamp

3:58 domokato: ,(clamp -1 :min 0)

3:58 clojurebot: -1

3:59 justin_smith: domokato: it still does nothing

3:59 domokato: the default is already nil

3:59 domokato: o

3:59 ,(defn clamp [x & {:keys [min max]}] (clojure.core/min (or max x) (clojure.core/max (or min x) x)))

3:59 clojurebot: #'sandbox/clamp

3:59 domokato: ,(clamp -1 :min 0)

3:59 clojurebot: -1

4:00 mmeix: (also min and max as parameter names are not so good, i think, because these are function names in clojure)

4:00 justin_smith: that style of keyword arg is very unpopular

4:02 domokato: but why doesn't it work?

4:04 mmeix: ,(clamp -1 {:min 0})

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

4:04 mmeix: oops

4:05 domokato: perhaps cleaner: ,(defn clamp [x & {minimum :min maximum :max}] (min (or maximum x) (max (or minimum x) x)))

4:05 ,(defn clamp [x & {minimum :min maximum :max}] (min (or maximum x) (max (or minimum x) x)))

4:05 clojurebot: #'sandbox/clamp

4:05 domokato: but still doesn't work

4:05 ,(clamp -1 :min 0)

4:05 clojurebot: -1

4:06 mmeix: ,(clamp -1 {:minimum 0})

4:06 clojurebot: #error {\n :cause "No value supplied for key: {:minimum 0}"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No value supplied for key: {:minimum 0}"\n :at [clojure.lang.PersistentHashMap create "PersistentHashMap.java" 77]}]\n :trace\n [[clojure.lang.PersistentHashMap create "PersistentHashMap.java" 77]\n [sandbox$clamp doInvoke "NO_SOURCE_FILE" 0]\n [clojure.lang.RestFn invo...

4:06 mmeix: hrmm

4:06 sorry

4:06 ... gets coffee

4:07 domokato: that won't work because of the &

4:07 justin_smith: ,(clamp -1 :max 1 :min 0)

4:07 clojurebot: 0

4:08 TEttinger: I'd recommend having a separate fn for clamping down, up, and both... clamp usually means clamp both to me

4:08 justin_smith: since you didn't supply max, max was -1, which meant your min was not applied

4:08 TEttinger: the down and up ones are just max and min

4:08 TEttinger: haha

4:08 right

4:08 mmeix: here we go again :-)

4:09 so all that variadic stuff is kind of pointless then

4:09 TEttinger: yep!

4:09 domokato: how did max become -1?

4:09 justin_smith: domokato: because if not supplied it is x

4:09 domokato: i thought if not supplied it is nil

4:10 justin_smith: well that would give you a nullpointerexception

4:10 domokato: i used ors though

4:10 justin_smith: domokato: (or maximum x)

4:10 which means you get maximum, if provided, or -1

4:10 so when you don't supply :max, the -1 slips through

4:10 but if you do, as shown above, things work as expected

4:11 mmeix: so I guess we come back to using: min, max and (defn clamp [min-x max-x x] (min (max min-x x) max-x))

4:11 right?

4:11 TEttinger: justin_smith: I imagine this is why keyword args are unpopular :)

4:11 justin_smith: right, I think that makes the most sense

4:11 TEttinger: not even the main reason!

4:11 mmeix: what would be the main reason?

4:11 justin_smith: (they compose poorly)

4:12 mmeix: ah, I see

4:12 justin_smith: mmeix: a common thing in clojure is to take a function, and write another function that takes the same args, and calls that function

4:12 mmeix: understood

4:12 justin_smith: mmeix: it's hard to capture the args in a usable form when using keyword args

4:12 mmeix: yes, Isee

4:13 justin_smith: which is why it's more popular to just use a map as one of your args - same functionality, much more powerful

4:14 TEttinger: and to destructure it, right?

4:14 justin_smith: right

4:14 mmeix: yes, and in this simple clamp case it's overkill anyway

4:16 I wondered the other day, which principles led Rich Hickey in designing the argument positions in clojure/core functions

4:17 colls last, I understand, for thread macro and map

4:17 justin_smith: if you use a sequence, it should come last, if you use an associative lookup, it should come first

4:18 (generally)

4:19 mmeix: thanks

4:20 domokato: so this doesn't work...

4:20 ,(defn clamp [min-x max-x x] (let [min-x (or min-x x) max-x (or max-x x)] (min (max min-x x) max-x)))

4:20 clojurebot: #'sandbox/clamp

4:20 domokato: ,(clamp -1 0 nil)

4:20 clojurebot: #error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.lang.Numbers ops "Numbers.java" 1013]}]\n :trace\n [[clojure.lang.Numbers ops "Numbers.java" 1013]\n [clojure.lang.Numbers gt "Numbers.java" 229]\n [clojure.lang.Numbers max "Numbers.java" 4027]\n [sandbox$clamp invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval50 invoke "NO_SOURCE_FILE" 0]\n [cloj...

4:20 domokato: ,(clamp 0 nil -1)

4:20 justin_smith: remember the last arg is your x

4:20 clojurebot: -1

4:21 justin_smith: yeah, so my or thing is wrong, sorry

4:21 domokato: (is that idiomatic?)

4:23 justin_smith: ,(defn clamp [min-x max-x x] (let [min-x (or min-x x) max-x (or max-x x)] (min (max min-x x) max-x))) ; fixed

4:23 clojurebot: #'sandbox/clamp

4:23 justin_smith: ,(clamp 0 nil -1)

4:23 clojurebot: -1

4:23 justin_smith: or, wait

4:23 haha

4:23 not fixed

4:29 domokato: the best i could come up with

4:29 ,(defn clamp [minimum maximum x] (let [clamp-bottom (max x (or minimum x))] (min clamp-bottom (or maximum clamp-bottom))))

4:29 clojurebot: #'sandbox/clamp

4:29 domokato: (clamp 0 nil -1)

4:29 ,(clamp 0 nil -1)

4:29 clojurebot: 0

4:30 justin_smith: ,(clamp nil 1 2)

4:30 clojurebot: 1

4:30 justin_smith: nice

4:31 mmeix: ah! was it the double usage of min-x/max-x in the let assignment?

4:33 xtrntr: hi, i'm following modern-cljs tutorials right now

4:33 mmeix: instructive discussion :-)

4:33 xtrntr: might i ask what is a typical workflow environment for people using clojure in web dev?

4:33 im using sublime + emacs + terminal and it feels a bit strange

4:34 i did all development in an ide only before

4:34 justin_smith: xtrntr: why both sublime and emacs?

4:34 xtrntr: for html and js files

4:34 is there a way to display tree-like directory in emacs?

4:35 justin_smith: xtrntr: I find M-x dired + i key for opening subdir is good

4:35 but it's not quite a tree

4:35 good enough for me though

4:35 mmeix: (if using something like Reagent, html-writing gets to a minimum)

4:35 (I find)

4:35 (js also)

4:35 xtrntr: ah

4:35 i guess im more of asking an emacs question then :blushes:

4:36 justin_smith: xtrntr: also, you should be able to do your repl stuff inside emacs (though I often prefer not to), and your web server can be running from inside your repl

4:37 xtrntr: ok, i guess thats something to look forward

4:37 will follow tutorials at a snail's pace first

4:37 mmeix: figwheel or boot-reload are very helpful too, I find

4:38 (but maybe that wasn't the question)

5:12 xtrntr: hi

5:12 my clojure brepl gets stuck

5:12 does anyone know why?

5:31 it works now

5:31 but i don't know why i have to refresh the browser in order for the expression to evaluate

5:31 am i doing it wrong? :(

5:38 mmeix: are you looking for auto-reloading code?

5:39 ddellacosta: xtrntr: I missed the beginning of that, did you paste in a code sample?

5:39 xtrntr: no, i'm just following the modern-cljs tutorials

5:39 yes, looking for auto-reloading code? you mean the default for clojure-brepl is to refresh the webpage to evaluate my expressions?

5:39 also, i'm very new to web dev

5:40 mmeix: there are means to automatically push code to the browser

5:40 figwheel is one of them

5:41 xtrntr: ok, i'll look at it -later-

5:41 don't wanna mess up the tutorials.. i'm treading oh so carefully :)

6:29 noncom|2: if i store my functions in a [] or {} and then i change and reevalute the defs of them, should the references stored in the {}s and []s point to the new function definition, or will it retain the old one?

6:34 shoky_: noncom|2: afaik, if you have [f] then it will retain the old one because the function itself is stored. if you have [#'f] then it will point to the new one, as it is storing the actual var. or something like that

6:36 noncom|2: thank you, a good insight

7:30 frud: Hi! When making a webapp with user accounts, do you all generally prefer Friend or Buddy? Making my first web app in Clojure, and can't find either comparisons or tutorials much :/

8:12 xtrntr: hey frud

8:12 are you still there?

8:12 wanted to link you this

8:12 https://github.com/magomimmo/modern-cljs

8:12 working through it myself :)

8:13 Walther: Hi there! I'm having fun with this one http://iloveponies.github.io/120-hour-epic-sax-marathon/p-p-p-pokerface.html - but ran into a wall. Any ideas on what goes wrong with the "straight" function? http://walther.guru/poker.txt

8:22 shoky: ,(range 10 14)

8:22 clojurebot: (10 11 12 13)

8:22 shoky: Walther ^

8:24 Walther: Ah, range's end is not inclusive

8:26 excellent, thanks!

9:14 expez: If I make a data-reader for #js can I otherwise read cljs file with the clj reader?

10:01 sub0: What is the useless skin around the vagina called?

10:01 WOMAN!

10:26 spacepluk: hi there, is there any alive project to host clojure on c/c++?

10:32 arrubin: spacepluk: You could embed a JS engine and use ClojureScript.

10:33 spacepluk: arrubin: yeah, but I was thinking about things like deftype for c++ classes, calling/generating native code and that kind of stuff

10:42 justin_smith: spacepluk: there's no active project. I think the big issue is that clojure really needs gc.

10:44 spacepluk: justin_smith: that's what it looked like :( I wouldn't mind having a runtime in exchange of that kind of power.

10:45 justin_smith: spacepluk: in a way, pixie gets close to that - the runtime interop is with C (or really the host OS, but C is pretty approachable from host level), the vm is made using rpythong

10:45 *python

10:46 it doesn't aim to be a fully compatible clojure though

10:47 spacepluk: cljs-terra is very interesting

10:49 I guess there's not enough public for something like this

10:49 justin_smith: spacepluk: there's people who would use it, but not many people available who want to spend the decades of man hours to make a good vm from scratch.

10:50 re-using a vm is so much easier

10:50 and clojure inherently needs a vm

10:50 spacepluk: absolutely

10:51 I just found this, but I'm not sure what it is -> https://github.com/halgari/mjolnir

10:51 justin_smith: spacepluk: it's similar to jni - it's for generating native code from within the vm

10:51 spacepluk: ah, ok I saw LLVM and got all excited

10:51 justin_smith: spacepluk: it's from the same author that went on to do pixie, one of his older projects

10:52 spacepluk: I'll check it out

10:53 justin_smith: note that pixie isn't hosted by python - it uses rpython to compose a native level vm (there is no runtime python)

10:53 spacepluk: justin_smith: thanks, I was just thinking about that

10:54 it sounds very cool

13:00 gganley: im trying to import a html table as a map is there any way i can automate that or am I going to have to do it all by hand?

13:05 spacepluk: gganley: any xml library should work

13:09 gganley: spacepluk: which is the most popular one?

13:40 spacepluk: ggherdov: ah sorry, it was just an idea I'm just getting started with clojure

13:40 and that wasn't for you, I'm sorry again

13:41 vas: Hey everyone, how do I get a repl running from a jar in the namespace that I want?

13:43 or alternatively, is there a straightforward way to SSH emacs/cider-jack-in ?

14:05 rhg135: java -cp <JAR>:<clojure jar> clojure.main

14:06 That loads a repl

14:08 spacepluk: I'm trying to add a maven dependency and I'm getting this (http://sprunge.us/QfUa), any idea what I'm doing wrong?

14:09 rhg135: does that artifact actually exist?

14:09 The version mostly

14:10 spacepluk: rhg135: I think it does: http://search.maven.org/#artifactdetails%7Corg.apache.storm%7Cstorm%7C0.9.5%7Cpom

14:12 I also tried the last version but I get the same error

14:12 rhg135: Network?

14:12 spacepluk: it's slightly slow now, but everything else seems to be working just fine

14:13 no proxies or firewalls

14:14 rhg135: I'm out of ideas, the only time I see that is when I make a typo

14:15 spacepluk: rhg135: thanks, I'll keep digging

14:17 rhg135: There may be a way to debug dependency resolution but I've never tried

14:18 spacepluk: hmm, other modules download just fine

14:34 eric1: /set irc.server.freenode.nicks ""

14:44 Seylerius: Normally (range x) produces [0 1 2 ... x-1]. What produces [x x+1 x+2 ...]?

14:44 mmeix: ,(range 4 9)

14:45 clojurebot: (4 5 6 7 8)

14:45 Seylerius: Nah, what I want is an infinite lazyseq starting at x

14:45 mmeix: ,(doc range)

14:45 clojurebot: "([] [end] [start end] [start end step]); Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity. When step is equal to 0, returns an infinite sequence of start. When start is equal to end, returns empty list."

14:45 mmeix: ah

14:45 ,(iterate inc 5)

14:45 clojurebot: (5 6 7 8 9 ...)

14:46 Seylerius: There we go.

14:46 (inc mmeix)

14:46 lazybot: ⇒ 3

14:46 mmeix: ,(doc iterate)

14:46 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

14:49 mmeix: ,(drop 5 (range))

14:49 clojurebot: (5 6 7 8 9 ...)

14:49 mmeix: another possibility

14:49 Seylerius: Even better.

14:50 And what about if I want a function to behave differently depending on whether the arg is a clj-time datetime or an int? Would I multi-arity it and hint [^int n] as opposed to hinting [^DateTime date]? I'm not sure about that last one...

14:50 Actually, I'll just make two functions.

14:51 mmeix: you could write a multimethod

14:51 http://clojure.org/multimethods

14:53 and dispatch on your desired type

14:54 multi-arity will not work, because you have ONE argument in both cases

14:54 works only for different numbers of arguments

14:54 Seylerius: Yeah. I'm just making a couple different functions.

14:54 mmeix: AFAIK

14:54 Seylerius: Simplest.

14:54 Although thank you for the info.

14:54 mmeix: :-)

15:02 Seylerius: Gah. Y'know what sucks? I'm using Gorilla REPL in Conkeror, and my emacs-style keys only work /intermittently/.

15:03 I /like/ Gorilla REPL, but this interference with conkeror's keybinds is /annoying/.

15:04 reutermj: So I'm using cursive and it cannot resolve a reference to an abstract method

15:04 is this a limitation of clojure's type hints?

15:13 vas: Hey when you guys update a web app running from a jar... do you load balance? Like have version 0 running, have some of it round-robin to version 1 when you upload it, and then finally remove version 0?

15:17 amalloy: reutermj: no

15:18 reutermj: amalloy: Hmmmm when I compile it with *warn-on-reflection* I get a reflection warning

15:18 amalloy: yes, you are doing something wrong evidently

15:18 but so far all you have said is "a thing doesn't work, is something wrong with clojure". nobody can tell how to fix your problem from that

15:19 reutermj: (defn compute [^RecursiveTask task] (.compute task))

15:20 .compute is an abstract method in RecursiveTask

15:21 amalloy: it's protected. you can't call it from non-subclasses

15:21 http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/RecursiveTask.html#compute()

15:22 so not only is there a reflection warning, the code won't run. the warning has done its job

15:22 (unless you pass in a subclass which has overridden the method to be public)

15:22 reutermj: ok I didn't even notice it was protected

15:26 mmeix: which one would be preferable: (defn f [x] (drop x (range)) or (defn f [x] (iterate inc x))? (I guess the second ...)

15:29 pepijndevos: I thought (GET "/team" {params :params} in compojure would put the query parameters in parama? It's empty. Do I need some wrapper?

15:29 Seylerius: mmeix: iterate looks like it'd have a lower constant cost at the start (grabbing and dropping the first x entries from range), so it depends on the difference in calling cost between inc and each step of range. If repeating inc overtakes that constant from the start, then range wins.

15:36 mmeix: ,(defn f1 [x] (drop x (range))

15:36 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

15:37 mmeix: ,,(def f1 [x] (drop x (range)))

15:37 clojurebot: #error {\n :cause "Too many arguments to def"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Too many arguments to def, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]}\n {:type java.lang.RuntimeException\n :message "Too many arguments to def"\n :at [clojure.lang.Util runtimeException "Util.jav...

15:37 mmeix: hrrm

15:37 ,(def f1 [x] (drop x (range)))

15:37 clojurebot: #error {\n :cause "Too many arguments to def"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Too many arguments to def, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]}\n {:type java.lang.RuntimeException\n :message "Too many arguments to def"\n :at [clojure.lang.Util runtimeException "Util.jav...

15:37 mmeix: ,(defn f1 [x] (drop x (range)))

15:37 clojurebot: #'sandbox/f1

15:38 mmeix: ,(time (take 10 (f1 100000)))

15:38 clojurebot: "Elapsed time: 0.543007 msecs"\n(100000 100001 100002 100003 100004 ...)

15:39 mmeix: ,(defn f2 [x] (iterate inc x))

15:39 clojurebot: #'sandbox/f2

15:39 mmeix: ,(time (take 10 (f2 100000)))

15:39 clojurebot: "Elapsed time: 0.166414 msecs"\n(100000 100001 100002 100003 100004 ...)

18:06 justin_smith: ,(time (f2 100000))

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

18:23 justin_smith: ,(defn f2 [x] (iterate inc x))

18:23 clojurebot: #'sandbox/f2

18:23 justin_smith: ,(time (f2 100000))

18:23 clojurebot: "Elapsed time: 0.486575 msecs"\n(100000 100001 100002 100003 100004 ...)

21:03 gfredericks: I like < better than >

21:03 you might say I think that < > >

21:04 justin_smith: hey, I know, we could rename comp to <-

21:05 gfredericks: haha

22:14 vas: So say I have an updated version of my jar to upload to my webserver, how to make zero-downtime a reality?

22:25 akkad: well if you have more than one server, and say, nginx on the front end, you can start more than one, and have a rolling restart with multiple backends

22:34 vas: akkad: That is a good idea. I just have one server, with apache on the front. The rolling restart sounds like the proper way to do that. Thank you will look into it.

22:39 I'm thinking of changing the default port on my .jar and then having apache forward to the new port.. I think that works as a simple zero-downtime for my needs

22:39 like have 2 jars running while i turn one off

22:55 brandon123: i'm trying to pass an array of an enum value into an annotation on a gen-class method and i can't seem to find any information on the right way to do that

22:56 at the risk of being questioned why i would be trying to do what i'm doing, here's a code link https://github.com/brinman2002/springboot-clj/blob/master/src/main/clojure/org/brinman2002/app/service/SimpleService.clj#L7

22:56 when compiling, this gives me a "Exception in thread "main" java.lang.ClassCastException: clojure.lang.Var cannot be cast to java.lang.Class"

23:07 and of course ten minutes later i figure it out... works if you use vectors instead of into-array

23:08 i'll go ahead and take off so you guys can laugh about the person trying to do clojure and spring together

23:31 justin_smith: lol

23:49 TimMc: clojure.core/abstract-singleton-proxy-factory-bean

23:55 http://grepcode.com/file/repository.springsource.com/org.aspectj/com.springsource.org.aspectj.weaver/1.6.3/org/aspectj/weaver/patterns/HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor.java

Logging service provided by n01se.net