#clojure log - Mar 27 2015

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

0:00 TEttinger: the way I do it, because I don't use editor fanciness other than paren matching and syntax highlighting, is press ) until I'm matched

0:01 Jaood: ;)

0:04 * Jaood does the same

0:04 chr15m: that just takes you to the brace though, right? doesn't actually gather them.

0:08 bendlas: hm, I see that issue all the time when shoulder surfing people coding. and I remember it from my pre-paredit days. seems like some OSS clout to be had in releasing a cool editor plugin for that

0:09 especially since in clojure there's typically a mix of ), } and ]

0:09 Jaood: chr15m: looks like we understood you differently

0:09 chr15m: @bendlas so you can do it with paredit? i have paredit.

0:10 bendlas: or maybe I understood you wrong; you didn't mean inserting all the nessecary closing parens?

0:14 chr15m: no i mean if there are loose parens hanging around on lines after the main one

0:14 main one = the one you are working on

0:15 (fn [x] ...

0:15 )

0:15 bendlas: oh, you mean spurious white space between you closing parens

0:15 chr15m: i want a single keystroke to gather that single brace back onto the last line it can go to

0:15 yep

0:16 scottj: chr15m: in paredit in emacs pressing ) will do that for all closing brackets. (if by last line you mean previous line)

0:16 chr15m: scottj: good to know, thank you. i am in vim.

0:17 bendlas: scottj: cool, good to know that

0:17 chr15m: scottj: WAIT. paredit in vim also does this.

0:17 you are truly legendary sir!

0:17 thank you!

0:17 bendlas: I always used to jump outside of the last closing paren and press backspace until they were tidy

0:17 scottj: just repeating what everyone before said :)

0:18 chr15m: lol

0:18 my hubris chooses to ignore the fact it took three attempts to explain the obvious to me

0:18 i am great

0:19 bendlas: seconded ^^

0:19 elvis45261: is there any rule about namespaces ?

0:19 does it have to follow the folder hiearchy ?

0:20 bendlas: elvis45261: yes, plus have at least one parent folder

0:20 i.e two segments

0:20 elvis45261: alright ty

0:21 bendlas: yw

0:25 freddd: does anyone have any idea if dissoc-in will ever make it to core from core.incubator?

0:53 elvis4526: There is really no way to write macro with only clojurescript ?

0:54 if that's the case, is it okay that the clojure file for the macros live in the same place as my cljs files or there should be some "separation" ?

0:56 joe124: hi I am currently working through clojure for the brave and true, is buyign the early access ebook worth it?

0:57 bja: chr15m: go to the line to collect on and hold J

0:57 it'll bring up the previous line every time you hit J

0:57 (which if you have a bunch of parens, just collects those)

0:58 chr15m: bja ah yes, nice

0:58 bja although with paredit hitting ) seems to work better

0:58 bja: I use vim-sext

0:58 vim-sexp

0:58 chr15m: ah ok

0:58 that is tpope's plugin right?

0:58 bja: guns

0:59 chr15m: ah yes

0:59 joe124: is using atom for making clojure programs bad?

0:59 chr15m: it is in the 0.01% of vim plugins not written by tpope

0:59 gws: tpope has this one which works on top of vim-sexp (i use it) https://github.com/tpope/vim-sexp-mappings-for-regular-people

0:59 bja: joe124: do you want it to be bad?

1:00 joe124: no

1:00 bja: then it's not bad

1:00 joe124: awesome i feel great now!

1:00 bja: if you want to really level up, consider using ed to write your clojure

1:01 ed combined with your usual shell and repl for fg/bg abilities and maybe a good mouse with copy/paste

1:01 it'll really change you

1:02 joe124: i have a question why is lisp and such not popular

1:02 is it because lisp languages are harder to learn?

1:04 what is the difference between {:a 5} and (def a 5)

1:17 amalloy: joe124: honestly the differences so outnumber the similarities that they're difficult to list. the two expressions you gave do totally different things; the main similarity is that they both involve the number 5

1:19 joe124: amalloy i just was wondering because in both the number 5 is bound to a

1:19 amalloy: not really

1:19 in the second, you create a global var named a, and make its value be 5

1:20 in the second, you create a hashmap, with the single key :a and the corresponding value 5

1:20 there's no binding or assigning of anything in the second one, just a map with a key and a value

1:21 joe124: but isnt a map kind of like assigning

1:21 gws: no a map is a data structure

1:22 freddd: joe124: a map is also known as a hash or dictionary in other languages if that helps you understand at all.

1:27 joe124: yah thanks guys i guess i just noticed a similarity was wondering if there was anything more to it

1:30 elvis4526: I am confused. How can you make a "global" js variable in cljs ?

1:31 I would have expected that (def js/myGlobal val) would work

1:34 oh nvm

2:38 Igor: How can I close http connection with http-kit? (close channel) doesn't work

2:46 vas: @Igor it doesn't automagically close?

3:32 Seylerius: Hmm... I'm kinda stuck on 4clojure #31

3:33 Pack a sequence...

3:33 Anyone got a hint?

3:50 ordnungswidrig: Seylerius: "packing" = "grouping"

3:52 Seylerius: a better hint would be "partitioning", I guess

4:13 Seylerius: ##(= [1 2 3]

4:13 ##(= [1 2 3] '(1 2 3))

4:13 lazybot: ⇒ true

4:13 * Seylerius nods

4:30 dysfun: is there a 'funcall' equivalent? i.e. apply, but doesn't take a list as arg?

4:31 opqdonut: #(%1 %2) ?

4:32 ordnungswidrig: ,(apply prn [1 2 3])

4:33 clojurebot: 1 2 3\n

4:33 ordnungswidrig: ,(apply prn [[1 2 3]])

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

4:33 ordnungswidrig: hmmmm

4:34 ,(apply prn [[1 2 3]])

4:34 clojurebot: [1 2 3]\n

4:34 ordnungswidrig: dysfun: simple wrap the arg in a vector for apply.

4:41 dysfun: ordnungswidrig: yes, it's just that if said function already existed, it would mean no need to embed a lambda in a (filter)

5:09 borkdude: what are good reasons to choose immutant over embedded jetty or undertow (except for clustering, which I don't need)?

5:17 dysfun: it's quite fast. it's worth testing the performance vs other things

5:17 it fits nicely into the j2ee stack if you're of that persuasion (i'm not)

5:19 borkdude: do people use embedded jetty a lot in production?

5:20 oddcully: what's the key here "embedded" or "jetty"?

5:21 borkdude: jetty

5:21 oddcully: and from immutants homepage, i'd say, that if you don't need quartz, hornet, ... then maybe don't bother with the extra baggage

5:22 http://www.techwars.io/fight/jetty/tomcat/ no ;P

5:23 spinningarrow: super stupid question guys - what does the result of the (doc ...) function mean? for example, if it says `(read-csv input & options)`, what exactly does `input & options` mean there?

5:23 borkdude: spinningarrow check out http://clojure.org/functional_programming

5:24 spinningarrow especially http://clojure.org/special_forms#fn

5:25 spinningarrow basically & options means options is a variadic list of parameters

5:25 spinningarrow like in +, you can call it with an arbitrary amount of params: (+ 1 2 3 4 5 6)

5:26 oddcully: spinningarrow: above from the docs then is: ([] [x] [x y] [x y & more])

5:27 (the last one)

5:34 mpenet: borkdude: jetty is fine in production

5:35 borkdude: ex: prismatic runs on it I believe

5:36 borkdude: mpenet cool

5:38 oddcully: i also use jetty embeded and not. had not problems so far (saising fist to universe to dare)

5:49 f3ew: What's the clojure model equivalent of the Unix pipeline pattern?

5:53 mpenet: f3ew: comp or the -> functions I guess

5:55 ,(-> {:a {:b {:c [1]}}} :a :b :c first inc)

5:55 clojurebot: 2

5:59 oddcully: f3ew: or core.async

6:12 Seylerius: ,(defn dup [coll] (loop [remainder coll result []] (if (empty? remainder) result (recur (rest remainder) (conj result (repeat 2 (first remainder)))))))

6:12 clojurebot: #'sandbox/dup

6:13 Seylerius: ,(dup [1 2 3 4])

6:13 clojurebot: [(1 1) (2 2) (3 3) (4 4)]

6:13 Seylerius: Oh, of course

6:14 (defn dup [coll] (loop [remainder coll result []] (if (empty? remainder) result (recur (rest remainder) (concat result (repeat 2 (first remainder)))))))

6:15 ,(defn dup [coll] (loop [remainder coll result []] (if (empty? remainder) result (recur (rest remainder) (concat result (repeat 2 (first remainder)))))))

6:15 clojurebot: #'sandbox/dup

6:15 justin_smith: Seylerius: or apply conj

6:16 Seylerius: (dup [1 2 3 4])

6:16 ,(dup [1 2 3 4])

6:16 clojurebot: (1 1 2 2 3 ...)

6:16 noncom: f3ew: what do you mean?

6:16 ,(conj {} '(1 2))

6:16 clojurebot: #error{:cause "java.lang.Long cannot be cast to java.util.Map$Entry", :via [{:type java.lang.ClassCastException, :message "java.lang.Long cannot be cast to java.util.Map$Entry", :at [clojure.lang.APersistentMap cons "APersistentMap.java" 42]}], :trace [[clojure.lang.APersistentMap cons "APersistentMap.java" 42] [clojure.lang.RT conj "RT.java" 610] [clojure.core$conj__4067 invoke "core.clj" 85] [sa...

6:16 Seylerius: noncom: It wants a vector, not a list.

6:16 justin_smith: that error message is so funny

6:16 noncom: yaeh, and that seemed strange to me

6:17 ,(conj {} '(:eval '(me "ok")))

6:17 clojurebot: #error{:cause "clojure.lang.Keyword cannot be cast to java.util.Map$Entry", :via [{:type java.lang.ClassCastException, :message "clojure.lang.Keyword cannot be cast to java.util.Map$Entry", :at [clojure.lang.APersistentMap cons "APersistentMap.java" 42]}], :trace [[clojure.lang.APersistentMap cons "APersistentMap.java" 42] [clojure.lang.RT conj "RT.java" 610] [clojure.core$conj__4067 invoke "core....

6:17 justin_smith: ,(conj {} '([] []))

6:17 clojurebot: #error{:cause "clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry", :via [{:type java.lang.ClassCastException, :message "clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry", :at [clojure.lang.APersistentMap cons "APersistentMap.java" 42]}], :trace [[clojure.lang.APersistentMap cons "APersistentMap.java" 42] [clojure.lang.RT conj "RT.java" 610] [clojure.core$conj__...

6:17 justin_smith: that message is factually false

6:17 persistentvector can be cast

6:17 noncom: :D

6:17 also:

6:17 justin_smith: it's just complaining about the type of the wrong item

6:17 noncom: ,(conj {} (:eval '(+ 1 2)))

6:17 clojurebot: {}

6:17 noncom: haha!

6:18 i know what happens, but funny still

6:18 yeah, and your example with [] is even more fun i think :)

6:19 Seylerius: justin_smith: Weirdly enough, my function isn't working, despite producing a good result.

6:19 ,(dup [1 2 3])

6:19 clojurebot: (1 1 2 2 3 ...)

6:19 justin_smith: ,((`~`~get `~`~`~`~get `~`~`~`~`~`~`~get `~`~`~`~`~`~`~`~`~`~`~get) [:a :b :c :d :e] 42 :OK)

6:19 clojurebot: :OK

6:19 justin_smith: Seylerius: what's wrong with that result?

6:20 Seylerius: It's failing #32

6:20 Can clojurebot be coerced into providing a little more of the result?

6:20 hyPiRion: oh sure

6:20 Seylerius: ,(dup [1 2])

6:20 clojurebot: (1 1 2 2)

6:20 hyPiRion: call it with str or something

6:21 ,(str (dup [1 2 3 4]))

6:21 clojurebot: "clojure.lang.LazySeq@34932041"

6:21 hyPiRion: ,(pr-str (dup [1 2 3 4]))

6:21 clojurebot: "(1 1 2 2 3 ...)"

6:21 Seylerius: Heh

6:21 ordnungswidrig: ,(take 10 (dup [1 2 3 4]))

6:21 clojurebot: (1 1 2 2 3 ...)

6:21 hyPiRion: ,(binding [*print-length* 1000] (pr-str (dup [1 2 3 4])))

6:21 clojurebot: "(1 1 2 2 3 3 4 4)"

6:21 justin_smith: ,(apply str (dup [1 2 3 4]))

6:21 clojurebot: "11223344"

6:21 ordnungswidrig: (into [] (take 10 (dup [1 2 3 4])))

6:21 ,(into [] (take 10 (dup [1 2 3 4])))

6:21 clojurebot: [1 1 2 2 3 ...]

6:22 Seylerius: We clearly now have the information we need.

6:22 ordnungswidrig: grr

6:22 hyPiRion: perhaps pr is better actually

6:22 Seylerius: And yet it's still failing #32.

6:22 hyPiRion: 4clojure #32?

6:22 Seylerius: Yep

6:23 hyPiRion: What is it failing on?

6:23 Seylerius: Okay, now that's fscking weird.

6:23 * hyPiRion just recently came into the discussion

6:23 Seylerius: I didn't change a single paren, and now it's passing.

6:23 justin_smith: Seylerius: when I paste the most recent def, it solves 32

6:23 Seylerius: 4clojure is stupid sometimes.

6:23 hyPiRion: Seylerius: might've been a timeout issue?

6:24 justin_smith: also, (concat result (repeat 2 (first remainder))) is objectively worse than (conj result remainder remainder)

6:24 also, (concat result (repeat 2 (first remainder))) is objectively worse than (conj result remainder (first remainder) (first remainder)) that is

6:24 heh

6:24 Seylerius: Noted.

6:25 hyPiRion: If 4clojure hasn't been restarted in a while, then some alright solutions may timeout.

6:25 * hyPiRion looks at amalloy_

6:25 justin_smith: oh that was still wrong :( (conj result (first remainder) (first remainder))

6:26 Seylerius: Hah

6:26 f3ew: noncom: the equivalent of a cat file |grep string | tee >(command) | some_other_command > file2

6:26 Seylerius: And the advantage of repeat becomes clear in #33, where I need to do it an arbitrary number of times.

6:26 justin_smith: Seylerius: (apply conj coll (repeat n val))

6:27 Seylerius: apply conj beats concat?

6:27 justin_smith: definitely, I'd say. If you have a vector

6:27 noncom: f3ew: ummm, well, clojure is a jvm-based programming language, so i am not really sure about what you're asking, but for interacting with bash you can use the conch library and for piping functions, well, yes, there are facilities

6:27 Glenjamin: is (apply conj) prerrable to (into) ?

6:28 justin_smith: Glenjamin: into is likely better than apply conj, yeah

6:29 Seylerius: Oooh. Shiny.

6:29 hyPiRion: and hey, if you need an eager concat on vectors, then I can recommend (defn catvec [& vecs] (reduce into vecs))

6:30 f3ew: noncom: I'm not interacting with bash, I have clojure functions I would like to chain up in a similar style

6:30 oddcully: f3ew: so you want to read a file, filter some limes, send the lines down to another process and save them also into a file? so you want to use closure _instead_ of a shell, right?

6:30 justin_smith: oddcully: he just wants the syntactic style

6:30 which is -> or ->>

6:30 f3ew: oddcully: s/file/event stream/, and process that event stream

6:31 noncom: f3ew: also https://github.com/rplevy/swiss-arrows

6:32 justin_smith: f3ew: oh, if it's explicitly a stream with new items coming in async, then core.async

6:33 f3ew: justin_smith: I'm writing riemann configs, so the reading bit is handled for me

6:34 justin_smith: f3ew: yeah, so you want one of those arrows, probably -> with the occasional nested ->> / some-> / some->> etc.

6:37 Seylerius: ,(defn ranger [a b] (if (< a b) (conj [a] (ranger (inc a) b)) []))

6:37 clojurebot: #'sandbox/ranger

6:37 Seylerius: ,(ranger 1 4)

6:37 clojurebot: [1 [2 [3 []]]]

6:37 Seylerius: Ah, right.

6:38 ,(defn ranger [a b] (if (< a b) (into [a] (ranger (inc a) b)) []))

6:38 clojurebot: #'sandbox/ranger

6:38 Seylerius: ,(ranger 1 4)

6:38 clojurebot: [1 2 3]

6:38 Seylerius: Yep

6:45 justin_smith: ,(def ranger (constantly 'Strider))

6:45 clojurebot: #'sandbox/ranger

6:57 egli: borkdude: immutant is just a nicely package if you want web, messaging, transactions, etc

6:58 it's very industrial strength but you have to dig jboss xml config files

6:59 noncom: ,ranger

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

7:26 Seylerius: ,(defn mixer [seqa seqb] (loop [one seqa two seqb result []] (if (apply or (map empty [one two])) result (recur (rest one) (rest two) (conj result (first one) (first two)))))

7:26 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

7:32 justin_smith: Seylerius: you can't apply or

7:33 ,(some? empty [[1] [2]])

7:33 clojurebot: #error{:cause "Wrong number of args (2) passed to: core/some?", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: core/some?", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 36] [sandbox$eval47 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 67...

7:33 justin_smith: ,(some empty [[1] [2]])

7:33 clojurebot: []

7:33 Empperi: or is a macro, thus you can't use apply with it

7:33 Seylerius: justin_smith: wound up just manually or-ing it.

7:34 The real problem was a missing paren. Emacs catches those so much better, what with highlighting matches.

7:34 justin_smith: ,(some empty? [[1] [2]])

7:34 clojurebot: nil

7:34 justin_smith: that's what I wanted

7:35 Seylerius: if you aren't specifically sharing with us all, you can use /msg to talk to clojurebot

7:35 Seylerius: Shiny.

7:35 Although I do value y'all's opinions a fair bit on this stuff.

7:35 It's rather handy.

7:36 All of you clever and more experienced clojure-folks are good to talk to.

7:36 justin_smith: Seylerius: sure, but I don't think you need our help with unmatched parens :)

7:36 Seylerius: :p

7:36 Other than the or bit, what d'you think of the method in that one?

7:37 justin_smith: Seylerius: looks decent enough, it would be clearer as a reduce

7:37 generally, loop is low level, and it's good to convert to one of the higher level constructs when applicable

7:38 Seylerius: Right...

7:39 justin_smith: something like (defn mixer [a b] (reduce into [] (map vector a b)))

7:40 it does the same thing, but much less verbosely

7:40 Seylerius: Oh that's nice.

7:40 I forget about map being able to pull from multiple sources.

7:40 justin_smith: ,(defn mixer [a b] (reduce into [] (map vector a b)))

7:40 clojurebot: #'sandbox/mixer

7:40 justin_smith: ,(mixer [:a :b :c :d] [1 2 3 4 5])

7:40 clojurebot: [:a 1 :b 2 :c ...]

7:40 justin_smith: that's what it should do, right?

7:40 Seylerius: Yep

7:41 ,(map vector [1 2 3] [:a :b :c])

7:41 clojurebot: ([1 :a] [2 :b] [3 :c])

7:41 Seylerius: Right.

7:41 justin_smith: oooh

7:41 ,(defn mixer [a b] (mapcat vector a b))

7:41 clojurebot: #'sandbox/mixer

7:41 justin_smith: ,(mixer [:a :b :c :d] [1 2 3 4 5])

7:41 clojurebot: (:a 1 :b 2 :c ...)

7:41 Seylerius: Oh goodness.

7:42 justin_smith: much better! don't even need reduce

7:42 ,(def mixer (partial mapcat vector))

7:42 clojurebot: #'sandbox/mixer

7:42 Seylerius: mapcat. fscking mapcat...

7:42 Wait... partial?

7:42 justin_smith: ,(mixer [:a :b :c] [1 2 3] '(l m n o p))

7:42 clojurebot: (:a 1 l :b 2 ...)

7:42 justin_smith: partial makes it varargs :)

7:42 Seylerius: I gathered that.

7:43 I'm looking that up on the cheatsheet now for the w1n it's apparently made of.

7:43 Empperi: partial creates a new function where it already has n parameters given

7:43 thus that would turn to: (mapcat vector <rest of the parameters here>)

7:44 justin_smith: Seylerius: still blows my mind that your loop can be redefined to three functions in one sexp :)

7:45 Seylerius: That makes two of us.

7:45 justin_smith: hopefully you followed along - tried to do it step by step

7:45 clgv: is there a best practice tutorial for tagged literals and data readers somewhere?

7:48 Seylerius: Indeed.

7:55 I officially love partial.

7:55 It's made of win.

7:56 justin_smith: Seylerius: yeah, I'm a fan

7:56 AeroNotix: my only gripe is that it's quite a long name, so sometimes using #(...) is shorter anyway

7:58 ordnungswidrig: AeroNotix: ,(def ∂ partial)

7:58 clgv: AeroNotix: but `partial` documents the intent better ;)

7:59 ordnungswidrig: ,(def ∂ partial)

7:59 clojurebot: #'sandbox/∂

7:59 ordnungswidrig: .((∂ + 2) 4)

7:59 ,((∂ + 2) 4)

7:59 clojurebot: 6

8:01 AeroNotix: clgv: the first time you read it, yeah

8:01 ordnungswidrig: but that's not widely used, partial is its name.

8:01 ordnungswidrig: AeroNotix: sure, but you were complaining about the length of the name :-)

8:02 clgv: AeroNotix: I meant the intent of the dev using partial. #(...) (fn ...) could be anthing - with `partial` you know, it is just that first function plus some fixed params. so you can skip to that function immediately to read up what it does

8:02 AeroNotix: I am yeah

8:02 Seylerius: ordnungswidrig: What greek letter was that?

8:02 AeroNotix: it's a trivial thing

8:03 clgv: Seylerius: delta

8:03 ordnungswidrig: Seylerius: not greek a curly d.

8:03 http://www.fileformat.info/info/unicode/char/2202/index.htm

8:03 clgv: looks like a delta ;)

8:04 ordnungswidrig: ∂ vs. ∂

8:04 clgv: ordnungswidrig: with that context it is a different styled delta ;)

8:05 ordnungswidrig: well, YMMV. The uppercasing behaviour of that codepoints is different

8:05 (I guess)

8:06 Seylerius: ,(defn poser [a coll] (mapcat vector coll (repeat a)))

8:06 clojurebot: #'sandbox/poser

8:06 Seylerius: ,(poser 0 [1 2 3])

8:06 clojurebot: (1 0 2 0 3 ...)

8:07 Seylerius: Ah

8:07 michaelr`: err

8:08 What would be a good way to use react.js components from om?

8:08 more specifically with sablono, if possible

8:09 Seylerius: ,(defn poser [a coll] (butlast (mapcat vector coll (repeat a))))

8:09 clojurebot: #'sandbox/poser

8:09 Seylerius: ,(poser 0 [1 2 3])

8:09 clojurebot: (1 0 2 0 3)

8:10 michaelr`: yeah, with sablono - how to use react components with sablono?

8:15 edbond: michaelr`, sounds like a question for #clojurescript

8:16 michaelr`, sounds like a question for #clojurescript room

8:16 AeroNotix: is there an echo in here

8:16 is there an echo in here

8:16 michaelr`: what?

8:16 what?

8:16 clojurebot: what is this

8:16 what is cells

8:17 AeroNotix: haha

8:17 edbond: haha

8:17 slipset: re partial, I know emacs, and I think Intellij can use different glyphs for partial, fn et al

8:18 AeroNotix: slipset: heathen

8:19 slipset: https://github.com/hackscience/purty-mode

8:19 michaelr`: edbond: thanks, I think that I got the answer..

8:19 slipset: I think I've seen tbaldridge use the lambda glyph for anonymous functions

8:20 tbaldridge: slipset: yep, it's from Emacs Live

8:21 slipset: and jay fields http://blog.jayfields.com/2013/05/emacs-lisp-font-lock-for-clojures.html

8:22 and he found that in emacs-live it seems

8:42 elvis4526: How do you bind a function to a js symbol in cljs ?

8:42 (def $scope.submit (fn [])) ain't doing it. :-(

8:43 edbond: elvis4526, there is a #clojurescript room for cljs questions

8:44 elvis4526: ty

8:44 lewis1711: so what's the deal with using java8 libs from clojure? looking to use one that makes use of lambdas a lot

8:50 thheller: lewis1711: lamdas are basically just syntax sugar, so it just works.

9:02 brianwr: Hi, having a problem recurrent problem with clojurescript/reagent/re-frame compiling error: sometimes i get i error like: "referred var ... does not exist at line ..." I know that is an error somewhere, but i am unable to find the origin of it using the stack trace. Any tips?

9:06 Oh, forgot to mention that im using figwheel too ;)

9:21 Beamed: [i0jefqo'efqipj'rvjip

9:21 sorry, cat

9:25 danlentz: i wonder why there is not more buzz about dunaj. I havent spent time to study in detail, but some of the ideas sound very good to me.

9:29 arrdem: I agree that a bunch of the ideas sound good, but I don't think anyone has really had time to try it out yet.

9:29 danlentz: yeah

9:29 its overwhelming

9:30 arrdem: agreed.

9:30 danlentz: but there are only 4 people in the #dunaj group right now

9:30 somehow that does not seem appropriate level of interest

9:30 and one of them is me and the other is the author

9:30 arrdem: I mean... #oxlang is just me and cemerick

9:31 just kinda comes with being a fork / blue sky projec.t

9:32 tbaldridge: the fork bit is probably the hardest, mostly because you have to compete in the same space

9:32 arrdem: Right. I think the one sales pitch which dunaj has failed to explicitly make so far is that it is a _drop in replacement_ for Clojure built on top of Clojure that you can try out now.

9:33 danlentz: it is indeed unclear

9:33 arrdem: which is just a bandaid over the fact that grats, you're now competing with Core.

9:33 danlentz: i kindof see it as a proving ground for new ideas rather than a replacement

9:34 arrdem: agreed, but being a proving ground implies more than just experimental use IMO

9:34 cemerick: arrdem: s/fork//

9:34 danlentz: he said he hasnt gotten any feedback at all from cognitect

9:35 arrdem: cemerick: I'd merge it

9:35 cemerick: oh, but tbaldridge said this already basically

9:35 arrdem: what, dunaj?

9:35 arrdem: cemerick: your sed

9:35 cemerick: heh

9:36 there's plenty of room for more languages, but not for alt-clojures

9:36 tbaldridge: So duanj reminds me a ton of a fork of Blender3D that happened like 12 years ago. Some guy needed a bunch of features, so he forked it and worked on his own for quite some time.

9:37 puredanger: danlentz: there's interesting things in dunaj, but it's just so much stuff all together that I can't even pick out something to critique

9:37 tbaldridge: Problem was, when he was done 90% of his features were so different from master that it could never be merged, everything had changed. Forks and then remerging can never work IMO.

9:38 arrdem: agreed. I did the lib-clojure refactor a while back, and when I got it working I realized that I'd created a bunch of unmergable patches.

9:39 puredanger: there is also the issue that it is just a pile of solutions without the consideration of what the source problems or alternative solutions are

9:43 sobel: so, if i have a little clojure to deploy to an existing app that doesn't already have clojure, what's really involved, besides the clojure runtime and non-clojure deps like the oracle jar it needs

9:44 same question, command-line operation.

9:44 dstockton: quite an open question sobel

9:45 michaelr`: sobel: on thing is build integration, with the maven plugin maybe if it's a maven project

9:45 AeroNotix: sobel: I just did something similar with an Java application

9:45 I just had the Java developers use an Uberjar and put that into the project

9:45 sobel: the java app is already mavenized

9:45 noncom: i am setting up a nrepl server on macos, but i cannot conenct to it. telnet seems to do fine, but lighttable or counterclockwise don't.. any ideas?

9:45 AeroNotix: you would just put the clojuer code as a mvn dep then

9:45 noncom: (there are no firewalls on)

9:46 dnolen: for people looking for a simple Emacs ClojureScript setup, 0.0-3165 now works a charm with inf-clojure

9:46 sobel: so, publish my clojar to the internal mvn repo, add it as a dep to the app?

9:46 dnolen: https://github.com/clojure/clojurescript/wiki/Emacs-%26-Inferior-Clojure-Interaction-Mode

9:52 clgv: sobel: it might help integration if you provide a java facade for the common interop calls

9:52 (interop between the java app and you clojure lib, is meant ;) )

9:53 sobel: will i have to add clojure runtime as a dep to the java app, or can that get bundled?

9:54 clgv: pretty sure i'll need to do that

9:54 clgv: sobel: it istransitively pulled in because of your clojurelib

9:55 sobel: clgv: aha. thanks.

9:56 clgv: sobel: you'll need that offcicial API http://clojure.github.io/clojure/javadoc/

9:57 AeroNotix: sobel: I just did a really heavy amount of java interop to do exactly this

9:57 provide a clojure library that looks and smells like java

9:57 there's quite a bit which is undocumented, or documented poorly.

9:58 sobel: AeroNotix: i'm convinced. the interop surface is extremely narrow, fortunately.

9:58 AeroNotix: cool

9:58 clgv: AeroNotix: are there gundogs sniffing your libs? ;)

9:58 AeroNotix: clgv: what

9:58 sobel: clgv: that will get pulled in transitively, right?

9:58 AeroNotix: the only thing you can't do is create Enums in Clojure, or at least I couldn't figure out how

9:58 clgv: sobel: it is part of clojure since at least 1.6 (maybe 1.5?)

9:58 sobel: clgv: or..oh, you meant i'll need those docs, gotcha

9:58 AeroNotix: but you can do literally everything else as far as I know

9:59 sobel: i can live without enums.

10:00 lewis1711: what do you do with enums in a dynamically typed language?

10:00 AeroNotix: lewis1711: provide java with a nice API

10:01 I just use :java-source-paths in lein

10:01 lewis1711: I always just end up assigning symbols to variables, so I don't make mistakes through typos

10:01 AeroNotix: with an enum

10:01 sobel: if the java api becomes that classy, i'll just straight-up write it in java

10:01 lewis1711: ah, fair call

10:01 clgv: AeroNotix: they could be translated to namespaced keywords at the java facade, if the requirements permit

10:01 AeroNotix: clgv: no need for a java facade

10:01 you can write the majority nicely in just pure clojuer

10:01 with gen-class and gen-interface

10:01 along if you really want, a java Enum file.

10:02 clgv: depends on the java side requirements whether the facade is a good idea ;)

10:02 gen-class is usually not what I want to use ...

10:02 AeroNotix: I've had good experiences with it.

10:03 pure-Clojure library, gen-class'd facade code. ezpz

10:03 no java needed

10:03 but the java friends get a library that looks and feels like java

10:03 all the IDE goodies as well.

10:03 sobel: AeroNotix: that is my preference, unless i _have_ to provide Enums

10:03 which..i can't imagine, but whatever

10:03 i'll write enum-gen if it comes to that :)

10:03 AeroNotix: writing an enum in java and the rest in clojure is ez too. You just use :java-source-paths and match up the package names you used in gen-class to make it look nice.

10:04 clgv: AeroNotix: there are plenty of gen-class scenarios that are faster implemented by using java ;)

10:04 and better...

10:04 AeroNotix: quantify better

10:05 faster, perhaps, if you're not familiar with the esoterics in gen-class.

10:05 clgv: so you'll have to judge on per case basis.

10:05 sobel: i'll be back when i can't make class-gen work :)

10:05 gen-class, too

10:05 AeroNotix: cool.

10:06 sobel: thx for the consult. this org needs a healthy introductory clojure experience.

10:10 elvis4526: with java jdbc, how do I know construct the db-spec for postgresql ?

10:10 I'm not sure what I'm suppose to put as :classname

10:11 I have postgresql/postgresql pulled in with lein

10:19 om: elvis4526: :subprotocol "postgresql" should be enough

10:20 java.jdbc shall get the classname for you

10:20 elvis4526: om: awesome, thanks!

10:21 brianwr: I having a problem recurrent problem with clojurescript/reagent/re-frame/figwheel enviroment. Sometimes i get a compile error like: "referred var ... does not exist at line ..." I know that is an error somewhere, but i am unable to find the origin of it using the stack trace. Any tips on debugging this?

10:24 om: elvis4526: you're welcome (by the way, it should be org.postgresql.Driver, if you ever need it)

10:32 danlentz: there are worse things than piles of solutions

10:32 :)

10:45 ppppaul: anyone have experience using onyx and have any opinions on it?

10:48 clgv: ppppaul: what is your parallelization scenario?

10:56 timvisher: how do i reload my project.clj file without restarting my repl?

10:58 clgv: timvisher: because of new dependencies?

10:59 timvisher: there at least two libs to add dependencies on the fly

11:01 danlentz: look at vinyasa

11:01 https://github.com/zcaudate/vinyasa

11:04 clgv: right, that was one of them

11:13 danlentz: timvisher: this looks interesting also http://palletops.com/alembic-clojure-classpath-control/

11:13 timvisher: thanks!

11:17 justin_smith: alembic.still/load-project simply adds any deps that are in your project.clj but have not been loaded by the vm yet

11:19 alejandrozf: Hi all! how I could get "full" leiningen for "transporting" to an offline machine?

11:20 wink: alejandrozf: it shouldn't be more than the bat/sh called 'lein' and one corresponding jar in the correct path, i.e. under ~/.lein/

11:21 alejandrozf: wink: both are on github page?

11:22 wink: alejandrozf: you could just grab the lein.sh, do an install and then copy the jar from .lein/self-installs

11:22 it probably IS somewhere there as well, yeah

11:22 alejandrozf: wink: ohh thanks :)!

11:23 wink: the shell script is not hugely complicated, if you take a peek

11:23 if it can't find the jar, it will download it

11:23 and I think you only need to copy those 2 files and you're set

11:23 alejandrozf: wink: got it! I will take look too!

11:26 danlentz: this githib ddos attack certainly is lasting a while

11:27 chouser: thanks, china

11:28 clgv: chouser: huh?

11:30 chouser: clgv: There's some evidence that the Chinese Gov't is using its firewall capabilities to drive the ddos.

11:30 clgv: chouser: why wouldn't they like github?

11:31 danlentz: quick, deploy the octocats!

11:31 chouser: clgv: https://en.greatfire.org/blog/2015/mar/evidence-shows-cnnic-and-cac-behind-mitm-attacks

11:33 danlentz: The solution is simple. Lets just ask them to borrow some more money to upgrade our cyber defenses.

11:33 clgv: chouser: that article talks about th certificate issuses (MITM)?

11:33 zot: is there a way to override the hasheq function on a defrecord-created type?

11:34 justin_smith: clgv: chouser: yeah, that's proof that China did it, not a reason they would want to

11:34 I think the rationale has to do with the fact that github can be used to share arbitrary content, and tools that can be used to defeat the great firewall

11:35 sobel: danlentz: i think i just fell for vinyasa on the tagline alone: give your workflow more flow

11:37 clgv: sobel: :D

11:38 danlentz: sobel: wait until you get to the part about “Downard Facing Defn”

11:38 zot: (i should clarify — override, short of using deftype and having to manually make all the other stuff…)

11:40 clgv: zot: what is the requirement forcing you to do that?

11:40 zot: currently, porting some clojurescript code that already seems to do this; it's okay if it's a bit hackey, since it's a proof of concept

11:41 clgv: zot: it doesnt sound like a good idea to ruin defrecords ability to behave like a normal map

11:42 zot: ruin is a strong word :) in my case, I just want it to exclude hashing one of the fields

11:43 clgv: zot: can you trick it by making that field mutable?

11:43 zot: interesting idea. would that have other implications?

11:44 actually, i thought that mutable only exists for deftype ...

11:44 (looking now)

11:46 clgv: zot: honestly, I wouldnt attempt that.

11:46 zot: can't you achieve the same via aggregation?

11:47 timvisher: should the cider repl maintain history between sessions?

11:47 zot: clgv: what do you by aggregation?

11:47 clgv: have a deftype with the field for the non-hash data and the defrecord?

11:48 zot: meaning house the non-hashable data as a field of the defrecord? or as separate entities?

11:50 clgv: zot: (deftype Composite [strange-value, record] ...implement...your...own...hashing...)

11:50 danlentz: zot: why must you directly use hashing?

11:50 clgv: zot: the composite would not have map properties though

11:52 sobel: danlentz: lordy. =)

11:53 zot: danlentz: short version — i initially elided all of the hash/equiv code when trying to port, and i have tracked down a couple bugs to this, so they were clearly necessary. i could probably change the structure a bit to avoid it, but my intention is to avoid invasive changes when possible. i may just do the deftype thing, since for at least one of these objects, i don't need full map-i-ness.

11:53 oops, second half was really a response to clgv

11:54 clgv: zot: I'd reevaluate the solution approach of the CLJS implementation

11:55 zot: it smells as if there is something fishy ;)

11:56 zot: clgv: not sure if it's fishy per se, or perhaps my explanation sucks. code in question is here: https://github.com/tonsky/datascript/blob/master/src/datascript/core.cljs#L18

11:57 basically for comparison, just want e/a/v, ignore tx/added. (this exists in at least 2 other structures in the codebase, so it's not unique to this one, but simplest to see.)

11:57 clgv: zot: IHash is the standard protocol of CLJS, right?

11:57 zot: yep

11:57 as i understand, IHashEq is the clj equivalent for transparent operation

11:58 clgv: ok then you are running into the problem that Clojure is not build up from protocols ;)

11:59 zot: i know… i'm still smiling from the hope that something hacky would apparate in front of me :) and doing it as a deftype in the meanwhile.

11:59 clgv: zot: which part of the map implementation does Datom need?

11:59 Glenjamin: can you just (defn same-datom) ?

11:59 clgv: zot: just associative lookup and write?

12:00 Glenjamin: I'd guess hashin is used implicitely e.g. from PHM

12:00 Glenjamin: oh right, good point

12:01 clgv: otherwise that's a solution ;)

12:01 zot: for Datom I haven't checked, but at least one other structure required that i add real map'y code. (i'm looking at my own log to see.)

12:01 Glenjamin: could throw the mutable bits on metadata perhaps?

12:01 which is horrible

12:01 zot: yeah, i had that thought and got distracted. is that doable / pure evil?

12:01 (i can accept doable evil for now, since i've already crossed the line once or twice just to make the tests work.)

12:02 clgv: zot: because there are interfaces for lookup and write that you could implement on a deftype in case you do not need a real map but want associative operations

12:02 zot: yeah, that's what i've done elsewhere.

12:03 wink: hmm, anyone knows of a dsl/example/something related how to define a flow of sorts?

12:03 actual problem: a storm topology. the builder syntax (java) is horrible. I might try to write some "config" and read that

12:05 zot: clgv: that's my path, apparently, although it will mark the first conversion from defrecord -> deftype, between the 2 languages, which makes me … nervous.

12:06 clgv: zot: I'd change the CLJS implementation as well.

12:07 zot: that thought crossed my mind too, and probably doesn't cost me toooo much.

12:09 clgv: thanks for the thoughts, i appreciate the shared wisdom :)

12:10 clgv: zot: no problem ;)

12:29 om: is there a better way to do this?:

12:29 ,(def index {1 [:a :b :c] 2 [:a :c] 3 [:a :d]})

12:29 clojurebot: #'sandbox/index

12:29 om: ,(defn r-map [ids] (apply merge-with into (for [[k vs] ids, v vs] (hash-map v (vector k)))))

12:29 clojurebot: #'sandbox/r-map

12:30 om: ,(r-map index)

12:30 clojurebot: {:c [1 2], :b [1], :d [3], :a [1 2 3]}

12:31 gfredericks: om: looks pretty reasonable to me

12:33 om: gfredericks: no way to avoid n^2 order, I guess?

12:33 clgv: om: you need to specify at least one goal to put "better" into context ;)

12:34 om: no that's possible in O(n)

12:34 om: clgv: right ;) : say, 1) more efficient 2) more idiomatic

12:35 clgv: om: you can do it with `reduce-kv`

12:35 om: thanks gfredericks, clgv I'll stick with it

12:36 clgv: n^2 is aweful for that task ;)

12:36 om: oh

12:36 clvg: this is why I asked ;)

12:37 gfredericks: what's n^2 about it? what's n?

12:37 clgv: om: with more precise estimation both version end up with O( m*n ) with number of entries n and maximum number of vals m

12:38 arrdem: gfredericks: think should I back out that options map edit to the wiki?

12:38 om: clgv: yeap, sure, in my example n=m in the worste case

12:38 gfredericks: arrdem: the what??

12:38 lazybot: gfredericks: What are you, crazy? Of course not!

12:38 justin_smith: ,(reduce (fn [acc [k vs]] (reduce (fn [acc v] (update-in acc [v] (fnil conj []) k)) acc vs)) {} {1 [:a :b :c] 2 [:a :c] 3 [:a :d]})

12:38 clojurebot: {:a [1 2 3], :b [1], :c [1 2], :d [3]}

12:39 arrdem: gfredericks: https://groups.google.com/d/msg/clojure/yzLCZh-GiQ8/nXiIFewvdusJ and your reply

12:39 justin_smith: om: nested reduce ^

12:39 om: (inc justin_smith)

12:39 lazybot: ⇒ 218

12:39 gfredericks: arrdem: I haven't looked at the clojure list in decades, are you confusing me with gtrak?

12:39 arrdem: derp sorry man

12:39 om: thks folks

12:39 gfredericks: (inc gtrak) ;; where is that guy anyways

12:39 lazybot: ⇒ 13

12:40 arrdem: I haven't seen him around here in ages...

12:40 justin_smith: yeah, it's been a while

12:40 $seen gtrak

12:40 lazybot: gtrak was last seen quittingRemote host closed the connection 1 week and 6 days ago.

12:40 gfredericks: I hung out with him at strangeloop a good bit but that's it

12:40 justin_smith: only a week!

12:40 arrdem: justin_smith: hey man that's a lot of clock cycles

12:41 gfredericks: he might be the only peer named Gary I've ever known

12:41 it's an unfamiliar feeling

12:41 clgv: justin_smith: one angel dies when you use `reduce` on a map ;)

12:41 justin_smith: haha

12:41 clgv: every time :P

12:42 justin_smith: clgv: so are you saying I should be using reduce-kv or what?

12:42 mavbozo: i want to append streams of data to a file but there could be many writer. is clojure.java.io/writer with :append true is good enough to prevent writers overwriting each other?

12:42 clgv: justin_smith: yes

12:42 justin_smith: clgv: the inner one is not on a map, btw

12:42 clgv: justin_smith: but the outer one

12:43 justin_smith: clgv: I think I misenterpreted "every time"

12:43 ,(reduce-kv (fn [acc k vs] (reduce (fn [acc v] (update-in acc [v] (fnil conj []) k)) acc vs)) {} {1 [:a :b :c] 2 [:a :c] 3 [:a :d]})

12:43 clojurebot: {:a [1 2 3], :b [1], :c [1 2], :d [3]}

12:43 om: clgv, justin_smith: this doesn't change much ;)

12:44 justin_smith: om: I'm sure he has a good reason for making the distinction

12:45 om: justin_smith: you mean to prefer the 3 arg reduce-kv to destructuring?

12:45 clgv: om: `reduce-kv` is more efficient and semantically the better fit

12:46 om: clgv: thanks, I'll cast a look at the source

12:46 justin_smith: yeah, it's the more specialized version I just keep forgetting

12:46 om: the source is uninformative

12:46 om: regarding effciency?

12:46 justin_smith: unless you go find the java underlying it I guess

12:46 regarding anything, it's just an interop call

12:46 clgv: $source reduce-kv

12:46 lazybot: reduce-kv is http://is.gd/mzlL83

12:46 om: yeap I see that now ;)

12:47 clgv: $source APersistentHashMap

12:47 lazybot: Source not found.

12:47 clgv: $source PersistentHashMap

12:47 lazybot: Source not found.

12:47 clgv: damn...

12:47 om: cider shows it in a snap ;)

12:47 justin_smith: om: clgv: semantically better, perf wise the difference is negligable https://www.refheap.com/98938

12:48 Bronsa: justin_smith: that's kinda surprising

12:48 justin_smith: it might make a bugger difference to pull out the fnil

12:48 clgv: justin_smith: make the map bigger and you'll see ;)

12:49 justin_smith: Bronsa: that's from a 1.6 repl

12:50 Bronsa: one moment, something weird might have been going on in my repl

12:52 I accidentally ran the reduce-kv one twice, because my inferior-lisp is being stupid

12:52 and the presence of the inputs is misleading compared to what generated them

12:54 Bronsa: clgv: https://www.refheap.com/98938 updated, the difference is less negligable, but still relatively small

12:55 clgv: justin_smith: again, try a bigger map

12:56 justin_smith: I don't know about you, but bigger maps aren't the common case in my code

12:56 clgv: well, then it's not worth it for you

12:57 the difference is 6% and the reduce-kv is probably not the dominant part in that form

12:57 justin_smith: clgv: as expected, replacing (fnil conj []) as an inline with a top level def makes a bigger perf difference

12:57 hmm... maybe not bigger, similar

12:58 om: pretty interesting, thanks justin_smith:

12:59 danlentz: so, reduce on a map is inefficient?

13:00 bendlas: ,(doc reduce-kv)

13:00 clojurebot: "([f init coll]); Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals."

13:00 om: I am dealing with adjacency tables and they are getting bigger: I'll do some testing

13:00 justin_smith: danlentz: I think it's more that reduce-kv is more optimized. For example it avoids the usual destructuring, if nothing else.

13:05 danlentz: seems like a seq of MapEntries would get destructured at some point

13:06 justin_smith: chouser: yeah, I found some more detailed info, and the specific github repos being ddosed are tools for circumventing the Chinese government firewall.

13:06 danlentz: destructuring isn't just about getting some values out of a container though

13:06 it's relatively heavyweight (the destructuring syntax specifically)

13:07 not like it will be a bottleneck, but it's big enough to consider taking it out of code that is in a bottleneck

13:08 danlentz: thats for pointing that out. I don’t think I’ve done it, but I’m not sure it would have occurred to me _not_ to do it

13:24 BinaryResult: A quick reminder, Disco Melee is currently hiring clojure developers https://docs.google.com/document/d/1GvnrSCUbYgbY9XdFs_DUx-0QZG2bIYT8Mbr0zdpTeew/edit?usp=sharing

13:31 rizo: hey, I started getting frequent repl fails recently: "Exception in thread "Thread-3" SocketException The transport's socket appears to have lost its connection to the nREPL server"

13:31 anyone knows what can cause it?

13:31 justin_smith: rizo: is it a local or remote repl?

13:32 rizo: local one

13:32 justin_smith: rizo: how are you accessing the repl - from an editor?

13:32 rizo: no, from the shell directly

13:33 justin_smith: OK, it's weird that there would be no indication of why the repl failed

13:33 rizo: justin_smith: $ `lein repl` ... nREPL server started on port 58236 on host - nrepl://

13:34 full output: https://gist.github.com/rizo/e20ed0d3dc53daafb92a

13:34 justin_smith: and when does this happen?

13:35 just randomly? immediately on startup?

13:35 rizo: I'm running an analytics system with a scheduler component (cronj), cassandra and redis. And it just fails in the middle of calculation

13:35 justin_smith: 137 means it got forcibly killed

13:36 it could be a victim of linux kernel memory overcommit

13:36 rizo: I've been using this service for some time now, it never happened before. I don't know though if some recent changes my team made to the project could affect something

13:36 justin_smith: rizo: is this on linux?

13:36 rizo: ubuntu lts

13:37 justin_smith: so, when you ask linux for memory, it always says yes

13:37 rizo: It runs for like 2 - 5 minutes and then fails

13:37 justin_smith: and if you try to use memory that isn't physically there, a random process gets killed

13:37 the more memory you are using, the higher the chance your process is killed

13:37 rizo: happende on two different machines. same project same docker container

13:37 (yes, i'm using the clojure:latest docker image, forgot to mention)

13:38 justin_smith: unless something else is randomly handing out SIGKILL to your processes, I would look at reducing your memory usage (starting with setting a lower max heap usage for the vm)

13:39 rizo: well... both of the servers have 32G of memory and I don't think they used it all during the execution

13:39 justin_smith: rizo: then find out what sends your process a sigkill

13:39 and turn on core dumps, you can use gdb to find out exactly what was happening when the sigkill happened

13:40 but really, random sigkill almost always means memory overcommit

13:40 rizo: I'll try it, thanks

13:42 justin_smith: rizo: funny enough, first google hit for signal 137 from java, was someone who was getting their cassandra server killed because of memory overcommit

13:42 rizo: It's really strange since I already tested the project with far more input data but it never failed this way

13:42 justin_smith: rizo: could be as simple as something that uses n^2 memory that snuck into the codebase

13:43 rizo: justin_smith: in my case it's a client cassaforte, I fetch around 5gb for batch processing

13:43 justin_smith: rizo: OK, I'd say profile things, turn on core dumps, check memory usage settings for the container if applicable

13:44 rizo: will have to check the recent commits. So you think the reason for the process failure is the os sending sigkill? Can it be anything else?

13:44 justin_smith: rizo: no, exit code 137 means the process received a sigkill

13:45 the signal sent via kill -9

13:45 or when you access overcommitted memory

13:45 rizo: makes sense

13:47 justin_smith: thanks for the tips ;)

13:50 justin_smith: one of the recent changes was related with the cache handling, so it may have affected the memory usage

13:50 justin_smith: rizo: yeah, that smells right

13:51 rizo: ever use jvisualvm? you can connect to the process and log memory usage (both total, and how much of the allocated memory is available) as it runs

13:51 it makes a nice graph

13:52 and if I'm right, you'll see an attempt to jump up in mem usage just before the process is killed

13:54 rizo: justin_smith: yeah, one of my colleague uses it. will try it now

13:58 JanMan_: 'ello

14:00 For those interested, I'm building a Clojure teams in multiple places to deliver a next generation distributed systems platform based fully on Clojure. Looking for senior engineers who like Clojure to participate. http://bit.ly/1N7Aui9

14:02 puredanger: JanMan_: maybe you should sponsor a Clojure conference

14:02 arrdem: (inc puredanger)

14:02 lazybot: ⇒ 39

14:03 danlentz: ,danlentz

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

14:03 arrdem: (identity danlentz)

14:03 lazybot: danlentz has karma 1.

14:03 justin_smith: danlentz: it's only a pseudo syntax

14:04 danlentz: ,(def danlentz Math/PI)

14:04 clojurebot: #'sandbox/danlentz

14:04 danlentz: ,danlentz

14:04 clojurebot: 3.141592653589793

14:04 danlentz: (identity danlentz)

14:04 lazybot: danlentz has karma 1.

14:05 JanMan_: puredanger: Yup will be at Clojure West and hosting our local Clojure group

14:05 puredanger: JanMan_: thanks! We opened the sponsorship prospectus for http://euroclojure.org/sponsorship today too.

14:13 JanMan_: puredanger: Euro's a bit far for us to sponsor as we're USA based... although I have teams in Australia and Costa Rica.

14:13 puredanger: no worries, just doing my job :)

14:13 JanMan_: ABC: Always Be Closing

14:15 dyba: The other day I asked about a nif macro, a numeric if that looks like this:

14:15 joe124: how do i convert a string to an integer or number?

14:15 dyba: (defmacro nif "Numeric if. `expr` must evaluate to a number." [expr pos zero neg] `(cond (pos? ~expr) ~pos (zero? ~expr) ~zero :else ~neg))

14:16 I understand this version is buggy because it doesn't account for side effects

14:16 Rather, the correct way to define this macro is with a gensym

14:17 (defmacro nif [expr pos zero neg] (let [e (gensym)] `(let [~e ~expr] (cond (pos? ~e) ~pos (zero? ~e) ~zero :else ~neg))))

14:17 Bronsa: dyba: you want something like (defmacro nif [expr pos zero neg] `(let [expr# ~expr] (cond (pos? expr#) ~pos ..)))

14:17 dyba: Bronsa: that was my next question, if I could use the # with a binding

14:18 Bronsa: dyba: yes, most of the time there's no reason toe us (gensym) directly in clojure

14:18 to use*

14:18 dyba: I think when I tried that out it didn't work but maybe it was because I had an outer let statement that wasn't quoted in which I used e#

14:18 Bronsa: there are cases where you will need it, but this is not one of those

14:18 dyba: expr#

14:19 joe124: how do i convert a string to an int or have user-input take in their input as an int?

14:19 Bronsa: dyba: right, the auto-gensym thing works only in the context a syntax-quote

14:19 justin_smith: dyba: why is this a macro?

14:24 amalloy: justin_smith: because it only evaluates one of pos/zero/neg

14:24 justin_smith: ahh, of course

14:25 dyba: justin_smith: if you make it a function, you don't account for side effects

14:25 that is, evaluating expr may repeat the result more than once

14:26 Oh, I just saw amalloy answered

14:28 joe124: can someone help me with my tiny function? http://pastebin.com/KNv9UY7z

14:28 (i'm a beginner)

14:29 justin_smith: joe124: int doesn't have side effects

14:29 joe124: also, your let has too many ()

14:29 around it

14:30 joe124: ok one sec

14:30 justin_smith: joe124: so user-input is a string, throughout the entire function

14:30 also, int doesn't work on strings

14:31 joe124: what is the proper way to either input an int from a user or convert a string to an int?

14:31 justin_smith: ,(Integer/parseInt "1")

14:31 clojurebot: 1

14:32 joe124: it says no such namespace: integer

14:32 justin_smith: joe124: I guess you didn't capitalize it properly

14:32 joe124: but that doesn't change the string into an int - it gives a new int from the string, and you have to use the return value

14:34 joe124: does this l ook better? http://pastebin.com/sJeeQaiA

14:34 justin_smith: that looks like it is probably right

14:34 did you try it?

14:34 joe124: yah it works,

14:34 i'm wondering is this a proper functional style?

14:35 justin_smith: it's printing a response rather than returning anything useful

14:37 and it's inherently an IO thing - it takes user input and prints, there's no way to really do those things "functional"

14:37 joe124: ok one sec

14:38 Glenjamin: you can do more to separate the IO from the computation, but it's hard in a 3 line example

14:38 justin_smith: yeah

14:39 I think the distinction is harder to derive for something so simple

14:39 joe124: thats a g ood point lol

14:39 can you explain why this code doesn't w ork http://pastebin.com/qGCMWchC

14:40 is my 'if' statement in the wrong parenthesis or something

14:40 justin_smith: joe124: true and false are not functions

14:40 so you can't call them

14:40 joe124: yah i just want to return them

14:40 justin_smith: parens don't do that, they call things

14:41 joe124: that function could be (defn is-greater-or-equal-to-five [x] (>= x 5))

14:41 Glenjamin: http://pastebin.com/Fi5djbkh perhaps

14:41 justin_smith: (inc Glenjamin)

14:41 lazybot: ⇒ 18

14:42 mpenet: rizo: you're fetching the data in a single query?

14:43 rizo: anyway it's probalby not the main issue

14:46 arrdem: Has anyone played with trying to make macros as values meaningful? I'm just thinking that for some stuff like `or` and `and` there is a clear two-arity function which could make sense to take as a value. (yes I'm aware we have wrapper fns).

14:46 joe124: thank you glenjamin and justin_smith

14:46 justin_smith: arrdem: apply would become a pain in the ass to implement

14:46 arrdem: is my suspicion at least

14:47 currently it isn't a macro, and doesn't have to worry about leaving args unevaluated

14:50 rizo: mpenet: not alway. the queries run in sequence but in total there must be dozens of them

14:50 joe124: When is object oriented programming a better decision to use than functional, and vice versa?

14:51 danlentz: when in rome…

14:51 mpenet: rizo: if you can parallelise them alia will be a lot faster at this kind of things

14:56 mavbozo: joe124: in what context? clojure?

14:58 justin_smith: joe124: object oriented is good for things that don't need threads, you don't have tight memory constraints, and you need something that's easily split between many programmers. Functional is good if you need threads or async in general, if you don't have tight memory constraints, and the problem is expressable directly as an algorithm needing relatively little interaction with the outside world mid calculation.

14:59 danlentz: wait, when you dont have tight memory constraints?

15:00 justin_smith: danlentz: neither is apropriate for situations with tight memory constraints

15:05 anti-freeze: Hey everyone. Does anyone know how to include domina in selmer after the clojurescript compiler does its work?

15:06 I keep getting blank source files when they're actually included

15:08 Or infact any of the Compiled JS files in the js/out folder

15:08 compiled CLJS*

15:10 ambrosebs: ,(reduce + 0 [1 2])

15:10 clojurebot: 3

15:15 joe124: (reduce #(* % 2) myList) why doesnt this work?

15:16 arrdem: joe124: reduce takes a function of two arguments. Your provided function is a function of one argument.

15:17 emaczen: Is there a function that combines range and take?

15:17 I know of nth rest, but I would also need an nthfirst

15:17 but I am also hoping that these utilities already exist

15:18 joe124: (reduce #(* % %) lst) ?

15:18 mavbozo: (reduce #(* %1 %2) lst)

15:19 joe124: i want to take each element in the list, double it, then multiply it by the next element

15:19 arrdem: joe124: okay, so #(* 2 %1 %2) would do it for you.

15:20 joe124: woah thanks

15:20 arrdem: you may need to give reduce the base case of 1.

15:20 otherwise it'll use the first element of the seq as its base case, and you'll be off by a factor of 2 in the result

15:21 so ##(reduce #(* 2 %1 %2) 1 [2 3 4 5])

15:21 lazybot: ⇒ 1920

15:22 arrdem: ##(reduce * (map #(* %1 2) [2 3 4 5]))

15:22 lazybot: ⇒ 1920

15:22 arrdem: w00t

15:22 joe124: reduce is scary can i just use map?

15:24 jroes: don't be afraid!

15:24 puredanger: ,(*)

15:24 clojurebot: 1

15:25 arrdem: joe124: how could you solve this problem using only map? you need to accumulate a result over each element of the seq.

15:25 map will just give you a new seq back with everything multiplied by two for instance.

15:25 joe124: thats true

15:26 can you give me a problem so solve to practice using reduce

15:27 arrdem: joe124: implement get-in using reduce. it's not too hard.

15:28 joe124: what does get-in do

15:28 arrdem: so (get-in {:a {:b {:c 1}}} [:a :b :c]) -> 1

15:29 joe124: so it adds the values of everything in there?

15:29 arrdem: I suppose this is perfect #clojure-beginners material..

15:29 joe124: omg that exists

15:29 spieden: joe124: it paths into nested maps using a sequence of keys

15:30 joe124: (get-in {:a {:b {:c 1}}} [:a :b]) -> {:c 1} ?

15:30 arrdem: joe124: bingo

15:30 spieden: yep

15:30 danlentz: well

15:31 (map vector lst (rest list))

15:31 will break it into pairs for you

15:31 joe124: i dont know what vector and rest mean

15:32 arrdem: $grim clojure.core/rest

15:32 lazybot: http://grimoire.arrdem.com/1.6.0/clojure.core/rest

15:32 arrdem: $grim clojure.core/vector

15:32 lazybot: http://grimoire.arrdem.com/1.6.0/clojure.core/vector

15:32 arrdem: since good 'ol hiredman has banned me from clojurebot's doc functionality

15:32 danlentz: but reduce is better

15:33 arrdem: joe124: so how can we do get-in with reduce?

15:34 joe124: we have to change [:a :b :c] to look like ({{:a {:b {:c}}) so it evaluates the :c

15:34 danlentz: arrdem: are you calling hiredman a bot-blocker

15:34 ;)

15:35 joe124: is it mainly a formatting problem?

15:36 arrdem: joe124: nope. what does reduce do?

15:37 joe124: sums everything?

15:37 if you use +

15:37 danlentz: joe124: it is important to understand that [:a :b :c] and {:a {:b {:c nil}}} are not just formatted differently, but structurally different

15:38 joe124: sure but if we can format it correctly and put () around it it will evaluate to get the value we want

15:38 Seylerius: joe124: It bangs everything through one function.

15:39 joe124: im just a bit confused between reduce and map

15:39 i know map applies a function to everything

15:39 arrdem: yep.

15:39 Seylerius: Basically, it starts with the first two, and repeats with the next and the result of the first, and so on.

15:39 danlentz: ,(doc reduce)

15:39 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

15:40 arrdem: eh docstring truncation

15:40 $grim clojure.core/reduce

15:40 lazybot: http://grimoire.arrdem.com/1.6.0/clojure.core/reduce

15:41 joe124: so (reduce + [1 2 3]) is like (+ (+ 1 2) 3)

15:41 arrdem: exactly

15:41 jroes: ,(reduce + [1 2 3])

15:41 clojurebot: 6

15:42 arrdem: it's important to note that in the two argument case, the first element of the sequence is used as reduce's initial accumulator value.

15:42 you can specify the accumulator by giving three arguments, being the function, the accumulator and then the sequence of inputs.

15:43 so to go back to the get-in example

15:43 we have the function

15:43 $grim clojure.core/get

15:43 lazybot: http://grimoire.arrdem.com/1.6.0/clojure.core/get

15:43 arrdem: ##(get {:a 1} :a)

15:43 lazybot: ⇒ 1

15:44 arrdem: so we can write get-in as the reduce of get over the input datastructure and the list of keys.

15:44 ##(reduce get {:a {:b {:c 1}}} [:a :b :c])

15:44 lazybot: ⇒ 1

15:45 arrdem: which is the same as saying (get (get (get {:a {:b {:c 1}}} :a) :b) :c)

15:45 joe124: i dont get it

15:46 wait

15:46 so the first get returns what

15:46 danlentz: see how it follows the same pattern as what you did a moment ago with +

15:46 joe124: i mean the most inside get

15:46 arrdem: ##(get {:a {:b {:c 1}}} :a)

15:46 lazybot: ⇒ {:b {:c 1}}

15:47 danlentz: what does the second one return?

15:47 arrdem: so {:a {:b {:c 1}}} is a map which maps the value :a to a map which maps the value :b to a map which maps the value :c to 1

15:47 joe124: second get returns {:c 11}

15:48 arrdem: {:c 1} yes

15:48 danlentz: yup

15:48 and the third?

15:48 joe124: third get returns :c

15:48 jroes: ,(get {:c 1} :c)

15:48 clojurebot: 1

15:48 arrdem: why would the third return :c?

15:49 joe124: well it returns :c but then changes to it's key or whatever of 1

15:49 arrdem: the third will get the value named by the key :c from the map {:c 1}

15:49 joe124: i mean value yeah

15:51 ##(reduce get {:a {:b {:c 1}}} [:a :b])

15:51 lazybot: ⇒ {:c 1}

15:51 joe124: ##(get {:c 1} [:c])

15:51 lazybot: ⇒ nil

15:52 joe124: ?

15:53 nkoza: joe124: (get-in {:c 1} [:c]) or (get {:c 1} :c)

15:54 joe124: why does get-in use a vector as an argument

15:54 nuwanda_: because it's supposed to go through nested data structures, the vector has the list of keys to lookup

15:55 arrdem: joe124: okay so each iteration of reduce is (reduce f (f (first col)) (rest col)), right?

15:56 joe124: what does first col mean

15:56 jroes: collection

15:56 arrdem: col is shorthand for collection. the sequence of inputs that reduce takes is named col iirc.

15:56 first is a function.

15:56 $grim clojure.core/first

15:56 lazybot: http://grimoire.arrdem.com/1.6.0/clojure.core/first

15:57 arrdem: ##(first [1 2 3])

15:57 lazybot: ⇒ 1

15:57 arrdem: ##(first [2 3])

15:57 lazybot: ⇒ 2

15:57 arrdem: ##(first [3])

15:57 lazybot: ⇒ 3

15:57 arrdem: etc.

15:57 joe124: (reduce f (f (first col)) (rest col)) so...

15:58 arrdem: oops. (reduce f (f acc (first col)) (rest col))

15:58 sorry I dropped the accumulator

15:58 right? because the next value of the accumulator is (f acc (first col))

15:58 joe124: (reduce f (f acc (first col)) (rest col)) ah im seeing

15:59 so in '(1 2 3) first col is 1 rest col is '(2 3)

15:59 arrdem: yep.

15:59 joe124: where do we inc first col?

15:59 so it moves to the next one

16:00 arrdem: we don't per se

16:01 (reduce [f acc col] (if (empty? col) acc (reduce (f acc (first col)) (rest col)))))

16:01 so rather than "increment", and walk down the collection that way, instread we just call ourselves again with the next value of the accumulator and the rest of the collection.

16:02 joe124: what is this showing

16:02 how to implement reduce ?

16:02 arrdem: yep. a recursive reduce implementation.

16:02 you could also do it as a while loop but the two are equivalent.

16:02 joe124: is recursive is always preffered

16:02 in clojure

16:03 arrdem: sorta. Unfortunately we don't have tail call optimization so the loop and the recursive implementation do actually do different things.

16:04 Bronsa: https://github.com/clojure/clojure/commit/caa3b4fdc8da5880309b317d0045b1280181c452

16:04 arrdem: instead we have recurl.

16:04 *recur

16:04 joe124: (reduce [f acc col] (if (empty? col) acc (reduce (f acc (first col)) (rest col))))) im having a tough time understanding this

16:04 hiredman: whooo boy

16:04 joe124: like what does this do first?

16:05 hiredman: you are missing some parts

16:05 ,(doc reduce)

16:05 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

16:05 arrdem: hiredman: doing foldr not reduce for simplicity

16:06 not that you can hear me I think.

16:06 joe124: i have to eat arrdem wil u be here later

16:06 arrdem: yep. hit me up over in #clojure-beginners.

16:06 joe124: ok sure thanks a ton

16:06 arrdem: my pleasure

16:13 Bronsa: yeow. thanks for the heads up.

16:14 Frozenlock: I might need to do some low level network communication. Is clojure-protobuf the way to go?

16:27 hyPiRion: If you're communicating between Clojure programs, EDN should be sufficient at first. Unless you really need perf from the get-go, which I guess you don't.

16:31 Frozenlock: It's to communicate with a protocol on UDP. Playing with bytes and stuff. (My first time going this low level)

16:34 borkdude: "identifying the platform (:clj, :cljs, :cljr)"... what's cljr?

16:35 arrdem: borkdude: cljclr?

16:35 I'm guessing.

16:35 arohner: borkdude: .net CLR

16:35 borkdude: ah

16:35 arohner: man, cond :let would make my life simpler right now

16:36 hyPiRion: Can I identify other platforms like that?

16:36 say, :?!$ as Swearjure

16:36 arohner: lol

16:36 swearjure isn't a platform :-p

16:37 arrdem: I'd vote for swearjure support on jira

16:37 Bronsa: puredanger: assuming you're investingating the cause of the build failure -- I think there's a possibility that there's a bug in the tests, I just got a failure reported with `(->> [1] (mapcat inc))` which is an obvious error

16:46 puredanger: Bronsa: thx, just starting to look at it

16:46 Bronsa: puredanger: I think there are actually 2 bugs in that test (i don't know any test.check so I have no idea how to fix them)

16:46 puredanger: the reported error looks like it's masking the real error

16:47 Bronsa: yeah

16:47 puredanger: but that should be fixed too :)

16:47 Bronsa: puredanger: the first one is the one that's causing wrong tests to be generated

16:47 puredanger: well, they're random. some of them are expected to be bogus

16:47 Bronsa: puredanger: the second one is in the error reporting, trying to shrink, that's causing the NPE

16:47 puredanger: yeah, it looks like the wrong one are not getting filtered out correctly

16:48 e.g. I just got a (->> [-2 -4 -1] (take-while empty?))

16:48 puredanger: they don't get filtered at all, they just produce errors

16:49 Bronsa: puredanger: correct me if I'm wrong -- but the way i read it is that the intention is to catch IllegalArgumentExceptions, ClassCastExceptions and NPEs and handle those tests as if they succeeded

16:50 puredanger: close - those exceptions from the different forms are treated as equivalent

16:50 an exception in one and no exception should not succeed

16:50 Bronsa: ah, gotcha

16:51 puredanger: we're basically applying a series of random transforms to a random input in a variety of ways

16:51 looking for differences

16:51 Bronsa: I see now

16:53 hiredman: maybe someone in here knows the answer to this, I seem to recall a quote from someone associated with the v8 javascript runtime about performance being *the* enabling feature, does anyone recall a specific talk or something where that may be from?

16:54 Bronsa: puredanger: well I don't quite understand it then :) I'll let you guys figure it out, here's a failing test in case it's helpful http://sprunge.us/NLAh

16:55 puredanger: sure, I'll take it :)

17:01 ohhh, I know what the problem is

17:02 sveri: Hi, I am using sqlkorma and I have an entity like this: (defentity users (belongs-to tenant)). Now when I do a (select users (with tenant).... I get a flat map back containing the tenant keys and values mixed with the users keys and values...There might be collisions when two tables have the same column names...Am I missing something here?

17:22 otwieracz: hello

17:22 In my ~/.lein/profiles I've got:

17:22 {:user {.... :dependencies [[org.clojure/tools.nrepl "0.2.10"]] }}

17:22 However:

17:23 $ lein repl

17:23 nREPL server started on port 38613 on host - nrepl://

17:23 REPL-y 0.3.5, nREPL 0.2.6

17:23 justin_smith: otwieracz: put it in :dev

17:23 otwieracz: Why 0.2.6 is here?

17:23 mavbozo: hardcoded to leiningen

17:23 justin_smith: :dev will override the leiningen version, :user will not

17:24 otwieracz: OK, I changed from :user to :dev

17:24 $ lein repl

17:24 nREPL server started on port 56471 on host - nrepl://

17:24 REPL-y 0.3.5, nREPL 0.2.6

17:24 (I've already tried it :))

17:25 justin_smith: otwieracz: is this in a project, or a projectless repl?

17:25 mavbozo: as of now, you can only override it in a project

17:25 otwieracz: projectless repl.

17:25 It works in project.

17:25 mavbozo: there's a discussion here a couple of days ago

17:27 gfredericks: is there anything comparable to unsigned-bit-shift-right in clojure pre-1.6

17:27 justin_smith: ~unsigned

17:27 clojurebot: excusez-moi

17:27 Lewix: gfredericks: smell like a c++ guy

17:28 otwieracz: mavbozo: OK, so if I need nrepl 0.2.10 here, because 0.2.6 is buggy

17:28 What should I do?

17:29 mavbozo: otwieracz: for now, you must work in a project dir

17:30 justin_smith: otwieracz: java -cp $(cat magic-cp-file-you-created-based-on-lein-cp) clojure.main

17:30 is also an option

17:30 lein cp, followed by a bit of text editing to generate that file

17:30 or you can put the java command plus the whole class path literal in a shell script of course

17:31 without a project, lein isn't really doing much for you beyond generating that classpath anyway

17:31 so why not cache that part, fix it, and use java

17:41 mavbozo: justin_smith: i tried it, create nrepl-server, start it, and I can connect it by using cider

17:41 oddcully: (inc justin_smith)

17:41 lazybot: ⇒ 219

17:41 oddcully: alias-ed that

17:41 mavbozo: justin_smith: but why I still got message "Please, install (or update) cider-nrepl 0.8.2 and restart CIDER"

17:41 cider-nrepl is in the classpath

17:41 justin_smith: mavbozo: missing the cider-nrepl middleware at runtime?

17:42 maybe it isn't initialized properly?

17:43 danlentz: is there a difference between clojurebot and lazybot for evaluating expressions? ie, comma vs. hashhash

17:43 ,danlentz

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

17:43 mavbozo: justin_smith: ah, you're right, I have to put another parameter in nrepl-server/start-server

17:43 danlentz: ,(def danlentz 1)

17:43 clojurebot: #'sandbox/danlentz

17:43 danlentz: ,danlentz

17:43 clojurebot: 1

17:44 danlentz: ##danlentz

17:44 ##(def danlentz 2)

17:44 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

17:44 danlentz: ah

17:44 ##(identity danlentz)

17:44 lazybot: java.lang.RuntimeException: Unable to resolve symbol: danlentz in this context

17:45 mavbozo: justin_smith: boom! done!

17:45 danlentz: ,(all-ns)

17:45 clojurebot: (#object[clojure.lang.Namespace "clojure.uuid"] #object[clojure.lang.Namespace "user"] #object[clojure.lang.Namespace "clojure.core"] #object[clojure.lang.Namespace "clojure.repl"] #object[clojure.lang.Namespace "sandbox"] ...)

17:45 mavbozo: (inc justin_smith)

17:45 lazybot: ⇒ 220

17:46 danlentz: ##(all-ns)

17:46 lazybot: ⇒ (#<Namespace lazybot.plugins.lmgtfy> #<Namespace cheshire.parse> #<Namespace lazybot.plugins.timer> #<Namespace clojure.set> #<Namespace findfn.core> #<Namespace slingshot.slingshot> #<Namespace cheshire.generate> #<Namespace socrates.util> #<Namespace lazybot.plugin... https://www.refheap.com/98950

17:46 danlentz: ah, neat

17:49 ##(dir lazybot.plugins.unix-jokes)

17:49 lazybot: java.lang.SecurityException: You tripped the alarm! lazybot.plugins.unix-jokes is bad!

17:50 danlentz: ,(dir lazybot.plugins.unix-jokes)

17:50 clojurebot: #error{:cause "No namespace: lazybot.plugins.unix-jokes found", :via [{:type java.lang.Exception, :message "No namespace: lazybot.plugins.unix-jokes found", :at [clojure.core$the_ns invoke "core.clj" 3994]}], :trace [[clojure.core$the_ns invoke "core.clj" 3994] [clojure.repl$dir_fn invoke "repl.clj" 185] [sandbox$eval119 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.java" 6784] ...

17:51 danlentz: ##(ns-publics ‘member:lazybot.plugins.unix-jokes)

17:51 lazybot: java.lang.SecurityException: You tripped the alarm! ns-publics is bad!

17:52 _orangejuice: https://www.irccloud.com/pastebin/RLahrnCX

17:53 why does that return false?

17:53 https://www.irccloud.com/pastebin/UavVRGrF

17:54 mavbozo: ,(doc identical?)

17:54 nuwanda_: ,(doc identical?)

17:54 clojurebot: "([x y]); Tests if 2 arguments are the same object"

17:54 "([x y]); Tests if 2 arguments are the same object"

17:55 mavbozo: _orangejuice:^that's your answer

17:55 nuwanda_: basically, I don't think identical? is what you're after here, if you expect that to return true

17:55 _orangejuice: identical? checks if its referring to the same object but and = checks if data is same?

17:55 mavbozo: yup

17:56 _orangejuice: Thank you!

17:58 catern: what are some features of other languages that clojure is able to implement/steal thanks to macros?

17:58 types, goroutines, pattern matching, others?

18:01 mavbozo: stm

18:02 catern: stm?

18:02 mavbozo: dosync

18:02 for software transactional memory

18:02 catern: ah

18:07 spieden: "->" reminds me of "$" in haskell -- a bit different though

18:08 catern: mavbozo: what other languages have stm? Erlang, right?

18:08 mavbozo: haskell

18:09 justin_smith: catern: the threading macros / doto are two other examples

18:09 catern: justin_smith: but those aren't actually stolen from other languages

18:09 justin_smith: doto being effectively like the OO a.x().y() etc.

18:09 catern: other lisps don't have them :)

18:09 but can, if they adapt our macros

18:10 mavbozo: catern: erlang does not have STM

18:10 catern: I don't really know anything about erlang, but I though Clojure concurrency stuff was Erlangish?

18:11 danlentz: justin_smith: https://github.com/danlentz/cl-ctrie/blob/master/ctrie-util.lisp#L199

18:11 justin_smith: catern: not at all

18:11 catern: it's haskellish

18:11 catern: oh, okay

18:11 justin_smith: danlentz: yeah, I am glad those constructs are catching on :)

18:12 danlentz: a recursive macro, no less

18:12 justin_smith: danlentz: for all I know someone tried them in common lisp before clojure came around, but I never saw them until I learned clojure

18:12 mavbozo: catern: http://clojure.org/state -> rich hickey chose not to Erlang-style actor model

18:12 catern: the threading macros are being added to elisp core, I believe

18:12 muraiki: heh I was right about to paste that mavbozo

18:12 catern: mavbozo: oh, thank you

18:12 justin_smith: catern: yeah, maybe clojure's biggest gift so far to the lisp world

18:13 mavbozo: muraiki: :p

18:13 catern: http://endlessparentheses.com/new-on-elpa-and-in-emacs-25-1-seq-el.html

18:15 mavbozo: catern: wooo.. clojure inspired sequence abstraction

18:16 danlentz: clojures greatest gift to the lisp world is a viable language in which you can work in lisp and get paid.

18:16 Frozenlock: If only emacs was immutable...

18:16 justin_smith: haha

18:16 danlentz: if only that could be backported to other langs the way our new syntaxes are :)

18:16 catern: Frozenlock: if emacs was immutable then those new sequence abstractions wouldn't be added :)

18:17 Frozenlock: errr

18:17 catern: you'd have to create a new emacs with them included :P

18:17 Frozenlock: If only emacs had immutable data-structure :-p

18:17 justin_smith: my emacs is immutable, it just sits there and doesn't change no matter what I do

18:17 oh, never mind, that was just a super long line printing in a process buffer :)

18:18 * justin_smith waits for his rimshot.

18:18 mavbozo: (inc danlentz)

18:18 lazybot: ⇒ 2

18:21 mavbozo: catern: we could just change the reference to point to the new emacs value

18:21 catern: mavbozo: like with gcc?

18:22 and egcs

18:22 :)

18:24 haha

18:24 Frozenlock: Wow, I need to review all the new stuff in Emacs. Some of it is very nice. http://endlessparentheses.com/new-on-elpa-and-in-emacs-25-1-let-alist.html

18:24 catern: my type theory professor would be really mad at this statement

18:24 * mavbozo still giggling

18:24 catern: "First and foremost, Clojure is dynamic. That means that a Clojure program is not just something you compile and run, but something with which you can interact."

18:24 he would be so mad

18:25 because he semifrequently says that he thinks part of the dynamic vs static thing is just a branding problem

18:25 and that those dynamic languages just got a better name for themselves, and everything thinks statically typed languages are static and therefore boring and slow

18:25 well here is Clojure exploiting that label! :D

18:26 danlentz: isnt static generally faster?

18:26 catern: danlentz: yes :)

18:26 danlentz: but the public relations problem, you see, would lead you to believe otherwise...

18:27 justin_smith: catern: you could switch dynamic with ad-hoc and retain the meaning and likely make that professor happy

18:27 catern: justin_smith: quite so

18:28 but it wouldn't sound quite as good for clojure... :)

18:28 justin_smith: catern: but I prefer clojure in part because I like to develop with an ad-hoc system with exposed underpinnings

18:29 catern: justin_smith: what does "ad-hoc system" mean?

18:29 mavbozo: catern: rich hickey does not refer to dynamic typing in that sentence

18:29 catern: (in the way you are using it)

18:29 mavbozo: yeah, but that's generally what people mean by "dynamic" when discussing programming languages :)

18:29 justin_smith: catern: it means not in its final form, being modified while in use, with various abstractions only tentatively present

18:30 perhaps I am at heart more tinkerer than programmer

18:30 danlentz: “ad-hoc system” is how you pronounce “system” with a bad chest cold

18:31 justin_smith: "In military, ad hoc units are created during unpredictable situations, when the cooperation between different units is needed for fast action."

18:31 danlentz: I think working in lisp building things up in a very experimental, practical way is very helpful to me

18:31 justin_smith: yeah, that's what I am trying to get at

18:32 danlentz: how often do you really know everything you need to know at the very beginning of a project when designing a top-down approach

18:32 mavbozo: catern: agree, back in my early programming days, i think interpreter~dynamic vs compiled~static

18:32 danlentz: when i was young I learned on applesoft basic, which was a very interactive REPL experience

18:32 nicferrier: hey all. is there a guide to embedding a repl in your app?

18:33 danlentz: https://github.com/clojure-emacs/cider-nrepl

18:33 hiredman: https://github.com/clojure/tools.nrepl#embedding-nrepl-starting-a-server

18:33 catern: nicferrier: writing an app that isn't in Emacs? what an age it is!

18:33 nicferrier: :-)

18:33 justin_smith: nicferrier: as you'll see from those docs, it's quite easy

18:34 nicferrier: I don't really wanna embed nrepl.

18:34 I'd prefer just a readline like interface, basically just what clojure -m gives you.

18:34 or whatever the switch is.

18:34 still. looking.

18:34 Frozenlock: nicferrier: If you are using CIDER, you'll probably want to add the cider.nrepl handler with it.

18:35 nicferrier: Frozenlock: I'm not. can't get on with cider.

18:35 justin_smith: nicferrier: in that case, dynamically bind *in* and *out* and *err*, then launch clojure.main

18:35 nicferrier: justin_smith: when you say launch... you mean call?

18:35 justin_smith: perhaps in its own thread

18:35 depending what all else you are doing

18:35 but yeah

18:36 nicferrier: cool.

18:36 and if I uberjar that it'll all be cool right?

18:36 justin_smith: and you can provide the "-m" "some.ns" args if you like

18:36 nicferrier: yup, clojure.main is gonna be in your uberjar

18:37 nicferrier: that's awesome.

18:37 I wanna use it because I can't break through a firewall.

18:37 mavbozo: (inc justin_smith)

18:37 lazybot: ⇒ 221

18:38 justin_smith: nicferrier the trick is of course providing valid *in* / *out* / *err* bindings, but if you can use the root bindings, that's a sinch

18:38 mavbozo: nicferrier: not even ssh port-forwarding?

18:39 justin_smith: nicferrier: I use ssh -L for that typically, or ssh -R depending which side I am connecting from

18:39 nicferrier: ha. you puny mortals.

18:39 you haven't met *real* security people.

18:39 justin_smith: haha

18:40 danlentz: *real* security people are undetectable

18:40 justin_smith: fair enough, have fun with clojure.main then :)

18:40 * mavbozo giggling again

18:40 nicferrier: they told me that at work today. "do ssh port forwarding!" and how I laughed when we got "fd closed"

18:40 justin_smith: nicferrier: the issue with nrepl, anyway, is it gives anyone who can make a local tcp connection effectively the user who is running your app, it's wide open on the localhost

18:41 nicferrier: justin_smith: exactly

18:41 justin_smith: and you can be much picker with clojure.main

18:41 nicferrier: but I couldn't connect to it because the box is locked down by the network and I can't get anything (eg: emacs) on the box.

18:41 justin_smith: maybe this is something that will be fixed with the socket repl in core

18:41 mavbozo: what about unix domain socket?

18:41 justin_smith: mavbozo: nrepl can't use those

18:41 hiredman: nicferrier: well, you could just run the repl that clojure.main runs

18:41 justin_smith: they are hard to use from clojure

18:42 from the jvm, even

18:42 hiredman: the jvm doesn't do domain sockets well

18:42 nicferrier: yeah, can't use unix sockts without c extension. guess what?

18:42 justin_smith: the fact that hiredman ignores me keeps demonstrating itself

18:42 mavbozo: justin_smith: from security view point, it's good right?

18:42 nicferrier: but yeah. I can use the clojure.main I reckon.

18:42 justin_smith: mavbozo: from a security view what is good?

18:42 nicferrier: justin_smith: why does he ignore you? you're the most helpful person here!

18:43 hiredman: our main work server embeds a socket repl listening on localhost, and we have a little netcat based client

18:43 mavbozo: unix domain socket compared to tcp port

18:43 justin_smith: he likely thinks I;m annoying, who knows

18:43 nicferrier: justin_smith: oh well. you're not.

18:43 justin_smith: mavbozo: yeah, much more secure, but not accessible easily from jvm, because not portable to windows basically

18:43 hiredman: (that you run locally as *ctl script)

18:45 mavbozo: nicferrier, justin_smith there is a junixsocket for unixdomain socket with jni. but still not portable to windows

18:45 nicferrier: jni is still c

18:45 justin_smith: mavbozo: yeah, it exists, but it isn't going to end up in clojure itself

19:42 Seylerius: ,(defn dropper [coll n] (if (empty? coll) coll (into (take (dec n) coll) (dropper (drop n coll) n))))

19:42 clojurebot: #'sandbox/dropper

19:42 Seylerius: ,(dropper [1 2 3 4 5 6 7 8] 3)

19:42 clojurebot: (5 4 7 8 1 ...)

19:43 justin_smith: Seylerius: into is different with lists, and take returns lists

19:43 well, lazy-seqs, but they act like lists in this case

19:44 ,(into () [1 2 3 4 5])

19:44 clojurebot: (5 4 3 2 1)

19:45 Seylerius: Right.

19:45 Because into is conj-based

19:46 I'm just struggling for the alternative.

19:47 ,(defn dropper [coll n] (if (empty? coll) coll (into (into [] (take (dec n) coll)) (dropper (drop n coll) n))))

19:47 clojurebot: #'sandbox/dropper

19:47 Seylerius: ,(dropper [1 2 3 4 5 6 7 8] 3)

19:47 clojurebot: [1 2 4 5 7 ...]

19:47 Seylerius: Hah.

19:48 It's not the prettiest thing ever, but it worked.

19:49 gfredericks: ,(partition 2 3 (range 1 9))

19:49 clojurebot: ((1 2) (4 5) (7 8))

19:49 Seylerius: justin_smith: got a suggestion to avoid the stacked intos?

19:49 Oh. Well, that's nice.

19:49 gfredericks: ,(apply concat (partition 2 3 (range 1 9)))

19:49 clojurebot: (1 2 4 5 7 ...)

19:49 justin_smith: I think you can use subvec instead of take there to avoid the nested into

19:49 or just use concat, yeah

19:50 Seylerius: ,(flatten (partition 2 3 (range 1 9)))

19:50 clojurebot: (1 2 4 5 7 ...)

19:50 justin_smith: ~flatten

19:50 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

19:50 Seylerius: Heh.

19:50 Okay.

19:50 Point made.

19:50 TEttinger: ,(apply concat (partition 2 3 (range 1 9)))

19:50 clojurebot: (1 2 4 5 7 ...)

19:53 Seylerius: ,(apply concat (partition 1 2 (range 1 9)))

19:53 clojurebot: (1 3 5 7)

19:55 hyPiRion: ,(defn aside [& fs] (fn [xs] (map #(%1 %2) fs xs)))

19:55 clojurebot: #'sandbox/aside

19:55 hyPiRion: ,(defn dropper* [coll n] (if (seq coll) (->> (split-at n coll) ((aside butlast #(dropper* % n))) (apply concat))))

19:55 clojurebot: #'sandbox/dropper*

19:55 hyPiRion: ,(dropper* (range 1 9) 3)

19:55 clojurebot: (1 2 4 5 7)

19:56 hyPiRion: oh, it drops a bit eagerly I guess

20:02 danlentz: thats what she said

20:05 pretty interesting the different ways to approach dropper

20:11 im not sure where dropper comes from (is this a well known exercise?) but another interesting example of using reductions to manage state is Evan Gamble’s index-except exercise https://gist.github.com/egamble/7685276

21:06 Seylerius: danlentz: It's problem #41 on 4clojure

21:08 ,(defn dropper [coll n] (apply concat (partition (dec n) n coll)))

21:08 clojurebot: #'sandbox/dropper

21:09 Seylerius: ,(dropper [:a :b :c :d :e :f] 2)

21:09 clojurebot: (:a :c :e)

21:09 Seylerius: (= (dropper [:a :b :c :d :e :f] 2) [:a :c :e])

21:09 ,(= (dropper [:a :b :c :d :e :f] 2) [:a :c :e])

21:09 clojurebot: true

21:09 Seylerius: ...

21:09 4clojure is saying I'm failing that unit test.

21:10 ,(= (dropper [1 2 3 4 5 6] 4) [1 2 3 5 6])

21:10 clojurebot: false

21:11 Seylerius: ,(dropper [1 2 3 4 5 6] 4)

21:11 clojurebot: (1 2 3)

21:11 Seylerius: Okay, that's legit.

21:20 jpavlick: hi guys

21:21 I'm trying to get a clojure hello world running and I'm performing poorly.

21:21 ~> lein run -m core.demo Can't find 'core.demo' as .class or .clj for lein run: please check the spelling.

21:21 clojurebot: Excuse me?

21:23 TEttinger: jpavlick: hm, did you start the project with lein new ?

21:24 I'm wondering if something was created and manually renamed

21:26 joe1245: can someone explain how this is valid code? http://pastebin.com/z8WtmYsh i thought the syntax was (myfunc [args] (body))

21:29 TEttinger: joe1245: those are different parameter lists for the same fn name

21:30 it's how something like + can be (+ 1 2) or (+ 1 2 3 4 5)

21:30 joe1245: ok t hanks

21:31 TEttinger: so you could call that fn with one or two args

21:31 joe1245: also when i try to call it by (sum 3) it doesn't work I have to use (sum [3]) can you explain

21:32 TEttinger: it expects a sequence for vals, it calls empty? on it to test if it has items in it, which only works for some form of sequence

21:32 so [3] works because it can be treated as a seq

21:32 you could also use a set if you wanted, like #{3}

21:33 also, vals is a poor choice for a parameter name, since it's already a fn in the standard lib

21:33 (doc vals)

21:33 clojurebot: "([map]); Returns a sequence of the map's values, in the same order as (seq map)."

21:33 joe1245: cool thank you

21:33 btw how did you learn clojure

21:34 TEttinger: uh, mostly tinkering on lazybot plugins, which is not the best way to do it

21:34 but brave clojure is excellent these days

21:34 tahmid: I would recommend brave clojure

21:34 joe1245: cool i'm doing that now

21:35 TEttinger: it does seem like brave clojure has good pacing and gets to important parts of clojure early on

21:35 tahmid: I like the vibe of it

21:35 TEttinger: I've linked it to some people, and a few days later they're asking questions that I wouldn't have been close to when I started

21:36 joe1245: after i finish brave clojure what kind of project is clojure good at?

21:36 i want to show something interactive to put on my website for example

21:37 tahmid: You can do that with quil

21:39 TEttinger: clojure (that's clojure on the JVM I mean) is especially good at server-side stuff, but clojurescript has some really amazing stuff that can be done on the client side with libs like Om

21:39 joe1245: awesome looks like just what i wanted

21:39 quil and stuff

21:40 TEttinger: I've used play-clj before, which is also cool but doesn't do things in webpages

21:41 joe1245: yah i want to do webpage stuff because really who wants to download fungame.exe

21:47 tahmid: ‘(+ 2 3)

21:48 ,(+ 2 3)

21:48 clojurebot: 5

21:53 tahmid: ,(comp filter odd?)

21:53 clojurebot: #object[clojure.core$comp$fn__4446 "clojure.core$comp$fn__4446@3017a4f3"]

21:53 tahmid: (transduce (comp (filter odd?) (map inc)))

21:53 TEttinger: ,(transduce (comp (filter odd?) (map inc)))

21:53 clojurebot: #error{:cause "Wrong number of args (1) passed to: core/transduce", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (1) passed to: core/transduce", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 32] [sandbox$eval73 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.j...

21:54 tahmid: ,(println clojure-version)

21:54 clojurebot: #object[clojure.core$clojure_version clojure.core$clojure_version@32315315]\n

21:54 TEttinger: ,(transduce (comp (filter odd?) (map inc)) (range 10))

21:54 clojurebot: #error{:cause "Wrong number of args (2) passed to: core/transduce", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: core/transduce", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 36] [sandbox$eval121 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler....

21:54 TEttinger: ,clojure-version

21:54 clojurebot: #object[clojure.core$clojure_version "clojure.core$clojure_version@32315315"]

21:54 TEttinger: hm

21:54 that's not good

21:55 tahmid: it’s 1.7+ right ?

21:56 vas: can someone explain to me the use of [[ double brackets ]] in anonymous fxns?

21:56 TEttinger: vas: it's used for destructuring

21:57 giving names to elements in a collection, as opposed to naming the collection itself

21:57 vas: you just blew my mind

21:59 TEttinger: ,((fn [start [internal insides within]] (+ start internal insides within)) 10 [1 2 3])

21:59 clojurebot: 16

21:59 TEttinger: it gets better!

21:59 ,((fn [start [internal insides within]] (+ start internal insides within)) 10 [1 2 3 4 5 6 7 8 9])

21:59 clojurebot: 16

22:00 TEttinger: it only looks at the names that are assigned in the destructuring, so if you have more it discards them (but you can name the whole of that [1 2 3 4 5 6 7 8 9] with :as)

22:00 vas: Aha!

22:01 TEttinger: ,((fn [start [internal insides within :as somelonglist]] (+ start internal insides within (apply + somelonglist))) 10 [1 2 3 4 5 6 7 8 9])

22:01 clojurebot: 61

22:03 TEttinger: using destructuring is one of the main ways that clojure code can be made smaller and cleaner, especially code that deals with nested collections

22:04 (the biggest way is knowing as much of the standard lib as possible)

22:05 mapcat is crazy cool

22:05 gfredericks: ~mapcat is crazy cool

22:05 clojurebot: Ok.

22:06 vas: I think I'm gonna print out core.clj and wallpaper my room with source code

22:06 raspasov: vas: haha

22:07 TEttinger: imagine if you did that for the java standard lib

22:07 "We're gonna need a bigger room!"

22:07 raspasov: TEttinger: hahaha

22:07 vas: Hahaha at that point i might just rather know the bytecode by heart

22:08 TEttinger: hm, let's see what the largest files are in the openjdk source...

22:09 raspasov: TEttinger: what if you did it for Scala? oh boy, you'll have to re-wallpaper your room every year and a half!

22:09 TEttinger: haha

22:10 vas: if i find the right artist and micropen i think i can get core.clj tattooed on my body

22:13 thanks for the examples on maps, TEttinger

22:13 er, [[ double bracks ]]

22:14 TEttinger: no problem!

22:23 one of the largest files in the JDK Is FilterGeneric.java , it's 4500 lines, most of them longer than 80 chars, with stuff like

22:23 return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18], av[19]); }

22:24 my god, there's a shell script in that java source

22:24 : SHELL; n=FilterGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -ea -cp . genclasses | sed 's| *[/]/ *$||') >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~

Logging service provided by n01se.net