#clojure logs

2014-08-11

00:05fifosineHow do I turn a string into a generator?
00:06fifosineso that each time I perform take, it also drops what I've taken?
00:06fifosineand returns nil when there are no chars left?
00:07amalloyfifosine: 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
00:07fifosineamalloy: Then how do I select a range of elements?
00:07amalloytake
00:07fifosinelike, give me the first set of 5 chars
00:07fifosinethen the next set of five chars
00:08amalloyuse all of clojure's gazillions of sequence operators
00:08amalloy&(partition-all 5 "abcdefghijklmnopqrstuvwxyz")
00:08lazybot⇒ ((\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))
00:10johnwalkerfifosine: if you don't wanna type the alphabet, you can also do
00:10johnwalker(map char (range 100)) and then what amalloy suggested
00:10fifosinenice, ty guys
00:11justin_smith,(apply str (map char (range (int \a) (int \z))))
00:11clojurebot"abcdefghijklmnopqrstuvwxy"
00:13johnwalkerhehe not quite ;)
00:13johnwalkergotta inc your z
00:33gfredericks&(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)))))))))
00:33lazybot⇒ 9578.0
00:33gfredericks^in case anybody was on the edge of their seat regarding the latest "java math" challenge
00:38rhg135that's a bit verbose
00:39rhg135needs some macro sugar
00:39rhg135maybe prefix-> or somn
00:40gfredericks&(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)))
00:40lazybotjava.lang.IllegalArgumentException: No matching method: scalb
00:41amalloyyou were right, rhg135, it's now immediately clear what gfredericks is doing
00:41gfrederickshwoops
00:41amalloy-> saves the day again
00:41gfredericks&(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))))
00:41lazybot⇒ 9578.0
00:41gfredericksphew
00:41rhg135like (prefix-> Math Math/X methods...)
00:42rhg135prefix all methods with the class
00:42gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? x) (symbol "Math" (name x)) x)))
00:42clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0:0)>
00:42gfredericks,(require 'clojure.walk)
00:42clojurebotnil
00:42gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? x) (symbol "Math" (name x)) x)))
00:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:42gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? x) (symbol "Math" (name expr)) expr)))
00:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:42gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? expr) (symbol "Math" (name expr)) expr)))
00:42clojurebot#'sandbox/mathly
00:43gfrederickssorry evrbdy
00:43rhg135np
00:43rhg135bots are our slaves
00:43rhg135*evil laugh*
00:43gfredericks,(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent)))))
00:43clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (-1) passed to: walk/postwalk>
00:44gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (symbol? %) (symbol "Math" (name %)) %) expr))
00:44clojurebot#'sandbox/mathly
00:44gfredericks,(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent)))))
00:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: sinh in class java.lang.Math, compiling:(NO_SOURCE_PATH:0:0)>
00:44gfredericksI give up
00:44rhg135macroexpand it
00:44rhg135should be similar to the first one
00:45gfrederickstoo much wine for macroexpansion
00:45rhg135hmm
00:47gfredericksokay phine
00:47gfredericks,(macroexpand-1 '(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent))))))
00:47clojurebot(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 ...))))
00:48gfredericksah ha
00:48gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (and (symbol? %) (not (resolve %))) (symbol "Math" (name %)) %) expr))
00:48clojurebot#'sandbox/mathly
00:48gfredericks,(mathly (ceil (exp (scalb (-> E sinh log1p log1p) (-> PI (atan2 PI) sqrt sin log toDegrees getExponent)))))
00:48clojurebot9578.0
00:48gfredericksbam.
00:48rhg135woo
00:48Raynesmathly
00:49gfredericksif you're not calling `resolve` in your macro you're doing it wrong.
00:49rhg135wouldn't -> turn to Math/->
00:49gfredericksthat was the original problem
00:49rhg135which would go boom
00:49rhg135oh
00:49rhg135ic
00:49gfredericksthus the addition of the resolve check
00:50rhg135hmm
00:50rhg135nice
00:50rhg135useful
00:50gfredericksdon't ever do that in real life
00:50rhg135but let it accept the class name
00:50rhg135java is already ugly in principle
00:51amalloygfredericks: look what you have wrought
00:51rhg135doesn't need verbose syntax too
00:51gfredericksamalloy: another senseless tragedy caused by drunk macro composition
00:51TEttingeroh geez does that macro do what I think it does?
00:51TEttingeruse Math within a form?
00:51amalloyMath/yes
00:52rhg135uh oh
00:52gfredericks,(mathly (+ PI PI))
00:52clojurebot6.283185307179586
00:52rhg135seems it wasn't a good idea
00:52gfredericks,(mathly (* PI E E))
00:52clojurebot23.213404357363384
00:52gfredericks^ why wouldn't you want to do that
00:52TEttingerwell I :use the clojure numeric tower in my version of lazybot because people need math eval a lot
00:53rhg135To confuse readers, gfredericks
00:53TEttinger,(alias use-math mathly)
00:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: use-math in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:54TEttinger,(alias mathly use-math)
00:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mathly in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:54TEttingerhm
00:54TEttingerhas it been 5 min? yes it has
00:54gfredericks,mathly
00:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mathly in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:54rhg331(def use-math mathly)
00:54gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (and (symbol? %) (not (resolve %))) (symbol "Math" (name %)) %) expr))
00:54clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0:0)>
00:54TEttingerout of scope
00:54gfredericks,(require 'clojure.walk)
00:54clojurebotnil
00:54gfredericks,(defmacro mathly [expr] (clojure.walk/postwalk #(if (and (symbol? %) (not (resolve %))) (symbol "Math" (name %)) %) expr))
00:54clojurebot#'sandbox/mathly
00:54gfredericksthere I fixed it
00:55gfredericksusing my Alt+p
00:55rhg331interesting implementation
00:55rhg331but superior to mine
00:56gfredericksthe night grows old; I must away.
00:58rhg331gn gfredericks
01:01prachetasprhg135 what are NPEs
01:01prachetasphow do i direct my comments at someone?
01:01TEttingerNullPointerException s
01:02rhg135Yup evil things
01:02prachetaspI've never run into an NPE
01:02TEttingerprachetasp, they happen when you try to use null (or nil, if it isn't checked for in the code) as a value
01:02TEttinger,(+ 1 nil)
01:02clojurebot#<NullPointerException java.lang.NullPointerException>
01:02prachetaspah so downstream
01:03prachetaspand how does get suppress npe's
01:04TEttingermake sure you don't have nils/nulls that aren't handled, like... #(if (seq nil) "yay" "it's nil")
01:04amalloyprachetasp: to get sometone's attention, just include their name in the message. your client probably tab-completes names, as well
01:04TEttinger,(if (seq nil) "yay" "it's nil")
01:04clojurebot"it's nil"
01:04rhg135It doesn't call a nil
01:04prachetaspan example?
01:05TEttingeryou can use nil for meaningful stuff, but mostly in clojure-land, where nil is basically synonymous with an empty seq
01:05rhg135(nil-v {})
01:05rhg135Vs (get nil-v {})
01:06TEttinger,(def nil-v nil)
01:06clojurebot#'sandbox/nil-v
01:06TEttinger,(nil-v {})
01:06clojurebot#<NullPointerException java.lang.NullPointerException>
01:06TEttinger,(get nil-v {})
01:06clojurebotnil
01:06prachetaspi see
01:07prachetaspdamn okay switching the get's back :)
01:07prachetaspI'd definitely rather it failed noisily
01:07prachetaspas a more general subjective question how do you guys usually do exception handling?
01:08rhg135I don't lol
01:08rhg135Don't hurt me!
01:09prachetaspyou just check inputs/outputs stringently?
01:09rhg135Maybe use schema
01:09prachetaspwhen I used C# (ugh) I just used to catch them at the top level and let it all bubble up
01:10prachetaspI've been using a similar strategy - especially in my ring apps
01:14rhg135I personally pass errors in a tuple with nil or a result
01:14rhg135Error monad ftw
01:15prachetaspyeah that seems like the most clojurey strategy
01:15prachetaspjust a PITA to write all that result-checking code haha
01:16rhg135Higher order functions and macros
01:17prachetaspso you have a standard error return format and you wrap the functions that need to check the return with a macro that recognizes that?
01:18rhg135A function works
01:18prachetaspright or HOE
01:18prachetaspHOF*
01:18rhg135The macro is just sugar
01:18rhg135Yup
01:18amalloyhigher-order exceptions: the new hotness, coming soon to java 9
01:18prachetasphahahah
01:18prachetaspcoming soon* to java 9
01:19rhg135Didn't lisp have that in the 50s
01:20amalloywell, it had signals
01:20prachetaspdidn't lisp have everything in the 50's?
01:21rhg135Hof are 90% of *
01:21rhg135Macros fill the rest
01:44prachetaspI'm trying to deploy a jar to a self-hosted Artifactory server
01:44prachetaspI've had no issues doing this with several other projects
01:44prachetaspbut now I'm getting Could not find artifact prachetasp:xxxxx:jar:1.0.0-20140811.054224-1 in snapshots
01:44prachetasprunning ubuntu 14.04
01:48prachetasptechnomancy I know you know the answer to this :)
02:31prachetaspwell for all that care to know - the server ran out of space and that's what caused this
02:32prachetaspso 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
04:11djcoinIs there anything to expect (performance, simplicity, whatever) from the recent addition of lambda to the JVM? Thanks :)
04:14llasramdjcoin: 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
04:16djcoinAlright!
04:16TEttingerdjcoin, in particular because I think java 8's install base is not good for end users
04:17TEttingercompared to 6 or 7
04:17TEttingeryet, at least
04:18llasramTEttinger: That'd be a good reason not to depend on Java 8 features, but there needs to be an integration plan
04:18TEttingeragreed
04:18llasrame.g. Scala has a community-discussed plan plus timetable and release schedule for integratino
04:18TEttingerlambdas are not closures, however
04:18TEttingerso clojure can't make as effective use of them as a replacement I think
04:20llasramWell. 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
04:20llasramHowever, 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
04:42TEttingerah, good point llasram
04:59ucbI 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.
05:05llasramucb: Something like? ##(let [m1 {:k 1}, m2 {:k 2}, {k1 :k} m1, {k2 :k} m2] [k1 k2])
05:05lazybot⇒ [1 2]
05:06ucbllasram: yeah, but using :keys in function signatures :)
05:06ucbmaybe I'm wrong and it cannot be done
05:06ucbalso apologies for moving the goal-posts :D
05:07llasramWell, 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
05:09ucbyeah, 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.
05:09ucbno worries, it's not vital
05:09llasramOh, hmm
05:10broquain1ucb: I think you're after this - https://gist.github.com/john2x/e1dca953548bfdfb9844
05:12ucbbroquaint: thanks, though it doesn't cover what I need :)
05:13ucbI guess I can just (fn [{a :key} {b :key}] ...) and be done with it
05:15broquaintMaybe with :or?
05:18ucbhow would that work (if it does)?
05:21llasramI 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
05:21hyPiRionucb: I'm not sure what you're attempting to do is really possible
05:22llasrams,point of keys,point of :keys,
05:22hyPiRiononly thing I can think of is like
05:22hyPiRion,(defn m2' [m] (into {} (for [[k v] m] [(keyword (str (name k) 2)) v])))
05:22clojurebot#'sandbox/m2'
05:22ucbhyPiRion: 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 ^_^
05:23hyPiRion,(fn [{:keys [foo bar]} m2] (let [{:keys [foo2 bar2]} (m2' m2)] [[foo foo2] [bar bar2]]))
05:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol:   in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:23hyPiRionwell, you get the idea
05:25ucbyeah
05:25ucbthanks for that :)
05:27curveballspeaking 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
05:28curveballEssentially, I want to pull the top level keyword based on the contents of the value of the inner map
05:30TEttingercurveball, and if you have {:apple {:type :duplicate}, :orange {:type :duplicate}}
05:31TEttingerthen you'd have some weird overlap
05:31hyPiRion,(let [m {:apple {:type :foo}, :orange {:type :bar}}, [apple-type orange-type] (map #(get-in m %) [[:apple :type] [:orange :type]])] [apple-type orange-type]) ;?
05:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol:   in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:31hyPiRionoh dangit, my nbsps go bananas today
05:32hyPiRion,(let [m {:apple {:type :foo}, :orange {:type :bar}}, [apple-type orange-type] (map #(get-in m %) [[:apple :type] [:orange :type]])] [apple-type orange-type]) ;?
05:32clojurebot[:foo :bar]
05:32curveballyes 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)
05:32llasramcurveball: ? ##(->> {:apple {:type :foo}, :orange {:type :bar}} (mapcat (fn [[fruit {:keys [type]}]] [type fruit])) (into []))
05:32lazybot⇒ [:bar :orange :foo :apple]
05:32hyPiRionoh. like that.
05:33llasramhyPiRion: You should try some of the other fun Unicode whitespace :-D
05:33TEttingerand you'd want the names of course ##(->> {:apple {:type :foo}, :orange {:type :bar}} (mapcat (fn [[fruit {:keys [type]}]] [(name type) fruit])) (into []))
05:33lazybot⇒ ["bar" :orange "foo" :apple]
05:33TEttingeralthough does let allow arbitrary vectors in?
05:34TEttingerthis would need to be a macro, right?
05:34curveballHmm… destructuring and then just building it back… interesting
05:36curveballI was hoping there was some built in recursive value find that could pop out the highest level keyword found under.
05:36curveballThat totally works though, and cleaner than my approaches, thanks!
05:37hyPiRionI totally didn't understand that question, I realise.
05:38llasramI'm not entirely certain I did either.
05:38llasramBut then can two humans ever really understand each other's questions?
05:39curveballdepends on definition of understand
05:39hyPiRionllasram: people can understand sufficiently enough
05:42llasramI 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
05:43curveballthat’s closer to the truth than you think llasram
05:43TEttingerllasram, qualia hypothesis?
05:43hyPiRionllasram: Well, that would at least explain some of the source code I've seen in my lifetime.
05:44llasramHa!
05:44llasramTEttinger: not really where I was going, but I do find qualia difficult to fully reject :-)
05:46TEttingerllasram, especially having tried to make art that was distinguishable for 2 different partly- and fully-red-green-colorblind people, I can see it
05:47TEttingerit'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"
05:47thesaskwatchHi, what's wrong with this code: (map #( [% %] ) { :a 1 }) ?
05:47TEttingerthesaskwatch, a lot
05:47llasramthesaskwatch: It tries to call a vector as a 0-argument function
05:48rodnaph_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?
05:48TEttinger,(map #( [%1 %2] ) { :a 1 })
05:48thesaskwatchah, right
05:48clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval27/fn--28>
05:48llasramthesaskwatch: You can either use the explicit `vector` function, or you'll sometimes see e.g. #(-> [% %])
05:48TEttingerif you just want double keys, try ##(map #(vector % % ) { :a 1 })
05:48lazybot⇒ ([[:a 1] [:a 1]])
05:48TEttingeroh yeah, kv pairs
05:49TEttingerwhat should it do?
05:49thesaskwatchTEttinger: I want to turn [{:a 1} {:b 2}] into {:a {:a 1} :b {:b 1}}
05:49TEttingerwhy 1 for both?
05:49thesaskwatch:b at the end should be 2
05:50TEttingerok
05:50llasramrodnaph_: Why not just use a static logging configuration properties file?
05:50TEttinger,(into {} (map #(vector (key %) % ) { :a 1 })
05:50clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
05:50TEttinger,(into {} (map #(vector (key %) % ) { :a 1 }))
05:50clojurebot{:a [:a 1]}
05:50thesaskwatchTEttinger: thanks
05:50TEttinger,(into {} (map #(vector (key %) % ) { :a 1 :b 2}))
05:50clojurebot{:b [:b 2], :a [:a 1]}
05:50TEttingerno prob, thesaskwatch
05:50thesaskwatchthat's how I would do it minus the vector part
05:51rodnaph_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.
05:52llasramrodnaph_: 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)
05:52llasramIn 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
05:53rodnaph_llasram: ok, i'll give it a go then, thanks.
05:54thesaskwatchTEttinger: why is [] treated as function in this case? (fn [] ["abc"]) works fine
05:54thesaskwatchTEttinger: (in this previous #() case)
05:54TEttingerthesaskwatch, that's the arg list
05:54TEttingerin fn you return the last form, but in #() it immediately calls the form
05:54llasramthesaskwatch: You can use the reader to see:
05:55llasram,#([:what-is-this])
05:55clojurebot#<sandbox$eval130$fn__131 sandbox$eval130$fn__131@24539d>
05:55llasramEr
05:55llasram,`#([:what-is-this])
05:55clojurebot(fn* [] ([:what-is-this]))
05:55llasramThere we go
05:55llasram,`#(inc 1)
05:55clojurebot(fn* [] (clojure.core/inc 1))
05:55TEttingersee the parens around the brackets?
05:55TEttingerit's trying to call it with #()
05:55llasramWhich you need, or else you'd need to write #((inc 1)), which would be annoying :-)
05:55TEttinger,`(fn [] [:what-is-this])
05:55clojurebot(clojure.core/fn [] [:what-is-this])
05:56thesaskwatchTEttinger: ok, didn't know that. It's a quite different behaviour. Didn't see it mentioned in docs.
05:56TEttingerthanks llasram~
05:56TEttinger(inc llasram)
05:56lazybot⇒ 32
07:57dimovichis it possible to automatically add dependencies from cider repl?
07:58dimovichread somewhere about a project that checks your ns declaration and loads the dependecies, but forgot the name... :(
07:58schmirdimovich: maybe slamhound
07:58dimovichyeah... thanks
08:02clgvslamhound does not load dependencies based on ns-forms. it allows to reconstruct ns-forms with respect to what is used in the source file
08:04schmiryes, not sure what the OP was asking for
08:32TimMcpomegranate?
08:32TimMcI couldn't get it tow rok for me, but that was a while ago.
08:33TimMc*to work
08:35justin_smithTimMc: alembic is much easier to use than pomegranate
09:31clgvTimMc: but he wanted to determine dependency artifacts from namespace ns-forms which is probably impossible in general ...
09:32clgvjustin_smith: thank you for the alembic reference - I did not know that one, yet
09:36justin_smithit'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)
09:40clgvby one-off without project you mean "lein try"?
09:41justin_smithI mean I already have a no-project repl open
09:41justin_smithand want to load some random lib
09:41clgvah ok^^
09:41justin_smithlike lein try but a bit more flexible
09:43justin_smithI 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?
09:45JohnTalenti 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.
09:46TimMcclgv: Ah, I see. Yeah, impossible in the general case, and unsatisfying in the easy case. :-P
09:47clgvjustin_smith: depends on the non-functional requirements. nested maps potentially require more memory
09:48clgvJohnTalent: what is your question?
09:49clgvJohnTalent: most turing complete languages offer you more than one way to implement desired functionality
09:52justin_smithclgv: but do nested maps have any advantage over a map with a seq for each key in representing ngrams?
09:52justin_smithI am starting to think not
09:52TimMcsomething something tries
09:53clgvjustin_smith: humm, nested maps probably give you an advantage when you need to consider subtrees
09:55justin_smithclgv: yeah, I don't think my algo needs subtrees - it's just markov with a meory of N
09:55JohnTalentclgv: 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.
09:56JohnTalenti really think clojure is orthogonal to standarization in corportions. sadly, because it seems like a fine language to some extents.
09:56clgvJohnTalent: how do you do it in java and c++ with local variables?
09:57justin_smithJohnTalent: "determining their final result" is much easier in clojure, because they aren't variables and they can't be changed
09:59clgvJohnTalent: local bindings in clojure can be interpreted as "final" local variables in java
10:00TimMcJohnTalent: By orthogonal do you actually mean in opposition?
10:01TimMcor at cross-purposes
10:01JohnTalentclgv: i was going to write my program in clojure, but after viewing clojure source, I'm not so sure.
10:01JohnTalentit seems like you need in depth knowledge of each of the hundreds of functions/macros that exist.
10:02clgvJohnTalent: did you read any introductorial material (books or guides on the internet) about clojure, yet?
10:02JohnTalentclgv: yes, i have.
10:02ToxicFrogFortunately, the clojure standard library is very well documented and that documentation is even avaiable from the REPL.
10:03clgvJohnTalent: no not really. you can build your knowledge iteratively starting from a few core functions and macros...
10:03sritchieAnyone seen this on cider? No reader function for tag +cljs
10:03sritchieoh, you know what -
10:03sritchieI’m converting files to cljx, haven’t moved that one yet
10:03sritchieit’s still .clj
10:03TimMcJohnTalent: 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:03clgvTimMc: or even the standard syntax of those languages^^
10:04TimMc(With the caveat that if you already know Java, it really helps...)
10:06JohnTalentclgv: that'd be nice
10:06ToxicFrogsritchie: cljx?
10:06JohnTalentclojure seems like such an investment though.
10:07sritchieToxicFrog: yeah, https://github.com/lynaghk/cljx
10:07JohnTalentc/c++ has like what 40 keywords?
10:07ToxicFrogTimMc: I'm not sure already knowing Java helps that much
10:07JohnTalentclojure has hundreds.
10:07clgvJohnTalent: it probably helps if you start implementing easy problems and then move on to problem with increasing difficulty
10:07ToxicFrogJohnTalent: ahahahahaha what?
10:08clgvJohnTalent: you mean function or macro names? otherwise clojure has as many clojure keywords as fit in your memory ;)
10:09JohnTalentlet me ask you this. Has clojure been catching on with corporations?
10:09JohnTalentonly one that I know is puppetlabs
10:10clgvJohnTalent: there are several threads on the mailinglist about that topic
10:10TimMcJohnTalent: Sure, I could name several.
10:11hyPiRionBiggest ones are probably Apple and Twitter.
10:11TimMcI work for one. :-)
10:11JohnTalentTimMc: thanks, that answers my question.
10:11JohnTalenti'd say in 3 months it'd be possible to be a beginner clojure programmer.
10:13ToxicFrogJohnTalent: it is not nearly that bad unless you are totally unfamiliar with dynamically typed HLLs, I think. Maybe start with the Koans?
10:13ToxicFrogThis reminds me, I should get back to work on my Spellcast project.
10:13teslanickhyPiRion: Clojure at Apple? For reals?
10:14JohnTalentthe 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:14teslanickJohnTalent: 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:14JohnTalentteslanick: that sounds about right.
10:15justin_smithIT WORKS. Markov chains from input text, with arbitrary memory. The chain is by character not by word. https://github.com/noisesmith/markov-toy
10:15JohnTalenti 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:15justin_smithnot bad for an hours work (you can check it out and run it, "lein run 4" gives decently uncanny results)
10:16teslanickThat's what learning is. Stumbling around and crashing into sharp edges until you develop some basic mastery.
10:16JohnTalenti mean javascript
10:18JohnTalentwyvern looks interesting. it's boringness might be a boon.
10:18clgvjustin_smith: no prng seed? ;)
10:18justin_smithclgv: oh, good idea
10:18ToxicFrogJohnTalent: AIUI, the "killer app" for cljs is core.async, which lets you escape from the callback hell that characterizes JS programming
10:18ToxicFrogBut I have limited experience with js and none with cljs.
10:18hyPiRionteslanick: yeah.
10:19dnolen_JohnTalent: also Microsoft, Citibank, Staples, Walmart Labs, Netflix
10:19justin_smithclgv: 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:19JohnTalentdnolen_: yup, thats several.
10:20JohnTalentwithout a good memory clojure is a bust.
10:20pcnI 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:20dnolen_JohnTalent: with a good memory X is a bust
10:20clgvJohnTalent: http://clojure.org/cheatsheet
10:20dnolen_s/without
10:20pcnThe update would be from a file
10:20justin_smithI 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:21justin_smithsome long term memory for the big standard library, traded for less need for short term code-reading memory
10:22ToxicFrogNaming 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:22ToxicFrogmapv already exists and does something different.
10:22ToxicFrogmapmap is silly but kind of appealing.
10:22justin_smithmap-vals
10:22TimMcI've seen "fmap" used for that.
10:22JohnTalenti'm still not sold. sucks.
10:22TimMcbut I like map-vals
10:22dnolen_JohnTalent: that's ok, no one is going to really try to convince you :)
10:22ToxicFrogJohnTalent: 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:23TimMcI don't think that's constructive.
10:24JohnTalentToxicFrog: 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:24clgvToxicFrog: update-vals?
10:24TimMchahaha
10:24justin_smithJohnTalent: well, if javascript is a given, multicore isn't even on the table
10:24TimMcdnolen_: Nonsense, if I get one more convert I can trade in my points for an RC car!
10:25JohnTalentjustin_smith: and cljs is?
10:25justin_smithno, I am saying with cljs, since it is based on javascript, multi-core is out of the question - it's not an option
10:25pcnSo, how do ppl deal with config files that change, but only updating when the program is signaled?
10:26clgvJohnTalent: well that technology radar thingy said "Clojure: adopt" ;)
10:26justin_smithso if that's your reason for using clojure, you may not want to be using clojure for this
10:26JohnTalentit matters not then sine my program will be a browser app
10:26ToxicFrogjustin_smith: well, it depends
10:26teslanickThere are advantages to clojure(script) over and above multi-core friendliness.
10:26ToxicFrogIf you want to escape callback hell and organize your code nicely into threads, core.async in cljs is killer
10:26justin_smithteslanick: absolutely, just wanting to be clear, since he said that was his reason
10:26ToxicFrogIf you want to actually execute code in parallel on multiple codes, you're boned.
10:27ToxicFrogSo it depends on whether you want it for code readability reasons (use clojure) or performance reasons (don't run in the browser)
10:27hyPiRionJohnTalent: What would make Clojure a worthy investment for you? Would making it easier to start with a better choice?
10:28JohnTalentthat 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:28ToxicFrogTimMc: 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:28dnolen_JohnTalent: a lot of people are successful JavaScript - seems like a sound tech choice to me. ClojureScript appeals mostly to ... surprise ... Clojure programmers.
10:29TimMcpcn: We've been exploring Archaius.
10:29ToxicFrogTimMc: it looks like we actually had fmap in contrib in 1.2, I'm not sure where it lives now.
10:29cbpi think any experienced dev can learn any language in like 2 full-time weeks
10:29JohnTalenti was looking at mie hello world last night and could not figure out the supposidly small code it tooks to make mie.cljs
10:30ToxicFrogJohnTalent: I note that 99%+ of the time you don't need the source for the things you're calling, just the docs.
10:30teslanickJohnTalent: Most functions don't do very much.
10:30ToxicFrogIndeed, 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:30hyPiRioncbp: Depends on what you mean by "learn".
10:30TimMcJohnTalent: CLJS is more complicated than CLJ because it (sort of) requires knowing about two different platforms.
10:30clgvJohnTalent: same advice as before start solving easy problems. you'll only need a limited number of functions and control structures (clojure.core macros)
10:30mdrogalis`tbaldridge: Be sure to take the computer as an argument to your function, loool.
10:31JohnTalentwhat 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:31ToxicFrogAha, it's in algo.generic
10:31tbaldridgemdrogalis`: 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:31clgvJohnTalent: solving easy problems with different focus will introduce you to different functions of clojure. consider 4clojure.com for practicing
10:31tbaldridgeSo the platform kind of restricts him from copying the clojure code.
10:31ToxicFrogJohnTalent: what makes it clifflike? I found starting small, with the Koans and similar exercises, to be quite approachable.
10:31teslanickOr even: http://clojurescriptkoans.com/
10:32cbphyPiRion: Enough to start being productive
10:32pcnTimMc: 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:32mdrogalis`tbaldridge: It's a fair question. Hulk's reply was pro, though.
10:32tbaldridgemdrogalis`: lol yes it is
10:32JohnTalentToxicFrog: koans are not a favorite of mine.
10:33JohnTalentit's the api and it's source
10:33clgvJohnTalent: you dont need to read clojure.core source to learn the basics of the language ;)
10:34clgvJohnTalent: you probably did not read the java source to learn java either ...
10:34JohnTalentlisps 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:34justin_smithJohnTalent: the order of operations is highly constrained
10:34JohnTalentclgv: javascript. i only know a little java. not a java fan. javascript is so so to me.
10:35JohnTalentjustin_smith: in what way?
10:35justin_smithJohnTalent: the advantage of lisp over an algol family language is that order of operations is never ambiguous
10:35ToxicFrogJohnTalent: well, you probably didn't read the JavaScript interpreter/stdlib source code when learning JavaScript,either.
10:36justin_smith*an advantage
10:36JohnTalenta function's arguments and internal macro can have exponentially different order of operations without knowing the source.
10:36ToxicFrogjustin_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:36JohnTalentToxicFrog: probably? you detain me by unknown information you guess?
10:36ToxicFrogJohnTalent: what? I can't parse that.
10:37ToxicFrogJohnTalent: 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:38justin_smithJohnTalent: 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:39JohnTalenta big let down was seeing lots of one character let definitions doing standard operational duty. big loss.
10:39ToxicFrog"standard operational duty"?
10:39teslanickAnd 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:40JohnTalentToxicFrog: "one character let definitions"?
10:40ToxicFrog...this is exciting. Replaced my map-specific implementation with clojure.algo.generic.functor/mapv, and now "lein test" OOMs.
10:40justin_smithteslanick: you don't need to write them, but you won't get far without using them
10:40ToxicFrogJohnTalent: I know what you meant by that. I don't know what you meant by "standard operational duty".
10:40teslanickjustin_smith: Agreed. You'll get about three months before you say, "god this sucks, there has to be something better"
10:40JohnTalentwell, i won't bother you guys any father. i had hoped for more. but i prefer homegrown functionality.
10:40teslanickEsp. in clojurescript where you're touching a lot of properties.
10:41JohnTalentwithout types it makes clojure a blob cake letting team members play jedi mind tricks on your soul.
10:41JohnTalenthahahah!
10:41dnolen_JohnTalent: 'grats you're now on the ignore list
10:42ToxicFrogJohnTalent: 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:42JohnTalentToxicFrog: 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:42ToxicFrogBut then, neither are the overwhelming majority of other programming languages.
10:42JohnTalentToxicFrog: yes precisely!
10:42justin_smithteslanick: ##(count (filter (comp :macro meta) (vals (ns-publics 'clojure.core))))
10:42ToxicFrogJohnTalent: what is this "clojure source API" you keep mentioning?
10:42lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
10:42ToxicFrogJohnTalent: and yet...you use JavaScript? So did you read the complete source for Rhino or V8 or whatever when learning it?
10:42JohnTalentToxicFrog: i am guessing you don't know.
10:43ToxicFrogLike, 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:43ToxicFrogJohnTalent: if I knew I wouldn't have asked.
10:43justin_smithclojure 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:44JohnTalentif cljs doesn't improve on concurrency I am guessing it's just for clojure programmers who don't want to battle unknown asyncs.
10:44ToxicFrogSanity check, everyone else in the channel, please: am I feeding the troll or do we just have a fundamental disconnect in mindset here?
10:44pcnIs he asking about docstrings?
10:44arrdemToxicFrog: reading scrollback..
10:44JohnTalentpcn: no the docstrings are good to ok.
10:44teslanickJohnTalent: You don't get true concurrency in JS anyway, unless you write the boilerplate worker code.
10:45ToxicFrogJohnTalent: 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:45hyPiRionToxicFrog: the former
10:45JohnTalentpcn: 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:45cbpI thought lamenting the lack of types while arguing for javascript was a telltale sign :-P
10:46ToxicFrogJohnTalent: "lose" how?
10:46JohnTalentteslanick: yappers, thats what i thought.
10:46pcnJohnTalent: You're not telling anyone what function/macro you're talking about. I feel the frustration here.
10:47arrdemToxicFrog: I vote not blatantly trolling
10:47tbaldridgeJohnTalent: and please define "one letter let statements"
10:47arrdemyet
10:47JohnTalentToxicFrog: because you need to know the full containts of what the function/macro does in order to shoe fit it into your code!
10:47tbaldridgeand provide an example.
10:47ToxicFrogJohnTalent: this is blatantly untrue.
10:47owengalenjoneslol
10:47pcnOK, what tbaldridge said is clearer than what I said
10:47arohner /ignore JohnTalent
10:48JohnTalentsorry, i will go.
10:48pcnJohnTalent: That's mis-understanding what functions do.
10:48tbaldridgeJohnTalent: no need to leave, I just think you're a bit mistaken.
10:48JohnTalenta language under each function. thats all i have been seeing on my eagerness to earn clojure.
10:49tbaldridgeJohnTalent: 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:50JohnTalentno they do not.
10:50teslanickI 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:50tbaldridgeJohnTalent: what do they not tell you?
10:50JohnTalenthowever, the sourceode does.
10:50teslanickAnd functions are stateless, so you don't have to care how they're implemented in the general cas.e
10:51tbaldridgeJohnTalent: 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:51hyPiRionJohnTalent: 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:51JohnTalenttbaldridge: 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:51hlprmnkyso 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:52hlprmnkyDoes that pretty much have it surrounded?
10:52JohnTalenthyPiRion: yes indeed, mostly so.
10:52hlprmnkyand how do you solve this problem when working in, say, Javascript?
10:52hyPiRionJohnTalent: So which other languages do you work with where you've read the source code of the language?
10:52tbaldridgeOr C?
10:53JohnTalentteslanick: does usually cover it all for you? or do you have to resort to code? be honest.
10:53arohnerWhen 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:53tbaldridgeJohnTalent: what do you currently program in? And what libraries have you used that aren't like this?
10:53justin_smithJohnTalent: 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:53puredangerarohner: that should be in Maven Central so you shouldn't need another repo
10:53hlprmnkyI 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:54arohnerpuredanger: it's reliably failing for me, on two different machines
10:54teslanickJohnTalent: 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:54arrdemarohner: can confirm, it's in Maven Central
10:54JohnTalenthyPiRion: 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:54hlprmnky(doc foo) -> if still confused, fire up REPL and putter around with various inputs to foo until I "get it"
10:54clojurebotTitim gan éirí ort.
10:54JohnTalentteslanick: precisely!!!
10:54puredangerarohner: could be a maven caching issue like we've been fighting with cljs
10:54arohnerpuredanger: hrm, lein is looking in sonatype-snapshots
10:54hlprmnkyI've never felt the need to use (source foo) *to figure out what a function does*
10:54hyPiRionJohnTalent: How is that relevant to my question?
10:55JohnTalentteslanick: by the way, if you want the 1 gig file of all telsa documents i can send you the link.
10:55ToxicFrogJohnTalent: 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:55teslanickJohnTalent: 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:55JohnTalenttbaldridge: python, but it' multicore is a joke. after this convo i will use javascript since it's a web app.
10:56ToxicFrogAnd that once wasn't even a core library, it was a third-party HTTP library.
10:56justin_smithJohnTalent: neither python nor javascript can do multicore
10:56JohnTalentyes, indeed javascript's webworkers isn't best for multicore. but i'm not counting on it.
10:57ToxicFrogJohnTalent: so, why does this paranoia apply only to clojure? Or have you read the complete source code to JavaScript?
10:57JohnTalentup until yesterday i was looking towards clojure to be my base.
10:57hyPiRionjustin_smith: `from multiprocessing import *`
10:57ToxicFrogPersonally, I'd be way more scared of hidden side effects and stuff in JS than I am in clojure.
10:57cbp`in my experience clojure/racket are the easiest languages to read source code in
10:57ToxicFrogIf 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:58puredangerJohnTalent: what do you seek here? confirmation of your opinions? a better way of working? better understanding?
10:59teslanick^ 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:59JohnTalentToxicFrog: 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:59JohnTalentpuredanger: all of the above.
11:00puredangerJohnTalent: I think I can summarize the last 10 pages of backchat that: others are not in agreement so let's move past that.
11:00tbaldridgeJohnTalent: 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:01JohnTalentpuredanger: i have what i need i think.
11:01JohnTalentpython is a joke too.
11:01JohnTalenti spent 4 years part time in it.
11:01tbaldridgeJohnTalent: 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:01JohnTalentthere are pythonesque apis but under the source code it's magic global variable happy time.
11:02ToxicFrogJohnTalent: 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:02ToxicFrogWhich is (a) something that everyone else in here disagrees with both for clojure specifically and programming in general;
11:02rweirgood python apis very rarely use many globals, and it's considered poor form
11:02tbaldridgeJohnTalent: 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:02ToxicFrog(b) totally inconsistent with your own stated usage of languages like JS; and
11:02ToxicFrog(c) completely, nakedly insane
11:03JohnTalenttbaldridge: companies don't like 'types', is this true, or untrue?
11:03arohner`puredanger: (re: pom issue) I dont have sonatype-oss-snapshots in my project, so how is it getting pulled in?
11:03arrdem"companies don't like types" lolwut
11:03puredangerarohner`: most likely your settings.xml
11:03pcnJohnTalent: That question doesn't make sense. Can you ask it with something more specific than "companies" and provide a context?
11:03puredanger~/.m2/settings.xml that is
11:03clojurebotIt's greek to me.
11:03tbaldridgeJohnTalent: 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:03arohner`puredanger: nope
11:04mgaarecompanies like business value. to what extent and under what circumstances types provide business value is a really enormous question
11:04arohner`puredanger: I'll bet you can repro by rm'ing your local copy of contrib.pom & lein deps
11:04JohnTalentif 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:04hlprmnkyI move that the room re-examine the recent question in re: "Is JohnTalent confused or trolling"
11:04tbaldridgeJohnTalent: companies are not people, therefore they cannot have emotions such as "liking" something :-P
11:04ToxicFrogjustin_smith: but dynamic typing doesn't bother you in JS?
11:04rweirhlprmnky, surely there wasn't doubt
11:04JohnTalentwhat 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:05rweirhlprmnky, this is like the 24th hour of it
11:05hlprmnkyooh
11:05ToxicFrogJohnTalent: no, that's what you came in saying.
11:05hlprmnky":("
11:05ToxicFrogJohnTalent: 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:05JohnTalentpcn: questions don't make sense because of no answer. there is no other reason.
11:06ToxicFrogJohnTalent: no, your questions don't make sense because they are incomprehensible word salad
11:06JohnTalentToxicFrog: yes, that is what I think of clojure's api salad.
11:06arrdemjustin_smith: JohnTalent better not be you testing that markov chain over #clojure logs :P
11:07ToxicFrogJohnTalent: The "API salad" exists only in your mind. Seek psychological help.
11:07owengalenjonesToxicFrog: ignore the troll
11:07arrdem /ignore JohnTalent
11:07JohnTalentToxicFrog: how many personal digs do you want to jab me with?
11:07puredangerToxicFrog: no need to get mean. API Salad is actually my new band name.
11:08hlprmnkyJohnTalent: 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:08ToxicFrogowengalenjones: 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:08hlprmnkyI'd be interested to look at it
11:08tbaldridgearrdem: that's enough! Now I have to read up and Markov chains this week and implement that....
11:08JohnTalentowengalenjones: You are so brave,i judge code , not people. I'm not stupid enough to do the later.
11:08owengalenjonesnot judging anyone
11:09puredangerarohner`: could also be something added by a lein user profile - check ~/.lein/profiles.clj
11:09owengalenjonesI think theres fundamental differences of opinion re: creating software
11:09owengalenjonesthat aren't going to be reconciled
11:09JohnTalentowengalenjones: when you call someone a troll, that is not judging someone?
11:09owengalenjonestime for everyone to move on
11:09owengalenjonesmy gut opinion at this point is that your trolling
11:09owengalenjonesyour not going to change your mind
11:09owengalenjonesclearly
11:09technomancylifehack: if you don't like clojure, you can say "I don't like clojure" instead of making stuff up
11:09arrdemtbaldridge: markov chains are fun. I built a set constrained cumulative markov chain for M:TG deck generation a while back..
11:09technomancy(if pressed, you can mutter something about parens)
11:10JohnTalentowengalenjones: 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:10arohnerpuredanger: 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:10owengalenjoneslike I said, I believe this is an argument over opinion
11:11JohnTalentowengalenjones: 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:11puredangerarohner: 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:11mgaarein any case, JohnTalent what other questions can we answer for you?
11:11JohnTalentmgaare: thats about it.
11:12puredangertechnomancy: is there any other place arohner could be getting unexpected repos from?
11:12ToxicFrogJohnTalent: 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:12JohnTalentmgaare: i woudn't liked to haev a magic counterance to my concerns. but sadly there doesn't appear to be any.
11:12ToxicFrogWell, that and the fact that the failing in question exists only in your mind.,
11:13arohnerpuredanger: gist incoming
11:13JohnTalentToxicFrog: i want to program. not read incredulous lisp macros to find out what the hell happens to a specific function argument.
11:14clgvJohnTalent: well then program and do not read macro source^^
11:14JohnTalentclgv: yes. thank you.
11:14mgaareJohnTalent: ok. Best of luck.
11:14JohnTalentmgaare: thanks.
11:14hlprmnkyone last point I will make and then I'm done with this discussion
11:14technomancyhilariously, "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:14hlprmnkyJohnTalent: you don't have to read the source, you can just ...call the macro and examine what you get back
11:14ToxicFrogJohnTalent: 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:14technomancyspecifically about why you don't need immutability
11:15hlprmnkybecause what you get back is all that there is
11:15arohnerpuredanger: arg. I commented out all my lein plugins, and problem goes away. I'll bisect
11:15rweirtechnomancy, how's CL better than clojure in that regard?
11:15hyPiRionrweir: it isn't, that's the point
11:15rweirhyPiRion, technomancy oh right
11:15arohnerpuredanger: though I suspect sonatype-oss-snapshots is still misconfigured, or has partial data or something
11:16JohnTalentToxicFrog: 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:16puredangerToxicFrog: please stop suggesting mental illness. It is harmful to people that have or know others with actual mental illness.
11:16rweirhow could tht pssibly not be the case for any language
11:17technomancyrweir: it wasn't "cl's way is better" so much as "it doesn't matter either way"
11:17rweirtechnomancy, right, get it
11:17JohnTalentrweir: 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:18rweiruh-huh
11:18hyPiRionJohnTalent: have you considered Haskell or Idris? That may be better if you're concerned with type safety.
11:19arohner`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:19puredangerarohner: 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:19timothywWith, https://github.com/clojure/tools.namespace, I’m trying to figure out how to find a cyclic load dependency.
11:19timothywAny hints?
11:19JohnTalenthyPiRion: 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:20justin_smith(inc arrdem)
11:20lazybot⇒ 35
11:21puredangerJohnTalent: 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:21justin_smithfor the markov joke, I was afk
11:21JohnTalenthaskell is lisp on steroids.
11:21stuartsierratimothyw: how so? tools.namespace should report an error when it detects a circular dependency
11:21cbp`haskell hasnt much to do with lisp
11:21JohnTalentit's all very good. but depends on who ever programmer's code you are reading.
11:22JohnTalentpuredanger: yes. i was giving clojure a try. i trully honestly wanted to make it work.
11:22justin_smithJohnTalent: 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:22ToxicFrogpuredanger: 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:22JohnTalentjustin_smith: actually, i think your thinking of types, not variables.
11:23hyPiRionjustin_smith: Well, that's more of a lack of familiarity with syntax, from my experience.
11:23timothywstuartsierra: I was trying clojure.tools.namespace.repl reported my cyclic dependency error.
11:23timothywwhich function should I use?
11:23timothyw‘m currently getting a cyclic error from Midje
11:24justin_smithhave you looked at haskell code? one letter variable names (or via point free, zero letter variable names)
11:24justin_smithhyPiRion: fair point
11:25JohnTalentthanks guys. it was mind opening speaking with you all. thank you for your time.
11:25stuartsierratimothyw: Sorry, I think all you can do is examine the source files for the namespace(s) for which an error was reported.
11:25technomancyarohner`: sure, can you open an issue so I don't forget?
11:26JaoodJohnTalent: how much time have you spent learning clojure?
11:26timothywstuartsierra: did that. In fact I stripped out my whole source and test directories, and am still getting that error
11:26mgaareJohnTalent: maybe you'd prefer scala. Static types, but looks like java so corporate people aren't so scared
11:27JohnTalentJaood: 3 or 4 days, full time.
11:27timothywso it has to be coming from the library dependencies
11:27timothywand I’m trying to isolate where
11:27JohnTalentto 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:28stuartsierratimothyw: Sometimes tools.namespace can get into an inconsistent state after an error. Have you tried with a completely new REPL process?
11:28JohnTalentmgaare: noted.
11:28JaoodJohnTalent: that's very little I would say, you should give it more time, especially since you don't have any lisp background
11:29timothywstuartsierra: yes. in fact it’s `lein midje :autotest` which reports this
11:29JohnTalentJaood: 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:29timothywand I’m trying to reprodcuce it from a repl
11:29JaoodJohnTalent: you said before you only experience was JS/Python
11:29JohnTalentThe little schemer.
11:30JohnTalentJaood: nope. now your just guessing at *my* source. :)
11:31stuartsierratimothyw: 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:32timothywstuartsierra: hrmm, you’re probably right. But my workflow slows down with without a running :autotest.
11:32timothywOk, I’ll try another angle
11:37TimMctimothyw: I wrote nephila to help me visualize Clojure projects. You could modify it to include the tests dir.
11:37TimMchttps://github.com/timmc/nephila
11:38TimMc(ooh, I really need to get that licensed)
11:38timothywTimMc: looks like it requires graphviz. I develop on a headless console. Can I use it there?
11:41pcntimothyw: if it outputs dot, you can view it elsewhere
11:41timothywpcn: okie dokes.
11:42pcnSo it outputs png, but same difference.
11:42pcnYou can view that elsewhere.
11:43pcnIf 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:43pcnSo it's a bust
11:46timothywyeah, I’ll give it a shot - the cyclic load error is somewhere in the included libs
11:48pcnI didn't get any groans for that? OK, back to work.
11:52pcnNo, just someone who needs perspective and maybe some space to relax.
11:58TimMctimothyw: Yeah, headless *should* be fine (morally speaking) -- nephila won't actually try to display the graph.
11:58timothywTimMc: makes sense
11:59TimMctimothyw: Oh, but nephila can't descend into dependencies, it's very stupid about how it analyzes code.
12:09timothywTimMc: 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:10mikerod,(keys (seq {:a 2}))
12:10clojurebot(:a)
12:10mikerod,(get (seq {:a 2}) :a)
12:10clojurebotnil
12:10mikerodI find this odd.
12:10edw,(seq {:a 2})
12:10clojurebot([:a 2])
12:10mikerod`keys` and `vals` work at the "seq" level
12:10mikerodbut they hide that the actual structure may not even be associative
12:10timothywI tried just using midje / lein-midje (with :autotest) on an empty project, and am still getting cyclic dependency errors
12:11timothywremoved .m2 , .lein/profiles and everything - no dice
12:11edw,(supers (first (seq {:a 2})))
12:11clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to java.lang.Class>
12:11timothywso I think this is a bug with Midje
12:11TimMcWhat version lein-midje?
12:11mikerodI see that `keys` and `vals` just expect a coll of MapEntry
12:11edw,(supers (class (first (seq {:a 2}))))
12:11clojurebot#{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:11mikerodI 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:12edw,(class (seq {:a 2}))
12:12clojurebotclojure.lang.PersistentArrayMap$Seq
12:12timothywTimMc: latest of each. [midje "1.6.3"] [lein-midje "3.1.1"]
12:12mikerode.g. (let [supposed-to-be-map (filter <something> actually-a-map)] (keys supposed-to-be-map))
12:13mikerodeverything is fine here
12:13clgv{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:13clgv{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:19clgv{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{blake}I suppose I could punt and use the combinatorics lib.
12:21arohnerpuredanger: data.xml-0.0.7's pom has <repository><id>sonatype-oss-snapshots....
12:22puredangerarohner: it has that to push snapshots (as it should). not sure why that should affect you though as a user?
12:23arohnerI'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:24arohnerI see the bug if I have both :plugins [lein-npm], :dependencies [data-xml]
12:24arohnerbug goes away if either is missing
12:24arohnercc technomancy: ^^
12:25arohnerpuredanger: shouldn't that be a deployRepo or something?
12:25technomancyarohner: 2.4.3 has :implicits false that should help debugging by turning off implicit middleware and implicit hooks
12:25technomancywhich are super easy to screw up
12:27arohnertechnomancy: bug is fixed by ':implicits false', but I don't know which middleware/hook is doing it. Does that disable all plugin hooks?
12:27technomancyarohner: 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:27technomancybut no such thing exists
12:28arohnertechnomancy: 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:28kristof{blake}: What exactly is coll? A collection of collections?
12:29technomancyimplicit hooks =(
12:29technomancyI have made some mistakes in my life and this is one of them
12:29arohnerAFAICT, 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:30arohnertechnomancy: what is an implicit hook, as opposed to say, normal plugin operation?
12:30{blake}kristof, yeah.
12:30arohnerI 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:31technomancyarohner: plugins are allowed to include a magic namespace that gets loaded whenever the plugin is added
12:31arohnertechnomancy: so it looks like data.xml's repo entry is getting added to my project
12:31kristof{blake}: You want a simple reduction over that collection.
12:31puredangerarohner: 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:31kristof{blake}: Start with a binary function that takes two collections and returns the set of all permutations between them.
12:31technomancyyou can do basically anything in here--including break all the rules of how stuff is supposed to work
12:32arohnertechnomancy: I don't think implicits is the bug here
12:32{blake}kristof, I'll give that a shot.
12:32puredangerarohner: so I will remove it from data.xml but there could separately be something else wrong
12:32arohnerI think it's something to do with how repos get added to the project
12:32{blake}kristof, Thanks!
12:32kristof{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:32justin_smithclgv: now uses a seed, and accepts multiple input files (ships with the Gettysburg Address and Little Red Riding Hood)
12:32arohnertechnomancy: 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:33justin_smithhttps://github.com/noisesmith/markov-toy
12:33clojurebotI don't understand.
12:33arohnertechnomancy: AFAICT, that repository entry is picked up by aether, and being used to resolve the rest of the project's deps
12:33kristof{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:33kristof{blake}: transducers are silly. *ducks*
12:34technomancyarohner: you said :implicits false fixes it?
12:34arohnertechnomancy: 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:35arohnertechnomancy: lein-npm is https://github.com/bodil/lein-npm/blob/master/src/leiningen/npm/deps.clj
12:35clgvjustin_smith: :D
12:35kristof{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:35arohnerpuredanger: the data.xml tests fail for me locally
12:36puredangermvn test passes for me and on the build box
12:36puredangerI 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:37clgvjustin_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:37clgvjustin_smith: that's a huge shortcut ;)
12:38arohnerpuredanger: ah, running 0.0.7's tests fail for me. master passes
12:38justin_smithclgv: did it give you that?
12:39clgvjustin_smith: yeah. lein run 0 10 resources/little-red.txt
12:39arohnertechnomancy: I gotta run, I'll be back in an hour or so
12:39arrdemclgv: http://hydra-media.cursecdn.com/dota2.gamepedia.com/8/80/Axe_kill_12.mp3
12:40justin_smithclgv: weird, that same seed gives me a different result... are seeds not portable between jvms?
12:40puredangerarohner: 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:40clgvjustin_smith: they are if you just stuff it into a prng
12:40clgvthe same prng class ;)
12:41justin_smithclgv: hmm - I'm not doing anything fancy, I just create random with a seed arg and then use it
12:41clgvjustin_smith: yeah just checked that. btw: I only copied the first line. there was more
12:42justin_smithahh!
12:43justin_smithyes, that was my first line too, success
12:47justin_smithclgv: thanks for the input and encouragement
12:49clgvjustin_smith: you are welcome
13:45tickingdo the neutral values of reducef and combinef with reducers/fold have to be the same?
13:47tickingit seems that the neutral value of the combine phase will be used as a seed to the reduces as well, which seems confusing
13:56puredangerdo you mean the identity value?
13:57puredangerI would not expect them to need to be the same
14:15amalloyticking: 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:17tickingamalloy: this separation doesn't appear to be strict though right? a neutral combine element might be passed into a reduce step
14:18amalloy{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:19amalloyticking: 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:20tickingamalloy: well, I'd expect the reduce function to only receive neutral reduce elements
14:21tickinge.g the reduce gets maps and fills them in some way while the combine step just accumulates them into a vector
14:21amalloybut if combine accumulates into a vector, then reduce can't get maps! it only gets the things that come out of combine
14:22amalloyreduce 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:24tickinga 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:24tickingust produce its identity element - this will be called multiple times. Operations may be performed in parallel. Results will preserve order."
14:24tickingthis reads to me the exact other way around :\
14:24amalloyman, i always forget what the two steps are called
14:25ticking:D
14:26tickingbut according to the docs I'd expect fold to be able to build two kinds of collections
14:27tickingone 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:32amalloyticking: so, that docstring does not seem to reflect the actual behavior in clojure/core/reducers.clj, which never calls reducef with no arguments
14:33llasramIndeed
14:34llasramActually, where did that doc string come from?
14:34llasramMy version says "each of which is reduced with reducef (with a seed value obtained by calling (combinef) with no arguments)"
14:34tickingllasram: http://clojure.org/reducers
14:35llasramWeeeird. It's totally different from the clojure.core.reducers/fold docstring, which additionally has not changed over its git history
14:36llasramWET
14:36amalloyllasram: 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:38tickingmaannn, thats to bad, I'd really prefer the version documented online ;)
14:39gill_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:39amalloylogarithmically long is pretty good for anything, having not read that gist
14:39gill_hah ok
14:39amalloyi 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:41arohnerpuredanger: data.xml 0.0.8 fixes the bug, thanks
14:43amalloygill_: 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:45gill_that's mine, good criticism :)
14:46gill_I am using grid->graph to build a relationship graph in loom
14:46llasramticking: What's a situation where you'd make use of the separate reducer/combiner identity elements?
14:46gill_where a cell's surrounding neighbors become relationships
14:47gill_a 30x30 grid takes like 600msec, but a 60x60 takes 6sec
14:47gill_maybe I should just approach it differently
14:49amalloyso 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:50gill_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:50aperiodicalso, gen-grid has pretty weird semantics
14:51aperiodic(gen-grid 2 2) makes a 3x3 grid
14:51amalloyaperiodic: no it doesn't?
14:51amalloy(range 2) is '(0 1), not '(0 1 2)
14:51aperiodicoh, i misread that literal
14:51aperiodicnevermind
14:52gill_yea, i agree gen-grid is just there for shorthand, not a really useful function
14:52amalloyi don't understand why that test graph doesn't have edges out from [1 0]
14:53gill_no diagonal neighbors
14:53gill_I'm neighboring the actual edges for each cell
14:53gill_so 0,0 has 1,0 and 0,1
14:54gill_is that what you mean? amalloy
14:54amalloyso? shouldn't [1 0] still be adjacent to [0 0] and [1 1], just like [0 1] is?
14:55amalloymaybe i just have no idea what your grid->graph is doing
14:55gill_that's a good point
14:55tickingllasram: 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:55gill_I should dig in to the graph section in loom, maybe it infers neighbors
14:56aperiodicgill_: 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:56tickingllasram: it might be better to do this in a pmap though.
14:56aperiodicassuming of course that g really is a grid
14:57llasramticking: Well, or change the structure of your data. When flat, the `reduce` portion runs over essentially arbitrary chunks of the input collection
14:57gill_hmm
14:57amalloyyeah, 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:58llasramticking: 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:58amalloy{blake}: urgh. why so eager?
15:00{blake}amalloy, Beg pardon?
15:00{blake}amalloy, You mean, why not do it lazily?
15:00gill_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:00amalloyhm. 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:01aperiodicgill_: that doesn't mean you have to repeatedly filter g in order to produce the map for the loom/graph call later
15:02aperiodicgill_: think of what the cost of filter is and how many times you call it in grid->graph
15:02tickingllasram: 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:02aperiodicgill_: the runtime of this function certainly ain't logarithmic; it's the inverse of logarithmic
15:02aperiodicer, no, not quite
15:02amalloyaperiodic: well, it's not exponential. just quadratic
15:02aperiodicthe n is in the wrong place
15:02gill_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:04llasramticking: Interesting. But sounds like more of a data structure problem for your algorithm than anything else
15:04llasramThe 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:04amalloy{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:05tickingllasram: yeah, I agree, its a misuse of the fold paradigm, that would have worked when it was implemented as on clojure.org
15:07amalloy{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:07amalloyideally, you'd produce [0 0 0], then stop, and produce [0 0 1] only if asked...
15:08amalloyand your implementation actually does do that
15:10llasramticking: 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:12tickingllasram: good idea ^^
15:15ToxicFrogHmm. This is irritating.
15:15ToxicFrog(update-in) calls the updater as (f val & args)
15:15ToxicFrogWhich means I can't do (update-in ... fmap f), because fmap expects (fmap f coll)
15:17amalloyToxicFrog: i mean, they had to pick *some* argument order, and the existing one is convenient in a lot more places
15:20ToxicFrogamalloy: yeah, I'm not saying it's wrong, just that they don't fit together conveniently.
15:23justin_smithllasram: the codomain of the reduce must be the domain of the combine
15:31llasramjustin_smith: Sure.
15:31llasramjustin_smith: Someone else has been brushing up on their math :-)
15:32justin_smiththe problem I guess is the combining should be transative (you want the same result regardless of the size you break things into)
15:33justin_smithbut I think there must be some valid combining step that is transative but does not have identical domain and codomain
15:33llasramWhat does it mean for a function to be transitive?
15:33justin_smithf(a,b) = f(b,a)
15:34justin_smithor in this case I may be generalizing from transative to something a bit different
15:34justin_smithf([a, b], [c,d]) = f([a, b, c], [d])
15:35llasramOh, ok -- I think that's usually called commutative, and the latter I think (for these purposes) is associative
15:35pyrtsajustin_smith: f(a,b) = f(b,a) is called symmetric.
15:35justin_smithoh, sorry
15:35llasramSO MANY NAMES
15:35justin_smithok
15:36justin_smithok, I dunno where I pulled transative from, it is clearly not the right term here
15:36pyrtsaTransitivity is generally used (alongside with reflexivity and symmetry) in the definition of equivalence.
15:37pyrtsaAssociativity and commutativity might be more interesting for functions in general.
15:37pyrtsaI mean, for binary functions.
15:37justin_smithpyrtsa: equivalence and ordering
15:37pyrtsaTrue.
15:38llasramBut the fold `combine` function I think doesn't actually *need* to be commutative. The semantics guarantee you get the left-folding behavior
15:38llasramNot sure how often that's actually useful
15:38justin_smithhmm
15:38llasramOh, actually -- order in a vector e.g.
15:38llasramduuur
15:39justin_smithI 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:41llasramf(f(a, b), c) = f(a, f(b, c)) is associative
15:42llasramwhich coincidentally is what the docstring for `fold` says :-)
15:44akhudekanybody 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:45akhudeke.g. keys get associated with the wrong values
15:45TEttingerRaynes 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:45TEttingerit used to work every time
15:45TEttingersomething must have changed in youtube now that they default to https
15:48akhudekping dnolen_
15:48amalloyTEttinger: so, what is your question? it sounds like you answered "why doesn't it work" already
15:48dnolen_akhudek: what's up?
15:48TEttingeramalloy, yeah, is there a way to get title to handle redirects?
15:48akhudekdnolen_: having an issue with transit scrambling map data
15:49akhudekdnolen_: communicting from clj to cljs
15:49TEttingerI think that's the issue, but what's weird is that it's intermittent
15:49amalloybeats me. have a look through the plugin source and see. it probably just calls slurp
15:49akhudekjust putting an example in gist
15:49dnolen_akhudek: ok, transit-clj -> transit-cljs
15:49akhudekhttps://gist.githubusercontent.com/akhudek/0ad26dcdf00e287c64b1/raw/7ad9783674b919746f0fb8cf2723457a06bf9ef0/gistfile1.txt
15:49michaelrany prismatic graph users? is there a good way to update a key in the graph map, from inside a defnk?
15:49TEttingerlike https://www.youtube.com/watch?v=zX4-eMbpiHA consistently fails to get a title, but never gives errors or anything
15:49TEttingerit always works with...
15:50TEttinger$title https://www.youtube.com/watch?v=zX4-eMbpiHA
15:50lazybot"Gibbon swinging through the trees very fast. - YouTube"
15:50akhudekdnolen_: 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:50TEttingerI 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:51TEttingerlet me get the exact regex
15:52dnolen_akhudek: you need to be more clear I just see gibberish at this point
15:52TEttinger2,(re-seq #"(https?://|www\.)[^\]\[(){}\"'$^\s]+" "https://www.youtube.com/watch?v=zX4-eMbpiHA&quot;)
15:52clojurebot(["https://www.youtube.com/watch?v=zX4-eMbpiHA&quot; "https://&quot;])
15:53akhudekdnolen_: does this help? https://gist.github.com/akhudek/28c8d395e5fcca995256
15:54puredangerTEttinger: if you're getting varying behavior, then I would suspect something caching related? btw there is a #transit-format room
15:54puredangernot that anyone is there
15:54michaelrnevermind, ignore my question..
15:55puredangersorry TEttinger , that should have been to akhudek and dnolen_ ! :)
15:56TEttinger2puredanger, 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:56TEttinger2but $title works
15:57dnolen_puredanger: thanks forgot about that
15:58TEttinger2https://gist.github.com/anonymous/e0198ca2826a321dfb88 code is here
15:58akhudekTEttinger2: 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:59TEttinger2hm what?
15:59TEttinger2was that meant for puredanger, akhudek?
16:00akhudekoh yes
16:00akhudek:-(
16:00dnolen_akhudek: still hard for me to see the problem.
16:00dnolen_akhudek: please put something together that's formatted to make it easier to read
16:00akhudekdnolen_: ok, will do
16:11akhudekdnolen_: formatted and hilighted https://gist.github.com/akhudek/0ad26dcdf00e287c64b1
16:12dnolen_akhudek: thanks looking into it
16:14TEttinger2what's especially weird is there's nothing printed in a fn that should print on every message
16:23ToxicFrogTwo questions:
16:23ToxicFrogwait, no, one question
16:23ToxicFrogI have a map. I want to find the value in the map (there is at most one) for which (p v) is true.
16:24ToxicFrog(some p (vals map)) tells me if it exists, but not what it is.
16:24ToxicFrogWhat function am I looking for?
16:24technomancy(comp first filter)
16:25ToxicFrogThank you.
16:26ToxicFrogWasn't sure if there was a canned function for it or not.
16:28timsgAnyone know of a function that’s like print but prints top-level strings with quotes?
16:28justin_smithprn
16:28timsgjustin_smith: thanks!
16:29justin_smiththere is also pr-str
16:29justin_smith,(print (pr-str "hello"))
16:29clojurebot"hello"
16:29TEttinger2timsg, pr is like print, prn is like println
16:29justin_smithTEttinger2: good point, thanks
16:30timsg,(print (pr-str [“hello”]))
16:30clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “hello” in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:30timsgI assume that’s a colloquy thing
16:30TEttinger2especially useful for spitting out clojure data structures to files so they can be read back later
16:30justin_smithsmartquotes
16:30timsgya
16:30TEttinger2,(print (pr-str ["hello"]))
16:30clojurebot["hello"]
16:33dnolen_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:33akhudekdnolen_: ok, thanks!
16:38sdegutisHi. 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:39arohnersdegutis: visualvm is a good starting point
16:39sdegutisThanks.
16:40arohnercomes with the JDK
16:40arohnerit's not a normal profiler, but it has some performance monitoring tools
16:43schmeehey 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:44schmeeI'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:45hiredman,(doc tree-seq)
16:45clojurebot"([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:50amalloy{blake}: try it and see. you're actually doing something pretty subtle, as i said, and preserving laziness
16:50amalloy,(defn cart [colls] (reduce #(for [x %1 y %2] (cons y x)) '([]) colls))
16:50clojurebot#'sandbox/cart
16:50amalloy,(first (cart (repeat 10 (range 1000))))
16:50clojurebot(0 0 0 0 0 ...)
16:50amalloyreturns 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{blake}amalloy, I did "(apply cart (take 10 (repeat [1 2 3])))".
16:56amalloywell, 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:05TEttingerhm, 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:05TEttingerbut there was a time gap between when I tried it and when I tried it with " ?"
17:21andrei_does the order in which you write functions inside a source file matter?
17:32dnolen_akhudek: deploying fix try transit-cljs 0.8.178
17:48bitemyapptechnomancy: no rule against Haskell proselytization?
17:49bitemyapptsk tsk.
17:49Bronsa:|
17:49aaelonyI'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:50aaelonycurious how that works...
17:51amalloyaaelony: #_ comments out the next form
17:52aaelonyamalloy: thanks, never seen that before
17:52aaelonyis there a good way to google for #_ to learn more?
17:53aaelonynevermind, #_ seems to google just fine :)
17:53swedishfishaaelony: http://clojure.org/reader
17:54swedishfishsearch on dispatch
17:54aaelonyswedishfish: thanks, saw that..
17:55TEttinger,(if false "won't execute" #_"not going to be the REAL else" "the real else")
17:55clojurebot"the real else"
17:55TEttingercontrast with
17:55TEttinger,(if false "won't execute" (comment "not going to be the REAL else") "the real else")
17:55clojurebot#<CompilerException java.lang.RuntimeException: Too many arguments to if, compiling:(NO_SOURCE_PATH:0:0)>
18:04hugodmmm, 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:06amalloythat's a pretty wild error, hugod. i'd be interested to hear what it turns out to be
18:06hugodgot me baffled at the moment - haven't been able to repro in a simple project either
18:08martinklepschAnyone an idea how to write nth-child selectors with garden? https://github.com/noprompt/garden
18:09martinklepsch:&:nth-child(2n) is what I'd think but thats not a valid symbol
18:10swedishfishmartinklepsch: I think you want nth-x
18:11swedishfishmartinklepsch: https://github.com/noprompt/garden/blob/master/src/cljx/garden/selectors.cljx#L604
18:12swedishfishmartinklepsch: i could be wrong. there is an nth-child function as well
18:12swedishfishhmm
18:13swedishfishmartinklepsch: you may need to do nth-child(2). The nth-child function seems to add the "n" if you pass in a number
18:16martinklepschswedishfish: ok thanks, thats helpful already! will try using the stuff in there
18:18amalloymartinklepsch: so does github's search
18:31arohneranyone here in Austin, and going to the meeting tonight?
18:32Raynesarohner: Nobody.,
18:32RaynesNot one single person will be there.
18:33mdrogalisRaynes: Austin has been vacacted.
18:33Raynes^
18:33mdrogalisVacated, maybe.
18:33mdrogalisEmacs's lack of spellcheck makes me sound like an idiot in IRC.
18:34TEttingerEmacs... makes me... an idiot...
18:34technomancy(require 'erc-spelling) (add-to-list 'erc-modules 'spelling)
18:34mdrogalistechnomancy: :P
18:35arohnermdrogalis: it is raining in August, so people are a little freaked out
18:36mdrogalisarohner: Head for the hills. D:
18:38aaelonysorry 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:38lazybotaaelony: Definitely not.
18:39aaelonylazybot may be right...
18:40technomancyaaelony: usually you get pretty solid HW support with thinkpads
18:40technomancybut it really depends what you want; if you're optimizing for screen brightness or weight or not having a terrible keyboard.
18:41aaelonytechnomancy: thanks for that, I'll take a look. Curious about the mouse/trackpad experience...
18:41aaelonymostly optimizing for not having a terrible keyword
18:41aaelonykeyboard
18:41aaelonylol
18:41technomancyaaelony: in that case it's pretty much just thinkpads
18:41arrubinJust be sure that you do not get anything with duel GPUs.
18:41arrubindual
18:42aaelonyarrubin: why not?
18:42arrubinaaelony: Because Linux's support for such things is garbage.
18:42aaelonyarrubin: that's a shame
18:42arrubinI 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:43curveballGoogle Pixel is danm good hardware
18:43arrubinIntel integrated GPUs are great as long as you do not play games these days.
18:43curveballvery mac like, and not hard to put linux on it
18:43arrubinAnd are even fine for most older games.
18:43curveballthat said, linux on a macbook is ridiculously easy imho
18:44aaelonycurveball: no driver problems on a macbook?
18:45curveballI dont game, but I’ve dualbooted ubuntu / mac osx on 2012 macbook with zero issues. Community for booting linux is pretty solid
18:46aaelonycurveball: I don't game either. I mostly prefer Mint to OS X and will likely stick with that. thanks for the comments
18:50technomancyinc on intel video
19:06technomancyis the Pixel screen glossy?
19:07joshhartiganhow can I just run a single .clj without having to create a whole lein project?
19:08technomancyjoshhartigan: lein run -m clojure.main myfile.clj
19:08technomancyerr
19:08joshhartiganthank you
19:08technomancylein run -m clojure.main/main myfile.clj # maybe?
19:19ben_vulpesdoes anyone know anything about importing a datomic db backup to an in-memory db?
19:23technomancyah, it's glossy. yeah so much for that.
19:23technomancynot like I need more Google products in my life anyway
19:24danielcomptonDo 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:25technomancydanielcompton: checkout source takes precedence
19:25technomancycheckout project.clj files are ignored
19:26Jaoodtechnomancy: where you planning to put linux on the chromebook or use chromeos?
19:26technomancyJaood: idly considering it for debian
19:27technomancyI liked the 400-nit screen of the samsung I used to have, but that was matte
19:27justin_smiththere'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:27justin_smithfor one of those $200 models
19:27Jaoodtechnomancy: did it sleep/resume well linux?
19:28technomancyJaood: perfectly, yeah
19:28technomancyI think the only thing that didn't work out of the box was the keyboard backlight; didn't bother with that.
19:28technomancyit was a really nice machine except for the horrible keyboard
19:28justin_smiththere is also system76 - they ship with linux installed and guaranteed full hardware support. they have netbooks too.
19:28technomancyand ironically now I don't use my laptop's internal keyboard anyway =\=
19:29technomancyhttp://technomancy.us/160
19:29danielcomptontechnomancy: thanks, thought so but just wanted to check
19:31danielcomptonjoshhartigan: https://github.com/kumarshantanu/lein-exec might also be helpful
19:33technomancynot really sure what lein-exec buys you for this
19:35Jaoodhttp://www.dell.com/us/business/p/xps-13-linux/pd - I guess that one also has a glossy screen
19:35technomancyyeah, this would just be something I could use if my thinkpad died before my novena arrives anyway
19:36technomancyprobably better just to grab something from craigslist for that
19:37technomancyhttps://www.crowdsupply.com/kosagi/novena-open-laptop
19:38aaelonysorry 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:38scottjaaelony: javamail?
19:39technomancyaaelony: unless they are guaranteed to have regular structure, it's not as simple as it sounds
19:39aaelonyyeah, I don't think it's simple
19:39aaelonybut I just want to count them, group them and count them, filter them, etc...
19:39technomancythere is no canonical way to determine in a mime multipart content message what part is the body vs attachments
19:40scottjhttps://java.net/projects/javamail/pages/MboxStore
19:40technomancybut javamail is probably the place to start
19:40aaelonycool, I'll check out javamail. many thanks
19:41aaelonyscottj and technomancy: perfect, thanks
19:42justin_smithalso, 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:43aaelonyjustin_smith: it's not mission criticial, just thought it would be interesting to use clojure to analyze what's in there.
19:44hiredmanhttp://www.youtube.com/watch?v=4s9IjkMAmn
19:45hiredmanerm
19:45hiredmanhttp://www.youtube.com/watch?v=4s9IjkMAmns
19:45Jaoodtechnomancy: impressive, they did really well raising money
19:46aaelonyhiredman: nice
19:46technomancyJaood: I'm excited. bit of a wait though
19:50akhudekdnolen_: seems to work now, thanks again!
19:50dnolen_akhudek: no problem, thanks for the report
19:52dnolen_akhudek: we don't actually have good test for cmaps so it was good that you found this bad case.
19:54akhudekdnolen_: 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:55dnolen_akhudek: I'm glad we built it too - it's really night and day compared to EDN perf.
20:03ebzzryHi! 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:04technomancyoh man... flashbacks to slime.
20:05ebzzrytechnomancy: ya. similar, especially when the compiled version of slime do not match.
20:06ebzzrygot it.
20:06ebzzryI reinstalled nrepl. ;-)
20:23mdeboardebzzry: 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:23mdeboardsurprising etc.
20:23mdeboardebzzry: was having this same issue the other day, or some flava of it
20:28CapitalSigmahey all
20:28gfrederickshi
20:28mdeboardohio
20:29CapitalSigmaas 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:29mdeboardprogramming clojure
20:29mdeboardno wait, Clojure Programming
20:29justin_smith~books
20:29mdeboardhttp://shop.oreilly.com/product/0636920013754.do
20:29clojurebotbooks is programming clojure
20:30gfredericksProjure Clogramming
20:30CapitalSigmathanks
20:30justin_smith~books
20:30clojurebotbooks is http://www.pragprog.com/titles/shcloj/programming-clojure
20:30justin_smithI thought there was more than that for books
20:31technomancyclojurebot 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:33gfredericksyou mean it doesn't have transducers
20:33{blake}heheh
20:33CapitalSigmamostly i want to try to understand when i should look at a problem and think "macro"
20:33kristofI thought Joy of Clojure was more lisp-zealous.
20:33{blake}Hardly everrrrrr!
20:34CapitalSigma{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:35mdeboardI am pretty sure I have bought every clojure book, or close to it. cemerick's is the best, for me
20:35mdeboardWeb programming wwith Clojure is p good too
20:35mdeboardfor the "web space" concepts
20:35kristofCapitalSigma: There is no structured set of design principles related to functional programming or macros.
20:36kristofCapitalSigma: 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:36CapitalSigmai did "the clojure koans" a while back, and they were handy
20:36kristofCapitalSigma: 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:38CapitalSigmakristof: i'm unclear how they're more powerful in that respect than a regular function
20:38mdeboardarrdem: 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{blake}CapitalSigma, Well, at least theoretically, that's pretty simple: You can use the power of the language to construct itself.
20:39CapitalSigma{blake}: i understand at a high level that they're "functions acting on the AST"
20:40kristofCapitalSigma: 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:40mdeboardI'm watching arrdem give a talk, weird
20:41kristofCapitalSigma: 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:41kristofCapitalSigma: No function will let you do that.
20:42kristofCapitalSigma: 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:43CapitalSigma{blake}: what do you mean by "do math the traditional way"?
20:43kristofNot prefix notation
20:43CapitalSigmaah
20:43{blake}Well, that's what kristof's example is. Infix with orders of precedence.
20:44CapitalSigmawell, SML does let you define infix operators with your own precedence
20:44kristofNot the point.
20:44CapitalSigmabut 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:44CapitalSigmathat macros give you the power to do by yourself
20:48codygmanHi, why isn't this giving me an unmodified dict?
20:48codygman> (map (fn [[k v]] [(keyword k) v]) (partition 2 {:a 1 :b 2}))
20:50SegFaultAX,(seq {:a 1 :b 2})
20:50clojurebot([:b 2] [:a 1])
20:51SegFaultAXcodygman: 2 problems. 1 is demonstrated above. 2 is `map` doesn't return a dict.
20:51SegFaultAX,(partition 2 {:a 1 :b 2})
20:51clojurebot(([:b 2] [:a 1]))
20:52SegFaultAXcodygman: What are you trying to do?
20:54codygmanSegFaultAX: Understand the into function used in an example here: http://clojure-doc.org/articles/tutorials/emacs.html
20:55SegFaultAXcodygman: There is a fundamental difference in inputs with the code you pasted and the code they're showing.
20:56SegFaultAXcodygman: Namely, `args` in the case of the linked code is a list.
20:56SegFaultAXLook closely:
20:56SegFaultAX,(seq {:a 1 :b 2 :c 3})
20:56clojurebot([:c 3] [:b 2] [:a 1])
20:56SegFaultAX(partition 2 [:a 1 :b 2 :c 3])
20:57SegFaultAX,(partition 2 [:a 1 :b 2 :c 3])
20:57clojurebot((:a 1) (:b 2) (:c 3))
20:57codygmanSegFaultAX: Thanks. I didn't notice that.
20:57technomancyunguessable precedence rules are hands-down my least-favourite thing about ML syntax
20:57SegFaultAXNote that what I passed to seq was a map and what I passed to partition is a vector.
20:58codygmanI do see that now ;)
20:58SegFaultAXcodygman: Implementing into is super trivial, but it helps to get an intuition for how it works.
20:59SegFaultAX,(reduce conj {} (partition 2 [:a 1 :b 2 :c 3]))
20:59clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
20:59SegFaultAX,(reduce conj {} (map vector (partition 2 [:a 1 :b 2 :c 3])))
20:59clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Vector arg to map conj must be a pair>
20:59SegFaultAXUgh.
20:59SegFaultAX,(reduce conj {} (map vec (partition 2 [:a 1 :b 2 :c 3])))
20:59clojurebot{:c 3, :b 2, :a 1}
21:00SegFaultAXForever getting vec and vector mixed up.
21:00SegFaultAXI need to invent a mnemonic for myself.
21:02amalloySegFaultAX: also s/reduce conj/into/ for your entire codebase
21:02SegFaultAXamalloy: ? I was specifically demonstrating how into works.
21:03amalloyi see. this was not clear from the context
21:03SegFaultAX"Implementing into is super trivial, but it helps to get an intuition for how it works."
21:04amalloytechnomancy: 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:04mdeboardIs there a way to see what options are available when creating a project from a template?
21:05SegFaultAXamalloy: A wild fixity appears...
21:07SegFaultAXmdeboard: Hope that it's documented?
21:07mdeboardgood point, i don't even know where to find documentation for e.g. compojure template
21:08SegFaultAXhttps://github.com/weavejester/compojure-template presumably
21:08mdeboardoh. well fine
21:08mdeboard:)
21:10mdeboardthanks, i guess the term i was looking for was "profile hints"
21:10mdeboardcompojure template doesn't have i guess
21:18technomancyamalloy_: "just spam it with parens till it compiles" <- my strategy
21:39Jabberzquestion 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:44mthvedtjabberz: not sure what you’re asking. anything in a loaded namespace generally won’t get GCed
21:45mthvedtanything interned in
21:47JabberzI 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:49mthvedtjabberz: GC is automatic. the only way to cause a memory leak is if a thread holds references it shouldn’t be holding.
22:17arrdemmdeboard: what's up?
22:28arrdemmdeboard: still happy to answer questions, thanks for sitting through any/all of my talk
22:47tehgeekmeisteris there a way to run a clojure file as a script? without a project.clj and all that jazz?
22:48DomKMtehgeekmeister: https://github.com/kumarshantanu/lein-exec
22:49technomancytehgeekmeister: lein run -m clojure.main/main file.clj
22:52tehgeekmeister@DomKM @technomancy thanks!
23:01tehgeekmeisteralso, is there a thing like line-seq but that returns a character at a time?
23:02technomancy(mapcat seq (line-seq ...))
23:06mdeboardarrdem: 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:06arrdemmdeboard: ohai
23:07mdeboardthe bit about*
23:07arrdemthanks for showing up! hope it wasn't too terrible despite tecnical difficulties
23:07mdeboardgood talk btw, the technical difficulties weren't that bad at all
23:08arrdemcoulda been a lot worse considering that I rebuilt my slides in the two hours leading up..
23:08arrdemnot as polished as I would have liked tho
23:08mdeboardit'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:10tehgeekmeister@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:11tehgeekmeisterI 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:11tehgeekmeisterrather than doing all that extra allocation
23:12tehgeekmeisteroh! i could use a reduce. =D
23:24arrdemmdeboard: thanks! that's good to here. I was more or less convinced that I totally lost everyone :P
23:25arrdemmod the two guys who were interested in static clojure variants already