#clojure log - May 04 2015

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

2:49 isaac_rks: what is clojure's position on the baltimore riots?

2:56 kovrik: Guys, how to configure Flycheck for Clojure?

2:58 TMA: ,(position 'clojure '(baltimore riots))

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

2:59 oddcully: isaac_rks: unless this is a clojure library, this is OT

3:00 isaac_rks: why are you trying to silence debate

3:00 #blacklivesmatter

3:02 oddcully: this channel is about the programming language clojure. there is a #clojure-offtopic channel, if you think you can discuss this only with fellow clojurists.

3:03 isaac_rks: is clojure a racialist programming language

3:05 wasamasa: lol

3:05 oddcully: how i wish i had /ignore implanted into my brain for rl

3:05 wasamasa: programming languages stand above such silly matters

3:05 unless you happen to come from a certain image board

3:06 oddcully: wasamasa: don't feed the troll

3:07 wasamasa: oddcully: you can help keeping this from entering #clojure-offtopic!

3:08 oddcully: hehe, sorry

4:27 wink: hmm, anyone got some UK dialup sample ip ranges? (or is from the uk and wouldn't mind giving me their first triplets?)

4:31 TEttinger: wink: it probably depends on the provider

4:31 wink: well of course. I don't need *all* :P

4:31 TEttinger: I always use DDG whenever I see a bare IP and want to know its geo location

4:31 wink: 2 or 3 would be plenty

4:31 yeah, but I need the other way round.

4:32 I did find some meanwhile

5:55 afhammad: how can I force lein to use a specific or min version of a lib? 'lein deps :tree' shows different version than what is in my target folder!

5:57 anyone about?

6:20 Kneiva: Is there a good tutorial or article about reify?

6:50 martinklepsch: what's a good way to test that something returns (constantly false) — not `false` but the function returned by constantly

6:56 TMA: martinklepsch: in general this is impossible -- it is equivalent to the halting problem

6:58 ,(constantly false)

6:58 clojurebot: #object[clojure.core$constantly$fn__4362 0x6bebb482 "clojure.core$constantly$fn__4362@6bebb482"]

6:58 TMA: ,#(and % false)

6:58 clojurebot: #object[sandbox$eval50$fn__51 0x76eb534c "sandbox$eval50$fn__51@76eb534c"]

6:59 TMA: ,(constantly (and false))

6:59 clojurebot: #object[clojure.core$constantly$fn__4362 0x2ecb4225 "clojure.core$constantly$fn__4362@2ecb4225"]

7:01 TMA: it is possible [in principle] to tell, whether the function was created by constantly

7:04 TEttinger: is there any way to use the values printed by the new object printer?

7:04 like if I want the "clojure.core$constantly$..." out of that

7:05 ,(= (constantly false) (constantly false))

7:05 clojurebot: false

7:05 TEttinger: ,(= (constantly true) (constantly true))

7:05 clojurebot: false

7:05 Bronsa: TEttinger it's not possible to compare functions

7:05 TEttinger: yeah I was wondering if they were the same object

7:06 Bronsa: they are not

7:06 TEttinger: ,(let [cf (constantly false)] (= cf cf))

7:06 clojurebot: true

7:06 TEttinger: ,(let [cf (constantly false)] (= cf (constantly false)))

7:06 clojurebot: false

7:06 TEttinger: interesting

7:06 Bronsa: not at all

7:07 constantly returns a new instance every time

7:07 TEttinger: Bronsa, I'm learning stuff, don't rain on my parade :P

7:07 Bronsa: functions can only compare by pointer equivalence

7:07 TEttinger sorry, didn't mean to sound mean

7:07 TimMc: $google serializable-fn

7:07 lazybot: [technomancy/serializable-fn · GitHub] https://github.com/technomancy/serializable-fn

7:07 TEttinger: yah, that

7:07 (inc TimMc)

7:07 lazybot: ⇒ 97

7:08 TimMc: (Note that this is not necessarily a recommendation.)

7:08 TEttinger: it's ok Bronsa, just keep toolnalyzating!

7:09 martinklepsch: TMA: interesting, thank you! I know realized that using (constantly false) was superflous in the first place and removed it

7:09 irctc: is clojure 1.7 stable?

7:10 or should i stick to 1.6

7:10 TEttinger: see topic

7:10 there may be bugs in 1.7, but we haven't seen any yet

7:10 we've been using 1.7-master in the bots here

7:10 Bronsa: irctc: it's stable enough that peoplle are already using 1.7.0-beta2 in production

7:11 irctc: i will give it a try

7:12 martinklepsch: there was this "concat is an antipattern" post the other day — I thought it was by alex miller but can't find it anymore — anyone a pointer?

7:12 antipattern probably a bit to strong. was more like "handle with care"

7:13 Bronsa: martinklepsch: http://stuartsierra.com/2015/04/26/clojure-donts-concat

7:13 martinklepsch: Bronsa: thanks!

7:17 zol: How can I use rename on a lazy seq? Like (clojure.set/rename ({:f 1}, {:f 2}) {:f id})

7:17 :id ~

7:17 wiruzx: Hey guys

7:18 Could you please tell me if core.typed works with destructuring defrecords?

7:23 Sorry, got it work

7:23 Should just use ann-form

7:23 irctc: Let say I have two nested maps over a lazy seq. Is there a way to first evaluate the first element on both maps, then the second, and so on.

7:41 m1dnight_: Guys, im trying to write my own function for fold but its not really working. I would like some pointers.

7:41 What I want is something like this:

7:41 (r/fold str ["foo" "bar"])

7:41 that actually works, but i figured Id do it with str/join

7:41 so I came up with this:

7:42 (r/fold #(apply clojure.string/join ", " %) ["foo" "bar"])

7:42 but that says I only pass 0 arguments to the fnction..

7:42 opqdonut: for the initial value?

7:43 m1dnight_: I thought about the intial value too, and (clojure.string/join ", " "") works just fine

7:43 opqdonut: your (r/fold str ["foo" "bar"]) probably does something like (str "foo" (str "bar" (str)))

7:43 m1dnight_: ohhh

7:43 opqdonut: that's not the initial value

7:43 m1dnight_: ,(str)

7:43 clojurebot: ""

7:43 m1dnight_: I see :)

7:43 opqdonut: ,(#(apply clojure.string/join ", " %)) -- this is your initial value

7:43 clojurebot: #error{:cause "Wrong number of args (0) passed to: sandbox/eval50/fn--51", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (0) passed to: sandbox/eval50/fn--51", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 28] [sandbox$eval50 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler ev...

7:43 m1dnight_: oh kay

7:43 might have to make it a bit more complex then I assume

7:44 or perhaps ,(#(apply clojure.string/jion ", " (when % % "")))

7:44 ,(#(apply clojure.string/jion ", " (when % % "")))

7:44 clojurebot: #error{:cause "No such var: clojure.string/jion", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: No such var: clojure.string/jion, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "No such var: clojure.string/jion", :at [clojure.lang.Util runtimeException "Util.java" 2...

7:44 opqdonut: nope

7:44 ,(#(apply clojure.string/join ", " &%))

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

7:45 opqdonut: ,(#(apply clojure.string/join ", " %&))

7:45 clojurebot: ", "

7:45 opqdonut: that

7:45 ,(#(apply clojure.string/join ", " &%) "a" "b" "c")

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

7:45 opqdonut: ,(#(apply clojure.string/join ", " %&) "a" "b" "c")

7:45 clojurebot: #error{:cause "Wrong number of args (4) passed to: string/join", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (4) passed to: string/join", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 44] [clojure.lang.AFn applyToHelper "AFn.java" 165] [clojure.lang.AFn applyTo "AFn.java" 144...

7:45 opqdonut: *sigh*

7:45 m1dnight_: I think I get the point though :D

7:45 opqdonut: ,(#(clojure.string/join ", " %&) "a" "b" "c")

7:45 clojurebot: "a, b, c"

7:45 opqdonut: yeah

7:45 you could also consider an explicit init arg to fold

8:52 zot: with the new volatile! bits, the limited docs say "Volatiles are faster than atoms but give up atomicity guarantees so should only be used with thread isolation." — where does said thread isolation originate? looking at the uses in 1.7.0-beta2 core.clj, such as drop, I don't see it. Or do I understand what the line is saying?

8:52 puredanger: transducers control the scope of application

8:53 zot: so if i wanted to use in another context, what example could i follow to achieve the same result?

8:53 puredanger: enforce thread isolation :)

8:54 the key is that there is no atomic way to read, then write a volatile (like you can do with an atom)

8:54 so that introduces a race condition, unless you can ensure that nothing else changes the volatile between the read and the write

8:55 guaranteeing that only a single thread modifies the volatile gives you that guarantee

8:56 zot: gotcha

8:56 thanks!

8:57 puredanger: all of the current core uses for transducers operate in the single calling thread

8:58 core.async channels with go blocks may actually end up executing over multiple threads in the pool, but other constraints guarantee that only a single thread at a time will be doing that work

8:58 using a volatile (as compared to a non-volatile field) ensures visibility across threads

9:30 instilled: I'm trying to load a blob from a database table as InputStream. Anyone knows how I can tell clojure.jdbc to return a java.io.InputStream instead of byte[]?

9:35 zoldar: instilled: have you seen this?: http://osdir.com/ml/clojure/2014-01/msg01225.html

9:39 instilled: zoldar: thank's for pointing this out. I've also skimmed through jdbc.clj and found this fn db-query-with-resultset. Thanks!

9:41 martinklepsch: good or bad idea to use just clojure.zip & clojure.xml to generate some xml response?

9:42 response is not trivial but the only XML stuff required in the project

10:15 wizzo: hi. is there a way to do a for with two arguments but make it increment both at once?

10:16 assuming they're both the same length

10:16 zot: (map (fn [[x y]] …) xs ys)

10:16 err

10:16 s/map/for/ with appropriate syntax

10:17 or just do (map identity xs ys) as the source i spose

10:18 wizzo: ooooh i see

10:18 never thought of that

10:18 zot thank you!

10:19 zot: glad to help. somebody answered that exact question for me a couple months ago :)

10:19 wizzo: :D

10:23 kaiyin: Is it a good idea to use a web framework as a gui framework these days?

10:25 justin_smith: it's pretty much the most portable way to do it

10:26 zot: you mean (map list xs ys) identity would complain about the argument count

10:26 zot: justin_smith: trudat.

10:59 zimablue1: test

11:01 xemdetia: kaiyin, I would dare say that this is actually the most common way nowadays. The number of native GUI applications I see are fewer and fewer

11:01 *new GUI applications

11:14 justin_smith: I think mobile was a huge gamechanger there - more than twice as many platforms to target once mobile is ubiquitous

11:19 xemdetia: I think also there was the fact that browsers could be kept up to date independent of the server without crippling pain and rollouts. It just was someone else's problem so I can just focus on building a really great server

11:20 (css issues nonwithstanding)

11:21 justin_smith: IOW you can force rollouts of new versions whether the client wants to upgrade or now :)

11:21 *not

11:24 xemdetia: also true, and weird native app frontends don't get stuck in time

11:24 and everyone agrees more or less on the protocol

11:25 justin_smith: the one pain in the ass is clients that refuse to use a sane browser

11:26 xemdetia: well I always consider that the same sort of people that just never upgrade anyway

11:26 same problem

11:26 justin_smith: right

11:26 it's a subset of the old problem, and still an improvement on the old scenario

11:26 xemdetia: "I want you to fix this on version 2!!! I understand you are on version 9 now but you MUST do this"

11:26 justin_smith: haha

11:27 xemdetia: or like someone asked why we had issue with a customer's win 3.11 client to the server a few months ago

11:39 kaiyin: xemdetia: is there a book on building local web apps using clojure?

11:42 xemdetia: kaiyin, I am the wrong person to ask about that. I mean if you want a sophisticated example I can suggest lighttable maybe?

11:45 node-webkit might be another starting point

11:45 there is no shame to just listening on an arbitrary local port to just get a product out there :)

11:46 zimablue: this might get asked a lot but what is the uptake/popularity of clojure looking like? I notice this channel is quiet

11:46 xemdetia: zimablue, this channel is usually pretty noisy actually

11:53 wasamasa: zimablue: it's becoming the most popular lisp dialect

11:54 jlegler: This channel is rarely quiet. It actually regularly annoys me because if I take my eyes off of it for a few hours I guaranteed have an hours worth of reading.

11:54 pbx: zimablue, its trajectory is very positive. if you're wondering whether you should learn it, maybe say a bit about where you're coming from and what you want to gain

12:20 puredanger: I recently looked at the download stats from sonatype for the clojure.org groupId artifacts (clojure, clojurescript, and the other contribs) - I was pretty shocked at the growth in the last year

12:24 # of unique IPs downloading per month has ~doubled over the last year for both Clojure and ClojureScript

12:33 willharrison: anyone know where I can download "are we there yet" as opposed to streaming it?

12:40 puredanger: iirc, if you send the iphone user agent string to the infoq site, it will serve you an mp4

12:41 mearnsh: willharrison: youtube-dl

12:41 works on infoq

12:41 puredanger: there is also https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/AreWeThereYet.md

12:42 if you'd prefer to not watch it at all :)

12:42 martinklepsch: I want to convert '123' seconds to a string like "00:02:03" — doing it with clj time like this: https://gist.github.com/martinklepsch/0717c8a543746086b6b7, alternative would be to just calculate stuff. Any other ideas?

12:46 puredanger: for just that, certainly calculating it w/o clj time seems easier to me

13:31 xeqi: puredanger: are those stats public anywhere?

13:31 puredanger: no

13:33 xeqi: aww. I'll see if I write something to walk over clojar's download stats.. Doesn't save unique ips, but at least gives an idea of downloads per day

13:33 drbobbeaty: martinklepsch: If you did: (clj-time.coerce/to-date-time (* arg 1000)) then your 123 would become 00:02:03 on Jan 1 1970. You can then use a formatter and get just the HH:mm:ss

13:48 Natane: so i'm trying to embed nrepl in my program with a cider-nrepl-handler, but it says "No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class nil"

13:48 it works just fine without the cider handler though

13:48 what am i doing wrong? D:

13:52 martinklepsch: thanks drbobbeaty & puredanger

13:54 dnolen: cfleming: ping

14:12 mavbozo: Natane, did you follow the instruction here? https://github.com/clojure-emacs/cider-nrepl#via-embedding-nrepl-in-your-app

14:12 Natane, coz i just did and it works

14:25 xeqi: is there a lib where I can get a line graph from a map or seq of pairs?

14:26 hiredman: there are lots

14:27 aphyr just released some gnuplot frontend, liebke/analemma is neat, there is also incanter, or just generating a text file and feeding that through gnuplot, or generating svgs directly

14:28 I guess analemma is more of a scatter plot than line

14:29 generating svgs is actually almost kind of nice, the xml is a higher level data model of an image than say generating jpgs

14:31 xeqi: I'll see if I can make analemma work. Scatter is fine

14:32 I jumped over it at first cause its examples are kinda sparse. references to `add-points` and `analemma-data` without any description of the shape of the data

14:34 hiredman: yeah, I recall last time I played with it I ended up forking it for some reason, and then later just generating the svgs myself, the quickest start may just be writing the data to a file and using gnuplot

14:52 xeqi: hiredman: thanks, ended up being able to get it to work

14:59 itruslove: xeqi: not sure if this matches your use case, nor if this is timely enough, but http://gorilla-repl.org/ has some easy-to-use graphing capabilities

15:04 sdegutis: Does something like this already exist for Clojure? https://github.com/sdegutis/routatron/blob/master/test/routatron/core_test.clj

15:13 sobel: before i rip out timbre for tools.logging because i need to use the already-configured log4j instance, am i missing something about timbre?

15:19 mr_rm: i'm looking at the new Visual Studio Code editor and it understand Clojure syntax. does anyone know if there is a way to hook it up to a repl?

15:20 J_Arcane: mr_rm: it understands clj because it's just Atom under the hood. You could just use Atom and https://github.com/maxbrunsfeld/atom-nrepl

15:26 Frozenlock: Is there a clever way of doing this? With match? Given [a1 b1] and [a2 b2], I want to test (= _1 _2).

15:28 amalloy: (every? true? (map = as bs))?

15:28 it's unclear what you're asking for, but maybe that is the answer

15:29 tim_: Frozenlock: isn't that just (= [a1 b1] [a2 b2]) ?

15:30 Frozenlock: No, that's the thing, I want to match a1 with a2 OR b2. I guess the simplest way to say it would be 'return true if any part is present in both'.

15:31 I could use 'for', or make sets and check the difference, but I wonder if there's a more elegant way of doing it.

15:31 tbaldridge: oh, then you should be able to do this I think:

15:31 (filter (set coll2) coll1)

15:32 at least that's what I normally use ^

15:32 amalloy: i think the problem is still kinda poorly defined. you want to test whether there's any single element in common between two collections?

15:32 tbaldridge: except of course if coll2 contains nil or false, sadly

15:33 tbaldridge: true, but you could easily write a predicate to do that.

15:33 actually that'd just be: (partial contains? (set coll2))

15:33 amalloy: every time i want to use a non-constant set as a predicate, i'm stymied by nil/false. i'm sure folks are tired of hearing it, but i wish #(#{x} y) returned (contains? #{x} y), instead of returning either y or nil

15:35 sdegutis: J_Arcane: wait, VS is just Atom?

15:36 oddcully: sdegutis: VS code is

15:36 sdegutis: um

15:36 Frozenlock: amalloy: but then the much loved (some #{}...) wouldn't work :-/

15:36 * sdegutis unblocks wikipedia for a minute

15:37 Frozenlock: Tho I see the point.

15:39 amalloy: Frozenlock: it's already broken, is my position. like, how do you use (some xs ys)? you write (if-let [the-x (some xs ys)] ...) to find the element that was in common

15:40 J_Arcane: http://thenextweb.com/apps/2015/04/30/microsofts-cross-platform-visual-studio-code-app-is-based-on-githubs-atom-editor/

15:40 wasamasa: how shocking

15:40 they were always good at stealing

15:41 J_Arcane: It's a BSD-style license, so it's not technically stealing, but a good example of why BSD licenses aren't a good idea.

15:42 whodidthis: dem gonna buy github eventually anyways so its ok

15:46 lvh: J_Arcane: Why is it not a good idea?

15:46 J_Arcane: lvh: it's basically handing your code to prospective competition with no recourse.

15:47 mr_rm: J_Arcane: thanks for the info. as for the bsd license, i respectfully disagree. sometimes what you want is to get widespread adoption of your idea/pattern AS the recourse :)

15:48 J_Arcane: share-alike licenses maintain competition by forcing competitors using your code to give back what they added to it. With a BSD license, you're giving that up.

15:49 TimMc: "We are working with the Electron team and actively contributing back to that framework."

15:49 So they're not just grabbing it -- GitHub is probably benefitting.

15:52 matthavener: anyone know how to call goog.now() from cljs?

15:53 bensu: matthavener: try again in #clojurescript

15:54 matthavener: ah, thank you

15:56 lvh: J_Arcane: Presumably, the folks at Github understood that perfectly well, and were more than happy to make that trade-off, particularly given what TimMc just said :-)

15:56 TimMc: ...but note that I don't use BSD license myself.

15:57 That's not a gamble I'm willing to take unless I want that software *in use*, no matter what.

16:01 sobel: Please talk to the #postgresql folks about benefits of the BSD license

16:05 TimMc: E.g. I have this URL library (johnny) that I'm writing... if it's good, I want people to use it so they don't screw up URLs so much. Having people not screw up URLs is more important to me than whether they take and don't give back.

16:06 kaiyin: how do you load all clj files in to the repl in cursive?

16:07 dnolen: kaiyin: what do you mean "load all clj files"?

16:08 kaiyin: dnolen: just for interactive development. take this for example: https://github.com/niftyn8/web-development-with-clojure

16:08 there are clj file for data model, view and routes, I want to load them all into a repl.

16:09 s/file/files

16:09 dnolen: kaiyin: there's is a Load File in REPL command, people just bind that

16:10 kaiyin: dnolen: yeah, but I need to load one by one, right?

16:11 on my laptop it's bound to shift-cmd-L

16:11 dnolen: kaiyin: generally there's is some namespace that kicks off the process which requires the other bits

16:11 people usually only load this ns

16:12 kaiyin: dnolen: really? but i got some error like this: Loading src/guestbook/handler.clj... CompilerException java.lang.Exception: No namespace: guestbook.routes.home,

16:13 and if i load guestbook.routes.home manually, this error goes away.

16:13 dnolen: kaiyin: sounds like you're namespaces are not following classpath conventions

16:13 s/you're/your

16:14 if you have a namespace foo.bar.baz, foo/bar/baz.clj better exist somewhere on the classpath

16:17 kaiyin: dnolen: i do have a file guestbook/routes/home.clj

16:18 dnolen: kaiyin: but does it exist on the classpath

16:18 the error says it doese not

16:18 s/doese/does

16:18 kaiyin: dnolen: here is the dir structure: https://gist.github.com/kindlychung/8b806465d04f50897bb7

16:19 how do i add it to class path then?

16:22 dnolen: kaiyin: that looks ok, how are you starting the REPL?

16:23 kaiyin: dnolen: local -> run nrepl with leiningen

16:24 dnolen: kaiyin: hrm yeah dunno, that should work and has always worked for me.

16:24 kaiyin: what is :source-paths set to in your project.clj?

16:25 kaiyin: dnolen: no such entry.

16:25 dnolen: I thought it defaulted to "src" but I'm not sure

16:34 kaiyin: ,(doto (java.lang.String. "abc") (.toUpperCase))

16:34 clojurebot: "abc"

16:34 kaiyin: why isn't this working?

16:35 dnolen: kaiyin: strings are immutables

16:35 immutable

16:35 ,(-> "abc" .toUpperCase)

16:35 clojurebot: "ABC"

16:42 irctc_: stuck, looking for help: have a clojure file with a bunch of functions, just need a way to pass over the contents of a HashMap<String,String> to the clojure script. i'm able to call Clojure.var("clojure.core", "load-file") and then invoke it with the actual clojure file. But can't find a way to pass over the Java Hashmap into the script, all help is greatly appreciated, TIA

16:43 justin_smith: irctc_: pass the HashMap as an arg to the var containing the function you want to call

16:44 Clojure.var("your.ns", "your-fn").invoke(HM)

16:44 or something very much like that

16:44 irctc_: thanks justin, by doing that will that let me access it as if it was a clojure map? will give it a shot! thank you!

16:45 justin_smith: irctc_: you can use it as a closer map if you convert it

16:45 or you can use it via interop

16:45 though some functions will work as normal regardless

16:45 hadronzoo: Does anyone know why the collection argument order in map and reduce is different than in assoc, conj, etc? I know the order stems from older lisps, but is there more to it?

16:46 irctc_: thanks for your help justin!

16:46 justin_smith: ,(let [hm (java.util.HashMap.)] (.put hm "a" 0) (into {} hm))

16:46 clojurebot: {"a" 0}

16:47 dnolen: hadronzoo: the collection fns are polymorphic on the collection

16:47 justin_smith: irctc_: ^ above demonstrates you can use into to turn a HashMap from java into a {}

16:48 hadronzoo: dnolen: that makes complete sense, but why is the collection not the first argument in map and reduce?

16:48 dnolen: hadronzoo: map and reduce aren't collection functions

16:49 hadronzoo: dnolen: they're sequence functions?

16:50 dnolen: hadronzoo: that's right

16:53 hadronzoo: dnolen: I just have coworkers asking me why Clojure's argument order for map and reduce isn't the same as underscore and Elixir's. I didn't have a good answer for them.

16:54 dnolen: hadronzoo: comparing to underscore doesn't really make any sense - its operations aren't even lazy

16:54 hadronzoo: I don't know how Elixir's sequence functions compose but I'd be surprised if they were lazy

16:54 justin_smith: hadronzoo: for map consider the case where you have two or more collection args

16:54 ,(map + [1 2 3] [4 5 6] [7 8 9])

16:54 clojurebot: (12 15 18)

16:55 justin_smith: that would not make much sense if collection came first

16:55 dnolen: hadronzoo: justin_smith's points on multiple collections is another bullet point in the design space

16:56 justin_smith: hadronzoo: also, from an OO lang's point of view, map is a method that is owned by the collection, so of course the collection is specified before the function

16:56 aaelony: is anyone using Spark MLlib via Clojure?

16:56 justin_smith: hadronzoo: but from an fp point of view, map is an operation that uses function + collection(s)

16:57 hadronzoo: the multiple collection case makes sense

16:57 dnolen: hadronzoo: ultimately Clojure's signature follows the signature chosen by functional programming languages - and that history precedes Underscore and Elixir by a considerable amount of time.

16:59 hadronzoo: dnolen: justin_smith: it's certainly been the argument order in every lisp I've used in the past. Thanks for the explanation.

17:00 Confusionist: CLJ-735 is an issue to improve an error message, but it's been open for 4 years. Judging from the SO questions, it's been haunting newbies for years. It just haunted me for a while. I suppose it's just not interesting/high priority enough to work on for most folks. Is there anything a random person (i.e. me) can contribute to something like that?

17:03 puredanger: I logged CLJ-735 :)

17:04 It got stuck in a weird limbo for a long time but I hope to get it into 1.8

17:05 ivan2: Anyone happen to know when the next batch of RHCAs are being filed?

17:05 I have a small patch for one of the newbie issues

17:07 Confusionist: puredanger, OK, so no contribution necessary/possible :)

17:09 puredanger: Confusionist: well, it could use a bit more work. if someone else picked it up and did those things, it would be easier for me to get it in once 1.8 opens up.

17:09 I'll drop some notes on the ticket in case you're interested

17:10 ivan2: what's an RHCA?

17:10 ivan2: Rich Hickey Contribution Agreement, the thing to sign before you can contribute patches

17:11 puredanger: oh, we usually call that the Clojure CA

17:11 ivan2: Ok yes that's what I meant

17:11 puredanger: go ahead and submit the patch if you've already signed

17:12 I get all the CAs by email so I can check even if you're not listed yet. if you need permissions, let me know.

17:12 I'd love a patch on the few newbie ones that are out there

17:12 ivan2: Great, let me get it signed-- didn't do that yet

17:14 puredanger: oh, well do that :) Someone at Cognitect updates the web site every couple days with new ones.

17:15 n8dawg: Hello, had core.async question, i want to pipe between two channels with a transducer, only way I can see to do it, is create channel with transducer and use two pipe functions, one for input one for output, that seems pretty wasteful/inefficient, am I missing something>

17:16 Bronsa: puredanger: has there been any discussion on CLJ-1706?

17:16 puredanger: no, mostly just me debating things in my head :)

17:17 Bronsa: heh

17:17 puredanger: we'll make some kind of decision on it the next time we cover tickets I'm sure. it's really the main thing left before an RC imo

17:22 oddcully: n8dawg: pipeline?

17:23 n8dawg: oddcully: yeah looked at pipeline but appears to run transducers in parallel, not effect I wanted, reductions wont work as expected for instance

17:26 Confusionist: puredanger, sounds good. I'll have to look into the CA and discuss it with my employer. I'll report back here.

17:32 godlikesme: hey

17:33 is there a good tutorial for learning clojure?

17:33 also, what is the best/simplest web framework for clojure(I'm looking for a microframework like flask for python)

17:37 Confusionist: godlikesme, you've probably found some tutorials using Google: didn't you like them, are there too many too chose, do you want some specific subject to be addressed, ... ?

17:38 godlikesme: Confusionist, I'll elaborate, I have quite a bit of experience in programming. I have some experience in functional programming(but not much). I've actually read a book on clojure a while ago and played with it(nothing serious)

17:38 Now I'm looking for something relatively short and concise

17:41 btobolaski: I liked living clojure but I'm not sure thats what you're looking for

17:42 godlikesme: "If you’re an experienced programmer looking for a thorough but gentle introduction to Clojure, this is the perfect guide for you. Author Carin Meier not only provides a practical overview of this JVM language and its functional programming concepts, but also includes a complete hands-on training course to help you learn Clojure..." -- sounds nice

17:42 ivan2: I just signed the Clojure CA, would appreciate any feedback on this patch https://github.com/ivanwick/clojure/commit/95a68908446fdfae2801292ebe528722711031c0 to fix http://dev.clojure.org/jira/browse/CLJ-1705

17:43 zerokarmaleft: godlikesme: aphyr's "

17:44 Confusionist: godlikesme, I understand your position. I'm basically piecing everything together from all the tutorials/resources I can find. If you're not new to programming, functional programming or lisps, the first half of most tutorials is just useless

17:44 zerokarmaleft: godlikesme: aphyr's "clojure from the ground up" is a great crash course

17:45 Confusionist: I just find myself skipping most of what people wrote. The shortest thing is probably what's on clojure.org itself

17:45 puredanger: ivan2: I think it would be better to wrap a function around the ams lookup that threw on the missing case

17:45 and then reroute all of those calls to the function. I wouldn't mess with preconditions in this case.

17:46 zerokarmaleft: godlikesme: luminus is also probably a good starting point coming from small frameworks like flask

17:47 puredanger: ivan2: also, make sure to follow the guidelines on making properly structured patches in http://dev.clojure.org/display/community/Developing+Patches

17:47 godlikesme: zerokarmaleft, thanks, I'll give it a shot

17:48 ivan2: puredanger: thanks, will make another pass at it

17:48 puredanger: godlikesme: if you feel like you have the syntax but not how to use it in anger, that's kind of the goal of my book https://pragprog.com/book/vmclojeco/clojure-applied

17:49 godlikesme: puredanger, nice! I like pragprog ebooks

17:49 I'll definitely give it a shot

17:49 puredanger: still in beta, but 80% available

17:50 cfleming: dnolen: Pong

18:51 ed-g: how do I make a case-insensitive regex?

18:56 amalloy: ed-g: #"(?i)..."

18:56 that's just the generic way to set flags for an entire regex; the i flag is for case insensitivity

18:56 ed-g: amalloy, awesome! thank you!

18:57 I was feeling a tinge of nostalgia for Perl

18:57 glad we could fix that

18:58 amalloy: ed-g: the same works in perl, by the way

18:58 /?i.../

18:58 although of course /.../i is more traditional/reasonable

19:04 eben: Hi does anybody have experience with multiple uberwar files on jetty accessing postgres?

19:06 It seems that I can only have one uber war talking to JDBC, all subsequent wars loaded fails to load the driver...

19:06 any body have any idea (good, bad or otherwise are welcome)!

19:10 digiorgi: "WARNING: CIDER requires nREPL 0.2.7" beacuse it runs the version 0.2.6 but in my profiles.clj i have {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]

19:10 :dependencies [[org.clojure/tools.nrepl "0.2.10"]]}}

19:10

19:31 arohner: digiorgi: I see that frequently too, I think it's a cider.el issue

20:23 Sizur: hi all, is anybody here familiar with "flatteno"?

20:25 dnolen: Sizur: yes, ask your question

20:25 Sizur: if second argument is unbound, why does it produce a bunch of unflattened answers together with one flattened?

20:26 if that's intended, how is this useful? (genuine question)

20:27 dnolen: Sizur: relational goals are very different from writing functions that only accomplish the operation that you care about

20:28 Sizur: there's no simple answer to your question - that's just how relational programming works

20:28 Sizur: ok, how is flatteno useful then?

20:28 how can you actually flatten with it?

20:29 you must make sure that every caro is not a listo? so you have to introduce a negation using failure?

20:31 dnolen: Sizur: the point isn't whether you'll actually use flatteno, the point is that you understand why it works the way that it does.

20:31 Sizur: if you understand the behavior you can move on.

20:32 Sizur: dnolen: what do you mean move on? how can i flatten a list?

20:33 also, i'm sure there is a way to restrict the relation so it will only produce really flattened answers, i just don't know it.

20:34 dnolen: Sizur: sorry I can't help you much more with this :) the answer is nearly always going to be "examine how it is done in real Prolog programs". It's generally a mechanical matter to convert it back to a miniKanren dialect.

20:34 Sizur: Googling gave me this - http://stackoverflow.com/questions/9059572/flatten-a-list-in-prolog

20:34 Sizur: so i can do it relatively easy if i introduce negation using failure, but the hard part is how to express that without negation

20:35 dnolen: I wrote core.logic and I still go hunting for Prolog answers when I get stumped

20:36 Sizur: dnolen: thanks!

20:36 amalloy: Sizur: i don't understand your premise. if the first argument is ground, and the second is unbound, it produces exactly one answer, which is the flattening of the first

20:37 whereas you seemed to be saying that's not the case

20:37 Sizur: amalloy: what implementation of flatteno? i came here because minikanren is silent :)

20:37 > (run 5 (q) (flatteno '(1 2 (3 4)) q))

20:37 $3 = (((1 2 (3 4))) (1 (2 (3 4))) (1 2 ((3 4))) (1 2 (3 4)) (1 2 (3 4) ()))

20:38 amalloy: $google clojure flatteno

20:38 lazybot: [Logic Programming Part 3 (List Logic) « boss-level.com] http://boss-level.com/?p=64

20:38 amalloy: feh

20:38 https://gist.github.com/jballanc/8308717

20:38 is what i found when i searched for clojure flatteno

20:38 and it behaves as i'd expect

20:39 Sizur: ah, unwrapo, let me implement that and check

20:44 gfredericks: printlno

20:44 System/exito

20:49 come on these are great jokes

20:49 .puto

20:52 Sizur: the body of cl/defna is disjuncted?

20:53 amalloy: as if via conda

20:54 Sizur: ah, it's a pattern match before the goal constructor is called

21:10 TimMc: gfredericks: :-D

21:12 gfredericks: TimMc: geez finally; it's getting harder and harder to make a buck around here

21:20 isaac_rks: what is Clojure's position on the crime of sodomy

21:25 bbloom_: Sizur: are you talking about the flatteno in clojure.core.logic.tests ?

21:26 dnolen: i think he's found a flatteno that doesn't match the name he's expecting

21:26 or at least what flatteno in the core.logic & minikanren tesks do doesn't match my intuition for the name flatteno

21:26 Sizur: you'll have to write your own relation, since that test one is not really what you want

21:26 it gives you all possible versions that are "flatter" ie w/ some layer removed

21:27 if you want like proper flatten which removes all nesting of any kind, you need to make that yourself

21:27 amalloy: that is definitely not the case for https://github.com/clojure/core.logic/blob/f3f2b4c6c4a906c1fa512720aa09cb1abe312cd1/src/test/clojure/clojure/core/logic/tests.clj#L467-L476

21:29 amalloy: yeah, that's not what's in the core.logic or minikanren test files

21:29 clojure.core.logic.tests=> (run 2 [q] (flatteno '(1 2 3) q))

21:29 (((1 2 3)) (1 (2 3)))

21:47 Rumel: If I'm getting a stack overflow error when using recur, is there a good way to debug it?

21:50 gfredericks: well you're presumably not getting the stack overflow because of recur, so I'd look around at whatever else you're doing

22:03 zacts: can I get by with using java 1.7 for clojure?

22:03 or is it better to use java 1.8?

22:04 justin_smith: zacts: you only need 1.8 if you are using it's features, clojure doesn't need it

22:05 zacts: ok

22:05 justin_smith: iirc clojure still works with 1.6, and it wasn't a very long time ago that it worked with 1.5

22:10 puredanger: Correct

22:11 I find 1.8 is generally 5-10% faster

23:33 mercwithamouth: so web dev guys....when you're working on a project that uses say compojure and reagent/figwheel would you just use lein and create a project within your project fot the client side work

23:33 what's the cleanest way to set the project up?

23:33 justin_smith: mercwithamouth: I put client and server in the same project

23:33 it rarely makes sense to mix and match client/server versions anyway

23:34 mercwithamouth: hmm gotcha. ok just manually add the various plugins i need....

Logging service provided by n01se.net