#clojure logs

2015-05-04

02:49isaac_rkswhat is clojure's position on the baltimore riots?
02:56kovrikGuys, how to configure Flycheck for Clojure?
02:58TMA,(position 'clojure '(baltimore riots))
02:58clojurebot#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",...
02:59oddcullyisaac_rks: unless this is a clojure library, this is OT
03:00isaac_rkswhy are you trying to silence debate
03:00isaac_rks#blacklivesmatter
03:02oddcullythis channel is about the programming language clojure. there is a #clojure-offtopic channel, if you think you can discuss this only with fellow clojurists.
03:03isaac_rksis clojure a racialist programming language
03:05wasamasalol
03:05oddcullyhow i wish i had /ignore implanted into my brain for rl
03:05wasamasaprogramming languages stand above such silly matters
03:05wasamasaunless you happen to come from a certain image board
03:06oddcullywasamasa: don't feed the troll
03:07wasamasaoddcully: you can help keeping this from entering #clojure-offtopic!
03:08oddcullyhehe, sorry
04:27winkhmm, anyone got some UK dialup sample ip ranges? (or is from the uk and wouldn't mind giving me their first triplets?)
04:31TEttingerwink: it probably depends on the provider
04:31winkwell of course. I don't need *all* :P
04:31TEttingerI always use DDG whenever I see a bare IP and want to know its geo location
04:31wink2 or 3 would be plenty
04:31winkyeah, but I need the other way round.
04:32winkI did find some meanwhile
05:55afhammadhow 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!
05:57afhammadanyone about?
06:20KneivaIs there a good tutorial or article about reify?
06:50martinklepschwhat's a good way to test that something returns (constantly false) — not `false` but the function returned by constantly
06:56TMAmartinklepsch: in general this is impossible -- it is equivalent to the halting problem
06:58TMA,(constantly false)
06:58clojurebot#object[clojure.core$constantly$fn__4362 0x6bebb482 "clojure.core$constantly$fn__4362@6bebb482"]
06:58TMA,#(and % false)
06:58clojurebot#object[sandbox$eval50$fn__51 0x76eb534c "sandbox$eval50$fn__51@76eb534c"]
06:59TMA,(constantly (and false))
06:59clojurebot#object[clojure.core$constantly$fn__4362 0x2ecb4225 "clojure.core$constantly$fn__4362@2ecb4225"]
07:01TMAit is possible [in principle] to tell, whether the function was created by constantly
07:04TEttingeris there any way to use the values printed by the new object printer?
07:04TEttingerlike if I want the "clojure.core$constantly$..." out of that
07:05TEttinger,(= (constantly false) (constantly false))
07:05clojurebotfalse
07:05TEttinger,(= (constantly true) (constantly true))
07:05clojurebotfalse
07:05BronsaTEttinger it's not possible to compare functions
07:05TEttingeryeah I was wondering if they were the same object
07:06Bronsathey are not
07:06TEttinger,(let [cf (constantly false)] (= cf cf))
07:06clojurebottrue
07:06TEttinger,(let [cf (constantly false)] (= cf (constantly false)))
07:06clojurebotfalse
07:06TEttingerinteresting
07:06Bronsanot at all
07:07Bronsaconstantly returns a new instance every time
07:07TEttingerBronsa, I'm learning stuff, don't rain on my parade :P
07:07Bronsafunctions can only compare by pointer equivalence
07:07BronsaTEttinger sorry, didn't mean to sound mean
07:07TimMc$google serializable-fn
07:07lazybot[technomancy/serializable-fn · GitHub] https://github.com/technomancy/serializable-fn
07:07TEttingeryah, that
07:07TEttinger(inc TimMc)
07:07lazybot⇒ 97
07:08TimMc(Note that this is not necessarily a recommendation.)
07:08TEttingerit's ok Bronsa, just keep toolnalyzating!
07:09martinklepschTMA: interesting, thank you! I know realized that using (constantly false) was superflous in the first place and removed it
07:09irctcis clojure 1.7 stable?
07:10irctcor should i stick to 1.6
07:10TEttingersee topic
07:10TEttingerthere may be bugs in 1.7, but we haven't seen any yet
07:10TEttingerwe've been using 1.7-master in the bots here
07:10Bronsairctc: it's stable enough that peoplle are already using 1.7.0-beta2 in production
07:11irctci will give it a try
07:12martinklepschthere 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?
07:12martinklepschantipattern probably a bit to strong. was more like "handle with care"
07:13Bronsamartinklepsch: http://stuartsierra.com/2015/04/26/clojure-donts-concat
07:13martinklepschBronsa: thanks!
07:17zolHow can I use rename on a lazy seq? Like (clojure.set/rename ({:f 1}, {:f 2}) {:f id})
07:17zol:id ~
07:17wiruzxHey guys
07:18wiruzxCould you please tell me if core.typed works with destructuring defrecords?
07:23wiruzxSorry, got it work
07:23wiruzxShould just use ann-form
07:23irctcLet 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.
07:41m1dnight_Guys, im trying to write my own function for fold but its not really working. I would like some pointers.
07:41m1dnight_What I want is something like this:
07:41m1dnight_(r/fold str ["foo" "bar"])
07:41m1dnight_that actually works, but i figured Id do it with str/join
07:41m1dnight_so I came up with this:
07:42m1dnight_(r/fold #(apply clojure.string/join ", " %) ["foo" "bar"])
07:42m1dnight_but that says I only pass 0 arguments to the fnction..
07:42opqdonutfor the initial value?
07:43m1dnight_I thought about the intial value too, and (clojure.string/join ", " "") works just fine
07:43opqdonutyour (r/fold str ["foo" "bar"]) probably does something like (str "foo" (str "bar" (str)))
07:43m1dnight_ohhh
07:43opqdonutthat's not the initial value
07:43m1dnight_,(str)
07:43clojurebot""
07:43m1dnight_I see :)
07:43opqdonut,(#(apply clojure.string/join ", " %)) -- this is your initial value
07:43clojurebot#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...
07:43m1dnight_oh kay
07:43m1dnight_might have to make it a bit more complex then I assume
07:44m1dnight_or perhaps ,(#(apply clojure.string/jion ", " (when % % "")))
07:44m1dnight_,(#(apply clojure.string/jion ", " (when % % "")))
07:44clojurebot#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...
07:44opqdonutnope
07:44opqdonut,(#(apply clojure.string/join ", " &%))
07:45clojurebot#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...
07:45opqdonut,(#(apply clojure.string/join ", " %&))
07:45clojurebot", "
07:45opqdonutthat
07:45opqdonut,(#(apply clojure.string/join ", " &%) "a" "b" "c")
07:45clojurebot#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...
07:45opqdonut,(#(apply clojure.string/join ", " %&) "a" "b" "c")
07:45clojurebot#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...
07:45opqdonut*sigh*
07:45m1dnight_I think I get the point though :D
07:45opqdonut,(#(clojure.string/join ", " %&) "a" "b" "c")
07:45clojurebot"a, b, c"
07:45opqdonutyeah
07:45opqdonutyou could also consider an explicit init arg to fold
08:52zotwith 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?
08:52puredangertransducers control the scope of application
08:53zotso if i wanted to use in another context, what example could i follow to achieve the same result?
08:53puredangerenforce thread isolation :)
08:54puredangerthe key is that there is no atomic way to read, then write a volatile (like you can do with an atom)
08:54puredangerso that introduces a race condition, unless you can ensure that nothing else changes the volatile between the read and the write
08:55puredangerguaranteeing that only a single thread modifies the volatile gives you that guarantee
08:56zotgotcha
08:56zotthanks!
08:57puredangerall of the current core uses for transducers operate in the single calling thread
08:58puredangercore.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
08:58puredangerusing a volatile (as compared to a non-volatile field) ensures visibility across threads
09:30instilledI'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[]?
09:35zoldarinstilled: have you seen this?: http://osdir.com/ml/clojure/2014-01/msg01225.html
09:39instilledzoldar: thank's for pointing this out. I've also skimmed through jdbc.clj and found this fn db-query-with-resultset. Thanks!
09:41martinklepschgood or bad idea to use just clojure.zip & clojure.xml to generate some xml response?
09:42martinklepschresponse is not trivial but the only XML stuff required in the project
10:15wizzohi. is there a way to do a for with two arguments but make it increment both at once?
10:16wizzoassuming they're both the same length
10:16zot(map (fn [[x y]] …) xs ys)
10:16zoterr
10:16zots/map/for/ with appropriate syntax
10:17zotor just do (map identity xs ys) as the source i spose
10:18wizzoooooh i see
10:18wizzonever thought of that
10:18wizzozot thank you!
10:19zotglad to help. somebody answered that exact question for me a couple months ago :)
10:19wizzo:D
10:23kaiyinIs it a good idea to use a web framework as a gui framework these days?
10:25justin_smithit's pretty much the most portable way to do it
10:26justin_smithzot: you mean (map list xs ys) identity would complain about the argument count
10:26zotjustin_smith: trudat.
10:59zimablue1test
11:01xemdetiakaiyin, 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:01xemdetia*new GUI applications
11:14justin_smithI think mobile was a huge gamechanger there - more than twice as many platforms to target once mobile is ubiquitous
11:19xemdetiaI 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:20xemdetia(css issues nonwithstanding)
11:21justin_smithIOW you can force rollouts of new versions whether the client wants to upgrade or now :)
11:21justin_smith*not
11:24xemdetiaalso true, and weird native app frontends don't get stuck in time
11:24xemdetiaand everyone agrees more or less on the protocol
11:25justin_smiththe one pain in the ass is clients that refuse to use a sane browser
11:26xemdetiawell I always consider that the same sort of people that just never upgrade anyway
11:26xemdetiasame problem
11:26justin_smithright
11:26justin_smithit's a subset of the old problem, and still an improvement on the old scenario
11:26xemdetia"I want you to fix this on version 2!!! I understand you are on version 9 now but you MUST do this"
11:26justin_smithhaha
11:27xemdetiaor like someone asked why we had issue with a customer's win 3.11 client to the server a few months ago
11:39kaiyinxemdetia: is there a book on building local web apps using clojure?
11:42xemdetiakaiyin, I am the wrong person to ask about that. I mean if you want a sophisticated example I can suggest lighttable maybe?
11:45xemdetianode-webkit might be another starting point
11:45xemdetiathere is no shame to just listening on an arbitrary local port to just get a product out there :)
11:46zimabluethis might get asked a lot but what is the uptake/popularity of clojure looking like? I notice this channel is quiet
11:46xemdetiazimablue, this channel is usually pretty noisy actually
11:53wasamasazimablue: it's becoming the most popular lisp dialect
11:54jleglerThis 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:54pbxzimablue, 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:20puredangerI 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:24puredanger# of unique IPs downloading per month has ~doubled over the last year for both Clojure and ClojureScript
12:33willharrisonanyone know where I can download "are we there yet" as opposed to streaming it?
12:40puredangeriirc, if you send the iphone user agent string to the infoq site, it will serve you an mp4
12:41mearnshwillharrison: youtube-dl
12:41mearnshworks on infoq
12:41puredangerthere is also https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/AreWeThereYet.md
12:42puredangerif you'd prefer to not watch it at all :)
12:42martinklepschI 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:46puredangerfor just that, certainly calculating it w/o clj time seems easier to me
13:31xeqipuredanger: are those stats public anywhere?
13:31puredangerno
13:33xeqiaww. 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:33drbobbeatymartinklepsch: 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:48Nataneso 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:48Nataneit works just fine without the cider handler though
13:48Natanewhat am i doing wrong? D:
13:52martinklepschthanks drbobbeaty & puredanger
13:54dnolencfleming: ping
14:12mavbozoNatane, did you follow the instruction here? https://github.com/clojure-emacs/cider-nrepl#via-embedding-nrepl-in-your-app
14:12mavbozoNatane, coz i just did and it works
14:25xeqiis there a lib where I can get a line graph from a map or seq of pairs?
14:26hiredmanthere are lots
14:27hiredmanaphyr 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:28hiredmanI guess analemma is more of a scatter plot than line
14:29hiredmangenerating svgs is actually almost kind of nice, the xml is a higher level data model of an image than say generating jpgs
14:31xeqiI'll see if I can make analemma work. Scatter is fine
14:32xeqiI 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:34hiredmanyeah, 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:52xeqihiredman: thanks, ended up being able to get it to work
14:59itruslovexeqi: 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:04sdegutisDoes something like this already exist for Clojure? https://github.com/sdegutis/routatron/blob/master/test/routatron/core_test.clj
15:13sobelbefore i rip out timbre for tools.logging because i need to use the already-configured log4j instance, am i missing something about timbre?
15:19mr_rmi'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:20J_Arcanemr_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:26FrozenlockIs there a clever way of doing this? With match? Given [a1 b1] and [a2 b2], I want to test (= _1 _2).
15:28amalloy(every? true? (map = as bs))?
15:28amalloyit's unclear what you're asking for, but maybe that is the answer
15:29tim_Frozenlock: isn't that just (= [a1 b1] [a2 b2]) ?
15:30FrozenlockNo, 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:31FrozenlockI could use 'for', or make sets and check the difference, but I wonder if there's a more elegant way of doing it.
15:31tbaldridgeoh, then you should be able to do this I think:
15:31tbaldridge(filter (set coll2) coll1)
15:32tbaldridgeat least that's what I normally use ^
15:32amalloyi think the problem is still kinda poorly defined. you want to test whether there's any single element in common between two collections?
15:32amalloytbaldridge: except of course if coll2 contains nil or false, sadly
15:33tbaldridgetrue, but you could easily write a predicate to do that.
15:33tbaldridgeactually that'd just be: (partial contains? (set coll2))
15:33amalloyevery 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:35sdegutisJ_Arcane: wait, VS is just Atom?
15:36oddcullysdegutis: VS code is
15:36sdegutisum
15:36Frozenlockamalloy: but then the much loved (some #{}...) wouldn't work :-/
15:37FrozenlockTho I see the point.
15:39amalloyFrozenlock: 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:40J_Arcanehttp://thenextweb.com/apps/2015/04/30/microsofts-cross-platform-visual-studio-code-app-is-based-on-githubs-atom-editor/
15:40wasamasahow shocking
15:40wasamasathey were always good at stealing
15:41J_ArcaneIt'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:42whodidthisdem gonna buy github eventually anyways so its ok
15:46lvhJ_Arcane: Why is it not a good idea?
15:46J_Arcanelvh: it's basically handing your code to prospective competition with no recourse.
15:47mr_rmJ_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:48J_Arcaneshare-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:49TimMc"We are working with the Electron team and actively contributing back to that framework."
15:49TimMcSo they're not just grabbing it -- GitHub is probably benefitting.
15:52matthaveneranyone know how to call goog.now() from cljs?
15:53bensumatthavener: try again in #clojurescript
15:54matthavenerah, thank you
15:56lvhJ_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:56TimMc...but note that I don't use BSD license myself.
15:57TimMcThat's not a gamble I'm willing to take unless I want that software *in use*, no matter what.
16:01sobelPlease talk to the #postgresql folks about benefits of the BSD license
16:05TimMcE.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:06kaiyinhow do you load all clj files in to the repl in cursive?
16:07dnolenkaiyin: what do you mean "load all clj files"?
16:08kaiyindnolen: just for interactive development. take this for example: https://github.com/niftyn8/web-development-with-clojure
16:08kaiyinthere are clj file for data model, view and routes, I want to load them all into a repl.
16:09kaiyins/file/files
16:09dnolenkaiyin: there's is a Load File in REPL command, people just bind that
16:10kaiyindnolen: yeah, but I need to load one by one, right?
16:11kaiyinon my laptop it's bound to shift-cmd-L
16:11dnolenkaiyin: generally there's is some namespace that kicks off the process which requires the other bits
16:11dnolenpeople usually only load this ns
16:12kaiyindnolen: really? but i got some error like this: Loading src/guestbook/handler.clj... CompilerException java.lang.Exception: No namespace: guestbook.routes.home,
16:13kaiyinand if i load guestbook.routes.home manually, this error goes away.
16:13dnolenkaiyin: sounds like you're namespaces are not following classpath conventions
16:13dnolens/you're/your
16:14dnolenif you have a namespace foo.bar.baz, foo/bar/baz.clj better exist somewhere on the classpath
16:17kaiyindnolen: i do have a file guestbook/routes/home.clj
16:18dnolenkaiyin: but does it exist on the classpath
16:18dnolenthe error says it doese not
16:18dnolens/doese/does
16:18kaiyindnolen: here is the dir structure: https://gist.github.com/kindlychung/8b806465d04f50897bb7
16:19kaiyinhow do i add it to class path then?
16:22dnolenkaiyin: that looks ok, how are you starting the REPL?
16:23kaiyindnolen: local -> run nrepl with leiningen
16:24dnolenkaiyin: hrm yeah dunno, that should work and has always worked for me.
16:24dnolenkaiyin: what is :source-paths set to in your project.clj?
16:25kaiyindnolen: no such entry.
16:25dnolenI thought it defaulted to "src" but I'm not sure
16:34kaiyin,(doto (java.lang.String. "abc") (.toUpperCase))
16:34clojurebot"abc"
16:34kaiyinwhy isn't this working?
16:35dnolenkaiyin: strings are immutables
16:35dnolenimmutable
16:35dnolen,(-> "abc" .toUpperCase)
16:35clojurebot"ABC"
16:42irctc_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:43justin_smithirctc_: pass the HashMap as an arg to the var containing the function you want to call
16:44justin_smithClojure.var("your.ns", "your-fn").invoke(HM)
16:44justin_smithor something very much like that
16:44irctc_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:45justin_smithirctc_: you can use it as a closer map if you convert it
16:45justin_smithor you can use it via interop
16:45justin_smiththough some functions will work as normal regardless
16:45hadronzooDoes 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:46irctc_thanks for your help justin!
16:46justin_smith,(let [hm (java.util.HashMap.)] (.put hm "a" 0) (into {} hm))
16:46clojurebot{"a" 0}
16:47dnolenhadronzoo: the collection fns are polymorphic on the collection
16:47justin_smithirctc_: ^ above demonstrates you can use into to turn a HashMap from java into a {}
16:48hadronzoodnolen: that makes complete sense, but why is the collection not the first argument in map and reduce?
16:48dnolenhadronzoo: map and reduce aren't collection functions
16:49hadronzoodnolen: they're sequence functions?
16:50dnolenhadronzoo: that's right
16:53hadronzoodnolen: 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:54dnolenhadronzoo: comparing to underscore doesn't really make any sense - its operations aren't even lazy
16:54dnolenhadronzoo: I don't know how Elixir's sequence functions compose but I'd be surprised if they were lazy
16:54justin_smithhadronzoo: for map consider the case where you have two or more collection args
16:54justin_smith,(map + [1 2 3] [4 5 6] [7 8 9])
16:54clojurebot(12 15 18)
16:55justin_smiththat would not make much sense if collection came first
16:55dnolenhadronzoo: justin_smith's points on multiple collections is another bullet point in the design space
16:56justin_smithhadronzoo: 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:56aaelonyis anyone using Spark MLlib via Clojure?
16:56justin_smithhadronzoo: but from an fp point of view, map is an operation that uses function + collection(s)
16:57hadronzoothe multiple collection case makes sense
16:57dnolenhadronzoo: 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:59hadronzoodnolen: justin_smith: it's certainly been the argument order in every lisp I've used in the past. Thanks for the explanation.
17:00ConfusionistCLJ-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:03puredangerI logged CLJ-735 :)
17:04puredangerIt got stuck in a weird limbo for a long time but I hope to get it into 1.8
17:05ivan2Anyone happen to know when the next batch of RHCAs are being filed?
17:05ivan2I have a small patch for one of the newbie issues
17:07Confusionistpuredanger, OK, so no contribution necessary/possible :)
17:09puredangerConfusionist: 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:09puredangerI'll drop some notes on the ticket in case you're interested
17:10puredangerivan2: what's an RHCA?
17:10ivan2Rich Hickey Contribution Agreement, the thing to sign before you can contribute patches
17:11puredangeroh, we usually call that the Clojure CA
17:11ivan2Ok yes that's what I meant
17:11puredangergo ahead and submit the patch if you've already signed
17:12puredangerI 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:12puredangerI'd love a patch on the few newbie ones that are out there
17:12ivan2Great, let me get it signed-- didn't do that yet
17:14puredangeroh, well do that :) Someone at Cognitect updates the web site every couple days with new ones.
17:15n8dawgHello, 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:16Bronsapuredanger: has there been any discussion on CLJ-1706?
17:16puredangerno, mostly just me debating things in my head :)
17:17Bronsaheh
17:17puredangerwe'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:22oddcullyn8dawg: pipeline?
17:23n8dawgoddcully: yeah looked at pipeline but appears to run transducers in parallel, not effect I wanted, reductions wont work as expected for instance
17:26Confusionistpuredanger, sounds good. I'll have to look into the CA and discuss it with my employer. I'll report back here.
17:32godlikesmehey
17:33godlikesmeis there a good tutorial for learning clojure?
17:33godlikesmealso, what is the best/simplest web framework for clojure(I'm looking for a microframework like flask for python)
17:37Confusionistgodlikesme, 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:38godlikesmeConfusionist, 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:38godlikesmeNow I'm looking for something relatively short and concise
17:41btobolaskiI liked living clojure but I'm not sure thats what you're looking for
17:42godlikesme"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:42ivan2I 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:43zerokarmaleftgodlikesme: aphyr's "
17:44Confusionistgodlikesme, 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:44zerokarmaleftgodlikesme: aphyr's "clojure from the ground up" is a great crash course
17:45ConfusionistI just find myself skipping most of what people wrote. The shortest thing is probably what's on clojure.org itself
17:45puredangerivan2: I think it would be better to wrap a function around the ams lookup that threw on the missing case
17:45puredangerand then reroute all of those calls to the function. I wouldn't mess with preconditions in this case.
17:46zerokarmaleftgodlikesme: luminus is also probably a good starting point coming from small frameworks like flask
17:47puredangerivan2: also, make sure to follow the guidelines on making properly structured patches in http://dev.clojure.org/display/community/Developing+Patches
17:47godlikesmezerokarmaleft, thanks, I'll give it a shot
17:48ivan2puredanger: thanks, will make another pass at it
17:48puredangergodlikesme: 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:49godlikesmepuredanger, nice! I like pragprog ebooks
17:49godlikesmeI'll definitely give it a shot
17:49puredangerstill in beta, but 80% available
17:50cflemingdnolen: Pong
18:51ed-ghow do I make a case-insensitive regex?
18:56amalloyed-g: #"(?i)..."
18:56amalloythat's just the generic way to set flags for an entire regex; the i flag is for case insensitivity
18:56ed-gamalloy, awesome! thank you!
18:57ed-gI was feeling a tinge of nostalgia for Perl
18:57ed-gglad we could fix that
18:58amalloyed-g: the same works in perl, by the way
18:58amalloy/?i.../
18:58amalloyalthough of course /.../i is more traditional/reasonable
19:04ebenHi does anybody have experience with multiple uberwar files on jetty accessing postgres?
19:06ebenIt seems that I can only have one uber war talking to JDBC, all subsequent wars loaded fails to load the driver...
19:06ebenany body have any idea (good, bad or otherwise are welcome)!
19:10digiorgi"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:10digiorgi :dependencies [[org.clojure/tools.nrepl "0.2.10"]]}}
19:10digiorgi
19:31arohnerdigiorgi: I see that frequently too, I think it's a cider.el issue
20:23Sizurhi all, is anybody here familiar with "flatteno"?
20:25dnolenSizur: yes, ask your question
20:25Sizurif second argument is unbound, why does it produce a bunch of unflattened answers together with one flattened?
20:26Sizurif that's intended, how is this useful? (genuine question)
20:27dnolenSizur: relational goals are very different from writing functions that only accomplish the operation that you care about
20:28dnolenSizur: there's no simple answer to your question - that's just how relational programming works
20:28Sizurok, how is flatteno useful then?
20:28Sizurhow can you actually flatten with it?
20:29Sizuryou must make sure that every caro is not a listo? so you have to introduce a negation using failure?
20:31dnolenSizur: 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:31dnolenSizur: if you understand the behavior you can move on.
20:32Sizurdnolen: what do you mean move on? how can i flatten a list?
20:33Sizuralso, 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:34dnolenSizur: 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:34dnolenSizur: Googling gave me this - http://stackoverflow.com/questions/9059572/flatten-a-list-in-prolog
20:34Sizurso i can do it relatively easy if i introduce negation using failure, but the hard part is how to express that without negation
20:35dnolenI wrote core.logic and I still go hunting for Prolog answers when I get stumped
20:36Sizurdnolen: thanks!
20:36amalloySizur: 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:37amalloywhereas you seemed to be saying that's not the case
20:37Sizuramalloy: what implementation of flatteno? i came here because minikanren is silent :)
20:37Sizur> (run 5 (q) (flatteno '(1 2 (3 4)) q))
20:37Sizur$3 = (((1 2 (3 4))) (1 (2 (3 4))) (1 2 ((3 4))) (1 2 (3 4)) (1 2 (3 4) ()))
20:38amalloy$google clojure flatteno
20:38lazybot[Logic Programming Part 3 (List Logic) « boss-level.com] http://boss-level.com/?p=64
20:38amalloyfeh
20:38amalloyhttps://gist.github.com/jballanc/8308717
20:38amalloyis what i found when i searched for clojure flatteno
20:38amalloyand it behaves as i'd expect
20:39Sizurah, unwrapo, let me implement that and check
20:44gfredericksprintlno
20:44gfredericksSystem/exito
20:49gfrederickscome on these are great jokes
20:49gfredericks.puto
20:52Sizurthe body of cl/defna is disjuncted?
20:53amalloyas if via conda
20:54Sizurah, it's a pattern match before the goal constructor is called
21:10TimMcgfredericks: :-D
21:12gfredericksTimMc: geez finally; it's getting harder and harder to make a buck around here
21:20isaac_rkswhat is Clojure's position on the crime of sodomy
21:25bbloom_Sizur: are you talking about the flatteno in clojure.core.logic.tests ?
21:26bbloom_dnolen: i think he's found a flatteno that doesn't match the name he's expecting
21:26bbloom_or at least what flatteno in the core.logic & minikanren tesks do doesn't match my intuition for the name flatteno
21:26bbloom_Sizur: you'll have to write your own relation, since that test one is not really what you want
21:26bbloom_it gives you all possible versions that are "flatter" ie w/ some layer removed
21:27bbloom_if you want like proper flatten which removes all nesting of any kind, you need to make that yourself
21:27bbloom_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:29bbloom_amalloy: yeah, that's not what's in the core.logic or minikanren test files
21:29bbloom_clojure.core.logic.tests=> (run 2 [q] (flatteno '(1 2 3) q))
21:29bbloom_(((1 2 3)) (1 (2 3)))
21:47RumelIf I'm getting a stack overflow error when using recur, is there a good way to debug it?
21:50gfrederickswell you're presumably not getting the stack overflow because of recur, so I'd look around at whatever else you're doing
22:03zactscan I get by with using java 1.7 for clojure?
22:03zactsor is it better to use java 1.8?
22:04justin_smithzacts: you only need 1.8 if you are using it's features, clojure doesn't need it
22:05zactsok
22:05justin_smithiirc clojure still works with 1.6, and it wasn't a very long time ago that it worked with 1.5
22:10puredangerCorrect
22:11puredangerI find 1.8 is generally 5-10% faster
23:33mercwithamouthso 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:33mercwithamouthwhat's the cleanest way to set the project up?
23:33justin_smithmercwithamouth: I put client and server in the same project
23:33justin_smithit rarely makes sense to mix and match client/server versions anyway
23:34mercwithamouthhmm gotcha. ok just manually add the various plugins i need....