#clojure logs

2015-03-27

00:00TEttingerthe way I do it, because I don't use editor fanciness other than paren matching and syntax highlighting, is press ) until I'm matched
00:01Jaood;)
00:04chr15mthat just takes you to the brace though, right? doesn't actually gather them.
00:08bendlashm, 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
00:09bendlasespecially since in clojure there's typically a mix of ), } and ]
00:09Jaoodchr15m: looks like we understood you differently
00:09chr15m@bendlas so you can do it with paredit? i have paredit.
00:10bendlasor maybe I understood you wrong; you didn't mean inserting all the nessecary closing parens?
00:14chr15mno i mean if there are loose parens hanging around on lines after the main one
00:14chr15mmain one = the one you are working on
00:15chr15m(fn [x] ...
00:15chr15m)
00:15bendlasoh, you mean spurious white space between you closing parens
00:15chr15mi want a single keystroke to gather that single brace back onto the last line it can go to
00:15chr15myep
00:16scottjchr15m: in paredit in emacs pressing ) will do that for all closing brackets. (if by last line you mean previous line)
00:16chr15mscottj: good to know, thank you. i am in vim.
00:17bendlasscottj: cool, good to know that
00:17chr15mscottj: WAIT. paredit in vim also does this.
00:17chr15myou are truly legendary sir!
00:17chr15mthank you!
00:17bendlasI always used to jump outside of the last closing paren and press backspace until they were tidy
00:17scottjjust repeating what everyone before said :)
00:18chr15mlol
00:18chr15mmy hubris chooses to ignore the fact it took three attempts to explain the obvious to me
00:18chr15mi am great
00:19bendlasseconded ^^
00:19elvis45261is there any rule about namespaces ?
00:19elvis45261does it have to follow the folder hiearchy ?
00:20bendlaselvis45261: yes, plus have at least one parent folder
00:20bendlasi.e two segments
00:20elvis45261alright ty
00:21bendlasyw
00:25freddddoes anyone have any idea if dissoc-in will ever make it to core from core.incubator?
00:53elvis4526There is really no way to write macro with only clojurescript ?
00:54elvis4526if 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" ?
00:56joe124hi I am currently working through clojure for the brave and true, is buyign the early access ebook worth it?
00:57bjachr15m: go to the line to collect on and hold J
00:57bjait'll bring up the previous line every time you hit J
00:57bja(which if you have a bunch of parens, just collects those)
00:58chr15mbja ah yes, nice
00:58chr15mbja although with paredit hitting ) seems to work better
00:58bjaI use vim-sext
00:58bjavim-sexp
00:58chr15mah ok
00:58chr15mthat is tpope's plugin right?
00:58bjaguns
00:59chr15mah yes
00:59joe124is using atom for making clojure programs bad?
00:59chr15mit is in the 0.01% of vim plugins not written by tpope
00:59gwstpope has this one which works on top of vim-sexp (i use it) https://github.com/tpope/vim-sexp-mappings-for-regular-people
00:59bjajoe124: do you want it to be bad?
01:00joe124no
01:00bjathen it's not bad
01:00joe124awesome i feel great now!
01:00bjaif you want to really level up, consider using ed to write your clojure
01:01bjaed combined with your usual shell and repl for fg/bg abilities and maybe a good mouse with copy/paste
01:01bjait'll really change you
01:02joe124i have a question why is lisp and such not popular
01:02joe124is it because lisp languages are harder to learn?
01:04joe124what is the difference between {:a 5} and (def a 5)
01:17amalloyjoe124: 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
01:19joe124amalloy i just was wondering because in both the number 5 is bound to a
01:19amalloynot really
01:19amalloyin the second, you create a global var named a, and make its value be 5
01:20amalloyin the second, you create a hashmap, with the single key :a and the corresponding value 5
01:20amalloythere's no binding or assigning of anything in the second one, just a map with a key and a value
01:21joe124but isnt a map kind of like assigning
01:21gwsno a map is a data structure
01:22fredddjoe124: a map is also known as a hash or dictionary in other languages if that helps you understand at all.
01:27joe124yah thanks guys i guess i just noticed a similarity was wondering if there was anything more to it
01:30elvis4526I am confused. How can you make a "global" js variable in cljs ?
01:31elvis4526I would have expected that (def js/myGlobal val) would work
01:34elvis4526oh nvm
02:38IgorHow can I close http connection with http-kit? (close channel) doesn't work
02:46vas@Igor it doesn't automagically close?
03:32SeyleriusHmm... I'm kinda stuck on 4clojure #31
03:33SeyleriusPack a sequence...
03:33SeyleriusAnyone got a hint?
03:50ordnungswidrigSeylerius: "packing" = "grouping"
03:52ordnungswidrigSeylerius: a better hint would be "partitioning", I guess
04:13Seylerius##(= [1 2 3]
04:13Seylerius##(= [1 2 3] '(1 2 3))
04:13lazybot⇒ true
04:30dysfunis there a 'funcall' equivalent? i.e. apply, but doesn't take a list as arg?
04:31opqdonut#(%1 %2) ?
04:32ordnungswidrig,(apply prn [1 2 3])
04:33clojurebot1 2 3\n
04:33ordnungswidrig,(apply prn [[1 2 3]])
04:33clojurebot#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...
04:33ordnungswidrighmmmm
04:34ordnungswidrig,(apply prn [[1 2 3]])
04:34clojurebot[1 2 3]\n
04:34ordnungswidrigdysfun: simple wrap the arg in a vector for apply.
04:41dysfunordnungswidrig: yes, it's just that if said function already existed, it would mean no need to embed a lambda in a (filter)
05:09borkdudewhat are good reasons to choose immutant over embedded jetty or undertow (except for clustering, which I don't need)?
05:17dysfunit's quite fast. it's worth testing the performance vs other things
05:17dysfunit fits nicely into the j2ee stack if you're of that persuasion (i'm not)
05:19borkdudedo people use embedded jetty a lot in production?
05:20oddcullywhat's the key here "embedded" or "jetty"?
05:21borkdudejetty
05:21oddcullyand from immutants homepage, i'd say, that if you don't need quartz, hornet, ... then maybe don't bother with the extra baggage
05:22oddcullyhttp://www.techwars.io/fight/jetty/tomcat/ no ;P
05:23spinningarrowsuper 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?
05:23borkdudespinningarrow check out http://clojure.org/functional_programming
05:24borkdudespinningarrow especially http://clojure.org/special_forms#fn
05:25borkdudespinningarrow basically & options means options is a variadic list of parameters
05:25borkdudespinningarrow like in +, you can call it with an arbitrary amount of params: (+ 1 2 3 4 5 6)
05:26oddcullyspinningarrow: above from the docs then is: ([] [x] [x y] [x y & more])
05:27oddcully(the last one)
05:34mpenetborkdude: jetty is fine in production
05:35mpenetborkdude: ex: prismatic runs on it I believe
05:36borkdudempenet cool
05:38oddcullyi also use jetty embeded and not. had not problems so far (saising fist to universe to dare)
05:49f3ewWhat's the clojure model equivalent of the Unix pipeline pattern?
05:53mpenetf3ew: comp or the -> functions I guess
05:55mpenet,(-> {:a {:b {:c [1]}}} :a :b :c first inc)
05:55clojurebot2
05:59oddcullyf3ew: or core.async
06:12Seylerius,(defn dup [coll] (loop [remainder coll result []] (if (empty? remainder) result (recur (rest remainder) (conj result (repeat 2 (first remainder)))))))
06:12clojurebot#'sandbox/dup
06:13Seylerius,(dup [1 2 3 4])
06:13clojurebot[(1 1) (2 2) (3 3) (4 4)]
06:13SeyleriusOh, of course
06:14Seylerius(defn dup [coll] (loop [remainder coll result []] (if (empty? remainder) result (recur (rest remainder) (concat result (repeat 2 (first remainder)))))))
06:15Seylerius,(defn dup [coll] (loop [remainder coll result []] (if (empty? remainder) result (recur (rest remainder) (concat result (repeat 2 (first remainder)))))))
06:15clojurebot#'sandbox/dup
06:15justin_smithSeylerius: or apply conj
06:16Seylerius(dup [1 2 3 4])
06:16Seylerius,(dup [1 2 3 4])
06:16clojurebot(1 1 2 2 3 ...)
06:16noncomf3ew: what do you mean?
06:16noncom,(conj {} '(1 2))
06:16clojurebot#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...
06:16Seyleriusnoncom: It wants a vector, not a list.
06:16justin_smiththat error message is so funny
06:16noncomyaeh, and that seemed strange to me
06:17noncom,(conj {} '(:eval '(me "ok")))
06:17clojurebot#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....
06:17justin_smith,(conj {} '([] []))
06:17clojurebot#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__...
06:17justin_smiththat message is factually false
06:17justin_smithpersistentvector can be cast
06:17noncom:D
06:17noncomalso:
06:17justin_smithit's just complaining about the type of the wrong item
06:17noncom,(conj {} (:eval '(+ 1 2)))
06:17clojurebot{}
06:17noncomhaha!
06:18noncomi know what happens, but funny still
06:18noncomyeah, and your example with [] is even more fun i think :)
06:19Seyleriusjustin_smith: Weirdly enough, my function isn't working, despite producing a good result.
06:19Seylerius,(dup [1 2 3])
06:19clojurebot(1 1 2 2 3 ...)
06:19justin_smith,((`~`~get `~`~`~`~get `~`~`~`~`~`~`~get `~`~`~`~`~`~`~`~`~`~`~get) [:a :b :c :d :e] 42 :OK)
06:19clojurebot:OK
06:19justin_smithSeylerius: what's wrong with that result?
06:20SeyleriusIt's failing #32
06:20SeyleriusCan clojurebot be coerced into providing a little more of the result?
06:20hyPiRionoh sure
06:20Seylerius,(dup [1 2])
06:20clojurebot(1 1 2 2)
06:20hyPiRioncall it with str or something
06:21hyPiRion,(str (dup [1 2 3 4]))
06:21clojurebot"clojure.lang.LazySeq@34932041"
06:21hyPiRion,(pr-str (dup [1 2 3 4]))
06:21clojurebot"(1 1 2 2 3 ...)"
06:21SeyleriusHeh
06:21ordnungswidrig,(take 10 (dup [1 2 3 4]))
06:21clojurebot(1 1 2 2 3 ...)
06:21hyPiRion,(binding [*print-length* 1000] (pr-str (dup [1 2 3 4])))
06:21clojurebot"(1 1 2 2 3 3 4 4)"
06:21justin_smith,(apply str (dup [1 2 3 4]))
06:21clojurebot"11223344"
06:21ordnungswidrig(into [] (take 10 (dup [1 2 3 4])))
06:21ordnungswidrig,(into [] (take 10 (dup [1 2 3 4])))
06:21clojurebot[1 1 2 2 3 ...]
06:22SeyleriusWe clearly now have the information we need.
06:22ordnungswidriggrr
06:22hyPiRionperhaps pr is better actually
06:22SeyleriusAnd yet it's still failing #32.
06:22hyPiRion4clojure #32?
06:22SeyleriusYep
06:23hyPiRionWhat is it failing on?
06:23SeyleriusOkay, now that's fscking weird.
06:23SeyleriusI didn't change a single paren, and now it's passing.
06:23justin_smithSeylerius: when I paste the most recent def, it solves 32
06:23Seylerius4clojure is stupid sometimes.
06:23hyPiRionSeylerius: might've been a timeout issue?
06:24justin_smithalso, (concat result (repeat 2 (first remainder))) is objectively worse than (conj result remainder remainder)
06:24justin_smithalso, (concat result (repeat 2 (first remainder))) is objectively worse than (conj result remainder (first remainder) (first remainder)) that is
06:24justin_smithheh
06:24SeyleriusNoted.
06:25hyPiRionIf 4clojure hasn't been restarted in a while, then some alright solutions may timeout.
06:25justin_smithoh that was still wrong :( (conj result (first remainder) (first remainder))
06:26SeyleriusHah
06:26f3ewnoncom: the equivalent of a cat file |grep string | tee >(command) | some_other_command > file2
06:26SeyleriusAnd the advantage of repeat becomes clear in #33, where I need to do it an arbitrary number of times.
06:26justin_smithSeylerius: (apply conj coll (repeat n val))
06:27Seyleriusapply conj beats concat?
06:27justin_smithdefinitely, I'd say. If you have a vector
06:27noncomf3ew: 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
06:27Glenjaminis (apply conj) prerrable to (into) ?
06:28justin_smithGlenjamin: into is likely better than apply conj, yeah
06:29SeyleriusOooh. Shiny.
06:29hyPiRionand hey, if you need an eager concat on vectors, then I can recommend (defn catvec [& vecs] (reduce into vecs))
06:30f3ewnoncom: I'm not interacting with bash, I have clojure functions I would like to chain up in a similar style
06:30oddcullyf3ew: 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?
06:30justin_smithoddcully: he just wants the syntactic style
06:30justin_smithwhich is -> or ->>
06:30f3ewoddcully: s/file/event stream/, and process that event stream
06:31noncomf3ew: also https://github.com/rplevy/swiss-arrows
06:32justin_smithf3ew: oh, if it's explicitly a stream with new items coming in async, then core.async
06:33f3ewjustin_smith: I'm writing riemann configs, so the reading bit is handled for me
06:34justin_smithf3ew: yeah, so you want one of those arrows, probably -> with the occasional nested ->> / some-> / some->> etc.
06:37Seylerius,(defn ranger [a b] (if (< a b) (conj [a] (ranger (inc a) b)) []))
06:37clojurebot#'sandbox/ranger
06:37Seylerius,(ranger 1 4)
06:37clojurebot[1 [2 [3 []]]]
06:37SeyleriusAh, right.
06:38Seylerius,(defn ranger [a b] (if (< a b) (into [a] (ranger (inc a) b)) []))
06:38clojurebot#'sandbox/ranger
06:38Seylerius,(ranger 1 4)
06:38clojurebot[1 2 3]
06:38SeyleriusYep
06:45justin_smith,(def ranger (constantly 'Strider))
06:45clojurebot#'sandbox/ranger
06:57egliborkdude: immutant is just a nicely package if you want web, messaging, transactions, etc
06:58egliit's very industrial strength but you have to dig jboss xml config files
06:59noncom,ranger
06:59clojurebot#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 [...
07:26Seylerius,(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)))))
07:26clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
07:32justin_smithSeylerius: you can't apply or
07:33justin_smith,(some? empty [[1] [2]])
07:33clojurebot#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...
07:33justin_smith,(some empty [[1] [2]])
07:33clojurebot[]
07:33Empperior is a macro, thus you can't use apply with it
07:33Seyleriusjustin_smith: wound up just manually or-ing it.
07:34SeyleriusThe real problem was a missing paren. Emacs catches those so much better, what with highlighting matches.
07:34justin_smith,(some empty? [[1] [2]])
07:34clojurebotnil
07:34justin_smiththat's what I wanted
07:35justin_smithSeylerius: if you aren't specifically sharing with us all, you can use /msg to talk to clojurebot
07:35SeyleriusShiny.
07:35SeyleriusAlthough I do value y'all's opinions a fair bit on this stuff.
07:35SeyleriusIt's rather handy.
07:36SeyleriusAll of you clever and more experienced clojure-folks are good to talk to.
07:36justin_smithSeylerius: sure, but I don't think you need our help with unmatched parens :)
07:36Seylerius:p
07:36SeyleriusOther than the or bit, what d'you think of the method in that one?
07:37justin_smithSeylerius: looks decent enough, it would be clearer as a reduce
07:37justin_smithgenerally, loop is low level, and it's good to convert to one of the higher level constructs when applicable
07:38SeyleriusRight...
07:39justin_smithsomething like (defn mixer [a b] (reduce into [] (map vector a b)))
07:40justin_smithit does the same thing, but much less verbosely
07:40SeyleriusOh that's nice.
07:40SeyleriusI forget about map being able to pull from multiple sources.
07:40justin_smith,(defn mixer [a b] (reduce into [] (map vector a b)))
07:40clojurebot#'sandbox/mixer
07:40justin_smith,(mixer [:a :b :c :d] [1 2 3 4 5])
07:40clojurebot[:a 1 :b 2 :c ...]
07:40justin_smiththat's what it should do, right?
07:40SeyleriusYep
07:41Seylerius,(map vector [1 2 3] [:a :b :c])
07:41clojurebot([1 :a] [2 :b] [3 :c])
07:41SeyleriusRight.
07:41justin_smithoooh
07:41justin_smith,(defn mixer [a b] (mapcat vector a b))
07:41clojurebot#'sandbox/mixer
07:41justin_smith,(mixer [:a :b :c :d] [1 2 3 4 5])
07:41clojurebot(:a 1 :b 2 :c ...)
07:41SeyleriusOh goodness.
07:42justin_smithmuch better! don't even need reduce
07:42justin_smith,(def mixer (partial mapcat vector))
07:42clojurebot#'sandbox/mixer
07:42Seyleriusmapcat. fscking mapcat...
07:42SeyleriusWait... partial?
07:42justin_smith,(mixer [:a :b :c] [1 2 3] '(l m n o p))
07:42clojurebot(:a 1 l :b 2 ...)
07:42justin_smithpartial makes it varargs :)
07:42SeyleriusI gathered that.
07:43SeyleriusI'm looking that up on the cheatsheet now for the w1n it's apparently made of.
07:43Empperipartial creates a new function where it already has n parameters given
07:43Empperithus that would turn to: (mapcat vector <rest of the parameters here>)
07:44justin_smithSeylerius: still blows my mind that your loop can be redefined to three functions in one sexp :)
07:45SeyleriusThat makes two of us.
07:45justin_smithhopefully you followed along - tried to do it step by step
07:45clgvis there a best practice tutorial for tagged literals and data readers somewhere?
07:48SeyleriusIndeed.
07:55SeyleriusI officially love partial.
07:55SeyleriusIt's made of win.
07:56justin_smithSeylerius: yeah, I'm a fan
07:56AeroNotixmy only gripe is that it's quite a long name, so sometimes using #(...) is shorter anyway
07:58ordnungswidrigAeroNotix: ,(def ∂ partial)
07:58clgvAeroNotix: but `partial` documents the intent better ;)
07:59ordnungswidrig,(def ∂ partial)
07:59clojurebot#'sandbox/∂
07:59ordnungswidrig.((∂ + 2) 4)
07:59ordnungswidrig,((∂ + 2) 4)
07:59clojurebot6
08:01AeroNotixclgv: the first time you read it, yeah
08:01AeroNotixordnungswidrig: but that's not widely used, partial is its name.
08:01ordnungswidrigAeroNotix: sure, but you were complaining about the length of the name :-)
08:02clgvAeroNotix: 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
08:02AeroNotixI am yeah
08:02Seyleriusordnungswidrig: What greek letter was that?
08:02AeroNotixit's a trivial thing
08:03clgvSeylerius: delta
08:03ordnungswidrigSeylerius: not greek a curly d.
08:03ordnungswidrighttp://www.fileformat.info/info/unicode/char/2202/index.htm
08:03clgvlooks like a delta ;)
08:04ordnungswidrig∂ vs. ∂
08:04clgvordnungswidrig: with that context it is a different styled delta ;)
08:05ordnungswidrigwell, YMMV. The uppercasing behaviour of that codepoints is different
08:05ordnungswidrig(I guess)
08:06Seylerius,(defn poser [a coll] (mapcat vector coll (repeat a)))
08:06clojurebot#'sandbox/poser
08:06Seylerius,(poser 0 [1 2 3])
08:06clojurebot(1 0 2 0 3 ...)
08:07SeyleriusAh
08:07michaelr`err
08:08michaelr`What would be a good way to use react.js components from om?
08:08michaelr`more specifically with sablono, if possible
08:09Seylerius,(defn poser [a coll] (butlast (mapcat vector coll (repeat a))))
08:09clojurebot#'sandbox/poser
08:09Seylerius,(poser 0 [1 2 3])
08:09clojurebot(1 0 2 0 3)
08:10michaelr`yeah, with sablono - how to use react components with sablono?
08:15edbondmichaelr`, sounds like a question for #clojurescript
08:16edbondmichaelr`, sounds like a question for #clojurescript room
08:16AeroNotixis there an echo in here
08:16AeroNotixis there an echo in here
08:16michaelr`what?
08:16michaelr`what?
08:16clojurebotwhat is this
08:16clojurebotwhat is cells
08:17AeroNotixhaha
08:17edbondhaha
08:17slipsetre partial, I know emacs, and I think Intellij can use different glyphs for partial, fn et al
08:18AeroNotixslipset: heathen
08:19slipsethttps://github.com/hackscience/purty-mode
08:19michaelr`edbond: thanks, I think that I got the answer..
08:19slipsetI think I've seen tbaldridge use the lambda glyph for anonymous functions
08:20tbaldridgeslipset: yep, it's from Emacs Live
08:21slipsetand jay fields http://blog.jayfields.com/2013/05/emacs-lisp-font-lock-for-clojures.html
08:22slipsetand he found that in emacs-live it seems
08:42elvis4526How do you bind a function to a js symbol in cljs ?
08:42elvis4526(def $scope.submit (fn [])) ain't doing it. :-(
08:43edbondelvis4526, there is a #clojurescript room for cljs questions
08:44elvis4526ty
08:44lewis1711so what's the deal with using java8 libs from clojure? looking to use one that makes use of lambdas a lot
08:50thhellerlewis1711: lamdas are basically just syntax sugar, so it just works.
09:02brianwrHi, 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?
09:06brianwrOh, forgot to mention that im using figwheel too ;)
09:21Beamed[i0jefqo'efqipj'rvjip
09:21Beamedsorry, cat
09:25danlentzi 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.
09:29arrdemI agree that a bunch of the ideas sound good, but I don't think anyone has really had time to try it out yet.
09:29danlentzyeah
09:29danlentzits overwhelming
09:30arrdemagreed.
09:30danlentzbut there are only 4 people in the #dunaj group right now
09:30danlentzsomehow that does not seem appropriate level of interest
09:30danlentzand one of them is me and the other is the author
09:30arrdemI mean... #oxlang is just me and cemerick
09:31arrdemjust kinda comes with being a fork / blue sky projec.t
09:32tbaldridgethe fork bit is probably the hardest, mostly because you have to compete in the same space
09:32arrdemRight. 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.
09:33danlentzit is indeed unclear
09:33arrdemwhich is just a bandaid over the fact that grats, you're now competing with Core.
09:33danlentzi kindof see it as a proving ground for new ideas rather than a replacement
09:34arrdemagreed, but being a proving ground implies more than just experimental use IMO
09:34cemerickarrdem: s/fork//
09:34danlentzhe said he hasnt gotten any feedback at all from cognitect
09:35arrdemcemerick: I'd merge it
09:35cemerickoh, but tbaldridge said this already basically
09:35cemerickarrdem: what, dunaj?
09:35arrdemcemerick: your sed
09:35cemerickheh
09:36cemerickthere's plenty of room for more languages, but not for alt-clojures
09:36tbaldridgeSo 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.
09:37puredangerdanlentz: 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
09:37tbaldridgeProblem 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.
09:38arrdemagreed. 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.
09:39puredangerthere is also the issue that it is just a pile of solutions without the consideration of what the source problems or alternative solutions are
09:43sobelso, 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
09:44sobelsame question, command-line operation.
09:44dstocktonquite an open question sobel
09:45michaelr`sobel: on thing is build integration, with the maven plugin maybe if it's a maven project
09:45AeroNotixsobel: I just did something similar with an Java application
09:45AeroNotixI just had the Java developers use an Uberjar and put that into the project
09:45sobelthe java app is already mavenized
09:45noncomi 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?
09:45AeroNotixyou would just put the clojuer code as a mvn dep then
09:45noncom(there are no firewalls on)
09:46dnolenfor people looking for a simple Emacs ClojureScript setup, 0.0-3165 now works a charm with inf-clojure
09:46sobelso, publish my clojar to the internal mvn repo, add it as a dep to the app?
09:46dnolenhttps://github.com/clojure/clojurescript/wiki/Emacs-%26-Inferior-Clojure-Interaction-Mode
09:52clgvsobel: it might help integration if you provide a java facade for the common interop calls
09:52clgv(interop between the java app and you clojure lib, is meant ;) )
09:53sobelwill i have to add clojure runtime as a dep to the java app, or can that get bundled?
09:54sobelclgv: pretty sure i'll need to do that
09:54clgvsobel: it istransitively pulled in because of your clojurelib
09:55sobelclgv: aha. thanks.
09:56clgvsobel: you'll need that offcicial API http://clojure.github.io/clojure/javadoc/
09:57AeroNotixsobel: I just did a really heavy amount of java interop to do exactly this
09:57AeroNotixprovide a clojure library that looks and smells like java
09:57AeroNotixthere's quite a bit which is undocumented, or documented poorly.
09:58sobelAeroNotix: i'm convinced. the interop surface is extremely narrow, fortunately.
09:58AeroNotixcool
09:58clgvAeroNotix: are there gundogs sniffing your libs? ;)
09:58AeroNotixclgv: what
09:58sobelclgv: that will get pulled in transitively, right?
09:58AeroNotixthe only thing you can't do is create Enums in Clojure, or at least I couldn't figure out how
09:58clgvsobel: it is part of clojure since at least 1.6 (maybe 1.5?)
09:58sobelclgv: or..oh, you meant i'll need those docs, gotcha
09:58AeroNotixbut you can do literally everything else as far as I know
09:59sobeli can live without enums.
10:00lewis1711what do you do with enums in a dynamically typed language?
10:00AeroNotixlewis1711: provide java with a nice API
10:01AeroNotixI just use :java-source-paths in lein
10:01lewis1711I always just end up assigning symbols to variables, so I don't make mistakes through typos
10:01AeroNotixwith an enum
10:01sobelif the java api becomes that classy, i'll just straight-up write it in java
10:01lewis1711ah, fair call
10:01clgvAeroNotix: they could be translated to namespaced keywords at the java facade, if the requirements permit
10:01AeroNotixclgv: no need for a java facade
10:01AeroNotixyou can write the majority nicely in just pure clojuer
10:01AeroNotixwith gen-class and gen-interface
10:01AeroNotixalong if you really want, a java Enum file.
10:02clgvdepends on the java side requirements whether the facade is a good idea ;)
10:02clgvgen-class is usually not what I want to use ...
10:02AeroNotixI've had good experiences with it.
10:03AeroNotixpure-Clojure library, gen-class'd facade code. ezpz
10:03AeroNotixno java needed
10:03AeroNotixbut the java friends get a library that looks and feels like java
10:03AeroNotixall the IDE goodies as well.
10:03sobelAeroNotix: that is my preference, unless i _have_ to provide Enums
10:03sobelwhich..i can't imagine, but whatever
10:03sobeli'll write enum-gen if it comes to that :)
10:03AeroNotixwriting 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:04clgvAeroNotix: there are plenty of gen-class scenarios that are faster implemented by using java ;)
10:04clgvand better...
10:04AeroNotixquantify better
10:05AeroNotixfaster, perhaps, if you're not familiar with the esoterics in gen-class.
10:05clgvso you'll have to judge on per case basis.
10:05sobeli'll be back when i can't make class-gen work :)
10:05sobelgen-class, too
10:05AeroNotixcool.
10:06sobelthx for the consult. this org needs a healthy introductory clojure experience.
10:10elvis4526with java jdbc, how do I know construct the db-spec for postgresql ?
10:10elvis4526I'm not sure what I'm suppose to put as :classname
10:11elvis4526I have postgresql/postgresql pulled in with lein
10:19omelvis4526: :subprotocol "postgresql" should be enough
10:20omjava.jdbc shall get the classname for you
10:20elvis4526om: awesome, thanks!
10:21brianwrI 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:24omelvis4526: you're welcome (by the way, it should be org.postgresql.Driver, if you ever need it)
10:32danlentzthere are worse things than piles of solutions
10:32danlentz:)
10:45ppppaulanyone have experience using onyx and have any opinions on it?
10:48clgvppppaul: what is your parallelization scenario?
10:56timvisherhow do i reload my project.clj file without restarting my repl?
10:58clgvtimvisher: because of new dependencies?
10:59clgvtimvisher: there at least two libs to add dependencies on the fly
11:01danlentzlook at vinyasa
11:01danlentzhttps://github.com/zcaudate/vinyasa
11:04clgvright, that was one of them
11:13danlentztimvisher: this looks interesting also http://palletops.com/alembic-clojure-classpath-control/
11:13timvisherthanks!
11:17justin_smithalembic.still/load-project simply adds any deps that are in your project.clj but have not been loaded by the vm yet
11:19alejandrozfHi all! how I could get "full" leiningen for "transporting" to an offline machine?
11:20winkalejandrozf: it shouldn't be more than the bat/sh called 'lein' and one corresponding jar in the correct path, i.e. under ~/.lein/
11:21alejandrozfwink: both are on github page?
11:22winkalejandrozf: you could just grab the lein.sh, do an install and then copy the jar from .lein/self-installs
11:22winkit probably IS somewhere there as well, yeah
11:22alejandrozfwink: ohh thanks :)!
11:23winkthe shell script is not hugely complicated, if you take a peek
11:23winkif it can't find the jar, it will download it
11:23winkand I think you only need to copy those 2 files and you're set
11:23alejandrozfwink: got it! I will take look too!
11:26danlentzthis githib ddos attack certainly is lasting a while
11:27chouserthanks, china
11:28clgvchouser: huh?
11:30chouserclgv: There's some evidence that the Chinese Gov't is using its firewall capabilities to drive the ddos.
11:30clgvchouser: why wouldn't they like github?
11:31danlentzquick, deploy the octocats!
11:31chouserclgv: https://en.greatfire.org/blog/2015/mar/evidence-shows-cnnic-and-cac-behind-mitm-attacks
11:33danlentzThe solution is simple. Lets just ask them to borrow some more money to upgrade our cyber defenses.
11:33clgvchouser: that article talks about th certificate issuses (MITM)?
11:33zotis there a way to override the hasheq function on a defrecord-created type?
11:34justin_smithclgv: chouser: yeah, that's proof that China did it, not a reason they would want to
11:34justin_smithI 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:35sobeldanlentz: i think i just fell for vinyasa on the tagline alone: give your workflow more flow
11:37clgvsobel: :D
11:38danlentzsobel: wait until you get to the part about “Downard Facing Defn”
11:38zot(i should clarify — override, short of using deftype and having to manually make all the other stuff…)
11:40clgvzot: what is the requirement forcing you to do that?
11:40zotcurrently, 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:41clgvzot: it doesnt sound like a good idea to ruin defrecords ability to behave like a normal map
11:42zotruin is a strong word :) in my case, I just want it to exclude hashing one of the fields
11:43clgvzot: can you trick it by making that field mutable?
11:43zotinteresting idea. would that have other implications?
11:44zotactually, i thought that mutable only exists for deftype ...
11:44zot(looking now)
11:46clgvzot: honestly, I wouldnt attempt that.
11:46clgvzot: can't you achieve the same via aggregation?
11:47timvishershould the cider repl maintain history between sessions?
11:47zotclgv: what do you by aggregation?
11:47clgvhave a deftype with the field for the non-hash data and the defrecord?
11:48zotmeaning house the non-hashable data as a field of the defrecord? or as separate entities?
11:50clgvzot: (deftype Composite [strange-value, record] ...implement...your...own...hashing...)
11:50danlentzzot: why must you directly use hashing?
11:50clgvzot: the composite would not have map properties though
11:52sobeldanlentz: lordy. =)
11:53zotdanlentz: 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:53zotoops, second half was really a response to clgv
11:54clgvzot: I'd reevaluate the solution approach of the CLJS implementation
11:55clgvzot: it smells as if there is something fishy ;)
11:56zotclgv: 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:57zotbasically 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:57clgvzot: IHash is the standard protocol of CLJS, right?
11:57zotyep
11:57zotas i understand, IHashEq is the clj equivalent for transparent operation
11:58clgvok then you are running into the problem that Clojure is not build up from protocols ;)
11:59zoti 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:59clgvzot: which part of the map implementation does Datom need?
11:59Glenjamincan you just (defn same-datom) ?
11:59clgvzot: just associative lookup and write?
12:00clgvGlenjamin: I'd guess hashin is used implicitely e.g. from PHM
12:00Glenjaminoh right, good point
12:01clgvotherwise that's a solution ;)
12:01zotfor 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:01Glenjamincould throw the mutable bits on metadata perhaps?
12:01Glenjaminwhich is horrible
12:01zotyeah, i had that thought and got distracted. is that doable / pure evil?
12:01zot(i can accept doable evil for now, since i've already crossed the line once or twice just to make the tests work.)
12:02clgvzot: 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:02zotyeah, that's what i've done elsewhere.
12:03winkhmm, anyone knows of a dsl/example/something related how to define a flow of sorts?
12:03winkactual problem: a storm topology. the builder syntax (java) is horrible. I might try to write some "config" and read that
12:05zotclgv: that's my path, apparently, although it will mark the first conversion from defrecord -> deftype, between the 2 languages, which makes me … nervous.
12:06clgvzot: I'd change the CLJS implementation as well.
12:07zotthat thought crossed my mind too, and probably doesn't cost me toooo much.
12:09zotclgv: thanks for the thoughts, i appreciate the shared wisdom :)
12:10clgvzot: no problem ;)
12:29omis there a better way to do this?:
12:29om,(def index {1 [:a :b :c] 2 [:a :c] 3 [:a :d]})
12:29clojurebot#'sandbox/index
12:29om,(defn r-map [ids] (apply merge-with into (for [[k vs] ids, v vs] (hash-map v (vector k)))))
12:29clojurebot#'sandbox/r-map
12:30om,(r-map index)
12:30clojurebot{:c [1 2], :b [1], :d [3], :a [1 2 3]}
12:31gfredericksom: looks pretty reasonable to me
12:33omgfredericks: no way to avoid n^2 order, I guess?
12:33clgvom: you need to specify at least one goal to put "better" into context ;)
12:34clgvom: no that's possible in O(n)
12:34omclgv: right ;) : say, 1) more efficient 2) more idiomatic
12:35clgvom: you can do it with `reduce-kv`
12:35omthanks gfredericks, clgv I'll stick with it
12:36clgvn^2 is aweful for that task ;)
12:36omoh
12:36omclvg: this is why I asked ;)
12:37gfrederickswhat's n^2 about it? what's n?
12:37clgvom: with more precise estimation both version end up with O( m*n ) with number of entries n and maximum number of vals m
12:38arrdemgfredericks: think should I back out that options map edit to the wiki?
12:38omclgv: yeap, sure, in my example n=m in the worste case
12:38gfredericksarrdem: the what??
12:38lazybotgfredericks: What are you, crazy? Of course not!
12:38justin_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:38clojurebot{:a [1 2 3], :b [1], :c [1 2], :d [3]}
12:39arrdemgfredericks: https://groups.google.com/d/msg/clojure/yzLCZh-GiQ8/nXiIFewvdusJ and your reply
12:39justin_smithom: nested reduce ^
12:39om(inc justin_smith)
12:39lazybot⇒ 218
12:39gfredericksarrdem: I haven't looked at the clojure list in decades, are you confusing me with gtrak?
12:39arrdemderp sorry man
12:39omthks folks
12:39gfredericks(inc gtrak) ;; where is that guy anyways
12:39lazybot⇒ 13
12:40arrdemI haven't seen him around here in ages...
12:40justin_smithyeah, it's been a while
12:40justin_smith$seen gtrak
12:40lazybotgtrak was last seen quittingRemote host closed the connection 1 week and 6 days ago.
12:40gfredericksI hung out with him at strangeloop a good bit but that's it
12:40justin_smithonly a week!
12:40arrdemjustin_smith: hey man that's a lot of clock cycles
12:41gfrederickshe might be the only peer named Gary I've ever known
12:41gfredericksit's an unfamiliar feeling
12:41clgvjustin_smith: one angel dies when you use `reduce` on a map ;)
12:41justin_smithhaha
12:41clgvevery time :P
12:42justin_smithclgv: so are you saying I should be using reduce-kv or what?
12:42mavbozoi 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:42clgvjustin_smith: yes
12:42justin_smithclgv: the inner one is not on a map, btw
12:42clgvjustin_smith: but the outer one
12:43justin_smithclgv: I think I misenterpreted "every time"
12:43justin_smith,(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:43clojurebot{:a [1 2 3], :b [1], :c [1 2], :d [3]}
12:43omclgv, justin_smith: this doesn't change much ;)
12:44justin_smithom: I'm sure he has a good reason for making the distinction
12:45omjustin_smith: you mean to prefer the 3 arg reduce-kv to destructuring?
12:45clgvom: `reduce-kv` is more efficient and semantically the better fit
12:46omclgv: thanks, I'll cast a look at the source
12:46justin_smithyeah, it's the more specialized version I just keep forgetting
12:46justin_smithom: the source is uninformative
12:46omregarding effciency?
12:46justin_smithunless you go find the java underlying it I guess
12:46justin_smithregarding anything, it's just an interop call
12:46clgv$source reduce-kv
12:46lazybotreduce-kv is http://is.gd/mzlL83
12:46omyeap I see that now ;)
12:47clgv$source APersistentHashMap
12:47lazybotSource not found.
12:47clgv$source PersistentHashMap
12:47lazybotSource not found.
12:47clgvdamn...
12:47omcider shows it in a snap ;)
12:47justin_smithom: clgv: semantically better, perf wise the difference is negligable https://www.refheap.com/98938
12:48Bronsajustin_smith: that's kinda surprising
12:48justin_smithit might make a bugger difference to pull out the fnil
12:48clgvjustin_smith: make the map bigger and you'll see ;)
12:49justin_smithBronsa: that's from a 1.6 repl
12:50justin_smithBronsa: one moment, something weird might have been going on in my repl
12:52justin_smithI accidentally ran the reduce-kv one twice, because my inferior-lisp is being stupid
12:52justin_smithand the presence of the inputs is misleading compared to what generated them
12:54justin_smithBronsa: clgv: https://www.refheap.com/98938 updated, the difference is less negligable, but still relatively small
12:55clgvjustin_smith: again, try a bigger map
12:56justin_smithI don't know about you, but bigger maps aren't the common case in my code
12:56clgvwell, then it's not worth it for you
12:57clgvthe difference is 6% and the reduce-kv is probably not the dominant part in that form
12:57justin_smithclgv: as expected, replacing (fnil conj []) as an inline with a top level def makes a bigger perf difference
12:57justin_smithhmm... maybe not bigger, similar
12:58ompretty interesting, thanks justin_smith:
12:59danlentzso, reduce on a map is inefficient?
13:00bendlas,(doc reduce-kv)
13:00clojurebot"([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:00omI am dealing with adjacency tables and they are getting bigger: I'll do some testing
13:00justin_smithdanlentz: I think it's more that reduce-kv is more optimized. For example it avoids the usual destructuring, if nothing else.
13:05danlentzseems like a seq of MapEntries would get destructured at some point
13:06justin_smithchouser: yeah, I found some more detailed info, and the specific github repos being ddosed are tools for circumventing the Chinese government firewall.
13:06justin_smithdanlentz: destructuring isn't just about getting some values out of a container though
13:06justin_smithit's relatively heavyweight (the destructuring syntax specifically)
13:07justin_smithnot like it will be a bottleneck, but it's big enough to consider taking it out of code that is in a bottleneck
13:08danlentzthats 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:24BinaryResultA quick reminder, Disco Melee is currently hiring clojure developers https://docs.google.com/document/d/1GvnrSCUbYgbY9XdFs_DUx-0QZG2bIYT8Mbr0zdpTeew/edit?usp=sharing
13:31rizohey, 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:31rizoanyone knows what can cause it?
13:31justin_smithrizo: is it a local or remote repl?
13:32rizolocal one
13:32justin_smithrizo: how are you accessing the repl - from an editor?
13:32rizono, from the shell directly
13:33justin_smithOK, it's weird that there would be no indication of why the repl failed
13:33rizojustin_smith: $ `lein repl` ... nREPL server started on port 58236 on host 127.0.0.1 - nrepl://127.0.0.1:58236
13:34rizofull output: https://gist.github.com/rizo/e20ed0d3dc53daafb92a
13:34justin_smithand when does this happen?
13:35justin_smithjust randomly? immediately on startup?
13:35rizoI'm running an analytics system with a scheduler component (cronj), cassandra and redis. And it just fails in the middle of calculation
13:35justin_smith137 means it got forcibly killed
13:36justin_smithit could be a victim of linux kernel memory overcommit
13:36rizoI'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:36justin_smithrizo: is this on linux?
13:36rizoubuntu lts
13:37justin_smithso, when you ask linux for memory, it always says yes
13:37rizoIt runs for like 2 - 5 minutes and then fails
13:37justin_smithand if you try to use memory that isn't physically there, a random process gets killed
13:37justin_smiththe more memory you are using, the higher the chance your process is killed
13:37rizohappende on two different machines. same project same docker container
13:37rizo(yes, i'm using the clojure:latest docker image, forgot to mention)
13:38justin_smithunless 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:39rizowell... both of the servers have 32G of memory and I don't think they used it all during the execution
13:39justin_smithrizo: then find out what sends your process a sigkill
13:39justin_smithand turn on core dumps, you can use gdb to find out exactly what was happening when the sigkill happened
13:40justin_smithbut really, random sigkill almost always means memory overcommit
13:40rizoI'll try it, thanks
13:42justin_smithrizo: funny enough, first google hit for signal 137 from java, was someone who was getting their cassandra server killed because of memory overcommit
13:42rizoIt's really strange since I already tested the project with far more input data but it never failed this way
13:42justin_smithrizo: could be as simple as something that uses n^2 memory that snuck into the codebase
13:43rizojustin_smith: in my case it's a client cassaforte, I fetch around 5gb for batch processing
13:43justin_smithrizo: OK, I'd say profile things, turn on core dumps, check memory usage settings for the container if applicable
13:44rizowill 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:44justin_smithrizo: no, exit code 137 means the process received a sigkill
13:45justin_smiththe signal sent via kill -9
13:45justin_smithor when you access overcommitted memory
13:45rizomakes sense
13:47rizojustin_smith: thanks for the tips ;)
13:50rizojustin_smith: one of the recent changes was related with the cache handling, so it may have affected the memory usage
13:50justin_smithrizo: yeah, that smells right
13:51justin_smithrizo: 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:51justin_smithit makes a nice graph
13:52justin_smithand if I'm right, you'll see an attempt to jump up in mem usage just before the process is killed
13:54rizojustin_smith: yeah, one of my colleague uses it. will try it now
13:58JanMan_'ello
14:00JanMan_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:02puredangerJanMan_: maybe you should sponsor a Clojure conference
14:02arrdem(inc puredanger)
14:02lazybot⇒ 39
14:03danlentz,danlentz
14:03clojurebot#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:03arrdem(identity danlentz)
14:03lazybotdanlentz has karma 1.
14:03justin_smithdanlentz: it's only a pseudo syntax
14:04danlentz,(def danlentz Math/PI)
14:04clojurebot#'sandbox/danlentz
14:04danlentz,danlentz
14:04clojurebot3.141592653589793
14:04danlentz(identity danlentz)
14:04lazybotdanlentz has karma 1.
14:05JanMan_puredanger: Yup will be at Clojure West and hosting our local Clojure group
14:05puredangerJanMan_: thanks! We opened the sponsorship prospectus for http://euroclojure.org/sponsorship today too.
14:13JanMan_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:13puredangerno worries, just doing my job :)
14:13JanMan_ABC: Always Be Closing
14:15dybaThe other day I asked about a nif macro, a numeric if that looks like this:
14:15joe124how do i convert a string to an integer or number?
14:15dyba(defmacro nif "Numeric if. `expr` must evaluate to a number." [expr pos zero neg] `(cond (pos? ~expr) ~pos (zero? ~expr) ~zero :else ~neg))
14:16dybaI understand this version is buggy because it doesn't account for side effects
14:16dybaRather, the correct way to define this macro is with a gensym
14:17dyba(defmacro nif [expr pos zero neg] (let [e (gensym)] `(let [~e ~expr] (cond (pos? ~e) ~pos (zero? ~e) ~zero :else ~neg))))
14:17Bronsadyba: you want something like (defmacro nif [expr pos zero neg] `(let [expr# ~expr] (cond (pos? expr#) ~pos ..)))
14:17dybaBronsa: that was my next question, if I could use the # with a binding
14:18Bronsadyba: yes, most of the time there's no reason toe us (gensym) directly in clojure
14:18Bronsato use*
14:18dybaI 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:18Bronsathere are cases where you will need it, but this is not one of those
14:18dybaexpr#
14:19joe124how do i convert a string to an int or have user-input take in their input as an int?
14:19Bronsadyba: right, the auto-gensym thing works only in the context a syntax-quote
14:19justin_smithdyba: why is this a macro?
14:24amalloyjustin_smith: because it only evaluates one of pos/zero/neg
14:24justin_smithahh, of course
14:25dybajustin_smith: if you make it a function, you don't account for side effects
14:25dybathat is, evaluating expr may repeat the result more than once
14:26dybaOh, I just saw amalloy answered
14:28joe124can someone help me with my tiny function? http://pastebin.com/KNv9UY7z
14:28joe124(i'm a beginner)
14:29justin_smithjoe124: int doesn't have side effects
14:29justin_smithjoe124: also, your let has too many ()
14:29justin_smitharound it
14:30joe124ok one sec
14:30justin_smithjoe124: so user-input is a string, throughout the entire function
14:30justin_smithalso, int doesn't work on strings
14:31joe124what is the proper way to either input an int from a user or convert a string to an int?
14:31justin_smith,(Integer/parseInt "1")
14:31clojurebot1
14:32joe124it says no such namespace: integer
14:32justin_smithjoe124: I guess you didn't capitalize it properly
14:32justin_smithjoe124: 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:34joe124does this l ook better? http://pastebin.com/sJeeQaiA
14:34justin_smiththat looks like it is probably right
14:34justin_smithdid you try it?
14:34joe124yah it works,
14:34joe124i'm wondering is this a proper functional style?
14:35justin_smithit's printing a response rather than returning anything useful
14:37justin_smithand it's inherently an IO thing - it takes user input and prints, there's no way to really do those things "functional"
14:37joe124ok one sec
14:38Glenjaminyou can do more to separate the IO from the computation, but it's hard in a 3 line example
14:38justin_smithyeah
14:39justin_smithI think the distinction is harder to derive for something so simple
14:39joe124thats a g ood point lol
14:39joe124can you explain why this code doesn't w ork http://pastebin.com/qGCMWchC
14:40joe124is my 'if' statement in the wrong parenthesis or something
14:40justin_smithjoe124: true and false are not functions
14:40justin_smithso you can't call them
14:40joe124yah i just want to return them
14:40justin_smithparens don't do that, they call things
14:41justin_smithjoe124: that function could be (defn is-greater-or-equal-to-five [x] (>= x 5))
14:41Glenjaminhttp://pastebin.com/Fi5djbkh perhaps
14:41justin_smith(inc Glenjamin)
14:41lazybot⇒ 18
14:42mpenetrizo: you're fetching the data in a single query?
14:43mpenetrizo: anyway it's probalby not the main issue
14:46arrdemHas 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:46joe124thank you glenjamin and justin_smith
14:46justin_smitharrdem: apply would become a pain in the ass to implement
14:46justin_smitharrdem: is my suspicion at least
14:47justin_smithcurrently it isn't a macro, and doesn't have to worry about leaving args unevaluated
14:50rizompenet: not alway. the queries run in sequence but in total there must be dozens of them
14:50joe124When is object oriented programming a better decision to use than functional, and vice versa?
14:51danlentzwhen in rome…
14:51mpenetrizo: if you can parallelise them alia will be a lot faster at this kind of things
14:56mavbozojoe124: in what context? clojure?
14:58justin_smithjoe124: 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:59danlentzwait, when you dont have tight memory constraints?
15:00justin_smithdanlentz: neither is apropriate for situations with tight memory constraints
15:05anti-freezeHey everyone. Does anyone know how to include domina in selmer after the clojurescript compiler does its work?
15:06anti-freezeI keep getting blank source files when they're actually included
15:08anti-freezeOr infact any of the Compiled JS files in the js/out folder
15:08anti-freezecompiled CLJS*
15:10ambrosebs,(reduce + 0 [1 2])
15:10clojurebot3
15:15joe124(reduce #(* % 2) myList) why doesnt this work?
15:16arrdemjoe124: reduce takes a function of two arguments. Your provided function is a function of one argument.
15:17emaczenIs there a function that combines range and take?
15:17emaczenI know of nth rest, but I would also need an nthfirst
15:17emaczenbut I am also hoping that these utilities already exist
15:18joe124(reduce #(* % %) lst) ?
15:18mavbozo(reduce #(* %1 %2) lst)
15:19joe124i want to take each element in the list, double it, then multiply it by the next element
15:19arrdemjoe124: okay, so #(* 2 %1 %2) would do it for you.
15:20joe124woah thanks
15:20arrdemyou may need to give reduce the base case of 1.
15:20arrdemotherwise 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:21arrdemso ##(reduce #(* 2 %1 %2) 1 [2 3 4 5])
15:21lazybot⇒ 1920
15:22arrdem##(reduce * (map #(* %1 2) [2 3 4 5]))
15:22lazybot⇒ 1920
15:22arrdemw00t
15:22joe124reduce is scary can i just use map?
15:24jroesdon't be afraid!
15:24puredanger,(*)
15:24clojurebot1
15:25arrdemjoe124: how could you solve this problem using only map? you need to accumulate a result over each element of the seq.
15:25arrdemmap will just give you a new seq back with everything multiplied by two for instance.
15:25joe124thats true
15:26joe124can you give me a problem so solve to practice using reduce
15:27arrdemjoe124: implement get-in using reduce. it's not too hard.
15:28joe124what does get-in do
15:28arrdemso (get-in {:a {:b {:c 1}}} [:a :b :c]) -> 1
15:29joe124so it adds the values of everything in there?
15:29arrdemI suppose this is perfect #clojure-beginners material..
15:29joe124omg that exists
15:29spiedenjoe124: it paths into nested maps using a sequence of keys
15:30joe124(get-in {:a {:b {:c 1}}} [:a :b]) -> {:c 1} ?
15:30arrdemjoe124: bingo
15:30spiedenyep
15:30danlentzwell
15:31danlentz(map vector lst (rest list))
15:31danlentzwill break it into pairs for you
15:31joe124i dont know what vector and rest mean
15:32arrdem$grim clojure.core/rest
15:32lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/rest
15:32arrdem$grim clojure.core/vector
15:32lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/vector
15:32arrdemsince good 'ol hiredman has banned me from clojurebot's doc functionality
15:32danlentzbut reduce is better
15:33arrdemjoe124: so how can we do get-in with reduce?
15:34joe124we have to change [:a :b :c] to look like ({{:a {:b {:c}}) so it evaluates the :c
15:34danlentzarrdem: are you calling hiredman a bot-blocker
15:34danlentz;)
15:35joe124is it mainly a formatting problem?
15:36arrdemjoe124: nope. what does reduce do?
15:37joe124sums everything?
15:37joe124if you use +
15:37danlentzjoe124: it is important to understand that [:a :b :c] and {:a {:b {:c nil}}} are not just formatted differently, but structurally different
15:38joe124sure but if we can format it correctly and put () around it it will evaluate to get the value we want
15:38Seyleriusjoe124: It bangs everything through one function.
15:39joe124im just a bit confused between reduce and map
15:39joe124i know map applies a function to everything
15:39arrdemyep.
15:39SeyleriusBasically, it starts with the first two, and repeats with the next and the result of the first, and so on.
15:39danlentz,(doc reduce)
15:39clojurebot"([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:40arrdemeh docstring truncation
15:40arrdem$grim clojure.core/reduce
15:40lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/reduce
15:41joe124so (reduce + [1 2 3]) is like (+ (+ 1 2) 3)
15:41arrdemexactly
15:41jroes,(reduce + [1 2 3])
15:41clojurebot6
15:42arrdemit'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:42arrdemyou can specify the accumulator by giving three arguments, being the function, the accumulator and then the sequence of inputs.
15:43arrdemso to go back to the get-in example
15:43arrdemwe have the function
15:43arrdem$grim clojure.core/get
15:43lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/get
15:43arrdem##(get {:a 1} :a)
15:43lazybot⇒ 1
15:44arrdemso we can write get-in as the reduce of get over the input datastructure and the list of keys.
15:44arrdem##(reduce get {:a {:b {:c 1}}} [:a :b :c])
15:44lazybot⇒ 1
15:45arrdemwhich is the same as saying (get (get (get {:a {:b {:c 1}}} :a) :b) :c)
15:45joe124i dont get it
15:46joe124wait
15:46joe124so the first get returns what
15:46danlentzsee how it follows the same pattern as what you did a moment ago with +
15:46joe124i mean the most inside get
15:46arrdem##(get {:a {:b {:c 1}}} :a)
15:46lazybot⇒ {:b {:c 1}}
15:47danlentzwhat does the second one return?
15:47arrdemso {: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:47joe124second get returns {:c 11}
15:48arrdem{:c 1} yes
15:48danlentzyup
15:48danlentzand the third?
15:48joe124third get returns :c
15:48jroes,(get {:c 1} :c)
15:48clojurebot1
15:48arrdemwhy would the third return :c?
15:49joe124well it returns :c but then changes to it's key or whatever of 1
15:49arrdemthe third will get the value named by the key :c from the map {:c 1}
15:49joe124i mean value yeah
15:51joe124##(reduce get {:a {:b {:c 1}}} [:a :b])
15:51lazybot⇒ {:c 1}
15:51joe124##(get {:c 1} [:c])
15:51lazybot⇒ nil
15:52joe124?
15:53nkozajoe124: (get-in {:c 1} [:c]) or (get {:c 1} :c)
15:54joe124why does get-in use a vector as an argument
15:54nuwanda_because it's supposed to go through nested data structures, the vector has the list of keys to lookup
15:55arrdemjoe124: okay so each iteration of reduce is (reduce f (f (first col)) (rest col)), right?
15:56joe124what does first col mean
15:56jroescollection
15:56arrdemcol is shorthand for collection. the sequence of inputs that reduce takes is named col iirc.
15:56arrdemfirst is a function.
15:56arrdem$grim clojure.core/first
15:56lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/first
15:57arrdem##(first [1 2 3])
15:57lazybot⇒ 1
15:57arrdem##(first [2 3])
15:57lazybot⇒ 2
15:57arrdem##(first [3])
15:57lazybot⇒ 3
15:57arrdemetc.
15:57joe124 (reduce f (f (first col)) (rest col)) so...
15:58arrdemoops. (reduce f (f acc (first col)) (rest col))
15:58arrdemsorry I dropped the accumulator
15:58arrdemright? because the next value of the accumulator is (f acc (first col))
15:58joe124(reduce f (f acc (first col)) (rest col)) ah im seeing
15:59joe124so in '(1 2 3) first col is 1 rest col is '(2 3)
15:59arrdemyep.
15:59joe124where do we inc first col?
15:59joe124so it moves to the next one
16:00arrdemwe don't per se
16:01arrdem(reduce [f acc col] (if (empty? col) acc (reduce (f acc (first col)) (rest col)))))
16:01arrdemso 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:02joe124what is this showing
16:02joe124how to implement reduce ?
16:02arrdemyep. a recursive reduce implementation.
16:02arrdemyou could also do it as a while loop but the two are equivalent.
16:02joe124is recursive is always preffered
16:02joe124in clojure
16:03arrdemsorta. Unfortunately we don't have tail call optimization so the loop and the recursive implementation do actually do different things.
16:04Bronsahttps://github.com/clojure/clojure/commit/caa3b4fdc8da5880309b317d0045b1280181c452
16:04arrdeminstead we have recurl.
16:04arrdem*recur
16:04joe124(reduce [f acc col] (if (empty? col) acc (reduce (f acc (first col)) (rest col))))) im having a tough time understanding this
16:04hiredmanwhooo boy
16:04joe124like what does this do first?
16:05hiredmanyou are missing some parts
16:05hiredman,(doc reduce)
16:05clojurebot"([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:05arrdemhiredman: doing foldr not reduce for simplicity
16:06arrdemnot that you can hear me I think.
16:06joe124i have to eat arrdem wil u be here later
16:06arrdemyep. hit me up over in #clojure-beginners.
16:06joe124ok sure thanks a ton
16:06arrdemmy pleasure
16:13arrdemBronsa: yeow. thanks for the heads up.
16:14FrozenlockI might need to do some low level network communication. Is clojure-protobuf the way to go?
16:27hyPiRionIf 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:31FrozenlockIt's to communicate with a protocol on UDP. Playing with bytes and stuff. (My first time going this low level)
16:34borkdude"identifying the platform (:clj, :cljs, :cljr)"... what's cljr?
16:35arrdemborkdude: cljclr?
16:35arrdemI'm guessing.
16:35arohnerborkdude: .net CLR
16:35borkdudeah
16:35arohnerman, cond :let would make my life simpler right now
16:36hyPiRionCan I identify other platforms like that?
16:36hyPiRionsay, :?!$ as Swearjure
16:36arohnerlol
16:36arohnerswearjure isn't a platform :-p
16:37arrdemI'd vote for swearjure support on jira
16:37Bronsapuredanger: 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:46puredangerBronsa: thx, just starting to look at it
16:46Bronsapuredanger: 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:46puredangerthe reported error looks like it's masking the real error
16:47Bronsayeah
16:47puredangerbut that should be fixed too :)
16:47Bronsapuredanger: the first one is the one that's causing wrong tests to be generated
16:47puredangerwell, they're random. some of them are expected to be bogus
16:47Bronsapuredanger: the second one is in the error reporting, trying to shrink, that's causing the NPE
16:47Bronsapuredanger: yeah, it looks like the wrong one are not getting filtered out correctly
16:48Bronsae.g. I just got a (->> [-2 -4 -1] (take-while empty?))
16:48puredangerthey don't get filtered at all, they just produce errors
16:49Bronsapuredanger: 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:50puredangerclose - those exceptions from the different forms are treated as equivalent
16:50puredangeran exception in one and no exception should not succeed
16:50Bronsaah, gotcha
16:51puredangerwe're basically applying a series of random transforms to a random input in a variety of ways
16:51puredangerlooking for differences
16:51BronsaI see now
16:53hiredmanmaybe 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:54Bronsapuredanger: 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:55puredangersure, I'll take it :)
17:01puredangerohhh, I know what the problem is
17:02sveriHi, 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:22otwieraczhello
17:22otwieraczIn my ~/.lein/profiles I've got:
17:22otwieracz{:user {.... :dependencies [[org.clojure/tools.nrepl "0.2.10"]] }}
17:22otwieraczHowever:
17:23otwieracz $ lein repl
17:23otwieracznREPL server started on port 38613 on host 127.0.0.1 - nrepl://127.0.0.1:38613
17:23otwieraczREPL-y 0.3.5, nREPL 0.2.6
17:23justin_smithotwieracz: put it in :dev
17:23otwieraczWhy 0.2.6 is here?
17:23mavbozohardcoded to leiningen
17:23justin_smith:dev will override the leiningen version, :user will not
17:24otwieraczOK, I changed from :user to :dev
17:24otwieracz $ lein repl
17:24otwieracznREPL server started on port 56471 on host 127.0.0.1 - nrepl://127.0.0.1:56471
17:24otwieraczREPL-y 0.3.5, nREPL 0.2.6
17:24otwieracz(I've already tried it :))
17:25justin_smithotwieracz: is this in a project, or a projectless repl?
17:25mavbozoas of now, you can only override it in a project
17:25otwieraczprojectless repl.
17:25otwieraczIt works in project.
17:25mavbozothere's a discussion here a couple of days ago
17:27gfredericksis there anything comparable to unsigned-bit-shift-right in clojure pre-1.6
17:27justin_smith~unsigned
17:27clojurebotexcusez-moi
17:27Lewixgfredericks: smell like a c++ guy
17:28otwieraczmavbozo: OK, so if I need nrepl 0.2.10 here, because 0.2.6 is buggy
17:28otwieraczWhat should I do?
17:29mavbozootwieracz: for now, you must work in a project dir
17:30justin_smithotwieracz: java -cp $(cat magic-cp-file-you-created-based-on-lein-cp) clojure.main
17:30justin_smithis also an option
17:30justin_smithlein cp, followed by a bit of text editing to generate that file
17:30justin_smithor you can put the java command plus the whole class path literal in a shell script of course
17:31justin_smithwithout a project, lein isn't really doing much for you beyond generating that classpath anyway
17:31justin_smithso why not cache that part, fix it, and use java
17:41mavbozojustin_smith: i tried it, create nrepl-server, start it, and I can connect it by using cider
17:41oddcully(inc justin_smith)
17:41lazybot⇒ 219
17:41oddcullyalias-ed that
17:41mavbozojustin_smith: but why I still got message "Please, install (or update) cider-nrepl 0.8.2 and restart CIDER"
17:41mavbozocider-nrepl is in the classpath
17:41justin_smithmavbozo: missing the cider-nrepl middleware at runtime?
17:42justin_smithmaybe it isn't initialized properly?
17:43danlentzis there a difference between clojurebot and lazybot for evaluating expressions? ie, comma vs. hashhash
17:43danlentz,danlentz
17:43clojurebot#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:43mavbozojustin_smith: ah, you're right, I have to put another parameter in nrepl-server/start-server
17:43danlentz,(def danlentz 1)
17:43clojurebot#'sandbox/danlentz
17:43danlentz,danlentz
17:43clojurebot1
17:44danlentz##danlentz
17:44danlentz##(def danlentz 2)
17:44lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
17:44danlentzah
17:44danlentz##(identity danlentz)
17:44lazybotjava.lang.RuntimeException: Unable to resolve symbol: danlentz in this context
17:45mavbozojustin_smith: boom! done!
17:45danlentz,(all-ns)
17:45clojurebot(#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:45mavbozo(inc justin_smith)
17:45lazybot⇒ 220
17:46danlentz##(all-ns)
17:46lazybot⇒ (#<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:46danlentzah, neat
17:49danlentz##(dir lazybot.plugins.unix-jokes)
17:49lazybotjava.lang.SecurityException: You tripped the alarm! lazybot.plugins.unix-jokes is bad!
17:50danlentz,(dir lazybot.plugins.unix-jokes)
17:50clojurebot#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:51danlentz##(ns-publics ‘member:lazybot.plugins.unix-jokes)
17:51lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
17:52_orangejuicehttps://www.irccloud.com/pastebin/RLahrnCX
17:53_orangejuicewhy does that return false?
17:53_orangejuicehttps://www.irccloud.com/pastebin/UavVRGrF
17:54mavbozo,(doc identical?)
17:54nuwanda_,(doc identical?)
17:54clojurebot"([x y]); Tests if 2 arguments are the same object"
17:54clojurebot"([x y]); Tests if 2 arguments are the same object"
17:55mavbozo_orangejuice:^that's your answer
17:55nuwanda_basically, I don't think identical? is what you're after here, if you expect that to return true
17:55_orangejuiceidentical? checks if its referring to the same object but and = checks if data is same?
17:55mavbozoyup
17:56_orangejuiceThank you!
17:58caternwhat are some features of other languages that clojure is able to implement/steal thanks to macros?
17:58caterntypes, goroutines, pattern matching, others?
18:01mavbozostm
18:02caternstm?
18:02mavbozodosync
18:02mavbozofor software transactional memory
18:02caternah
18:07spieden"->" reminds me of "$" in haskell -- a bit different though
18:08caternmavbozo: what other languages have stm? Erlang, right?
18:08mavbozohaskell
18:09justin_smithcatern: the threading macros / doto are two other examples
18:09caternjustin_smith: but those aren't actually stolen from other languages
18:09justin_smithdoto being effectively like the OO a.x().y() etc.
18:09justin_smithcatern: other lisps don't have them :)
18:09justin_smithbut can, if they adapt our macros
18:10mavbozocatern: erlang does not have STM
18:10caternI don't really know anything about erlang, but I though Clojure concurrency stuff was Erlangish?
18:11danlentzjustin_smith: https://github.com/danlentz/cl-ctrie/blob/master/ctrie-util.lisp#L199
18:11justin_smithcatern: not at all
18:11justin_smithcatern: it's haskellish
18:11caternoh, okay
18:11justin_smithdanlentz: yeah, I am glad those constructs are catching on :)
18:12danlentza recursive macro, no less
18:12justin_smithdanlentz: for all I know someone tried them in common lisp before clojure came around, but I never saw them until I learned clojure
18:12mavbozocatern: http://clojure.org/state -> rich hickey chose not to Erlang-style actor model
18:12caternthe threading macros are being added to elisp core, I believe
18:12muraikiheh I was right about to paste that mavbozo
18:12caternmavbozo: oh, thank you
18:12justin_smithcatern: yeah, maybe clojure's biggest gift so far to the lisp world
18:13mavbozomuraiki: :p
18:13caternhttp://endlessparentheses.com/new-on-elpa-and-in-emacs-25-1-seq-el.html
18:15mavbozocatern: wooo.. clojure inspired sequence abstraction
18:16danlentzclojures greatest gift to the lisp world is a viable language in which you can work in lisp and get paid.
18:16FrozenlockIf only emacs was immutable...
18:16justin_smithhaha
18:16justin_smithdanlentz: if only that could be backported to other langs the way our new syntaxes are :)
18:16caternFrozenlock: if emacs was immutable then those new sequence abstractions wouldn't be added :)
18:17Frozenlockerrr
18:17caternyou'd have to create a new emacs with them included :P
18:17FrozenlockIf only emacs had immutable data-structure :-p
18:17justin_smithmy emacs is immutable, it just sits there and doesn't change no matter what I do
18:17justin_smithoh, never mind, that was just a super long line printing in a process buffer :)
18:18mavbozo(inc danlentz)
18:18lazybot⇒ 2
18:21mavbozocatern: we could just change the reference to point to the new emacs value
18:21caternmavbozo: like with gcc?
18:22caternand egcs
18:22catern:)
18:24caternhaha
18:24FrozenlockWow, 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:24caternmy type theory professor would be really mad at this statement
18:24catern"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:24caternhe would be so mad
18:25caternbecause he semifrequently says that he thinks part of the dynamic vs static thing is just a branding problem
18:25caternand 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:25caternwell here is Clojure exploiting that label! :D
18:26danlentzisnt static generally faster?
18:26caterndanlentz: yes :)
18:26caterndanlentz: but the public relations problem, you see, would lead you to believe otherwise...
18:27justin_smithcatern: you could switch dynamic with ad-hoc and retain the meaning and likely make that professor happy
18:27caternjustin_smith: quite so
18:28caternbut it wouldn't sound quite as good for clojure... :)
18:28justin_smithcatern: but I prefer clojure in part because I like to develop with an ad-hoc system with exposed underpinnings
18:29caternjustin_smith: what does "ad-hoc system" mean?
18:29mavbozocatern: rich hickey does not refer to dynamic typing in that sentence
18:29catern(in the way you are using it)
18:29caternmavbozo: yeah, but that's generally what people mean by "dynamic" when discussing programming languages :)
18:29justin_smithcatern: it means not in its final form, being modified while in use, with various abstractions only tentatively present
18:30justin_smithperhaps I am at heart more tinkerer than programmer
18:30danlentz“ad-hoc system” is how you pronounce “system” with a bad chest cold
18:31justin_smith"In military, ad hoc units are created during unpredictable situations, when the cooperation between different units is needed for fast action."
18:31danlentzI think working in lisp building things up in a very experimental, practical way is very helpful to me
18:31justin_smithyeah, that's what I am trying to get at
18:32danlentzhow often do you really know everything you need to know at the very beginning of a project when designing a top-down approach
18:32mavbozocatern: agree, back in my early programming days, i think interpreter~dynamic vs compiled~static
18:32danlentzwhen i was young I learned on applesoft basic, which was a very interactive REPL experience
18:32nicferrierhey all. is there a guide to embedding a repl in your app?
18:33danlentzhttps://github.com/clojure-emacs/cider-nrepl
18:33hiredmanhttps://github.com/clojure/tools.nrepl#embedding-nrepl-starting-a-server
18:33caternnicferrier: writing an app that isn't in Emacs? what an age it is!
18:33nicferrier:-)
18:33justin_smithnicferrier: as you'll see from those docs, it's quite easy
18:34nicferrierI don't really wanna embed nrepl.
18:34nicferrierI'd prefer just a readline like interface, basically just what clojure -m gives you.
18:34nicferrieror whatever the switch is.
18:34nicferrierstill. looking.
18:34Frozenlocknicferrier: If you are using CIDER, you'll probably want to add the cider.nrepl handler with it.
18:35nicferrierFrozenlock: I'm not. can't get on with cider.
18:35justin_smithnicferrier: in that case, dynamically bind *in* and *out* and *err*, then launch clojure.main
18:35nicferrierjustin_smith: when you say launch... you mean call?
18:35justin_smithperhaps in its own thread
18:35justin_smithdepending what all else you are doing
18:35justin_smithbut yeah
18:36nicferriercool.
18:36nicferrierand if I uberjar that it'll all be cool right?
18:36justin_smithand you can provide the "-m" "some.ns" args if you like
18:36justin_smithnicferrier: yup, clojure.main is gonna be in your uberjar
18:37nicferrierthat's awesome.
18:37nicferrierI wanna use it because I can't break through a firewall.
18:37mavbozo(inc justin_smith)
18:37lazybot⇒ 221
18:38justin_smithnicferrier the trick is of course providing valid *in* / *out* / *err* bindings, but if you can use the root bindings, that's a sinch
18:38mavbozonicferrier: not even ssh port-forwarding?
18:39justin_smithnicferrier: I use ssh -L for that typically, or ssh -R depending which side I am connecting from
18:39nicferrierha. you puny mortals.
18:39nicferrieryou haven't met *real* security people.
18:39justin_smithhaha
18:40danlentz*real* security people are undetectable
18:40justin_smithfair enough, have fun with clojure.main then :)
18:40nicferrierthey told me that at work today. "do ssh port forwarding!" and how I laughed when we got "fd closed"
18:40justin_smithnicferrier: 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:41nicferrierjustin_smith: exactly
18:41justin_smithand you can be much picker with clojure.main
18:41nicferrierbut 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:41justin_smithmaybe this is something that will be fixed with the socket repl in core
18:41mavbozowhat about unix domain socket?
18:41justin_smithmavbozo: nrepl can't use those
18:41hiredmannicferrier: well, you could just run the repl that clojure.main runs
18:41justin_smiththey are hard to use from clojure
18:42justin_smithfrom the jvm, even
18:42hiredmanthe jvm doesn't do domain sockets well
18:42nicferrieryeah, can't use unix sockts without c extension. guess what?
18:42justin_smiththe fact that hiredman ignores me keeps demonstrating itself
18:42mavbozojustin_smith: from security view point, it's good right?
18:42nicferrierbut yeah. I can use the clojure.main I reckon.
18:42justin_smithmavbozo: from a security view what is good?
18:42nicferrierjustin_smith: why does he ignore you? you're the most helpful person here!
18:43hiredmanour main work server embeds a socket repl listening on localhost, and we have a little netcat based client
18:43mavbozounix domain socket compared to tcp port
18:43justin_smithhe likely thinks I;m annoying, who knows
18:43nicferrierjustin_smith: oh well. you're not.
18:43justin_smithmavbozo: yeah, much more secure, but not accessible easily from jvm, because not portable to windows basically
18:43hiredman(that you run locally as *ctl script)
18:45mavbozonicferrier, justin_smith there is a junixsocket for unixdomain socket with jni. but still not portable to windows
18:45nicferrierjni is still c
18:45justin_smithmavbozo: yeah, it exists, but it isn't going to end up in clojure itself
19:42Seylerius,(defn dropper [coll n] (if (empty? coll) coll (into (take (dec n) coll) (dropper (drop n coll) n))))
19:42clojurebot#'sandbox/dropper
19:42Seylerius,(dropper [1 2 3 4 5 6 7 8] 3)
19:42clojurebot(5 4 7 8 1 ...)
19:43justin_smithSeylerius: into is different with lists, and take returns lists
19:43justin_smithwell, lazy-seqs, but they act like lists in this case
19:44justin_smith,(into () [1 2 3 4 5])
19:44clojurebot(5 4 3 2 1)
19:45SeyleriusRight.
19:45SeyleriusBecause into is conj-based
19:46SeyleriusI'm just struggling for the alternative.
19:47Seylerius,(defn dropper [coll n] (if (empty? coll) coll (into (into [] (take (dec n) coll)) (dropper (drop n coll) n))))
19:47clojurebot#'sandbox/dropper
19:47Seylerius,(dropper [1 2 3 4 5 6 7 8] 3)
19:47clojurebot[1 2 4 5 7 ...]
19:47SeyleriusHah.
19:48SeyleriusIt's not the prettiest thing ever, but it worked.
19:49gfredericks,(partition 2 3 (range 1 9))
19:49clojurebot((1 2) (4 5) (7 8))
19:49Seyleriusjustin_smith: got a suggestion to avoid the stacked intos?
19:49SeyleriusOh. Well, that's nice.
19:49gfredericks,(apply concat (partition 2 3 (range 1 9)))
19:49clojurebot(1 2 4 5 7 ...)
19:49justin_smithI think you can use subvec instead of take there to avoid the nested into
19:49justin_smithor just use concat, yeah
19:50Seylerius,(flatten (partition 2 3 (range 1 9)))
19:50clojurebot(1 2 4 5 7 ...)
19:50justin_smith~flatten
19:50clojurebotflatten 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:50SeyleriusHeh.
19:50SeyleriusOkay.
19:50SeyleriusPoint made.
19:50TEttinger,(apply concat (partition 2 3 (range 1 9)))
19:50clojurebot(1 2 4 5 7 ...)
19:53Seylerius,(apply concat (partition 1 2 (range 1 9)))
19:53clojurebot(1 3 5 7)
19:55hyPiRion,(defn aside [& fs] (fn [xs] (map #(%1 %2) fs xs)))
19:55clojurebot#'sandbox/aside
19:55hyPiRion,(defn dropper* [coll n] (if (seq coll) (->> (split-at n coll) ((aside butlast #(dropper* % n))) (apply concat))))
19:55clojurebot#'sandbox/dropper*
19:55hyPiRion,(dropper* (range 1 9) 3)
19:55clojurebot(1 2 4 5 7)
19:56hyPiRionoh, it drops a bit eagerly I guess
20:02danlentzthats what she said
20:05danlentzpretty interesting the different ways to approach dropper
20:11danlentzim 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:06Seyleriusdanlentz: It's problem #41 on 4clojure
21:08Seylerius,(defn dropper [coll n] (apply concat (partition (dec n) n coll)))
21:08clojurebot#'sandbox/dropper
21:09Seylerius,(dropper [:a :b :c :d :e :f] 2)
21:09clojurebot(:a :c :e)
21:09Seylerius(= (dropper [:a :b :c :d :e :f] 2) [:a :c :e])
21:09Seylerius,(= (dropper [:a :b :c :d :e :f] 2) [:a :c :e])
21:09clojurebottrue
21:09Seylerius...
21:09Seylerius4clojure is saying I'm failing that unit test.
21:10Seylerius,(= (dropper [1 2 3 4 5 6] 4) [1 2 3 5 6])
21:10clojurebotfalse
21:11Seylerius,(dropper [1 2 3 4 5 6] 4)
21:11clojurebot(1 2 3)
21:11SeyleriusOkay, that's legit.
21:20jpavlickhi guys
21:21jpavlickI'm trying to get a clojure hello world running and I'm performing poorly.
21:21jpavlick~> lein run -m core.demo Can't find 'core.demo' as .class or .clj for lein run: please check the spelling.
21:21clojurebotExcuse me?
21:23TEttingerjpavlick: hm, did you start the project with lein new ?
21:24TEttingerI'm wondering if something was created and manually renamed
21:26joe1245can someone explain how this is valid code? http://pastebin.com/z8WtmYsh i thought the syntax was (myfunc [args] (body))
21:29TEttingerjoe1245: those are different parameter lists for the same fn name
21:30TEttingerit's how something like + can be (+ 1 2) or (+ 1 2 3 4 5)
21:30joe1245ok t hanks
21:31TEttingerso you could call that fn with one or two args
21:31joe1245also when i try to call it by (sum 3) it doesn't work I have to use (sum [3]) can you explain
21:32TEttingerit 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:32TEttingerso [3] works because it can be treated as a seq
21:32TEttingeryou could also use a set if you wanted, like #{3}
21:33TEttingeralso, vals is a poor choice for a parameter name, since it's already a fn in the standard lib
21:33TEttinger(doc vals)
21:33clojurebot"([map]); Returns a sequence of the map's values, in the same order as (seq map)."
21:33joe1245cool thank you
21:33joe1245btw how did you learn clojure
21:34TEttingeruh, mostly tinkering on lazybot plugins, which is not the best way to do it
21:34TEttingerbut brave clojure is excellent these days
21:34tahmidI would recommend brave clojure
21:34joe1245cool i'm doing that now
21:35TEttingerit does seem like brave clojure has good pacing and gets to important parts of clojure early on
21:35tahmidI like the vibe of it
21:35TEttingerI'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:36joe1245after i finish brave clojure what kind of project is clojure good at?
21:36joe1245i want to show something interactive to put on my website for example
21:37tahmidYou can do that with quil
21:39TEttingerclojure (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:39joe1245awesome looks like just what i wanted
21:39joe1245quil and stuff
21:40TEttingerI've used play-clj before, which is also cool but doesn't do things in webpages
21:41joe1245yah i want to do webpage stuff because really who wants to download fungame.exe
21:47tahmid‘(+ 2 3)
21:48tahmid,(+ 2 3)
21:48clojurebot5
21:53tahmid,(comp filter odd?)
21:53clojurebot#object[clojure.core$comp$fn__4446 "clojure.core$comp$fn__4446@3017a4f3"]
21:53tahmid(transduce (comp (filter odd?) (map inc)))
21:53TEttinger,(transduce (comp (filter odd?) (map inc)))
21:53clojurebot#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:54tahmid,(println clojure-version)
21:54clojurebot#object[clojure.core$clojure_version clojure.core$clojure_version@32315315]\n
21:54TEttinger,(transduce (comp (filter odd?) (map inc)) (range 10))
21:54clojurebot#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:54TEttinger,clojure-version
21:54clojurebot#object[clojure.core$clojure_version "clojure.core$clojure_version@32315315"]
21:54TEttingerhm
21:54TEttingerthat's not good
21:55tahmidit’s 1.7+ right ?
21:56vascan someone explain to me the use of [[ double brackets ]] in anonymous fxns?
21:56TEttingervas: it's used for destructuring
21:57TEttingergiving names to elements in a collection, as opposed to naming the collection itself
21:57vasyou just blew my mind
21:59TEttinger,((fn [start [internal insides within]] (+ start internal insides within)) 10 [1 2 3])
21:59clojurebot16
21:59TEttingerit gets better!
21:59TEttinger,((fn [start [internal insides within]] (+ start internal insides within)) 10 [1 2 3 4 5 6 7 8 9])
21:59clojurebot16
22:00TEttingerit 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:00vasAha!
22:01TEttinger,((fn [start [internal insides within :as somelonglist]] (+ start internal insides within (apply + somelonglist))) 10 [1 2 3 4 5 6 7 8 9])
22:01clojurebot61
22:03TEttingerusing destructuring is one of the main ways that clojure code can be made smaller and cleaner, especially code that deals with nested collections
22:04TEttinger(the biggest way is knowing as much of the standard lib as possible)
22:05TEttingermapcat is crazy cool
22:05gfredericks~mapcat is crazy cool
22:05clojurebotOk.
22:06vasI think I'm gonna print out core.clj and wallpaper my room with source code
22:06raspasovvas: haha
22:07TEttingerimagine if you did that for the java standard lib
22:07TEttinger"We're gonna need a bigger room!"
22:07raspasovTEttinger: hahaha
22:07vasHahaha at that point i might just rather know the bytecode by heart
22:08TEttingerhm, let's see what the largest files are in the openjdk source...
22:09raspasovTEttinger: what if you did it for Scala? oh boy, you'll have to re-wallpaper your room every year and a half!
22:09TEttingerhaha
22:10vasif i find the right artist and micropen i think i can get core.clj tattooed on my body
22:13vasthanks for the examples on maps, TEttinger
22:13vaser, [[ double bracks ]]
22:14TEttingerno problem!
22:23TEttingerone 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:23TEttinger 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:24TEttingermy god, there's a shell script in that java source
22:24TEttinger : 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~