#clojure log - Aug 11 2014

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

0:05 fifosine: How do I turn a string into a generator?

0:06 so that each time I perform take, it also drops what I've taken?

0:06 and returns nil when there are no chars left?

0:07 amalloy: fifosine: generators are not really a thing you do very much in clojure: very stateful for no real reason. instead, just seq the string, and then you have a seq of characters

0:07 fifosine: amalloy: Then how do I select a range of elements?

0:07 amalloy: take

0:07 fifosine: like, give me the first set of 5 chars

0:07 then the next set of five chars

0:08 amalloy: use all of clojure's gazillions of sequence operators

0:08 &(partition-all 5 "abcdefghijklmnopqrstuvwxyz")

0:08 lazybot: ⇒ ((\a \b \c \d \e) (\f \g \h \i \j) (\k \l \m \n \o) (\p \q \r \s \t) (\u \v \w \x \y) (\z))

0:10 johnwalker: fifosine: if you don't wanna type the alphabet, you can also do

0:10 (map char (range 100)) and then what amalloy suggested

0:10 fifosine: nice, ty guys

0:11 justin_smith: ,(apply str (map char (range (int \a) (int \z))))

0:11 clojurebot: "abcdefghijklmnopqrstuvwxy"

0:13 johnwalker: hehe not quite ;)

0:13 gotta inc your z

0:33 gfredericks: &(Math/ceil (Math/exp (Math/scalb (Math/log1p (Math/log1p (Math/sinh Math/E))) (Math/getExponent (Math/toDegrees (Math/log (Math/sin (Math/sqrt (Math/atan2 Math/PI Math/PI)))))))))

0:33 lazybot: ⇒ 9578.0

0:33 gfredericks: ^in case anybody was on the edge of their seat regarding the latest "java math" challenge

0:38 rhg135: that's a bit verbose

0:39 needs some macro sugar

0:39 maybe prefix-> or somn

0:40 gfredericks: &(Math/ceil (Math/exp (-> Math/E Math/sinh Math/log1p Math/log1p Math/scalb) (-> Math/PI (Math/atan2 Math/PI) Math/sqrt Math/sin Math/log Math/toDegrees Math/getExponent)))

0:40 lazybot: java.lang.IllegalArgumentException: No matching method: scalb

0:41 amalloy: you were right, rhg135, it's now immediately clear what gfredericks is doing

0:41 gfredericks: hwoops

0:41 amalloy: -> saves the day again

0:41 gfredericks: &(Math/ceil (Math/exp (Math/scalb (-> Math/E Math/sinh Math/log1p Math/log1p) (-> Math/PI (Math/atan2 Math/PI) Math/sqrt Math/sin Math/log Math/toDegrees Math/getExponent))))

0:41 lazybot: ⇒ 9578.0

0:41 gfredericks: phew

0:41 rhg135: like (prefix-> Math Math/X methods...)

0:42 prefix all methods with the class

0:42 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? x) (symbol "Math" (name x)) x)))

0:42 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0:0)>

0:42 gfredericks: ,(require 'clojure.walk)

0:42 clojurebot: nil

0:42 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? x) (symbol "Math" (name x)) x)))

0:42 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:42 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? x) (symbol "Math" (name expr)) expr)))

0:42 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:42 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? expr) (symbol "Math" (name expr)) expr)))

0:42 clojurebot: #'sandbox/mathly

0:43 gfredericks: sorry evrbdy

0:43 rhg135: np

0:43 bots are our slaves

0:43 *evil laugh*

0:43 gfredericks: ,(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent)))))

0:43 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (-1) passed to: walk/postwalk>

0:44 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? %) (symbol "Math" (name %)) %) expr))

0:44 clojurebot: #'sandbox/mathly

0:44 gfredericks: ,(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent)))))

0:44 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: sinh in class java.lang.Math, compiling:(NO_SOURCE_PATH:0:0)>

0:44 gfredericks: I give up

0:44 rhg135: macroexpand it

0:44 should be similar to the first one

0:45 gfredericks: too much wine for macroexpansion

0:45 rhg135: hmm

0:47 gfredericks: okay phine

0:47 ,(macroexpand-1 '(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent))))))

0:47 clojurebot: (Math/ceil (Math/exp (Math/scalb (Math/-> Math/E Math/sinh Math/log1p Math/log1p) (Math/-> Math/PI (Math/atan2 Math/PI) Math/sqrt Math/sin ...))))

0:48 gfredericks: ah ha

0:48 ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (and (symbol? %) (not (resolve %))) (symbol "Math" (name %)) %) expr))

0:48 clojurebot: #'sandbox/mathly

0:48 gfredericks: ,(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent)))))

0:48 clojurebot: 9578.0

0:48 gfredericks: bam.

0:48 rhg135: woo

0:48 Raynes: mathly

0:49 gfredericks: if you're not calling `resolve` in your macro you're doing it wrong.

0:49 rhg135: wouldn't -> turn to Math/->

0:49 gfredericks: that was the original problem

0:49 rhg135: which would go boom

0:49 oh

0:49 ic

0:49 gfredericks: thus the addition of the resolve check

0:50 rhg135: hmm

0:50 nice

0:50 useful

0:50 gfredericks: don't ever do that in real life

0:50 rhg135: but let it accept the class name

0:50 java is already ugly in principle

0:51 amalloy: gfredericks: look what you have wrought

0:51 rhg135: doesn't need verbose syntax too

0:51 gfredericks: amalloy: another senseless tragedy caused by drunk macro composition

0:51 TEttinger: oh geez does that macro do what I think it does?

0:51 use Math within a form?

0:51 amalloy: Math/yes

0:52 rhg135: uh oh

0:52 gfredericks: ,(mathly (+ PI PI))

0:52 clojurebot: 6.283185307179586

0:52 rhg135: seems it wasn't a good idea

0:52 gfredericks: ,(mathly (* PI E E))

0:52 clojurebot: 23.213404357363384

0:52 gfredericks: ^ why wouldn't you want to do that

0:52 TEttinger: well I :use the clojure numeric tower in my version of lazybot because people need math eval a lot

0:53 rhg135: To confuse readers, gfredericks

0:53 TEttinger: ,(alias use-math mathly)

0:54 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: use-math in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:54 TEttinger: ,(alias mathly use-math)

0:54 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mathly in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:54 TEttinger: hm

0:54 has it been 5 min? yes it has

0:54 gfredericks: ,mathly

0:54 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mathly in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:54 rhg331: (def use-math mathly)

0:54 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (and (symbol? %) (not (resolve %))) (symbol "Math" (name %)) %) expr))

0:54 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0:0)>

0:54 TEttinger: out of scope

0:54 gfredericks: ,(require 'clojure.walk)

0:54 clojurebot: nil

0:54 gfredericks: ,(defmacro mathly [expr] (clojure.walk/postwalk #(if (and (symbol? %) (not (resolve %))) (symbol "Math" (name %)) %) expr))

0:54 clojurebot: #'sandbox/mathly

0:54 gfredericks: there I fixed it

0:55 using my Alt+p

0:55 rhg331: interesting implementation

0:55 but superior to mine

0:56 gfredericks: the night grows old; I must away.

0:58 rhg331: gn gfredericks

1:01 prachetasp: rhg135 what are NPEs

1:01 how do i direct my comments at someone?

1:01 TEttinger: NullPointerException s

1:02 rhg135: Yup evil things

1:02 prachetasp: I've never run into an NPE

1:02 TEttinger: prachetasp, they happen when you try to use null (or nil, if it isn't checked for in the code) as a value

1:02 ,(+ 1 nil)

1:02 clojurebot: #<NullPointerException java.lang.NullPointerException>

1:02 prachetasp: ah so downstream

1:03 and how does get suppress npe's

1:04 TEttinger: make sure you don't have nils/nulls that aren't handled, like... #(if (seq nil) "yay" "it's nil")

1:04 amalloy: prachetasp: to get sometone's attention, just include their name in the message. your client probably tab-completes names, as well

1:04 TEttinger: ,(if (seq nil) "yay" "it's nil")

1:04 clojurebot: "it's nil"

1:04 rhg135: It doesn't call a nil

1:04 prachetasp: an example?

1:05 TEttinger: you can use nil for meaningful stuff, but mostly in clojure-land, where nil is basically synonymous with an empty seq

1:05 rhg135: (nil-v {})

1:05 Vs (get nil-v {})

1:06 TEttinger: ,(def nil-v nil)

1:06 clojurebot: #'sandbox/nil-v

1:06 TEttinger: ,(nil-v {})

1:06 clojurebot: #<NullPointerException java.lang.NullPointerException>

1:06 TEttinger: ,(get nil-v {})

1:06 clojurebot: nil

1:06 prachetasp: i see

1:07 damn okay switching the get's back :)

1:07 I'd definitely rather it failed noisily

1:07 as a more general subjective question how do you guys usually do exception handling?

1:08 rhg135: I don't lol

1:08 Don't hurt me!

1:09 prachetasp: you just check inputs/outputs stringently?

1:09 rhg135: Maybe use schema

1:09 prachetasp: when I used C# (ugh) I just used to catch them at the top level and let it all bubble up

1:10 I've been using a similar strategy - especially in my ring apps

1:14 rhg135: I personally pass errors in a tuple with nil or a result

1:14 Error monad ftw

1:15 prachetasp: yeah that seems like the most clojurey strategy

1:15 just a PITA to write all that result-checking code haha

1:16 rhg135: Higher order functions and macros

1:17 prachetasp: so you have a standard error return format and you wrap the functions that need to check the return with a macro that recognizes that?

1:18 rhg135: A function works

1:18 prachetasp: right or HOE

1:18 HOF*

1:18 rhg135: The macro is just sugar

1:18 Yup

1:18 amalloy: higher-order exceptions: the new hotness, coming soon to java 9

1:18 prachetasp: hahahah

1:18 coming soon* to java 9

1:19 rhg135: Didn't lisp have that in the 50s

1:20 amalloy: well, it had signals

1:20 prachetasp: didn't lisp have everything in the 50's?

1:21 rhg135: Hof are 90% of *

1:21 Macros fill the rest

1:44 prachetasp: I'm trying to deploy a jar to a self-hosted Artifactory server

1:44 I've had no issues doing this with several other projects

1:44 but now I'm getting Could not find artifact prachetasp:xxxxx:jar:1.0.0-20140811.054224-1 in snapshots

1:44 running ubuntu 14.04

1:48 technomancy I know you know the answer to this :)

2:31 well for all that care to know - the server ran out of space and that's what caused this

2:32 so if you every see Could not find artifact prachetasp:xxxxx:jar:1.0.0-20140811.054224-1 in snapshots its either your proxy settings or something with the upstream server

4:11 djcoin: Is there anything to expect (performance, simplicity, whatever) from the recent addition of lambda to the JVM? Thanks :)

4:14 llasram: djcoin: I'm sure at some point there will be a Clojure release which explicitly integrates with Java 8 lambdas and related features, but I don't think any specific plans have been publicly discussed yet

4:16 djcoin: Alright!

4:16 TEttinger: djcoin, in particular because I think java 8's install base is not good for end users

4:17 compared to 6 or 7

4:17 yet, at least

4:18 llasram: TEttinger: That'd be a good reason not to depend on Java 8 features, but there needs to be an integration plan

4:18 TEttinger: agreed

4:18 llasram: e.g. Scala has a community-discussed plan plus timetable and release schedule for integratino

4:18 TEttinger: lambdas are not closures, however

4:18 so clojure can't make as effective use of them as a replacement I think

4:20 llasram: Well. My understanding is that the Java 8 lambdas themselves are a Java language feature, and have no impact on the JVM that Clojure would need care about

4:20 However, as a Java library feature, the Java standard library grows many features supporting them in terms of various interfaces, which it would behoove Clojure functions to support for smooth interop

4:42 TEttinger: ah, good point llasram

4:59 ucb: I recall reading a blog a week or two ago where it was described how to destructure 2 maps that had the same keys, can anybody remind me of said blog or enlighten me in regards to the matter? I don't seem to be able to re-find said blog entry.

5:05 llasram: ucb: Something like? ##(let [m1 {:k 1}, m2 {:k 2}, {k1 :k} m1, {k2 :k} m2] [k1 k2])

5:05 lazybot: ⇒ [1 2]

5:06 ucb: llasram: yeah, but using :keys in function signatures :)

5:06 maybe I'm wrong and it cannot be done

5:06 also apologies for moving the goal-posts :D

5:07 llasram: Well, in `fn` args vs `let` uses the same syntax, so that's easy. But using `:keys`... Hmm. can't think of how that would work

5:09 ucb: yeah, same here. And I have a vague recollection of a discussion around this in said blog, with a solution, but I can't recall if there was any special :as syntax or not.

5:09 no worries, it's not vital

5:09 llasram: Oh, hmm

5:10 broquain1: ucb: I think you're after this - https://gist.github.com/john2x/e1dca953548bfdfb9844

5:12 ucb: broquaint: thanks, though it doesn't cover what I need :)

5:13 I guess I can just (fn [{a :key} {b :key}] ...) and be done with it

5:15 broquaint: Maybe with :or?

5:18 ucb: how would that work (if it does)?

5:21 llasram: I don't understand how any method of using :keys on multiple maps w/ the same keys could work. The whole point of keys is the 1-1 mapping from keyword to identifier. I really can't think of anything that lets you change that, unless you first modify the map to change the keys

5:21 hyPiRion: ucb: I'm not sure what you're attempting to do is really possible

5:22 llasram: s,point of keys,point of :keys,

5:22 hyPiRion: only thing I can think of is like

5:22 ,(defn m2' [m] (into {} (for [[k v] m] [(keyword (str (name k) 2)) v])))

5:22 clojurebot: #'sandbox/m2'

5:22 ucb: hyPiRion: well, I'm unsure as well. I just wanted to have an fn signature in which I could destructure two maps with clashing keys to save me some typing really ^_^

5:23 hyPiRion: ,(fn [{:keys [foo bar]} m2] (let [{:keys [foo2 bar2]} (m2' m2)] [[foo foo2] [bar bar2]]))

5:23 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol:   in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:23 hyPiRion: well, you get the idea

5:25 ucb: yeah

5:25 thanks for that :)

5:27 curveball: speaking of syntax stuff? What is most efficient way of turning this: {:apple {:type :foo}, :orange {:type :bar}}, into two statements inside a let so I get [bar-key :orange foo-key :apple]… I have ways where each line of let is looping over entire map or using like a filter… but would like something more idiomatic / clean

5:28 Essentially, I want to pull the top level keyword based on the contents of the value of the inner map

5:30 TEttinger: curveball, and if you have {:apple {:type :duplicate}, :orange {:type :duplicate}}

5:31 then you'd have some weird overlap

5:31 hyPiRion: ,(let [m {:apple {:type :foo}, :orange {:type :bar}}, [apple-type orange-type] (map #(get-in m %) [[:apple :type] [:orange :type]])] [apple-type orange-type]) ;?

5:31 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol:   in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:31 hyPiRion: oh dangit, my nbsps go bananas today

5:32 ,(let [m {:apple {:type :foo}, :orange {:type :bar}}, [apple-type orange-type] (map #(get-in m %) [[:apple :type] [:orange :type]])] [apple-type orange-type]) ;?

5:32 clojurebot: [:foo :bar]

5:32 curveball: yes TEttinger, however assume source will verify only one specific key of the two types I’m looking for (there are many more values in the map and the sub-maps, however source api will ensure only single of each)

5:32 llasram: curveball: ? ##(->> {:apple {:type :foo}, :orange {:type :bar}} (mapcat (fn [[fruit {:keys [type]}]] [type fruit])) (into []))

5:32 lazybot: ⇒ [:bar :orange :foo :apple]

5:32 hyPiRion: oh. like that.

5:33 llasram: hyPiRion: You should try some of the other fun Unicode whitespace :-D

5:33 TEttinger: and you'd want the names of course ##(->> {:apple {:type :foo}, :orange {:type :bar}} (mapcat (fn [[fruit {:keys [type]}]] [(name type) fruit])) (into []))

5:33 lazybot: ⇒ ["bar" :orange "foo" :apple]

5:33 TEttinger: although does let allow arbitrary vectors in?

5:34 this would need to be a macro, right?

5:34 * llasram twitches

5:34 curveball: Hmm… destructuring and then just building it back… interesting

5:36 I was hoping there was some built in recursive value find that could pop out the highest level keyword found under.

5:36 That totally works though, and cleaner than my approaches, thanks!

5:37 hyPiRion: I totally didn't understand that question, I realise.

5:38 llasram: I'm not entirely certain I did either.

5:38 But then can two humans ever really understand each other's questions?

5:39 curveball: depends on definition of understand

5:39 hyPiRion: llasram: people can understand sufficiently enough

5:42 llasram: I like to imagine that everyone are each actually speaking different languages and talking about completely different things all the time, and it's only through coincidence that the grammars overlap and no one notices

5:43 curveball: that’s closer to the truth than you think llasram

5:43 TEttinger: llasram, qualia hypothesis?

5:43 hyPiRion: llasram: Well, that would at least explain some of the source code I've seen in my lifetime.

5:44 llasram: Ha!

5:44 TEttinger: not really where I was going, but I do find qualia difficult to fully reject :-)

5:46 TEttinger: llasram, especially having tried to make art that was distinguishable for 2 different partly- and fully-red-green-colorblind people, I can see it

5:47 it's interesting how Mike was completely capable of describing the issue he had, and then one of my images through him for a loop -- "it's red in my left eye and green in my right. this has never happened before"

5:47 thesaskwatch: Hi, what's wrong with this code: (map #( [% %] ) { :a 1 }) ?

5:47 TEttinger: thesaskwatch, a lot

5:47 llasram: thesaskwatch: It tries to call a vector as a 0-argument function

5:48 rodnaph_: i'm trying to log to syslog using log4j through clj-logging-config, but everything seems to be going to a black-hole - does anyone have experience with getting this to work?

5:48 TEttinger: ,(map #( [%1 %2] ) { :a 1 })

5:48 thesaskwatch: ah, right

5:48 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval27/fn--28>

5:48 llasram: thesaskwatch: You can either use the explicit `vector` function, or you'll sometimes see e.g. #(-> [% %])

5:48 TEttinger: if you just want double keys, try ##(map #(vector % % ) { :a 1 })

5:48 lazybot: ⇒ ([[:a 1] [:a 1]])

5:48 TEttinger: oh yeah, kv pairs

5:49 what should it do?

5:49 thesaskwatch: TEttinger: I want to turn [{:a 1} {:b 2}] into {:a {:a 1} :b {:b 1}}

5:49 TEttinger: why 1 for both?

5:49 thesaskwatch: :b at the end should be 2

5:50 TEttinger: ok

5:50 llasram: rodnaph_: Why not just use a static logging configuration properties file?

5:50 TEttinger: ,(into {} (map #(vector (key %) % ) { :a 1 })

5:50 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:50 TEttinger: ,(into {} (map #(vector (key %) % ) { :a 1 }))

5:50 clojurebot: {:a [:a 1]}

5:50 thesaskwatch: TEttinger: thanks

5:50 TEttinger: ,(into {} (map #(vector (key %) % ) { :a 1 :b 2}))

5:50 clojurebot: {:b [:b 2], :a [:a 1]}

5:50 TEttinger: no prob, thesaskwatch

5:50 thesaskwatch: that's how I would do it minus the vector part

5:51 rodnaph_: llasram: yes i could - but could clj-logging-config first and it seemed to solve a lot of problems so have trusted it knows best. i'll fall back to doing it with a static file if that works though.

5:52 llasram: rodnaph_: well, this is the first time I've heard of clj-logging-config, and it honestly seems a bit out-of-place. I'm not quite sure what problems it lives to solve (beyond Clojure interface to dynamic logging config)

5:52 In general you just configure your Java logging library like you would for any other JVM project, which generally means a static properties or XML file

5:53 rodnaph_: llasram: ok, i'll give it a go then, thanks.

5:54 thesaskwatch: TEttinger: why is [] treated as function in this case? (fn [] ["abc"]) works fine

5:54 TEttinger: (in this previous #() case)

5:54 TEttinger: thesaskwatch, that's the arg list

5:54 in fn you return the last form, but in #() it immediately calls the form

5:54 llasram: thesaskwatch: You can use the reader to see:

5:55 ,#([:what-is-this])

5:55 clojurebot: #<sandbox$eval130$fn__131 sandbox$eval130$fn__131@24539d>

5:55 llasram: Er

5:55 ,`#([:what-is-this])

5:55 clojurebot: (fn* [] ([:what-is-this]))

5:55 llasram: There we go

5:55 ,`#(inc 1)

5:55 clojurebot: (fn* [] (clojure.core/inc 1))

5:55 TEttinger: see the parens around the brackets?

5:55 it's trying to call it with #()

5:55 llasram: Which you need, or else you'd need to write #((inc 1)), which would be annoying :-)

5:55 TEttinger: ,`(fn [] [:what-is-this])

5:55 clojurebot: (clojure.core/fn [] [:what-is-this])

5:56 thesaskwatch: TEttinger: ok, didn't know that. It's a quite different behaviour. Didn't see it mentioned in docs.

5:56 TEttinger: thanks llasram~

5:56 (inc llasram)

5:56 lazybot: ⇒ 32

7:57 dimovich: is it possible to automatically add dependencies from cider repl?

7:58 read somewhere about a project that checks your ns declaration and loads the dependecies, but forgot the name... :(

7:58 schmir: dimovich: maybe slamhound

7:58 dimovich: yeah... thanks

8:02 clgv: slamhound does not load dependencies based on ns-forms. it allows to reconstruct ns-forms with respect to what is used in the source file

8:04 schmir: yes, not sure what the OP was asking for

8:32 TimMc: pomegranate?

8:32 I couldn't get it tow rok for me, but that was a while ago.

8:33 *to work

8:35 justin_smith: TimMc: alembic is much easier to use than pomegranate

9:31 clgv: TimMc: but he wanted to determine dependency artifacts from namespace ns-forms which is probably impossible in general ...

9:32 justin_smith: thank you for the alembic reference - I did not know that one, yet

9:36 justin_smith: it's really handy to do a one-off test of a lib without having to modify project.clj (or even create a project for that matter)

9:40 clgv: by one-off without project you mean "lein try"?

9:41 justin_smith: I mean I already have a no-project repl open

9:41 and want to load some random lib

9:41 clgv: ah ok^^

9:41 justin_smith: like lein try but a bit more flexible

9:43 I decided to play with markov chains again - now I just need to decide on how I represent ngrams - a map with a prefix seq as key and a map of all suffixes? or a nested map of maps?

9:45 JohnTalent: i don't know about clojure. there seems be too many ways to do one thing in it. and reading someone elses nonstandarized code is time consuming.

9:46 TimMc: clgv: Ah, I see. Yeah, impossible in the general case, and unsatisfying in the easy case. :-P

9:47 clgv: justin_smith: depends on the non-functional requirements. nested maps potentially require more memory

9:48 JohnTalent: what is your question?

9:49 JohnTalent: most turing complete languages offer you more than one way to implement desired functionality

9:52 justin_smith: clgv: but do nested maps have any advantage over a map with a seq for each key in representing ngrams?

9:52 I am starting to think not

9:52 TimMc: something something tries

9:53 clgv: justin_smith: humm, nested maps probably give you an advantage when you need to consider subtrees

9:55 justin_smith: clgv: yeah, I don't think my algo needs subtrees - it's just markov with a meory of N

9:55 JohnTalent: clgv: how can i program without spending inordinate amount of time looking a single variable let names determining their final result in someone else's code.

9:56 i really think clojure is orthogonal to standarization in corportions. sadly, because it seems like a fine language to some extents.

9:56 clgv: JohnTalent: how do you do it in java and c++ with local variables?

9:57 justin_smith: JohnTalent: "determining their final result" is much easier in clojure, because they aren't variables and they can't be changed

9:59 clgv: JohnTalent: local bindings in clojure can be interpreted as "final" local variables in java

10:00 TimMc: JohnTalent: By orthogonal do you actually mean in opposition?

10:01 or at cross-purposes

10:01 JohnTalent: clgv: i was going to write my program in clojure, but after viewing clojure source, I'm not so sure.

10:01 it seems like you need in depth knowledge of each of the hundreds of functions/macros that exist.

10:02 clgv: JohnTalent: did you read any introductorial material (books or guides on the internet) about clojure, yet?

10:02 JohnTalent: clgv: yes, i have.

10:02 ToxicFrog: Fortunately, the clojure standard library is very well documented and that documentation is even avaiable from the REPL.

10:03 clgv: JohnTalent: no not really. you can build your knowledge iteratively starting from a few core functions and macros...

10:03 sritchie: Anyone seen this on cider? No reader function for tag +cljs

10:03 oh, you know what -

10:03 I’m converting files to cljx, haven’t moved that one yet

10:03 it’s still .clj

10:03 TimMc: JohnTalent: I don't think it's any worse than the amount of knowledge you need to pick up for the standard library of most languages.

10:03 clgv: TimMc: or even the standard syntax of those languages^^

10:04 TimMc: (With the caveat that if you already know Java, it really helps...)

10:06 JohnTalent: clgv: that'd be nice

10:06 ToxicFrog: sritchie: cljx?

10:06 JohnTalent: clojure seems like such an investment though.

10:07 sritchie: ToxicFrog: yeah, https://github.com/lynaghk/cljx

10:07 JohnTalent: c/c++ has like what 40 keywords?

10:07 ToxicFrog: TimMc: I'm not sure already knowing Java helps that much

10:07 JohnTalent: clojure has hundreds.

10:07 clgv: JohnTalent: it probably helps if you start implementing easy problems and then move on to problem with increasing difficulty

10:07 ToxicFrog: JohnTalent: ahahahahaha what?

10:08 clgv: JohnTalent: you mean function or macro names? otherwise clojure has as many clojure keywords as fit in your memory ;)

10:09 JohnTalent: let me ask you this. Has clojure been catching on with corporations?

10:09 only one that I know is puppetlabs

10:10 clgv: JohnTalent: there are several threads on the mailinglist about that topic

10:10 TimMc: JohnTalent: Sure, I could name several.

10:11 hyPiRion: Biggest ones are probably Apple and Twitter.

10:11 TimMc: I work for one. :-)

10:11 JohnTalent: TimMc: thanks, that answers my question.

10:11 i'd say in 3 months it'd be possible to be a beginner clojure programmer.

10:13 ToxicFrog: JohnTalent: it is not nearly that bad unless you are totally unfamiliar with dynamically typed HLLs, I think. Maybe start with the Koans?

10:13 This reminds me, I should get back to work on my Spellcast project.

10:13 teslanick: hyPiRion: Clojure at Apple? For reals?

10:14 JohnTalent: the biggest problem i see in clojure is order of operations, given macros and positional constraints between function arguments, let statements and other out-of-order functions.

10:14 teslanick: JohnTalent: I'm a JS developer by day, but I was able to pick up and go with the basics of Clojure in a couple weeks or so.

10:14 JohnTalent: teslanick: that sounds about right.

10:15 justin_smith: IT WORKS. Markov chains from input text, with arbitrary memory. The chain is by character not by word. https://github.com/noisesmith/markov-toy

10:15 JohnTalent: i am itching to program a web app. i'm seriously rethinking just doing it in java. clojurescript seems like a layer that just ads to the error posibilities.

10:15 justin_smith: not bad for an hours work (you can check it out and run it, "lein run 4" gives decently uncanny results)

10:16 teslanick: That's what learning is. Stumbling around and crashing into sharp edges until you develop some basic mastery.

10:16 JohnTalent: i mean javascript

10:18 wyvern looks interesting. it's boringness might be a boon.

10:18 clgv: justin_smith: no prng seed? ;)

10:18 justin_smith: clgv: oh, good idea

10:18 ToxicFrog: JohnTalent: AIUI, the "killer app" for cljs is core.async, which lets you escape from the callback hell that characterizes JS programming

10:18 But I have limited experience with js and none with cljs.

10:18 hyPiRion: teslanick: yeah.

10:19 dnolen_: JohnTalent: also Microsoft, Citibank, Staples, Walmart Labs, Netflix

10:19 justin_smith: clgv: also I notice that I didn't use the base argument in gen-chain properly (it could be used to summarize multiple inputs into one chain (ie. multiple start and stop tokens would exist)

10:19 JohnTalent: dnolen_: yup, thats several.

10:20 without a good memory clojure is a bust.

10:20 pcn: I would like to have a binding in a module that represents the confguration of my program. When I signal it, I'd like for that binding to be updated so subsequent reads to it get the new binding. Does anyone have examples of this being done?

10:20 dnolen_: JohnTalent: with a good memory X is a bust

10:20 clgv: JohnTalent: http://clojure.org/cheatsheet

10:20 dnolen_: s/without

10:20 pcn: The update would be from a file

10:20 justin_smith: I find that clojure reduces the amount I need to remember when programming - when things are default immutible, there are fewer details and gotchas for me to remember

10:21 some long term memory for the big standard library, traded for less need for short term code-reading memory

10:22 ToxicFrog: Naming question! What do I call a function that's a map (fn) over the values only of a map (data structure), leaving the keys unchanged?

10:22 mapv already exists and does something different.

10:22 mapmap is silly but kind of appealing.

10:22 justin_smith: map-vals

10:22 TimMc: I've seen "fmap" used for that.

10:22 JohnTalent: i'm still not sold. sucks.

10:22 TimMc: but I like map-vals

10:22 dnolen_: JohnTalent: that's ok, no one is going to really try to convince you :)

10:22 ToxicFrog: JohnTalent: so, do you have an actual interest in learning Clojure, or did you just come in here to complain about how hard you think it would be to learn if you ever tried?

10:23 TimMc: I don't think that's constructive.

10:24 JohnTalent: ToxicFrog: i am trying. i have other languages known. but I like clojure's multicore friendliness. but i don't feel like it's a good investment at this time. i think i'm just going to write it in javascript. debugging will certainly be much easier.

10:24 * ToxicFrog googles "fmap", gets 40 pages of Haskell type theory in the face

10:24 clgv: ToxicFrog: update-vals?

10:24 TimMc: hahaha

10:24 justin_smith: JohnTalent: well, if javascript is a given, multicore isn't even on the table

10:24 TimMc: dnolen_: Nonsense, if I get one more convert I can trade in my points for an RC car!

10:25 JohnTalent: justin_smith: and cljs is?

10:25 justin_smith: no, I am saying with cljs, since it is based on javascript, multi-core is out of the question - it's not an option

10:25 pcn: So, how do ppl deal with config files that change, but only updating when the program is signaled?

10:26 clgv: JohnTalent: well that technology radar thingy said "Clojure: adopt" ;)

10:26 justin_smith: so if that's your reason for using clojure, you may not want to be using clojure for this

10:26 JohnTalent: it matters not then sine my program will be a browser app

10:26 ToxicFrog: justin_smith: well, it depends

10:26 teslanick: There are advantages to clojure(script) over and above multi-core friendliness.

10:26 ToxicFrog: If you want to escape callback hell and organize your code nicely into threads, core.async in cljs is killer

10:26 justin_smith: teslanick: absolutely, just wanting to be clear, since he said that was his reason

10:26 ToxicFrog: If you want to actually execute code in parallel on multiple codes, you're boned.

10:27 So it depends on whether you want it for code readability reasons (use clojure) or performance reasons (don't run in the browser)

10:27 hyPiRion: JohnTalent: What would make Clojure a worthy investment for you? Would making it easier to start with a better choice?

10:28 JohnTalent: that thing that i am finding in clojure is, you must know the entire macro or entire function to understand what it does. and there just seems to be endless code to go through.

10:28 ToxicFrog: TimMc: looks like "fmap" is a more general "functor map" which is a polymorphic map that returns the same type as its input, rather than just "map" which always returns a sequence.

10:28 dnolen_: JohnTalent: a lot of people are successful JavaScript - seems like a sound tech choice to me. ClojureScript appeals mostly to ... surprise ... Clojure programmers.

10:29 TimMc: pcn: We've been exploring Archaius.

10:29 ToxicFrog: TimMc: it looks like we actually had fmap in contrib in 1.2, I'm not sure where it lives now.

10:29 cbp: i think any experienced dev can learn any language in like 2 full-time weeks

10:29 JohnTalent: i was looking at mie hello world last night and could not figure out the supposidly small code it tooks to make mie.cljs

10:30 ToxicFrog: JohnTalent: I note that 99%+ of the time you don't need the source for the things you're calling, just the docs.

10:30 teslanick: JohnTalent: Most functions don't do very much.

10:30 ToxicFrog: Indeed, the whole point of functional abstraction (in any language) is not needing to hold the entirety of the program in your head at once.

10:30 hyPiRion: cbp: Depends on what you mean by "learn".

10:30 TimMc: JohnTalent: CLJS is more complicated than CLJ because it (sort of) requires knowing about two different platforms.

10:30 clgv: JohnTalent: same advice as before start solving easy problems. you'll only need a limited number of functions and control structures (clojure.core macros)

10:30 mdrogalis`: tbaldridge: Be sure to take the computer as an argument to your function, loool.

10:31 JohnTalent: what I am finding is that is seems like a big cliff. i am amazed an hickley for his genius and instantiation of clojure in such a complete matter. the api for clojure is such a cliff.

10:31 ToxicFrog: Aha, it's in algo.generic

10:31 tbaldridge: mdrogalis`: yeah, to be fair I think he's wondering since he wrote Elixir and IIRC the Erlang VM doesn't support local mutation at all.

10:31 clgv: JohnTalent: solving easy problems with different focus will introduce you to different functions of clojure. consider 4clojure.com for practicing

10:31 tbaldridge: So the platform kind of restricts him from copying the clojure code.

10:31 ToxicFrog: JohnTalent: what makes it clifflike? I found starting small, with the Koans and similar exercises, to be quite approachable.

10:31 teslanick: Or even: http://clojurescriptkoans.com/

10:32 cbp: hyPiRion: Enough to start being productive

10:32 pcn: TimMc: that's a bit more distributed than what I'm thining of as my implementation for now. Any thoughts on how to do this locally, for a single system?

10:32 mdrogalis`: tbaldridge: It's a fair question. Hulk's reply was pro, though.

10:32 tbaldridge: mdrogalis`: lol yes it is

10:32 JohnTalent: ToxicFrog: koans are not a favorite of mine.

10:33 it's the api and it's source

10:33 clgv: JohnTalent: you dont need to read clojure.core source to learn the basics of the language ;)

10:34 JohnTalent: you probably did not read the java source to learn java either ...

10:34 JohnTalent: lisps inherit weakness is that there is no contraint on the order of operations nor the clear definition of the extents of it's 'keywords' extended by it's functions and macros.

10:34 justin_smith: JohnTalent: the order of operations is highly constrained

10:34 JohnTalent: clgv: javascript. i only know a little java. not a java fan. javascript is so so to me.

10:35 justin_smith: in what way?

10:35 justin_smith: JohnTalent: the advantage of lisp over an algol family language is that order of operations is never ambiguous

10:35 ToxicFrog: JohnTalent: well, you probably didn't read the JavaScript interpreter/stdlib source code when learning JavaScript,either.

10:36 justin_smith: *an advantage

10:36 JohnTalent: a function's arguments and internal macro can have exponentially different order of operations without knowing the source.

10:36 ToxicFrog: justin_smith: I believe -- correct me if I'm wrong -- that his objection is that in (x foo bar), if x is a macro, it is possible that the macro writer has done something evil.

10:36 JohnTalent: ToxicFrog: probably? you detain me by unknown information you guess?

10:36 ToxicFrog: JohnTalent: what? I can't parse that.

10:37 JohnTalent: anyways. You seem to be operating under the assumption that, since macros can do surprising things, you can't trust the documentation and must instead (recursively) read the source code for everything you call.

10:38 justin_smith: JohnTalent: unlike most languages, the order of function argument evaluation is defined (left to right is guaranteed). Regarding macros, good luck understanding any macro system (including the one that comes with C), they inherently are capable of evil

10:39 JohnTalent: a big let down was seeing lots of one character let definitions doing standard operational duty. big loss.

10:39 ToxicFrog: "standard operational duty"?

10:39 teslanick: And the clojure macros are designed for readability; they're not required to get anything done. I didn't bother with them for the first months of learning the language.

10:40 JohnTalent: ToxicFrog: "one character let definitions"?

10:40 ToxicFrog: ...this is exciting. Replaced my map-specific implementation with clojure.algo.generic.functor/mapv, and now "lein test" OOMs.

10:40 justin_smith: teslanick: you don't need to write them, but you won't get far without using them

10:40 ToxicFrog: JohnTalent: I know what you meant by that. I don't know what you meant by "standard operational duty".

10:40 teslanick: justin_smith: Agreed. You'll get about three months before you say, "god this sucks, there has to be something better"

10:40 JohnTalent: well, i won't bother you guys any father. i had hoped for more. but i prefer homegrown functionality.

10:40 teslanick: Esp. in clojurescript where you're touching a lot of properties.

10:41 JohnTalent: without types it makes clojure a blob cake letting team members play jedi mind tricks on your soul.

10:41 hahahah!

10:41 dnolen_: JohnTalent: 'grats you're now on the ignore list

10:42 ToxicFrog: JohnTalent: I am fairly confident saying that if you insist on writing everything from scratch and never using library functions, or alternately on reading the complete source code for every function you call, clojure is not a language you will enjoy.

10:42 JohnTalent: ToxicFrog: i am glad you know what I mean't but you aren't in a position to back why one letter let definitions exist in clojure source api?

10:42 ToxicFrog: But then, neither are the overwhelming majority of other programming languages.

10:42 JohnTalent: ToxicFrog: yes precisely!

10:42 justin_smith: teslanick: ##(count (filter (comp :macro meta) (vals (ns-publics 'clojure.core))))

10:42 ToxicFrog: JohnTalent: what is this "clojure source API" you keep mentioning?

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

10:42 ToxicFrog: JohnTalent: and yet...you use JavaScript? So did you read the complete source for Rhino or V8 or whatever when learning it?

10:42 JohnTalent: ToxicFrog: i am guessing you don't know.

10:43 ToxicFrog: Like, I genuinely cannot fathom this mindset that says functional abstraction is bad, let's throw away a fundamental tenet of programming and make things way harder for myself because black boxes make me uncomfortable.

10:43 JohnTalent: if I knew I wouldn't have asked.

10:43 justin_smith: clojure has no "source api" - the functions making up the core of the language have source code you can look at, but that is not an api

10:44 JohnTalent: if cljs doesn't improve on concurrency I am guessing it's just for clojure programmers who don't want to battle unknown asyncs.

10:44 ToxicFrog: Sanity check, everyone else in the channel, please: am I feeding the troll or do we just have a fundamental disconnect in mindset here?

10:44 pcn: Is he asking about docstrings?

10:44 arrdem: ToxicFrog: reading scrollback..

10:44 JohnTalent: pcn: no the docstrings are good to ok.

10:44 teslanick: JohnTalent: You don't get true concurrency in JS anyway, unless you write the boilerplate worker code.

10:45 ToxicFrog: JohnTalent: we've been over this. It does not let you execute code in parallel because this is a fundamental limitation of JS. It does let you write code using message-passing rather than callbacks.

10:45 hyPiRion: ToxicFrog: the former

10:45 JohnTalent: pcn: however i'm finding that without reading the full source you lose. so docstrings helps a little, but one letter let statements with recusive macro passing doesn't look like much fun to me.

10:45 cbp: I thought lamenting the lack of types while arguing for javascript was a telltale sign :-P

10:46 ToxicFrog: JohnTalent: "lose" how?

10:46 JohnTalent: teslanick: yappers, thats what i thought.

10:46 pcn: JohnTalent: You're not telling anyone what function/macro you're talking about. I feel the frustration here.

10:47 arrdem: ToxicFrog: I vote not blatantly trolling

10:47 tbaldridge: JohnTalent: and please define "one letter let statements"

10:47 arrdem: yet

10:47 JohnTalent: ToxicFrog: because you need to know the full containts of what the function/macro does in order to shoe fit it into your code!

10:47 tbaldridge: and provide an example.

10:47 ToxicFrog: JohnTalent: this is blatantly untrue.

10:47 owengalenjones: lol

10:47 pcn: OK, what tbaldridge said is clearer than what I said

10:47 arohner: /ignore JohnTalent

10:48 JohnTalent: sorry, i will go.

10:48 pcn: JohnTalent: That's mis-understanding what functions do.

10:48 tbaldridge: JohnTalent: no need to leave, I just think you're a bit mistaken.

10:48 JohnTalent: a language under each function. thats all i have been seeing on my eagerness to earn clojure.

10:49 tbaldridge: JohnTalent: I've been writing Clojure for years, I don't really know off the top of my head how every part of the "for" macro works, but I've never really needed to. The docs tell me everything I need to know

10:50 JohnTalent: no they do not.

10:50 teslanick: I don't understand what "a language under each function" means. The docstrings are usually very clear about what a fn takes as input, and what it produces as output.

10:50 tbaldridge: JohnTalent: what do they not tell you?

10:50 JohnTalent: however, the sourceode does.

10:50 teslanick: And functions are stateless, so you don't have to care how they're implemented in the general cas.e

10:51 tbaldridge: JohnTalent: the very point of pure functions is that given the same input they will give the same output. What is wrong with using them as black-boxes?

10:51 hyPiRion: JohnTalent: I'm not sure I follow your argument. You're saying you need to understand how every function/keyword in a language works on the source code level in order to be capable of using and understanding it?

10:51 JohnTalent: tbaldridge: that all depends on the documentation. only the source knows all. and thats why i have been finding i have to dredge through it , for every god damned function.

10:51 hlprmnky: so your complaint is that when you want to incorporate a new function into your code, (doc foo) doesn't tell you what you want to know, and (source foo) is hard to read because the authors of clojure.core use let assignments that aren't verbose enough for you to follow easily?

10:52 Does that pretty much have it surrounded?

10:52 JohnTalent: hyPiRion: yes indeed, mostly so.

10:52 hlprmnky: and how do you solve this problem when working in, say, Javascript?

10:52 hyPiRion: JohnTalent: So which other languages do you work with where you've read the source code of the language?

10:52 tbaldridge: Or C?

10:53 JohnTalent: teslanick: does usually cover it all for you? or do you have to resort to code? be honest.

10:53 arohner: When I add [org.clojure/data.xml "0.0.7"], I'm getting "Could not find artifact org.clojure:pom.contrib:pom:0.0.25". I know I've solved this in the past by adding another maven repo, can anyone remind me which?

10:53 tbaldridge: JohnTalent: what do you currently program in? And what libraries have you used that aren't like this?

10:53 justin_smith: JohnTalent: because clojure functions and macros don't have implicit side effects (unless very carefully documented to do so) all you need to care about is whether (f x) gives you the result you desire or not. You can use it if the output is what you need, and try other options otherwise. There are very few hidden gotchas in clojure.

10:53 puredanger: arohner: that should be in Maven Central so you shouldn't need another repo

10:53 hlprmnky: I don't know how useful you'll find this, JohnTalent, but as a relative newbie what I have found to work for me is:

10:54 arohner: puredanger: it's reliably failing for me, on two different machines

10:54 teslanick: JohnTalent: I've looked at the implementation of a couple functions, usually when I've misunderstood how they work. But most of the time examples and docs are perfect.

10:54 arrdem: arohner: can confirm, it's in Maven Central

10:54 JohnTalent: hyPiRion: types help alot i think. clojure has lots of goodness in it. but I really don't think corporations will catch onto it. because there is a language under every function.

10:54 hlprmnky: (doc foo) -> if still confused, fire up REPL and putter around with various inputs to foo until I "get it"

10:54 clojurebot: Titim gan éirí ort.

10:54 JohnTalent: teslanick: precisely!!!

10:54 puredanger: arohner: could be a maven caching issue like we've been fighting with cljs

10:54 arohner: puredanger: hrm, lein is looking in sonatype-snapshots

10:54 hlprmnky: I've never felt the need to use (source foo) *to figure out what a function does*

10:54 hyPiRion: JohnTalent: How is that relevant to my question?

10:55 JohnTalent: teslanick: by the way, if you want the 1 gig file of all telsa documents i can send you the link.

10:55 ToxicFrog: JohnTalent: be honest? I've written ~3000 lines of clojure -- granted, not much, but not nothing either -- and have had to refer to the source code for the libraries I use exactly once.

10:55 teslanick: JohnTalent: What do you mean? When I say "a couple" I literally mean, I think I've looked at the source code of two functions because I was using them wrong. In 8 months of fooling with clojure.

10:55 JohnTalent: tbaldridge: python, but it' multicore is a joke. after this convo i will use javascript since it's a web app.

10:56 ToxicFrog: And that once wasn't even a core library, it was a third-party HTTP library.

10:56 justin_smith: JohnTalent: neither python nor javascript can do multicore

10:56 JohnTalent: yes, indeed javascript's webworkers isn't best for multicore. but i'm not counting on it.

10:57 ToxicFrog: JohnTalent: so, why does this paranoia apply only to clojure? Or have you read the complete source code to JavaScript?

10:57 JohnTalent: up until yesterday i was looking towards clojure to be my base.

10:57 hyPiRion: justin_smith: `from multiprocessing import *`

10:57 ToxicFrog: Personally, I'd be way more scared of hidden side effects and stuff in JS than I am in clojure.

10:57 cbp`: in my experience clojure/racket are the easiest languages to read source code in

10:57 ToxicFrog: If you insist on reading the library source for clj but not js, I can only conclude that you are either trolling or tragically misinformed about something.

10:58 puredanger: JohnTalent: what do you seek here? confirmation of your opinions? a better way of working? better understanding?

10:59 teslanick: ^ I read the source code for JS libraries *all the time* because they do something undocumented, or they're memoizing something badly, or whatever.

10:59 JohnTalent: ToxicFrog: there are some in javascript. like null and such, and they have to be checked at every reference point, but i don't have to go through source to find what the hell duck type an argument is or what a macro adds to an argument.

10:59 puredanger: all of the above.

11:00 puredanger: JohnTalent: I think I can summarize the last 10 pages of backchat that: others are not in agreement so let's move past that.

11:00 tbaldridge: JohnTalent: yes, Python and Clojure are created very differently. Python relatively shallow, not very many abstractions. Clojure code often consists of many layers of abstractions.

11:01 JohnTalent: puredanger: i have what i need i think.

11:01 python is a joke too.

11:01 i spent 4 years part time in it.

11:01 tbaldridge: JohnTalent: so the recommendation is going to be, don't try to understand it all. Abstractions result in leverage. Use that to your advantage and don't worry about how it's built until you need it

11:01 JohnTalent: there are pythonesque apis but under the source code it's magic global variable happy time.

11:02 ToxicFrog: JohnTalent: you seem to be trying to argue that clojure is hard to learn, which I think some people in here would agree with, but you are using as the basis for argument the assertion that using clj requires reading the complete source code for every library you use

11:02 Which is (a) something that everyone else in here disagrees with both for clojure specifically and programming in general;

11:02 rweir: good python apis very rarely use many globals, and it's considered poor form

11:02 tbaldridge: JohnTalent: this is why Clojure code is often so small, there's so much composition going on that you get very dense, very relevant code. Thus why Clojure code is often 10x smaller than Java.

11:02 ToxicFrog: (b) totally inconsistent with your own stated usage of languages like JS; and

11:02 (c) completely, nakedly insane

11:03 JohnTalent: tbaldridge: companies don't like 'types', is this true, or untrue?

11:03 arohner`: puredanger: (re: pom issue) I dont have sonatype-oss-snapshots in my project, so how is it getting pulled in?

11:03 arrdem: "companies don't like types" lolwut

11:03 puredanger: arohner`: most likely your settings.xml

11:03 pcn: JohnTalent: That question doesn't make sense. Can you ask it with something more specific than "companies" and provide a context?

11:03 puredanger: ~/.m2/settings.xml that is

11:03 clojurebot: It's greek to me.

11:03 tbaldridge: JohnTalent: such a question requires many many pages of definitions. Types? (clojure has types), companies, what companies, what size. You can't generalize and expect to get a decent answer

11:03 arohner`: puredanger: nope

11:04 mgaare: companies like business value. to what extent and under what circumstances types provide business value is a really enormous question

11:04 arohner`: puredanger: I'll bet you can repro by rm'ing your local copy of contrib.pom & lein deps

11:04 JohnTalent: if i would say one thing about clojure/lisp. if there were types and contrictions on how function/macros operated on other function/macros there'd be more of a win.

11:04 hlprmnky: I move that the room re-examine the recent question in re: "Is JohnTalent confused or trolling"

11:04 tbaldridge: JohnTalent: companies are not people, therefore they cannot have emotions such as "liking" something :-P

11:04 ToxicFrog: justin_smith: but dynamic typing doesn't bother you in JS?

11:04 rweir: hlprmnky, surely there wasn't doubt

11:04 JohnTalent: what i have gathered today is that I need to go through all the source to all of the functions i will need to use.

11:05 rweir: hlprmnky, this is like the 24th hour of it

11:05 hlprmnky: ooh

11:05 ToxicFrog: JohnTalent: no, that's what you came in saying.

11:05 hlprmnky: ":("

11:05 ToxicFrog: JohnTalent: people in here have tried to explain why that is wrong and you have ignored all of them while flailing around making either incorrect or internally contradictory assertions about clj vs js.,

11:05 JohnTalent: pcn: questions don't make sense because of no answer. there is no other reason.

11:06 ToxicFrog: JohnTalent: no, your questions don't make sense because they are incomprehensible word salad

11:06 JohnTalent: ToxicFrog: yes, that is what I think of clojure's api salad.

11:06 arrdem: justin_smith: JohnTalent better not be you testing that markov chain over #clojure logs :P

11:07 ToxicFrog: JohnTalent: The "API salad" exists only in your mind. Seek psychological help.

11:07 owengalenjones: ToxicFrog: ignore the troll

11:07 arrdem: /ignore JohnTalent

11:07 JohnTalent: ToxicFrog: how many personal digs do you want to jab me with?

11:07 puredanger: ToxicFrog: no need to get mean. API Salad is actually my new band name.

11:08 hlprmnky: JohnTalent: Please don't forget to come back and tell us all about it when you finally decide that no currently-available programming language is not "a joke" and craft one of your own devising that addresses all the concerns you've raised

11:08 ToxicFrog: owengalenjones: I'm honestly not sure what to believe anymore. At first I thought confused and intimidated newbie. Then I though troll. Now I'm leaning towards mentally ill.

11:08 hlprmnky: I'd be interested to look at it

11:08 tbaldridge: arrdem: that's enough! Now I have to read up and Markov chains this week and implement that....

11:08 JohnTalent: owengalenjones: You are so brave,i judge code , not people. I'm not stupid enough to do the later.

11:08 owengalenjones: not judging anyone

11:09 puredanger: arohner`: could also be something added by a lein user profile - check ~/.lein/profiles.clj

11:09 owengalenjones: I think theres fundamental differences of opinion re: creating software

11:09 that aren't going to be reconciled

11:09 JohnTalent: owengalenjones: when you call someone a troll, that is not judging someone?

11:09 owengalenjones: time for everyone to move on

11:09 my gut opinion at this point is that your trolling

11:09 your not going to change your mind

11:09 clearly

11:09 technomancy: lifehack: if you don't like clojure, you can say "I don't like clojure" instead of making stuff up

11:09 arrdem: tbaldridge: markov chains are fun. I built a set constrained cumulative markov chain for M:TG deck generation a while back..

11:09 technomancy: (if pressed, you can mutter something about parens)

11:10 JohnTalent: owengalenjones: i do not answer to you my good friend. but I am open for facts to be contrary to which they appear to *me*.

11:10 arohner: puredanger: I'm not adding any repos there either. interestingly, rm'd my ~/.m2/repositories/org/clojure/pom.contrib/ dir, and re downloaded. I have the pom locally, but lein still complains about not finding it in sonatype-oss-snapshots

11:10 owengalenjones: like I said, I believe this is an argument over opinion

11:11 JohnTalent: owengalenjones: yes. you have no facts to counteract the failing I'm finding with Clojure, so you have so choice at all but to call me a troll and move on. brilliance.

11:11 puredanger: arohner: can you gist output? you might also try "lein pom", then "mvn -X test" to see if you get a better error report out of mvn.

11:11 mgaare: in any case, JohnTalent what other questions can we answer for you?

11:11 JohnTalent: mgaare: thats about it.

11:12 puredanger: technomancy: is there any other place arohner could be getting unexpected repos from?

11:12 ToxicFrog: JohnTalent: plenty of people have "facts to counteract the failing you're finding with clojure". You've just ignored them. This is what leads people to declare you a troll.

11:12 JohnTalent: mgaare: i woudn't liked to haev a magic counterance to my concerns. but sadly there doesn't appear to be any.

11:12 ToxicFrog: Well, that and the fact that the failing in question exists only in your mind.,

11:13 arohner: puredanger: gist incoming

11:13 JohnTalent: ToxicFrog: i want to program. not read incredulous lisp macros to find out what the hell happens to a specific function argument.

11:14 clgv: JohnTalent: well then program and do not read macro source^^

11:14 JohnTalent: clgv: yes. thank you.

11:14 mgaare: JohnTalent: ok. Best of luck.

11:14 JohnTalent: mgaare: thanks.

11:14 hlprmnky: one last point I will make and then I'm done with this discussion

11:14 technomancy: hilariously, "I can read the source for all the functions I use to make sure they don't do anything crazy" is an actual argument I have heard for CL over clojure

11:14 hlprmnky: JohnTalent: you don't have to read the source, you can just ...call the macro and examine what you get back

11:14 ToxicFrog: JohnTalent: you do not need to do that to program in Clojure. Your deep-seated belief that you need to do so and total unwillingness to consider alternatives may be a symptom of genuine mental illness. Please seek help. Goodbye.

11:14 technomancy: specifically about why you don't need immutability

11:15 hlprmnky: because what you get back is all that there is

11:15 arohner: puredanger: arg. I commented out all my lein plugins, and problem goes away. I'll bisect

11:15 rweir: technomancy, how's CL better than clojure in that regard?

11:15 hyPiRion: rweir: it isn't, that's the point

11:15 rweir: hyPiRion, technomancy oh right

11:15 arohner: puredanger: though I suspect sonatype-oss-snapshots is still misconfigured, or has partial data or something

11:16 JohnTalent: ToxicFrog: what alternative do I have other than reading source to know what happens to a specific function in clojure? Pure guessing at what the docstring doesn't provide?

11:16 puredanger: ToxicFrog: please stop suggesting mental illness. It is harmful to people that have or know others with actual mental illness.

11:16 rweir: how could tht pssibly not be the case for any language

11:17 technomancy: rweir: it wasn't "cl's way is better" so much as "it doesn't matter either way"

11:17 rweir: technomancy, right, get it

11:17 JohnTalent: rweir: types contrict possibilities at critical levels. This is what I am finding. Types are less of a problem in python. but in lisp like langauges, they appear huge.

11:18 rweir: uh-huh

11:18 hyPiRion: JohnTalent: have you considered Haskell or Idris? That may be better if you're concerned with type safety.

11:19 arohner`: technomancy: bug/feature request: I notice a bunch of lein plugins that end up calling leiningen.core.user/resolve-credentials, when they need to add deps. And often, they do it wrong, such that if I have :username & :credentials on a maven repo, the plugin breaks

11:19 puredanger: arohner: you should not actually be finding those artifacts in sonatype-oss-snapshots as those artifacts are not snapshots, so that doesn't seem like a problem. the problem is why you are not finding them in the maven central repo you should be finding them in. But sometimes you get errors that look like this as a downstream problem of something else. the maven errors are generally a bit more helpful I've found in this c

11:19 timothyw: With, https://github.com/clojure/tools.namespace, I’m trying to figure out how to find a cyclic load dependency.

11:19 Any hints?

11:19 JohnTalent: hyPiRion: yes, i got up to monads and just lost it at that level due to higher maths. it's a nice language for what little i know of it though. it's style is orthogonal to corporation acceptence too, sadly.

11:20 justin_smith: (inc arrdem)

11:20 lazybot: ⇒ 35

11:21 puredanger: JohnTalent: Clojure is a dynamically typed language. If this is incompatible with your view of what a language should be, you are never going to be totally satisfied with Clojure (even with Typed Clojure or Prismatic Schema or whatever). And that's ok. Not every language is a match for every developer, which is why we have more than one language.

11:21 justin_smith: for the markov joke, I was afk

11:21 JohnTalent: haskell is lisp on steroids.

11:21 stuartsierra: timothyw: how so? tools.namespace should report an error when it detects a circular dependency

11:21 cbp`: haskell hasnt much to do with lisp

11:21 JohnTalent: it's all very good. but depends on who ever programmer's code you are reading.

11:22 puredanger: yes. i was giving clojure a try. i trully honestly wanted to make it work.

11:22 justin_smith: JohnTalent: haskell is full of one letter variable names, and you not only don't know how an arg is used, you often don't even know at first glance what function it is being applied to

11:22 ToxicFrog: puredanger: I suggested it because I have known such people and some of them behaved very much like this and did actually benefit from such help. I realize that the odds JT is (a) not a troll and (b) will actually take this advice are infinitesmal, but I hope still >0.

11:22 JohnTalent: justin_smith: actually, i think your thinking of types, not variables.

11:23 hyPiRion: justin_smith: Well, that's more of a lack of familiarity with syntax, from my experience.

11:23 timothyw: stuartsierra: I was trying clojure.tools.namespace.repl reported my cyclic dependency error.

11:23 which function should I use?

11:23 ‘m currently getting a cyclic error from Midje

11:24 justin_smith: have you looked at haskell code? one letter variable names (or via point free, zero letter variable names)

11:24 hyPiRion: fair point

11:25 JohnTalent: thanks guys. it was mind opening speaking with you all. thank you for your time.

11:25 stuartsierra: timothyw: Sorry, I think all you can do is examine the source files for the namespace(s) for which an error was reported.

11:25 technomancy: arohner`: sure, can you open an issue so I don't forget?

11:26 Jaood: JohnTalent: how much time have you spent learning clojure?

11:26 timothyw: stuartsierra: did that. In fact I stripped out my whole source and test directories, and am still getting that error

11:26 mgaare: JohnTalent: maybe you'd prefer scala. Static types, but looks like java so corporate people aren't so scared

11:27 JohnTalent: Jaood: 3 or 4 days, full time.

11:27 timothyw: so it has to be coming from the library dependencies

11:27 and I’m trying to isolate where

11:27 JohnTalent: to be honest there are many postiive things i find with clojure, but I'd only love it fully if it was all my code. source and all.

11:28 stuartsierra: timothyw: Sometimes tools.namespace can get into an inconsistent state after an error. Have you tried with a completely new REPL process?

11:28 JohnTalent: mgaare: noted.

11:28 Jaood: JohnTalent: that's very little I would say, you should give it more time, especially since you don't have any lisp background

11:29 timothyw: stuartsierra: yes. in fact it’s `lein midje :autotest` which reports this

11:29 JohnTalent: Jaood: i got up to page 110 of PAIP. The Little Scheme and a few other lisp books. so I'm not sure how you can say that honestly.

11:29 timothyw: and I’m trying to reprodcuce it from a repl

11:29 Jaood: JohnTalent: you said before you only experience was JS/Python

11:29 JohnTalent: The little schemer.

11:30 Jaood: nope. now your just guessing at *my* source. :)

11:31 stuartsierra: timothyw: I'm not familiar with the internals of Midje, but I know it does some unusual things with namespaces and loading. That may be the cause of the problem rather than anything in your code.

11:32 timothyw: stuartsierra: hrmm, you’re probably right. But my workflow slows down with without a running :autotest.

11:32 Ok, I’ll try another angle

11:37 TimMc: timothyw: I wrote nephila to help me visualize Clojure projects. You could modify it to include the tests dir.

11:37 https://github.com/timmc/nephila

11:38 (ooh, I really need to get that licensed)

11:38 timothyw: TimMc: looks like it requires graphviz. I develop on a headless console. Can I use it there?

11:41 pcn: timothyw: if it outputs dot, you can view it elsewhere

11:41 timothyw: pcn: okie dokes.

11:42 pcn: So it outputs png, but same difference.

11:42 You can view that elsewhere.

11:43 If it output dot, you could maybe use other tools to pretty it up, but that's probably easy enough to do. But I'd have to read the source and understand all of the crazy disgusting underlying C and bash before i could explain that

11:43 So it's a bust

11:46 timothyw: yeah, I’ll give it a shot - the cyclic load error is somewhere in the included libs

11:48 pcn: I didn't get any groans for that? OK, back to work.

11:49 * clgv starts wondering whether JohnTalent is a bot and we all failed the turing test ;)

11:52 pcn: No, just someone who needs perspective and maybe some space to relax.

11:58 TimMc: timothyw: Yeah, headless *should* be fine (morally speaking) -- nephila won't actually try to display the graph.

11:58 timothyw: TimMc: makes sense

11:59 TimMc: timothyw: Oh, but nephila can't descend into dependencies, it's very stupid about how it analyzes code.

12:09 timothyw: TimMc: as long as a png gets generated, I’m fine with that. But if it doesn’t descend into dependenceis, then I can’t really use it.

12:10 mikerod: ,(keys (seq {:a 2}))

12:10 clojurebot: (:a)

12:10 mikerod: ,(get (seq {:a 2}) :a)

12:10 clojurebot: nil

12:10 mikerod: I find this odd.

12:10 edw: ,(seq {:a 2})

12:10 clojurebot: ([:a 2])

12:10 mikerod: `keys` and `vals` work at the "seq" level

12:10 but they hide that the actual structure may not even be associative

12:10 timothyw: I tried just using midje / lein-midje (with :autotest) on an empty project, and am still getting cyclic dependency errors

12:11 removed .m2 , .lein/profiles and everything - no dice

12:11 edw: ,(supers (first (seq {:a 2})))

12:11 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to java.lang.Class>

12:11 timothyw: so I think this is a bug with Midje

12:11 TimMc: What version lein-midje?

12:11 mikerod: I see that `keys` and `vals` just expect a coll of MapEntry

12:11 edw: ,(supers (class (first (seq {:a 2}))))

12:11 clojurebot: #{clojure.lang.IPersistentCollection java.util.Map$Entry java.lang.Runnable clojure.lang.Indexed clojure.lang.IMapEntry ...}

12:11 {blake}: Heyo: I wanna do a "for" (or "for-like") comprehension where I don't know the number of items beforehand. IOW, where normally I might say "for [x (first coll) y (second coll)] [x y]" to get all the permutations of x and y, I have a situation where "coll" might have any number of elements.

12:11 mikerod: I ran into a situation where we were returning a non-map by mistake; but `vals` worked. Later on we discovered "woops that isn't a map"

12:12 edw: ,(class (seq {:a 2}))

12:12 clojurebot: clojure.lang.PersistentArrayMap$Seq

12:12 timothyw: TimMc: latest of each. [midje "1.6.3"] [lein-midje "3.1.1"]

12:12 mikerod: e.g. (let [supposed-to-be-map (filter <something> actually-a-map)] (keys supposed-to-be-map))

12:13 everything is fine here

12:13 clgv: {blake}: thats not possible with `for`. since it is a macro you need to know the number of collections to traverse at compile time

12:13 {blake}: you'll have to do that recursively

12:15 {blake}: clgv, Yeah, I'd come to that conclusion. Or I was thinking of writing a for-wrapper macro. =P

12:19 clgv: {blake}: but for that for-wrapper your collection of collections must be a compiletime constant as well

12:20 {blake}: clgv, Oh, right. Duh. Darnit.

12:21 I suppose I could punt and use the combinatorics lib.

12:21 arohner: puredanger: data.xml-0.0.7's pom has <repository><id>sonatype-oss-snapshots....

12:22 puredanger: arohner: it has that to push snapshots (as it should). not sure why that should affect you though as a user?

12:23 arohner: I'm still trying to understand how sonatype-oss-snapshots is being checked during my deps. That's the only answer I have so far

12:24 I see the bug if I have both :plugins [lein-npm], :dependencies [data-xml]

12:24 bug goes away if either is missing

12:24 cc technomancy: ^^

12:25 puredanger: shouldn't that be a deployRepo or something?

12:25 technomancy: arohner: 2.4.3 has :implicits false that should help debugging by turning off implicit middleware and implicit hooks

12:25 which are super easy to screw up

12:27 arohner: technomancy: bug is fixed by ':implicits false', but I don't know which middleware/hook is doing it. Does that disable all plugin hooks?

12:27 technomancy: arohner: yeah, we should probably also add a command to list all the implicits so you can try adding them back in one by one

12:27 but no such thing exists

12:28 arohner: technomancy: puredanger: AFAICT, the order of events is: 1) I `lein deps`. 2) lein deps gets hooked by `lein-npm`. 3) lein-npm calls aether/resolve-dependencies on (:repositories project). 4) aether throws with the sonatype-oss-snapshots error

12:28 kristof: {blake}: What exactly is coll? A collection of collections?

12:29 technomancy: implicit hooks =(

12:29 I have made some mistakes in my life and this is one of them

12:29 arohner: AFAICT, none of my code, and no plugin code adds sonatype. I have profiles.clj commented out, and all non-lein-npm plugins commented out

12:30 technomancy: what is an implicit hook, as opposed to say, normal plugin operation?

12:30 {blake}: kristof, yeah.

12:30 arohner: I guess I don't understand what :implicits false is doing, so I don't know if it's a proper fix, or bandaid, or just disabling lein-npm

12:30 {blake}: kristof, Like "([-1 0 1])" or "([1 2 3][4 5 6])" or, etc., with an unknown number of items.

12:31 technomancy: arohner: plugins are allowed to include a magic namespace that gets loaded whenever the plugin is added

12:31 arohner: technomancy: so it looks like data.xml's repo entry is getting added to my project

12:31 kristof: {blake}: You want a simple reduction over that collection.

12:31 puredanger: arohner: on further inspection, data.xml doesn't need that; it is added by the sonatype super poms in the sonatype-oss-release profile, so could be removed

12:31 kristof: {blake}: Start with a binary function that takes two collections and returns the set of all permutations between them.

12:31 technomancy: you can do basically anything in here--including break all the rules of how stuff is supposed to work

12:32 arohner: technomancy: I don't think implicits is the bug here

12:32 {blake}: kristof, I'll give that a shot.

12:32 puredanger: arohner: so I will remove it from data.xml but there could separately be something else wrong

12:32 arohner: I think it's something to do with how repos get added to the project

12:32 {blake}: kristof, Thanks!

12:32 kristof: {blake}: Because this is a reduction, that makes it a *monoid*. Because it's a monoid... you can parallelize that with the reducers library. :)

12:32 justin_smith: clgv: now uses a seed, and accepts multiple input files (ships with the Gettysburg Address and Little Red Riding Hood)

12:32 arohner: technomancy: https://github.com/clojure/data.xml/blob/master/pom.xml does that repo entry trigger any bells for you?

12:33 {blake}: kristof, Oh, that would be cool. I'm just trying to figure those out. And the transducers.

12:33 justin_smith: https://github.com/noisesmith/markov-toy

12:33 clojurebot: I don't understand.

12:33 arohner: technomancy: AFAICT, that repository entry is picked up by aether, and being used to resolve the rest of the project's deps

12:33 kristof: {blake}: So not only does it scale to n collections, but it can, you know, go really fast. I have a suspicion that if you throw a conj in there, though, you might blow the stack, so careful.

12:33 {blake}: transducers are silly. *ducks*

12:34 technomancy: arohner: you said :implicits false fixes it?

12:34 arohner: technomancy: yes, but I think mainly by causing lein-npm to not run

12:34 {blake}: kristof, Neat. As far as transducers, I don't have opinions yet on a lot of this stuff. I'm still trying to earn them.

12:35 arohner: technomancy: lein-npm is https://github.com/bodil/lein-npm/blob/master/src/leiningen/npm/deps.clj

12:35 clgv: justin_smith: :D

12:35 kristof: {blake}: Conceptually speaking, for any coll1 with m elements and any coll2 with n elements, you're just going to loop over coll2, appending each y to the m elements in coll1 n times. That'll give you a final collection with m + n elements.

12:35 arohner: puredanger: the data.xml tests fail for me locally

12:36 puredanger: mvn test passes for me and on the build box

12:36 I removed the repo from the pom and am about to build a new version

12:37 {blake}: kristof, Yeah, I think I like that. I was hung up on trying to use for recursively.

12:37 clgv: justin_smith: There was once a sweet little maid who lived with her father and mother in a pretty little cottage and heard her scream. He rushed in and with his axe chopped off Mr. Wolf's head.

12:37 justin_smith: that's a huge shortcut ;)

12:38 arohner: puredanger: ah, running 0.0.7's tests fail for me. master passes

12:38 justin_smith: clgv: did it give you that?

12:39 clgv: justin_smith: yeah. lein run 0 10 resources/little-red.txt

12:39 arohner: technomancy: I gotta run, I'll be back in an hour or so

12:39 arrdem: clgv: http://hydra-media.cursecdn.com/dota2.gamepedia.com/8/80/Axe_kill_12.mp3

12:40 justin_smith: clgv: weird, that same seed gives me a different result... are seeds not portable between jvms?

12:40 puredanger: arohner: released data.xml 0.0.8, will take a bit to be available on mvn central but should not have the repo in the pom anymore

12:40 clgv: justin_smith: they are if you just stuff it into a prng

12:40 the same prng class ;)

12:41 justin_smith: clgv: hmm - I'm not doing anything fancy, I just create random with a seed arg and then use it

12:41 clgv: justin_smith: yeah just checked that. btw: I only copied the first line. there was more

12:42 justin_smith: ahh!

12:43 yes, that was my first line too, success

12:47 clgv: thanks for the input and encouragement

12:49 clgv: justin_smith: you are welcome

13:45 ticking: do the neutral values of reducef and combinef with reducers/fold have to be the same?

13:47 it seems that the neutral value of the combine phase will be used as a seed to the reduces as well, which seems confusing

13:56 puredanger: do you mean the identity value?

13:57 I would not expect them to need to be the same

14:15 amalloy: ticking: they dont' need to be the same, and there's a very convincing reason why, but this question comes up rarely enough that i always forget what it is

14:17 ticking: amalloy: this separation doesn't appear to be strict though right? a neutral combine element might be passed into a reduce step

14:18 amalloy: {blake}: the function you're trying to implement is a cartesian product, which has naturally been written plenty of times. there's one in math.combinatorics, for example

14:19 ticking: well of course. the neutral combine element should be of the same type produced by the combine function, so a reduce step won't care at all if what it gets is "neutral" or has been appended to many times

14:20 ticking: amalloy: well, I'd expect the reduce function to only receive neutral reduce elements

14:21 e.g the reduce gets maps and fills them in some way while the combine step just accumulates them into a vector

14:21 amalloy: but if combine accumulates into a vector, then reduce can't get maps! it only gets the things that come out of combine

14:22 reduce starts with one neutral element of type a, then gets a bunch of batches from combine steps, each of type b; and it builds up a result of type a by accumulating (f current-a new-b)

14:24 ticking: a quick excerp from clojure.org/reducers "r/fold takes a reducible collection and partitions it into groups of approximately n (default 512) elements. Each group is reduced using the reducef function. The reducef function will be called with no arguments to produce an identity value in each partition. The results of those reductions are then reduced with the combinef (defaults to reducef) function. When called with no arguments, (combinef) m

14:24 ust produce its identity element - this will be called multiple times. Operations may be performed in parallel. Results will preserve order."

14:24 this reads to me the exact other way around :\

14:24 amalloy: man, i always forget what the two steps are called

14:25 ticking: :D

14:26 but according to the docs I'd expect fold to be able to build two kinds of collections

14:27 one in the reduce phases, and the other in the combine phase, yet the neutral elements of the combine phase seem to leak into the reduce

14:32 amalloy: ticking: so, that docstring does not seem to reflect the actual behavior in clojure/core/reducers.clj, which never calls reducef with no arguments

14:33 llasram: Indeed

14:34 Actually, where did that doc string come from?

14:34 My version says "each of which is reduced with reducef (with a seed value obtained by calling (combinef) with no arguments)"

14:34 ticking: llasram: http://clojure.org/reducers

14:35 llasram: Weeeird. It's totally different from the clojure.core.reducers/fold docstring, which additionally has not changed over its git history

14:36 WET

14:36 amalloy: llasram: i don't really regard it as weird that documentation on clojure.org is misleading or out of date. it's like a force of nature

14:38 ticking: maannn, thats to bad, I'd really prefer the version documented online ;)

14:39 gill_: so this gist does exactly what I want, but I now realize it takes logarithmically long to complete when using larger grid sizes. Any sort of help with a quick glance is appreciated! https://gist.github.com/viperscape/d7a4298477be74feee2c

14:39 amalloy: logarithmically long is pretty good for anything, having not read that gist

14:39 gill_: hah ok

14:39 amalloy: i dunno, ticking. the way reducers actually work turns out to be pretty good. why don't you try imagining it works the way you want, and try to use it: you may find it's not actually that helpful

14:41 arohner: puredanger: data.xml 0.0.8 fixes the bug, thanks

14:43 amalloy: gill_: also, that gist is a big pile of code with no actual question, or explanation of what it does. i can say that grid->graph looks like it was written by someone who was not super-familiar with clojure, but it doesn't look particularly un-performant

14:45 gill_: that's mine, good criticism :)

14:46 I am using grid->graph to build a relationship graph in loom

14:46 llasram: ticking: What's a situation where you'd make use of the separate reducer/combiner identity elements?

14:46 gill_: where a cell's surrounding neighbors become relationships

14:47 a 30x30 grid takes like 600msec, but a 60x60 takes 6sec

14:47 maybe I should just approach it differently

14:49 amalloy: so you have a 2d grid, and you want to produce a map with one entry per [y x] coordinate, each of which contains a list of all the [y x] coordinates of its neighbors?

14:50 gill_: yes, in that quick blurb: https://gist.github.com/viperscape/d7a4298477be74feee2c#file-gridgraph-clj-L19 g1 represents the loom-way of creating relationships, to give an example of what I am actually accomplishing

14:50 aperiodic: also, gen-grid has pretty weird semantics

14:51 (gen-grid 2 2) makes a 3x3 grid

14:51 amalloy: aperiodic: no it doesn't?

14:51 (range 2) is '(0 1), not '(0 1 2)

14:51 aperiodic: oh, i misread that literal

14:51 nevermind

14:52 gill_: yea, i agree gen-grid is just there for shorthand, not a really useful function

14:52 amalloy: i don't understand why that test graph doesn't have edges out from [1 0]

14:53 gill_: no diagonal neighbors

14:53 I'm neighboring the actual edges for each cell

14:53 so 0,0 has 1,0 and 0,1

14:54 is that what you mean? amalloy

14:54 amalloy: so? shouldn't [1 0] still be adjacent to [0 0] and [1 1], just like [0 1] is?

14:55 maybe i just have no idea what your grid->graph is doing

14:55 gill_: that's a good point

14:55 ticking: llasram: calculating multiple prefix tries at once, where each trie is done as a bunch of assoc-ins in a reduce and the tries are collected into a vector

14:55 gill_: I should dig in to the graph section in loom, maybe it infers neighbors

14:56 aperiodic: gill_: I think the main inefficiency comes from filtering the entire graph to find the neighbors for a cell in the graph, when given the structure you can just determine the neighbors for a given coordinate if you know the dimensions of the grid

14:56 ticking: llasram: it might be better to do this in a pmap though.

14:56 aperiodic: assuming of course that g really is a grid

14:57 llasram: ticking: Well, or change the structure of your data. When flat, the `reduce` portion runs over essentially arbitrary chunks of the input collection

14:57 gill_: hmm

14:57 amalloy: yeah, the structure of the whole thing is just weird. what's the point of putting [y x] as the data values in the grid, when you can infer them from where it is?

14:57 {blake}: amalloy, Oh, I know. I even mentioned combinatorics. But I'm trying to get the thinking right. And I was right, it was easier than my original attempts.

14:58 llasram: ticking: If you pre-process the collection into distinct chunks you want to perform the trie-building operation on, then you could `fold` over the collection of chunks

14:58 {blake}: I got it down do "(reduce #(for [x %1 y %2] (cons y x)) '([]) coll)"

14:58 amalloy: {blake}: urgh. why so eager?

15:00 {blake}: amalloy, Beg pardon?

15:00 amalloy, You mean, why not do it lazily?

15:00 gill_: aperiodic: it's mostly because I was trying to shoehorn this into the graph function in loom, which seems to want it all laid out in a big map

15:00 amalloy: hm. i was thinking you're eagerly evaluating the whole thing because of the reduce, but i guess you're not actually? it's more subtle than it looked at first

15:00 {blake}: amalloy, Or is that more generally directed toward my attitude.

15:01 aperiodic: gill_: that doesn't mean you have to repeatedly filter g in order to produce the map for the loom/graph call later

15:02 gill_: think of what the cost of filter is and how many times you call it in grid->graph

15:02 ticking: llasram: yeah, the main problem is collecting everything into a giant trie, the problem is not nessecarily performance, but the trie of maps gets so wide that a GCOverheadError will throw besides plenty of memory left

15:02 aperiodic: gill_: the runtime of this function certainly ain't logarithmic; it's the inverse of logarithmic

15:02 er, no, not quite

15:02 amalloy: aperiodic: well, it's not exponential. just quadratic

15:02 aperiodic: the n is in the wrong place

15:02 gill_: ok

15:03 {blake}: amalloy, I don't really know. I'm only grasping laziness in the most obvious cases. But in the actual use case here, there are actually only three items (the same three, even) in each sub-collection and most commonly 2 subs. In other words, I could make it literal for my purposes, but I want to leave the door open to other possibilities.

15:04 llasram: ticking: Interesting. But sounds like more of a data structure problem for your algorithm than anything else

15:04 The whole "reduce over arbitrary chunks" thing to me really means the identity elements for the reduce and combine functions need to be the same

15:04 amalloy: {blake}: i think it's a cool implementation that at first glance looks eager but is actually just fine

15:05 {blake}: amalloy, How is it lazy? Or, how could it be?

15:05 ticking: llasram: yeah, I agree, its a misuse of the fold paradigm, that would have worked when it was implemented as on clojure.org

15:07 amalloy: {blake}: well, suppose you were product-ing three collections, each with a thousand elements. it would be bad if you had to produce all 1 billion combinations before you could return a single one

15:07 ideally, you'd produce [0 0 0], then stop, and produce [0 0 1] only if asked...

15:08 and your implementation actually does do that

15:10 llasram: ticking: You could still do it though, with just 10% more clunk. Identity would be the empty vector, and reduce would first conj an empty trie onto a vector if empty, and update the the nested in-vector trie if not

15:12 ticking: llasram: good idea ^^

15:15 ToxicFrog: Hmm. This is irritating.

15:15 (update-in) calls the updater as (f val & args)

15:15 Which means I can't do (update-in ... fmap f), because fmap expects (fmap f coll)

15:17 amalloy: ToxicFrog: i mean, they had to pick *some* argument order, and the existing one is convenient in a lot more places

15:20 ToxicFrog: amalloy: yeah, I'm not saying it's wrong, just that they don't fit together conveniently.

15:23 justin_smith: llasram: the codomain of the reduce must be the domain of the combine

15:31 llasram: justin_smith: Sure.

15:31 justin_smith: Someone else has been brushing up on their math :-)

15:32 justin_smith: the problem I guess is the combining should be transative (you want the same result regardless of the size you break things into)

15:33 but I think there must be some valid combining step that is transative but does not have identical domain and codomain

15:33 llasram: What does it mean for a function to be transitive?

15:33 justin_smith: f(a,b) = f(b,a)

15:34 or in this case I may be generalizing from transative to something a bit different

15:34 f([a, b], [c,d]) = f([a, b, c], [d])

15:35 llasram: Oh, ok -- I think that's usually called commutative, and the latter I think (for these purposes) is associative

15:35 pyrtsa: justin_smith: f(a,b) = f(b,a) is called symmetric.

15:35 justin_smith: oh, sorry

15:35 llasram: SO MANY NAMES

15:35 justin_smith: ok

15:36 ok, I dunno where I pulled transative from, it is clearly not the right term here

15:36 pyrtsa: Transitivity is generally used (alongside with reflexivity and symmetry) in the definition of equivalence.

15:37 Associativity and commutativity might be more interesting for functions in general.

15:37 I mean, for binary functions.

15:37 justin_smith: pyrtsa: equivalence and ordering

15:37 pyrtsa: True.

15:38 llasram: But the fold `combine` function I think doesn't actually *need* to be commutative. The semantics guarantee you get the left-folding behavior

15:38 Not sure how often that's actually useful

15:38 justin_smith: hmm

15:38 llasram: Oh, actually -- order in a vector e.g.

15:38 duuur

15:39 justin_smith: I think what we want (if there is a name for it) is the property f([a b c], []) = f([a b], [c]) = f([a], [b c]) = f([], [a b c])

15:41 llasram: f(f(a, b), c) = f(a, f(b, c)) is associative

15:42 which coincidentally is what the docstring for `fold` says :-)

15:44 akhudek: anybody use transit? I tried to swap out our edn for transit for communication between clojure and clojurescript and it’s scrambling data inside maps

15:45 e.g. keys get associated with the wrong values

15:45 TEttinger: Raynes or amalloy: lazybot question. I have my lazybot fork set to auto-announce youtube links, but it doesn't work a significant portion of the time (2/3 or more fail)

15:45 it used to work every time

15:45 something must have changed in youtube now that they default to https

15:48 akhudek: ping dnolen_

15:48 amalloy: TEttinger: so, what is your question? it sounds like you answered "why doesn't it work" already

15:48 dnolen_: akhudek: what's up?

15:48 TEttinger: amalloy, yeah, is there a way to get title to handle redirects?

15:48 akhudek: dnolen_: having an issue with transit scrambling map data

15:49 dnolen_: communicting from clj to cljs

15:49 TEttinger: I think that's the issue, but what's weird is that it's intermittent

15:49 amalloy: beats me. have a look through the plugin source and see. it probably just calls slurp

15:49 akhudek: just putting an example in gist

15:49 dnolen_: akhudek: ok, transit-clj -> transit-cljs

15:49 akhudek: https://gist.githubusercontent.com/akhudek/0ad26dcdf00e287c64b1/raw/7ad9783674b919746f0fb8cf2723457a06bf9ef0/gistfile1.txt

15:49 michaelr: any prismatic graph users? is there a good way to update a key in the graph map, from inside a defnk?

15:49 TEttinger: like https://www.youtube.com/watch?v=zX4-eMbpiHA consistently fails to get a title, but never gives errors or anything

15:49 it always works with...

15:50 $title https://www.youtube.com/watch?v=zX4-eMbpiHA

15:50 lazybot: "Gibbon swinging through the trees very fast. - YouTube"

15:50 akhudek: dnolen_: if you look at the second map in the list, you can see that the data is wrong. This is on the cljs side.

15:50 TEttinger: I thought it could be the regex that I use to match names, but then it sometimes works and sometimes doesn't for the same URL (I think)

15:51 let me get the exact regex

15:52 dnolen_: akhudek: you need to be more clear I just see gibberish at this point

15:52 TEttinger2: ,(re-seq #"(https?://|www\.)[^\]\[(){}\"'$^\s]+" "https://www.youtube.com/watch?v=zX4-eMbpiHA")

15:52 clojurebot: (["https://www.youtube.com/watch?v=zX4-eMbpiHA" "https://&quot;])

15:53 akhudek: dnolen_: does this help? https://gist.github.com/akhudek/28c8d395e5fcca995256

15:54 puredanger: TEttinger: if you're getting varying behavior, then I would suspect something caching related? btw there is a #transit-format room

15:54 not that anyone is there

15:54 michaelr: nevermind, ignore my question..

15:55 puredanger: sorry TEttinger , that should have been to akhudek and dnolen_ ! :)

15:56 TEttinger2: puredanger, yeah that's part of why I'm asking the pros -- could youtube have started caching these things in an un-title-able way?

15:56 but $title works

15:57 dnolen_: puredanger: thanks forgot about that

15:58 TEttinger2: https://gist.github.com/anonymous/e0198ca2826a321dfb88 code is here

15:58 akhudek: TEttinger2: possibly? the problem seems to be that the data is structured like {[:a-key 1] [{:b1 1, :b2 1} {:b1 2 :b2 2} }]} and the second map in the val is turning into {:a-key 2 :b1 2}

15:59 TEttinger2: hm what?

15:59 was that meant for puredanger, akhudek?

16:00 akhudek: oh yes

16:00 :-(

16:00 dnolen_: akhudek: still hard for me to see the problem.

16:00 akhudek: please put something together that's formatted to make it easier to read

16:00 akhudek: dnolen_: ok, will do

16:11 dnolen_: formatted and hilighted https://gist.github.com/akhudek/0ad26dcdf00e287c64b1

16:12 dnolen_: akhudek: thanks looking into it

16:14 TEttinger2: what's especially weird is there's nothing printed in a fn that should print on every message

16:23 ToxicFrog: Two questions:

16:23 wait, no, one question

16:23 I have a map. I want to find the value in the map (there is at most one) for which (p v) is true.

16:24 (some p (vals map)) tells me if it exists, but not what it is.

16:24 What function am I looking for?

16:24 technomancy: (comp first filter)

16:25 ToxicFrog: Thank you.

16:26 Wasn't sure if there was a canned function for it or not.

16:28 timsg: Anyone know of a function that’s like print but prints top-level strings with quotes?

16:28 justin_smith: prn

16:28 timsg: justin_smith: thanks!

16:29 justin_smith: there is also pr-str

16:29 ,(print (pr-str "hello"))

16:29 clojurebot: "hello"

16:29 TEttinger2: timsg, pr is like print, prn is like println

16:29 justin_smith: TEttinger2: good point, thanks

16:30 timsg: ,(print (pr-str [“hello”]))

16:30 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “hello” in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:30 timsg: I assume that’s a colloquy thing

16:30 TEttinger2: especially useful for spitting out clojure data structures to files so they can be read back later

16:30 justin_smith: smartquotes

16:30 timsg: ya

16:30 TEttinger2: ,(print (pr-str ["hello"]))

16:30 clojurebot: ["hello"]

16:33 dnolen_: akhudek: definitely some kind of off-by-one issue w/ the cache looking into will cut a transit-js and transit-cljs soon as I've resolved it

16:33 akhudek: dnolen_: ok, thanks!

16:38 sdegutis: Hi. My Clojure (ring) web app is making my whole Mac Pro slow to a crawl. What are some good free tools for profiling it?

16:39 arohner: sdegutis: visualvm is a good starting point

16:39 sdegutis: Thanks.

16:40 arohner: comes with the JDK

16:40 it's not a normal profiler, but it has some performance monitoring tools

16:43 schmee: hey folks, I have question about Enlive, in this gist I want to extract the numbers (like :content ("47,089") ) https://gist.github.com/schmee/694b9e9a486c1f1c2310

16:44 I'm just wondering if there is a way to write a more specific query or if I should just "brute-force" extract them from the maps

16:45 hiredman: ,(doc tree-seq)

16:45 clojurebot: "([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."

16:47 {blake}: amalloy, Actually, I don't think it is lazy. I know "for" is lazy but I think reduce realizes it.

16:50 amalloy: {blake}: try it and see. you're actually doing something pretty subtle, as i said, and preserving laziness

16:50 ,(defn cart [colls] (reduce #(for [x %1 y %2] (cons y x)) '([]) colls))

16:50 clojurebot: #'sandbox/cart

16:50 amalloy: ,(first (cart (repeat 10 (range 1000))))

16:50 clojurebot: (0 0 0 0 0 ...)

16:50 amalloy: returns a result pretty quickly - it definitely didn't have time to compute 10^30 combinations!

16:51 {blake}: amalloy, Right. But if it were lazy...Hmm, okay, still more to figure out.

16:55 amalloy, I did "(apply cart (take 10 (repeat [1 2 3])))".

16:56 amalloy: well, that will realize the whole thing, because you asked for the whole thing. but (take 10 (apply cart ...)) would work fine, and be fast

16:57 {blake}: fair 'nuff

17:05 TEttinger: hm, more weirdness amalloy with the bot titling. I think it may be caching or some time-related thing, because I tried the same gibbon video link followed by " ?" and it worked once, and never again

17:05 but there was a time gap between when I tried it and when I tried it with " ?"

17:21 andrei_: does the order in which you write functions inside a source file matter?

17:32 dnolen_: akhudek: deploying fix try transit-cljs 0.8.178

17:48 bitemyapp: technomancy: no rule against Haskell proselytization?

17:49 tsk tsk.

17:49 Bronsa: :|

17:49 aaelony: I'm taking a look at the Sente example project's project.clj, and noticing that the :compiler tag has a value of a map, but that map seems to allow the :optimizations key to have more than one value... is that correct? https://github.com/ptaoussanis/sente/blob/master/example-project/project.clj#L49

17:50 curious how that works...

17:51 amalloy: aaelony: #_ comments out the next form

17:52 aaelony: amalloy: thanks, never seen that before

17:52 is there a good way to google for #_ to learn more?

17:53 nevermind, #_ seems to google just fine :)

17:53 swedishfish: aaelony: http://clojure.org/reader

17:54 search on dispatch

17:54 aaelony: swedishfish: thanks, saw that..

17:55 TEttinger: ,(if false "won't execute" #_"not going to be the REAL else" "the real else")

17:55 clojurebot: "the real else"

17:55 TEttinger: contrast with

17:55 ,(if false "won't execute" (comment "not going to be the REAL else") "the real else")

17:55 clojurebot: #<CompilerException java.lang.RuntimeException: Too many arguments to if, compiling:(NO_SOURCE_PATH:0:0)>

18:04 hugod: mmm, wonder what could be causing this with an AOT'd uberjar: "Could not locate somens/services_methods$fn__17804/class__init.class or somens/services_methods$fn__17804/class.clj on classpath" - something is adding an extra /class in the file names

18:06 amalloy: that's a pretty wild error, hugod. i'd be interested to hear what it turns out to be

18:06 hugod: got me baffled at the moment - haven't been able to repro in a simple project either

18:08 martinklepsch: Anyone an idea how to write nth-child selectors with garden? https://github.com/noprompt/garden

18:09 :&:nth-child(2n) is what I'd think but thats not a valid symbol

18:10 swedishfish: martinklepsch: I think you want nth-x

18:11 martinklepsch: https://github.com/noprompt/garden/blob/master/src/cljx/garden/selectors.cljx#L604

18:12 martinklepsch: i could be wrong. there is an nth-child function as well

18:12 hmm

18:13 martinklepsch: you may need to do nth-child(2). The nth-child function seems to add the "n" if you pass in a number

18:16 martinklepsch: swedishfish: ok thanks, thats helpful already! will try using the stuff in there

18:17 * martinklepsch needs to get better at searching code with githubs search

18:18 amalloy: martinklepsch: so does github's search

18:31 arohner: anyone here in Austin, and going to the meeting tonight?

18:32 Raynes: arohner: Nobody.,

18:32 Not one single person will be there.

18:33 mdrogalis: Raynes: Austin has been vacacted.

18:33 Raynes: ^

18:33 mdrogalis: Vacated, maybe.

18:33 Emacs's lack of spellcheck makes me sound like an idiot in IRC.

18:34 TEttinger: Emacs... makes me... an idiot...

18:34 technomancy: (require 'erc-spelling) (add-to-list 'erc-modules 'spelling)

18:34 mdrogalis: technomancy: :P

18:35 arohner: mdrogalis: it is raining in August, so people are a little freaked out

18:36 mdrogalis: arohner: Head for the hills. D:

18:38 aaelony: sorry if this is tangential/orthogonal to clojure... can anyone recommend a good laptop that looks and feels somewhat like a macbook pro but runs linux decently without too much hassle??

18:38 lazybot: aaelony: Definitely not.

18:39 aaelony: lazybot may be right...

18:40 technomancy: aaelony: usually you get pretty solid HW support with thinkpads

18:40 but it really depends what you want; if you're optimizing for screen brightness or weight or not having a terrible keyboard.

18:41 aaelony: technomancy: thanks for that, I'll take a look. Curious about the mouse/trackpad experience...

18:41 mostly optimizing for not having a terrible keyword

18:41 keyboard

18:41 lol

18:41 technomancy: aaelony: in that case it's pretty much just thinkpads

18:41 arrubin: Just be sure that you do not get anything with duel GPUs.

18:41 dual

18:42 aaelony: arrubin: why not?

18:42 arrubin: aaelony: Because Linux's support for such things is garbage.

18:42 aaelony: arrubin: that's a shame

18:42 arrubin: I bought a ThinkPad T520 because it was on several lists of well supported laptops, but I did not know that upgrading to the dual GPU option would cause so many problems.

18:43 curveball: Google Pixel is danm good hardware

18:43 arrubin: Intel integrated GPUs are great as long as you do not play games these days.

18:43 curveball: very mac like, and not hard to put linux on it

18:43 arrubin: And are even fine for most older games.

18:43 curveball: that said, linux on a macbook is ridiculously easy imho

18:44 aaelony: curveball: no driver problems on a macbook?

18:45 curveball: I dont game, but I’ve dualbooted ubuntu / mac osx on 2012 macbook with zero issues. Community for booting linux is pretty solid

18:46 aaelony: curveball: I don't game either. I mostly prefer Mint to OS X and will likely stick with that. thanks for the comments

18:50 technomancy: inc on intel video

19:06 is the Pixel screen glossy?

19:07 joshhartigan: how can I just run a single .clj without having to create a whole lein project?

19:08 technomancy: joshhartigan: lein run -m clojure.main myfile.clj

19:08 err

19:08 joshhartigan: thank you

19:08 technomancy: lein run -m clojure.main/main myfile.clj # maybe?

19:19 ben_vulpes: does anyone know anything about importing a datomic db backup to an in-memory db?

19:23 technomancy: ah, it's glossy. yeah so much for that.

19:23 not like I need more Google products in my life anyway

19:24 danielcompton: Do lein checkouts take precedence over published artefacts, or do I need to set my project.clj to use snapshots to force it to use the snapshot?

19:25 technomancy: danielcompton: checkout source takes precedence

19:25 checkout project.clj files are ignored

19:26 Jaood: technomancy: where you planning to put linux on the chromebook or use chromeos?

19:26 technomancy: Jaood: idly considering it for debian

19:27 I liked the 400-nit screen of the samsung I used to have, but that was matte

19:27 justin_smith: there's an organization that will send you a chromebook that dual-boots ubuntu for an extra $50 over the retail - but it looks like installing it yourself shouldn't be too hard anyway

19:27 for one of those $200 models

19:27 Jaood: technomancy: did it sleep/resume well linux?

19:28 technomancy: Jaood: perfectly, yeah

19:28 I think the only thing that didn't work out of the box was the keyboard backlight; didn't bother with that.

19:28 it was a really nice machine except for the horrible keyboard

19:28 justin_smith: there is also system76 - they ship with linux installed and guaranteed full hardware support. they have netbooks too.

19:28 technomancy: and ironically now I don't use my laptop's internal keyboard anyway =\=

19:29 http://technomancy.us/160

19:29 danielcompton: technomancy: thanks, thought so but just wanted to check

19:31 joshhartigan: https://github.com/kumarshantanu/lein-exec might also be helpful

19:33 technomancy: not really sure what lein-exec buys you for this

19:35 Jaood: http://www.dell.com/us/business/p/xps-13-linux/pd - I guess that one also has a glossy screen

19:35 technomancy: yeah, this would just be something I could use if my thinkpad died before my novena arrives anyway

19:36 probably better just to grab something from craigslist for that

19:37 * Jaood checks what a novena is

19:37 technomancy: https://www.crowdsupply.com/kosagi/novena-open-laptop

19:38 aaelony: sorry for all the strange questions today... I've got some mbox format files that contain emails. Is there a clojure library that can read and parse mbox format? Thought I'd ask before I slurp away and put it into a map...

19:38 scottj: aaelony: javamail?

19:39 technomancy: aaelony: unless they are guaranteed to have regular structure, it's not as simple as it sounds

19:39 aaelony: yeah, I don't think it's simple

19:39 but I just want to count them, group them and count them, filter them, etc...

19:39 technomancy: there is no canonical way to determine in a mime multipart content message what part is the body vs attachments

19:40 scottj: https://java.net/projects/javamail/pages/MboxStore

19:40 technomancy: but javamail is probably the place to start

19:40 aaelony: cool, I'll check out javamail. many thanks

19:41 scottj and technomancy: perfect, thanks

19:42 justin_smith: also, mbox is prone to corruption issues, since your entire archive is one file, with no built in error correction mechanism (beyond what your fs may provide)

19:43 aaelony: justin_smith: it's not mission criticial, just thought it would be interesting to use clojure to analyze what's in there.

19:44 hiredman: http://www.youtube.com/watch?v=4s9IjkMAmn

19:45 erm

19:45 http://www.youtube.com/watch?v=4s9IjkMAmns

19:45 Jaood: technomancy: impressive, they did really well raising money

19:46 aaelony: hiredman: nice

19:46 technomancy: Jaood: I'm excited. bit of a wait though

19:50 akhudek: dnolen_: seems to work now, thanks again!

19:50 dnolen_: akhudek: no problem, thanks for the report

19:52 akhudek: we don't actually have good test for cmaps so it was good that you found this bad case.

19:54 akhudek: dnolen_: glad to help. We make very extensive use of complex maps and so far everything looks like it works. Really happy you guys built this as we’ve had performance issue with big edn transfers in the past.

19:55 dnolen_: akhudek: I'm glad we built it too - it's really night and day compared to EDN perf.

20:03 ebzzry: Hi! What does 'cider's version (0.8.0-snapshot) does not match cider-nrepl's version (not installed)' mean? How can I get cider-nrepl?

20:04 technomancy: oh man... flashbacks to slime.

20:05 ebzzry: technomancy: ya. similar, especially when the compiled version of slime do not match.

20:06 got it.

20:06 I reinstalled nrepl. ;-)

20:23 mdeboard: ebzzry: Yeah for whatever reason the emacs plugin version is tied directly to the clojure adapter's version. I trust it's a good one, just a little unusual IME

20:23 surprising etc.

20:23 ebzzry: was having this same issue the other day, or some flava of it

20:28 CapitalSigma: hey all

20:28 gfredericks: hi

20:28 mdeboard: ohio

20:29 CapitalSigma: as someone who's already familiar with java and functional programming, what should i read to try to get the really lisp-y aspects of clojure?

20:29 mdeboard: programming clojure

20:29 no wait, Clojure Programming

20:29 justin_smith: ~books

20:29 mdeboard: http://shop.oreilly.com/product/0636920013754.do

20:29 clojurebot: books is programming clojure

20:30 gfredericks: Projure Clogramming

20:30 CapitalSigma: thanks

20:30 justin_smith: ~books

20:30 clojurebot: books is http://www.pragprog.com/titles/shcloj/programming-clojure

20:30 justin_smith: I thought there was more than that for books

20:31 technomancy: clojurebot doesn't have a way to list every value for a given key

20:32 {blake}: "Programming Clojure" covers all the way up to Clojure 1.3. =P

20:33 gfredericks: you mean it doesn't have transducers

20:33 {blake}: heheh

20:33 CapitalSigma: mostly i want to try to understand when i should look at a problem and think "macro"

20:33 kristof: I thought Joy of Clojure was more lisp-zealous.

20:33 {blake}: Hardly everrrrrr!

20:34 CapitalSigma: {blake}: that's disappointing, reading stuff that lisp people write makes it sound like i'm missing out on some huge aspect of software design

20:35 mdeboard: I am pretty sure I have bought every clojure book, or close to it. cemerick's is the best, for me

20:35 Web programming wwith Clojure is p good too

20:35 for the "web space" concepts

20:35 kristof: CapitalSigma: There is no structured set of design principles related to functional programming or macros.

20:36 CapitalSigma: Nothing like "Gang of Four".

20:36 {blake}: CapitalSigma, Yes. The "hardly ever" philosophy is particular to Clojure, from what I can tell, and not entirely uncontroversial.

20:36 CapitalSigma: i did "the clojure koans" a while back, and they were handy

20:36 kristof: CapitalSigma: The joy and power of macro writing is mostly relief, and the intellectual depth is fairly simple. Here's some boilerplate code I keep writing, let me abstract it away.

20:37 {blake}: CapitalSigma, Yeah, those are pretty good for a while. Also the i-love-ponies course, for what it covers.

20:38 CapitalSigma: kristof: i'm unclear how they're more powerful in that respect than a regular function

20:38 mdeboard: arrdem: ping

20:38 {blake}: CapitalSigma, I wrote my first non-toy macro a couple of weeks ago. It was cool. I'm not so facile, however, that I can say I've had the epiphany.

20:39 CapitalSigma, Well, at least theoretically, that's pretty simple: You can use the power of the language to construct itself.

20:39 CapitalSigma: {blake}: i understand at a high level that they're "functions acting on the AST"

20:40 kristof: CapitalSigma: Write more clojure code, then.

20:40 {blake}: CapitalSigma, Right, and I don't think you can "get" them through -- right, exactly as kristof says, you only "get it" through coding.

20:40 mdeboard: I'm watching arrdem give a talk, weird

20:41 kristof: CapitalSigma: This isn't *clojure* per se, but I wrote a common lisp reader macro the other day so I can write #M(2 + 2 * 2 - 3) and that'll give you 3, not 5.

20:41 CapitalSigma: No function will let you do that.

20:42 CapitalSigma: Oh, look at any HTML markup DSL in clojure and ask yourself how you'd write that as a library using only functions. I guarantee you that you'd have a hard time and the language you end up with wouldn't feel write.

20:42 {blake}: And what you would do (or what I would do) in another language is write a parser to do math the traditional way. (Perhaps giving weight to the notion that "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp")

20:43 CapitalSigma: {blake}: what do you mean by "do math the traditional way"?

20:43 kristof: Not prefix notation

20:43 CapitalSigma: ah

20:43 {blake}: Well, that's what kristof's example is. Infix with orders of precedence.

20:44 CapitalSigma: well, SML does let you define infix operators with your own precedence

20:44 kristof: Not the point.

20:44 CapitalSigma: but i see that that's a special case

20:44 {blake}: I've done things like that a lot. The promise of CL is I don't have to.

20:44 CapitalSigma: that macros give you the power to do by yourself

20:48 codygman: Hi, why isn't this giving me an unmodified dict?

20:48 > (map (fn [[k v]] [(keyword k) v]) (partition 2 {:a 1 :b 2}))

20:50 SegFaultAX: ,(seq {:a 1 :b 2})

20:50 clojurebot: ([:b 2] [:a 1])

20:51 SegFaultAX: codygman: 2 problems. 1 is demonstrated above. 2 is `map` doesn't return a dict.

20:51 ,(partition 2 {:a 1 :b 2})

20:51 clojurebot: (([:b 2] [:a 1]))

20:52 SegFaultAX: codygman: What are you trying to do?

20:54 codygman: SegFaultAX: Understand the into function used in an example here: http://clojure-doc.org/articles/tutorials/emacs.html

20:55 SegFaultAX: codygman: There is a fundamental difference in inputs with the code you pasted and the code they're showing.

20:56 codygman: Namely, `args` in the case of the linked code is a list.

20:56 Look closely:

20:56 ,(seq {:a 1 :b 2 :c 3})

20:56 clojurebot: ([:c 3] [:b 2] [:a 1])

20:56 SegFaultAX: (partition 2 [:a 1 :b 2 :c 3])

20:57 ,(partition 2 [:a 1 :b 2 :c 3])

20:57 clojurebot: ((:a 1) (:b 2) (:c 3))

20:57 codygman: SegFaultAX: Thanks. I didn't notice that.

20:57 technomancy: unguessable precedence rules are hands-down my least-favourite thing about ML syntax

20:57 SegFaultAX: Note that what I passed to seq was a map and what I passed to partition is a vector.

20:58 codygman: I do see that now ;)

20:58 SegFaultAX: codygman: Implementing into is super trivial, but it helps to get an intuition for how it works.

20:59 ,(reduce conj {} (partition 2 [:a 1 :b 2 :c 3]))

20:59 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>

20:59 SegFaultAX: ,(reduce conj {} (map vector (partition 2 [:a 1 :b 2 :c 3])))

20:59 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Vector arg to map conj must be a pair>

20:59 SegFaultAX: Ugh.

20:59 ,(reduce conj {} (map vec (partition 2 [:a 1 :b 2 :c 3])))

20:59 clojurebot: {:c 3, :b 2, :a 1}

21:00 SegFaultAX: Forever getting vec and vector mixed up.

21:00 I need to invent a mnemonic for myself.

21:02 amalloy: SegFaultAX: also s/reduce conj/into/ for your entire codebase

21:02 SegFaultAX: amalloy: ? I was specifically demonstrating how into works.

21:03 amalloy: i see. this was not clear from the context

21:03 SegFaultAX: "Implementing into is super trivial, but it helps to get an intuition for how it works."

21:04 amalloy: technomancy: seriously. i think i've finally got a feel for how haskell's precedence seems to work, but it's such a drag to get that figured out compared to sexprs

21:04 mdeboard: Is there a way to see what options are available when creating a project from a template?

21:05 SegFaultAX: amalloy: A wild fixity appears...

21:07 mdeboard: Hope that it's documented?

21:07 mdeboard: good point, i don't even know where to find documentation for e.g. compojure template

21:08 SegFaultAX: https://github.com/weavejester/compojure-template presumably

21:08 mdeboard: oh. well fine

21:08 :)

21:10 thanks, i guess the term i was looking for was "profile hints"

21:10 compojure template doesn't have i guess

21:18 technomancy: amalloy_: "just spam it with parens till it compiles" <- my strategy

21:39 Jabberz: question on GC ... if you have refer to a symbol holding an atom inside, say a compojure handler, when the request is GC'd, the symbol for the ref won't hang around (ie leak) will it?

21:44 mthvedt: jabberz: not sure what you’re asking. anything in a loaded namespace generally won’t get GCed

21:45 anything interned in

21:47 Jabberz: I guess another way to ask it - as things done during the execution of a function go out of scope - say local symbols in a let form, stuff done during a ring request handler, etc -- how do clojure persistent data structures operate with GC

21:49 mthvedt: jabberz: GC is automatic. the only way to cause a memory leak is if a thread holds references it shouldn’t be holding.

22:17 arrdem: mdeboard: what's up?

22:28 mdeboard: still happy to answer questions, thanks for sitting through any/all of my talk

22:47 tehgeekmeister: is there a way to run a clojure file as a script? without a project.clj and all that jazz?

22:48 DomKM: tehgeekmeister: https://github.com/kumarshantanu/lein-exec

22:49 technomancy: tehgeekmeister: lein run -m clojure.main/main file.clj

22:52 tehgeekmeister: @DomKM @technomancy thanks!

23:01 also, is there a thing like line-seq but that returns a character at a time?

23:02 technomancy: (mapcat seq (line-seq ...))

23:06 mdeboard: arrdem: I didn't make the connection you were the one giving the talk until a few minutes into it. We've talked before about this or that. I was the guy in the very back who asked you to repeat the big about closures

23:06 arrdem: mdeboard: ohai

23:07 mdeboard: the bit about*

23:07 arrdem: thanks for showing up! hope it wasn't too terrible despite tecnical difficulties

23:07 mdeboard: good talk btw, the technical difficulties weren't that bad at all

23:08 arrdem: coulda been a lot worse considering that I rebuilt my slides in the two hours leading up..

23:08 not as polished as I would have liked tho

23:08 mdeboard: it's far more important that the presenter speak loudly & clearly and have a firm grasp on the material, all of which you nailed. The techncal probs happen to everyone

23:10 tehgeekmeister: @technomancy oh, i was hoping for something that did *less* work than line-seq. it's not for anything important though, it's actually quite silly and trivial.

23:11 I was just impressed that (print (count (line-seq ...))) was only 3x slower than wc -l, and wanted to see if that got closer by only counting newline characters

23:11 rather than doing all that extra allocation

23:12 oh! i could use a reduce. =D

23:24 arrdem: mdeboard: thanks! that's good to here. I was more or less convinced that I totally lost everyone :P

23:25 mod the two guys who were interested in static clojure variants already

Logging service provided by n01se.net