#clojure logs

2014-10-01

00:37joshuafcoleAre there any good tools for hunting down memory leaks in clojure? I'm interfacing with libgdx via play-clj
00:38joshuafcoleI'm ~80% certain that the problem is I'm spinning up a shape renderer each frame (part of an experimental mess). A refactor is planned, but I want to learn how to find the problem when it's less obvious
00:39joshuafcoleinterestingly, trying to call dispose on the shape renderer when I'm done with it throws an exception, hence the other 20%
00:42amalloyjoshuafcole: i've gotta go, but see: jmap for heap dumps (comes with the jdk), or yourkit for profiling
00:42joshuafcoleSure, I'll take a look. Thanks!
00:49vIkSiThello all
00:50danielcomptonjoshuafcole: jvisualvm (also with jdk) might be helpful for profiling
00:50vIkSiTif I have a collection c [1 2 3 4 5] - and I want to transform it such that only every alternate element is transformed
00:50vIkSiThow would I do it?
00:50joshuafcolefirst way that comes to my (novice) mind is
00:50danielcomptonvIkSiT: partition by 2, then operate on the first element only?
00:51vIkSiTeg, I want to add 1 to every alternate number
00:51vIkSiTdanielcompton, hmm - thats a good option. would it work for a stream?
00:51danielcomptonvIkSiT: it works on sequences, is that what you mean?
00:52vIkSiTdanielcompton, ah. true
01:01vIkSiThmm
01:01vIkSiTI guess that doesn't work
01:01vIkSiTwhat I really want is the following:
01:02vIkSiT(def a [1 2 3 4 5])
01:02vIkSiT(transform a)
01:02vIkSiT=> [1 "2" 3 "4" 5]
01:02vIkSiTassuming the function I'm applying is str
01:02vIkSiT(transform a str)
01:09sm0ke,(map-indexed (fn [x y] (if (odd? x) (str y) y)) [1 2 3 4])
01:09clojurebot(1 "2" 3 "4")
01:09sm0ke,(map-indexed (fn [x y] (if (odd? x) (str y) y)) [1 2 3 4 5])
01:09clojurebot(1 "2" 3 "4" 5)
01:10sm0ke,(defn transform [f c] #(map-indexed (fn [x y] (if (odd? x) (f y) y)) c))
01:10clojurebot#'sandbox/transform
01:11sm0ke,(transform str [1 2 3 4 5])
01:11clojurebot#<sandbox$transform$fn__77 sandbox$transform$fn__77@1fb8a15>
01:11sm0kelolwut
01:11sm0keugh
01:11TEttingeryou have transform defined as returning a fn
01:11sm0ke,(defn transform [f c] (map-indexed (fn [x y] (if (odd? x) (f y) y)) c))
01:11clojurebot#'sandbox/transform
01:11sm0ke,(transform str [1 2 3 4 5])
01:11clojurebot(1 "2" 3 "4" 5)
01:12TEttingermap-indexed is a weird one.
01:12sm0keyep
01:12bbloomno
01:12bbloom(doc map-indexed)
01:12clojurebot"([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
01:13TEttinger,(defn transform' [f &colls] (map (fn [idx &args] (if (odd? idx) (f args) args)) (range) colls))
01:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: args in this context, compiling:(NO_SOURCE_PATH:0:0)>
01:13TEttinger,(defn transform' [f &colls] (map (fn [idx & args] (if (odd? idx) (f args) args)) (range) colls))
01:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: colls in this context, compiling:(NO_SOURCE_PATH:0:0)>
01:13TEttinger,(defn transform' [f & colls] (map (fn [idx & args] (if (odd? idx) (f args) args)) (range) colls))
01:13clojurebot#'sandbox/transform'
01:14TEttinger,(transform' + [1 2 3] [10 20 30])
01:14clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.ArraySeq to java.lang.Number>
01:14TEttingeroh
01:14TEttinger,(defn transform' [f & colls] (map (fn [idx & args] (if (odd? idx) (apply f args) args)) (range) colls))
01:14clojurebot#'sandbox/transform'
01:14TEttinger,(transform' + [1 2 3] [10 20 30])
01:14clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentVector to java.lang.Number>
01:14TEttingergah
01:15sm0kehumm you may want to zip them
01:15TEttinger,(defn transform' [f & colls] (apply map (fn [idx & args] (if (odd? idx) (apply f args) args)) (range) colls))
01:15clojurebot#'sandbox/transform'
01:15TEttinger,(transform' + [1 2 3] [10 20 30])
01:15clojurebot((1 10) 22 (3 30))
01:15TEttingerwat
01:15sm0kelol
01:15TEttingeroh good
01:16TEttingerthat is actually correct
01:17TEttinger,(transform' str ["a" "b" "c" "d" "e"] [1 2 3 4 5])
01:17clojurebot(("a" 1) "b2" ("c" 3) "d4" ("e" 5))
01:17sm0kewth is up with the list
01:17TEttingerit checks that the index is odd
01:17TEttingerif not, it returns the items from the colls at that index
01:18sm0keyes but it doesnt apply the function
01:18TEttingerif yes, it applies f to both, and returns that
01:18sm0ke,(defn transformz [f & colls] (apply map (fn [idx & args] (if (odd? idx) (apply f args) args)) (range) colls))
01:18clojurebot#'sandbox/transformz
01:18sm0ke,(transformz + [1 2 3] [4 5 6])
01:18clojurebot((1 4) 7 (3 6))
01:18TEttingeryup
01:18sm0kewhy isnt it (5 7 9)!
01:19TEttingerremember, it's treating (if (odd? idx)) differently
01:19sm0keoh you had a apply before map
01:19sm0kehurm
01:19TEttinger,(defn transform-all [f & colls] (apply map (fn [idx & args] (apply f args)) (range) colls))
01:19clojurebot#'sandbox/transform-all
01:20TEttinger,(transform-all str ["a" "b" "c" "d" "e"] [1 2 3 4 5])
01:20clojurebot("a1" "b2" "c3" "d4" "e5")
01:20TEttingersame as
01:20TEttinger,(map str ["a" "b" "c" "d" "e"] [1 2 3 4 5])
01:20clojurebot("a1" "b2" "c3" "d4" "e5")
01:21sm0keyes i know that
01:21sm0kebut i am not able to spot why the function is not being applied
01:21sm0ke,(transformz + [1 2 3] [4 5 6])
01:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: transformz in this context, compiling:(NO_SOURCE_PATH:0:0)>
01:21sm0ke(apply f args) why is it giving a list
01:22sm0keoh i get it
01:23TEttingeryep, it gives a list in the else case
01:23sm0keits those who are not being applied
01:23sm0keTEttinger: who told you to write such a weird function
01:24sm0kethat was a weird one
01:25sm0ke,(range)
01:25clojurebot(0 1 2 3 4 ...)
02:15blur3dI’ve been struggling with some fairly simple clojurescipt/javascript interop. Bascially, I call a native javascript function, which returns a javascript array - however, I am having trouble using that array in the clojurescript code. The error I am getting is [object Object], [object Object], [object Object] is not iSeqable. The problem is that is it an array, and I think there might be a nodejs bug.
02:16blur3dI’ve tried casting it to an array also, but that didn’t seem to help
02:17blur3d(println (first #js [1 2 3])) works as expected - it returns 1
02:17blur3dhowever, (println (first ports)) - where ports is an array (confirmed in webkit console), it gives the iSeqable error
02:18blur3d**correction it prints ‘1’… returns nil.
02:20blur3dhttp://imgur.com/Ctf5K45 is an image of the webkit console. It dumps the ports value (using (.dir js/console ports), which shows it is an array
02:29dbaschjavascript arrays are not seqable, you need to convert it to clojurescript
02:32blur3dI’m thinking it is related to http://dev.clojure.org/jira/browse/CLJS-842
02:33blur3ddbasch: if javascript arrays are not seqable, why does (first #js [1 2 3]) work? I’m fairly sure clojurescript has a protocol that handles the conversion now
02:42dbaschtry (implements? ISeqable #js [1 2 3])
02:43dbaschand
02:43dbasch(implements? ISeqable (js->clj #js [1 2 3]))
02:45blur3dfalse, and true respectively. So you’re right
03:15weiis there a shortcut for (let [x …] (do-something-with! x) x)
03:21amalloy(doto x (do-something-with!))
03:21amalloy&(doc doto)
03:21lazybot⇒ "Macro ([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
03:22magopian&(doto 1 inc)
03:22lazybot⇒ 1
03:22magopianobviously ;)
03:22magopian&(doto 1 str)
03:22lazybot⇒ 1
03:23amalloy&(doto 1 println)
03:23lazybot⇒ 1 1
03:23magopianthanks ;)
03:23magopiani was thinking about something with side effect, was thinking a bit too much :)
03:23magopian(it's still "early" here in the morning... and yes, that's my only lame excuse :)
03:29weisweet, thanks amalloy
03:42iamcyberbirdhmm any way i can get rid of the curly f function symbol and use a lambda symbol instead?
03:42iamcyberbirdmore of an emacs question but i'm sure someone knows here
03:44pellishi all. i'm trying to figure out how https://clojurecup.com was made - what javascript framework was used in addition to React (hoping authors sit in this chan)
03:44pellisanyone have an idea?
03:45Rhainurpellis: probably Om?
03:46pellisgiven that React covers the UI concerns, does Om also cover the architecture concerns? i.e. a general structure of an app?
03:46pellisfor example, routing and event propagation?
03:47Rhainuroh no I meant Om is ClojureScript's interface to React
03:47Rhainurhttps://github.com/swannodette/om
03:49pellisRhainur: ah, i see!
03:50pellisRhainur: well, I think i bumped into Om somewhere - just this site brought up question such as what about routing, servers, events and such
03:51ddellacosta_pellis: Om is really only the "view" in MVC...sort of. More to the point, many architectures are possible with Om.
03:52ddellacosta_pellis: event propagation is handled by React, but routing is not. Many folks using Om use Secretary to handle client-side routing: https://github.com/gf3/secretary
03:58weidesign question. I’m using redis/carmine to put some computation jobs on a queue. after a computation is finished, the owner of the job needs to be notified of the answer. what’s a good way to do this? (another queue?)
04:01ucb_hi all, where am I going wrong: https://gist.github.com/3e7814d9a56a2c5139ed ?
04:05ucb_oh, I know, heh
04:11ucb_oh, am I stuck with signed bytes in clojure by any chance?
04:14ucb_bah, ignore me again
04:16TEttingerucb_: there's at the very least ztellman's byte handling lib
04:17rritochucb_: It is a java limitation, you can upgrade to byte if you need to hold 8 bits without dealing with the sign, but you'll need alot of (bit-and 255 x) if your doing cryptography
04:17ucb_TEttinger: yeah, I'm using bytebuffer (the lib), but I was being silly with all my questions. I don't need to do any interpretation of the bytes as it were. Thanks though!
04:17ucb_rritoch: yeah, and fortunately I am not doing crypto because I clearly don't understand all this stuff very well ^_^
04:17rritocherr, upgrade to int
04:18mmeixnerNewbie question: is there an idiomatic difference between "apply + " and "reduce + " ?
04:20pyrtsammeixner: For variadic functions like +, it's probably best to use apply because it lets the function short-circuit (and not evaluate all the arguments) when it matters. Not that + would short-circuit but still.
04:20mmeixnerI see, so this is an implementation detail somehow
04:20mmeixnerthanx
04:21TEttingerit is important to understand the difference between apply and reduce though
04:21mmeixnerah ...
04:21ucb_mmeixner: not just, consider the gymnastics you'd have to do if you wanted to apply conj for instance
04:21pyrtsammeixner: The difference is: with apply, the function + immediately sees that it's called with a sequence of arguments. With reduce, the function always gets called with 2 arguments.
04:21ucb_the trouble with apply and conj is that not all parameters to conj are of the same type
04:22pyrtsaucb_: Neither necessarily with reduce when you pass the init argument: (reduce f init xs)
04:23mmeixnerI see - some REPLing necessary to work this out ...
04:23ucb_pyrtsa: indeed, but with apply you'd have to conj/cons the initial collection (or nil) to the collection of items you want to cons, right?
04:23pyrtsaucb_: You can say (apply conj coll xs)
04:24ucb_oh, you can do that indeed!
04:24ucb_IVE BEEN WRONG ALL MY LIFE
04:24pyrtsaAnd again, the difference is that conj immediately sees that there are many things (i.e. xs), not just one (x).
04:24ucb_sure
04:25pyrtsaIndeed, (conj (conj (conj coll a) b) c) has a very different performance from (apply conj coll xs).
04:25pyrtsa(...As far as I remember.)
04:25ucb_it should, right?
04:26pyrtsaI think it should use transients behind the scenes. At least it could.
04:26mangepyrtsa: A great example of the performance difference is with (apply str ...) vs (reduce str ...), I think.
04:27pyrtsamange: Great. That's a good one.
04:27mmeixnerI just found this: "+ is itself implemented in terms of reduce for the variable-arity case (more than 2 arguments). "
04:27mmeixnerhttp://stackoverflow.com/questions/3153396/clojure-reduce-vs-apply
04:29mmeixnerthanks for all input! time to think ...
04:42rritochucb_: if you need something simple, here's an ugly hack to do your byte conversion which handles the sign bit for you (-> 0x98 str javax.xml.bind.DatatypeConverter/parseByte)
04:52TEttinger,(-> 0x98 str javax.xml.bind.DatatypeConverter/parseByte)
04:52clojurebot-104
04:52TEttinger,0x98
04:52clojurebot152
04:54TEttinger,(bit-and 0x98 -2r1111111)
04:54clojurebot128
04:54TEttingerhm
04:54TEttinger,(bit-and 0x98 2r1111111)
04:54clojurebot24
04:57CookedGryphonDoes anyone know if transit needs all its dependencies in all situations? I'd like to use it, but I'm on android and it adds ~14k method references with its dependencies when my total limit is 64k
04:57CookedGryphonIdeally I'd proguard things out, but I want to be able to use it from the repl
04:59TEttinger,(+ (bit-and 0x98 127) (* -1 (bit-and 0x98 128)))
04:59clojurebot-104
04:59TEttingerrritoch, should be... a bit faster
05:00TEttinger,[(+ (bit-and 0xf8 127) (* -1 (bit-and 0xf8 128))) (-> 0xf8 str javax.xml.bind.DatatypeConverter/parseByte)]
05:00clojurebot[-8 -8]
05:00clgvTEttinger: proof by criterium? ;)
05:00TEttinger,[(+ (bit-and 0x18 127) (* -1 (bit-and 0x18 128))) (-> 0x18 str javax.xml.bind.DatatypeConverter/parseByte)]
05:00clojurebot[24 24]
05:01TEttingerit's simple bit twiddling. it isolates the least significant 7 bits, and subtracts 128 if there's a value in the sign bit place (eighth bit, 128)
05:04TEttinger,[(- (bit-and 0x18 127) (bit-and 0x18 128)) (-> 0x18 str javax.xml.bind.DatatypeConverter/parseByte)]
05:04clojurebot[24 24]
05:04clgvno, I mean the supposed performance improvement ;)
05:04TEttingeroh haha
05:04TEttingerya think?
05:05clgvon the jvm I only believe in performance improvements backed up by benchmark numbers ,)
05:05rritochTEttinger: The version I provided was simply for readability, there are much faster ways, the fastest being to just use (byte -104), it will really depend on the implementation as to what method is best.
05:06TEttinger,(time (map #(- (bit-and % 127) (bit-and % 128)) (range 255)))
05:06clojurebot"Elapsed time: 0.136753 msecs"\n(0 1 2 3 4 ...)
05:06TEttinger,(time (map # (-> % str javax.xml.bind.DatatypeConverter/parseByte) (range 255)))
05:06clojurebot#<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>
05:06TEttinger,(time (map #(-> % str javax.xml.bind.DatatypeConverter/parseByte) (range 255)))
05:06clojurebot"Elapsed time: 0.121739 msecs"\n(0 1 2 3 4 ...)
05:06TEttingerwaaaaat
05:06TEttingerjit.
05:07rritochTEttinger: His problem though is to create a byte, neither of your codes create a byte
05:07TEttinger,(time (map #(byte (- (bit-and % 127) (bit-and % 128))) (range 255)))
05:07clojurebot"Elapsed time: 0.143679 msecs"\n(0 1 2 3 4 ...)
05:08TEttingerI don't get you, hotspot jit
05:09rritochTEttinger: I get it, duped by clojure's slowness, the DatatypeConverter library may be coded in binary (assembled) so it gets an unfair speed advantage.
05:09TEttingerah
05:09TEttingerso if mine was AOTed it would be better
05:09TEttinger(than it is now)
05:10clgvTEttinger: you definitely need to use cirterium (or similar) for these measurements
05:11clgvand using lazy functions wont help either ;)
05:11TEttingerwell they're both using map
05:12clgvyeah but (map ..) gets evaluated when printing so not within (time ...)
05:13clgvyou measured the construction of the lazy-seq not its realization which you wanted to
05:13clgv(quick-bench (mapv #(- (bit-and % 127) (bit-and % 128)) (range 255))) => Execution time mean : 11.765617 µs
05:13clgv(quick-bench (mapv #(-> % str javax.xml.bind.DatatypeConverter/parseByte) (range 255))) => Execution time mean : 18.155778 µs
05:13TEttingergah
05:14TEttingerwell that's promising
05:14clgvyou could rerun the above with `bench` to be more accurate
05:16clgvI have used criterium a lot lately
05:27vanilahi!
05:27vanilaHow does the clojure compiler work?
05:29noidipretty well, thanks for asking
05:29vanilahaha
05:29noidibut seriously, that's too broad a question to be answered in any meaningful way
05:30rritochTEttinger: Ok, well speed wise I think this should be the fastest (.byteValue 0x98)
05:31danielcomptonI benchmarked the bit functions with criterium, what happened next will surprise you...
05:31rritochHonestly, I didn't even know Long had a byteValue method...
05:32TEttingerhaha good point
05:33TEttingervanila, I think it's a little atypical of lisp implementations, since it compiles to jvm .class files on-the-fly or ahead-of-time as requested.
05:34vanilainteresting!
05:34TEttingeralmost everything gets its own .class file, like each fn
05:35TEttingerI don't know how it assembles the .class files other than "it's complicated and don't touch it"
05:36TEttingeryou can go through clojure's source on github, but it's pretty big
05:36cflemingAnd pretty ugly the first time you see it.
05:36cflemingThe compiler, that is.
05:37TEttingera lot of it is in https://github.com/clojure/clojure/tree/master/src/jvm/clojure/asm
05:37CookedGryphoncfleming: I don't know about that. I couldn't imagine being able to go and confidently make changes to the compiler of any other language I've used, but with Clojure I can look at the source and understand most of what's going on
05:37TEttingerthen there's this 8563-line file, https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java
05:38danielcomptonhttps://www.refheap.com/91008
05:38danielcomptonTEttinger: not a lot in it between them
05:38danielcomptonthough I do realise they're not all doing the same thing
05:39cflemingCookedGryphon: I've read a few compilers but I find the Clojure one pretty difficult to read. You're right that it's pretty concise for a production language though.
05:39TEttingerdanielcompton, why does the last one not show criterium bench stuff?
05:39cflemingCookedGryphon: I like the Clojurescript compiler source a lot.
05:42vanilaWhat compiler might I be better to read?
05:42TEttingervanila, it might be good to start with some small ones in the compile-to-JS area
05:42TEttingerwhat are you familiar with now, vanila? https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS
05:43vanilathanks! I'll look at some of these
05:46TEttingerwat is a nice tiny core of a language that may be a good starting point. not compiled though. https://github.com/manuel/wat-js
05:47TEttingerthe cola stuff is apparently fascinating to compiler buffs http://www.piumarta.com/software/cola/
05:48vanilathese links are great cheers!
05:48rritochvanilla why are you digging into the clojure compiler? If your not familiar with compiler design it may take you years. I've watched some of the MIT course on the subject (https://www.youtube.com/watch?v=k-bpyDgBxAo&amp;list=PL0300FE43396456C1&amp;index=1) but it put me to sleep after a few classes since most of it I'm already famliar with.
05:49TEttingerhttp://www.piumarta.com/software/maru/ is another tiny compiler in C, this one looks quite interesting but I have no idea how cross-platform it is
05:55TEttingervanila, I would strongly consider the translator rather than compiler route, like clojurescript does (translates to js, then use a compiler like google closure to make it optimized)
05:56TEttingerki is another apparently very small model that uses clojurescript
05:57TEttingerhttp://ki-lang.org/
05:58amano-
05:58TEttingerthis is basically the whole thing https://github.com/lantiga/ki/blob/master/src/ki.sjs
05:58TEttingerit macroexpands to javascript, which is extremely clever
05:59vanilawow!
05:59vanilaThat is really nifty
06:06rritochTEttinger, are you aware of a clojure form -> C "translator"? One of my clients requested I compile clojure forms to C for use with OpenCL but the project is far beyond the complexity I'm willing to swallow.
06:06TEttingeryes, there's a clojurec out there.
06:06rritochCool, I'll have to check it out
06:06TEttingerhttps://github.com/schani/clojurec
06:08TEttingerbertfrees' fork seems slightly further along, rritoch https://github.com/bertfrees/clojurec
06:09TEttingeroh, and there is opencl support in java, shouldn't be too hard to use if you have a JVM handy
06:09TEttingerhttps://github.com/ztellman/calx
06:09TEttingeroh mr. tellman, is there anything your libs don't do?
06:09TEttinger(be slow, I guess)
06:11rritochTEttinger, this is the project so far, it's been sleeping for awhile https://github.com/rritoch/WarpCTL, I used JOCL for the OpenCL support..
06:13rritochI lost interest in the project after trying to grab Cuda GPU temperatures using swig, most Cuda libraries are very platform dependent, I had some luck with NVML, but that's as far as I got on the project.
06:14TEttingercuda itself won't even run on AMD or intel graphics, so there's a limit right off the bat..
06:15rritochThe library itself uses OpenCL, but for temperatures you need to directly access the device drivers. For AMD it was the ADL-SDK which was fairly easy
06:17rritochBut for Cuda I tried multiple libraries, most won't compile on linux, but the NVML library seems to work, at least on windows, I don't have a Linux+NVidia system to test on.
06:17TEttingeryeah sounds nasty
06:18rritochWell, my linux box has 2X280X R9's crossfired, without accurate temperature controls they'll burn themselves to death in a short time.
06:19rritochI'm just assuming similar thermal problems with NVidia high-end GPU's
06:20rritochEither way, if I can find the way to translate forms to C and inject them into OpenCL that would be awesome. Right now I just make task-specific, hard-coded, kernels.
06:21rritochThat clojurec project looks promising though, if I can find my way through to the parts that can convert forms to C
06:24aztakany suggestions for how to make this more dry and clojuresque? :) https://gist.github.com/metamorph/754c59eba4186c6c4981 (I'm adding a :winner entry to a map depending on existing entries in the map)
06:27noncomhow do i select the s-expression where the cursor is currently, in emacs/prelude ?
06:27clgvdid ClojureC progress lately? is it usable at all for non-trivial clojure functions?
06:28TEttingerclgv, it has not progressed lately
06:28noncomsame as alt + shift + up in ccw
06:28clgvTEttinger: so probably pretty dead...
06:29TEttingerI'd think calx would be the way to go, but I think the client requirements may be different than what it provides
06:31clgvTEttinger: but calx is like embedded assembler in c/c++ ;)
06:41pellisddellacosta_: thanks for the secretary tip. is there a listing of typical clojurescript frontend stack?
06:42ddellacosta_pellis: I don't know if there is a typical front-end stack, actually! plenty of folks using reagent along with Om, not to mention server-side rendered stuff w/enlive, etc...
06:43ddellacosta_pellis: take a look at the Om readme for Om-related stack stuff, at least...
06:43pellisah, thanks
06:49borkdudeI am the only one who wants to turn a C-x-f action into a dired buffer half way through cd-ing a path?
06:50borkdudeif not, how do the others do it?
06:54borkdudejust C-d does it - yes!
07:11clgvborkdude: I did only hear spanish ;)
07:12vijaykiranhey - that's emacsish
07:14clgvso that's emacs lisp? ;) :P
07:15borkdudeclgv key chords
07:16vijaykiranborkdude: I thought (from your tweet) you are using that cursive thingie
07:16borkdudevijaykiran I try to be tool agnostic :)
07:17borkdudevijaykiran normally I use emacs, but for a workshop I will recommend cursive, so I have to have some knowledge about it myself
07:17cflemingvijaykiran: except he loves Cursive, he can't help himself :-)
07:17borkdudecfleming true!
07:18borkdudevijaykiran yesterday I tried emacs with lein ring: didn't work. cursive did. (inc cursive)
07:18cflemingvijaykiran: (disclaimer: I develop Cursive, so take anything I say about how much people love it with a grain of salt)
07:18vijaykiranman all these new-age-ide people ...
07:19vijaykirancfleming: great work, btw. I'm not a Cursive user ... yet.
07:19cflemingvijaykiran: Thanks! There's always time, we'll be waiting.
07:20borkdudevijaykiran you have emacs and cursive open on the same project and have benefits from both sides
07:20cflemingborkdude: Out of curiosity, what's nicer in Emacs than Cursive at the moment?
07:21LauJensenHas anyone here been able to connect LightTable to an nrepl started from Immutant yet?
07:21vijaykiranEmacs *is* nicer :) well for me it's not just for clojure dev
07:22vijaykiranNot that I don't have IntelliJ open all the time (for lesser lang-dev)
07:22borkdudecfleming I'd have to think about that while developing. I'm just more used to emacs keybindings
07:22clgvLauJensen: what's the problem? unknown port? middleware problems? http transport?
07:23borkdudecfleming I tried C-k in Intellij. It removed the whole line instead of structurally
07:23cflemingborkdude: Sure, just wondering - familarity is huge.
07:23LauJensenclgv: Unsure - Its simply hanging in the "Connecting" phase
07:23clgvLauJensen: can you connect with another client? e.g. leiningen?
07:24cflemingborkdude: Ah, you can fix that. Bind the Kill action to C-k, it'll override the built-in action in Clojure contexts and leave it in others.
07:24LauJensenclgv: Connecting to the same port via cider/emacs works fine
07:24borkdudecfleming I'll try
07:24clgvLauJensen: lein repl :connect host.port
07:24kyrreHow can I use clojure.data.zip.xml/xml-> (or any other function) to find the first occurrence of a tag in an XML file (without specifying all the parents) ?
07:24cflemingborkdude: The next drop actually has a keybinding panel that lets you configure all the keybindings at once to the Emacs defaults if you like.
07:24clgvLauJensen: ah ok. so probably a lighttable issue
07:25borkdudecfleming that's very nice
07:25cflemingborkdude: Except for the cider ones unfortunately, since I can't take over C-c by default.
07:25LauJensenclgv: Thats what Im thinking
07:25cflemingborkdude: But paredit etc should all be there.
07:26clgvLauJensen: they have their issues managed on github
07:27borkdudeah nice, C-k works now
07:27cflemingborkdude: Great
07:29dysfunis there a builtin that's equivalent to (partial filter id) ?
07:30gfredericksno; keep is the composition of that with map I think
07:30gfredericks(= (partial filter identity) (partial keep identity)) ;; probably
07:30dysfunthat sounds quite handy
07:31gfredericks,(keep first [[3 4] [] [5 6] [] [] [] [7]])
07:31clojurebot(3 5 7)
07:32dysfunyeah, i can use that for some of this
07:32dysfunthanks
07:32gfredericksI use (remove nil? ...) a lot, which is slightly different
07:33dysfun,(remove nil? (map first [[3 4] [] [5 6] [] [] [] [7]]))
07:33clojurebot(3 5 7)
07:34borkdudeI wondered, does the clojure compiler optimize when you use collection literals in functions, like (fn [x (#{:a :b} x)), or does it construct the collection in every call?
07:35borkdude(fn [x] ... I mean
07:35gfredericksborkdude: I *think* if the collection contains only literals, the whole thing can be stored once
07:35gfredericksI haven't double checked that it actually does that though
07:35gfrederickshey hey easy to find out
07:35gfredericks,(defn make-a-set [] #{2 3 7})
07:35clojurebot#'sandbox/make-a-set
07:35gfredericks,(identical? (make-a-set) (make-a-set))
07:35clojurebottrue
07:36gfrederickswhereas of course:
07:36gfredericks,(defn make-a-set [x] #{2 3 7 x})
07:36clojurebot#'sandbox/make-a-set
07:36gfredericks,(identical? (make-a-set 42) (make-a-set 42))
07:36clojurebotfalse
07:36borkdudeclojure is fantastic :)
07:40gfredericksiterate-while would be a nice function to have sometimes
07:42gfredericksI hesitate to use iterate + take-while if overshooting the underlying lazy seq would throw an exception
07:47m1dnightMy very basic actor implementation is taking shape. It gets ugly real quick though, due to not having pattern matching like Erlang.
07:48dysfuncore.match?
07:48clojurebotcore.match is a pattern-matching library available for use by anybody but technomancy
07:48dysfun:)
07:48dysfunalthough i've found in a lot of cases it works out cleaner to not use it than to use it. really depends what your functions look like
07:49m1dnightdysfun: In parameters that is. Like pong(<something>, 1) <body> and pong(<something>, othe_than_1): <body>
07:49dysfuni had a particularly bad example earlier though where the smallest reasonable core.match was 9 lines and the regular clojure 3 lines
07:52gfrederickscore.matrix is the first place I've seen the PFoo naming convention for protocols
07:57dysfun(commonly along with (defrecord foo [] foo-proo ... )
07:58dysfunm1dnight: you can use guards for some of that
07:59dysfun(a :guard my-type?)
07:59m1dnightoh, like haskell
07:59m1dnightill check it out dysfun
07:59m1dnightthnx
07:59dysfunnp
07:59dysfunyou may also like core.logic
07:59daniel___any frameworks built on garden? a bootstrap/foundation type framework would be cool
08:00dysfunor core.unify
08:00daniel___at least with a grid and some basic components
08:00dysfunit wouldn't take you long to adapt blueprint, for example
08:01dysfunmuch of it could be done automatically
08:01daniel___dysfun: how would you do it automatically?
08:01daniel___but i might start one as a little side project
08:01dysfunfind a css parser and process it
08:02daniel___problem is, im not a css expert
08:02dysfunwhy do you have to be an expert?
08:02dysfunthe syntax is intentionally very simple
08:02daniel___theres a lot of things to learn when it comes to responsive design
08:02daniel___media queries etc
08:03dysfunwhat are you trying to do?
08:03daniel___have a framework to make sites quickly that look half decent
08:03daniel___bootstrap and foundation are fine, i'd just like to use clojure
08:03daniel___since i use clj/cljs all over
08:04dysfuni'm not seeing the problem with using bootstrap and just writing new css in garden
08:04daniel___if everything was written in garden from the ground up, it would be easier to extend
08:04daniel___extending bootstrap with plain css doesnt really give you power over all the variables and functions less/sass provide
08:05dysfunah. well for that, you have compass (which has blueprint mixins), but it's not garden syntax obviously
08:05dysfunyou could automatically translate bootstrap to provide garden primitives i think
08:06daniel___i probably could, i'll give it a go if i have time
08:06dysfunit seems like the element translation function would be <5 lines
08:14daniel___dysfun: element translation function?
08:15daniel___to translate less into garden?
08:16dysfunwell, slightly more to translate something like less perhaps. but the pure css, yeah
08:17daniel___yeah, i could try and work backwards
08:17daniel___and then just refactor
08:47silasdavisis there any way to produce an (AOT'd) record with typed (non-Object) member fields
08:47silasdavisI was sort of hoping annotations might do it
08:48stuartsierrasilasdavis: no
08:48silasdavisjust write a Java class then I suppose.. ?
08:54stuartsierraya
09:07clgvsilasdavis: primitive member fields?
09:08clgvsilasdavis: otherwise you won't win much except you can omit type hints
09:12craigglennieStupid question… why doesn’t this return two lists, with even numbers in one and odd in the other? (split-with even? (range -5 5))
09:13craigglennieThis works to split into negative and non-negative: (split-with neg? (range -5 5))
09:13stuartsierracraigglennie: That's not what `split-with` does.
09:14stuartsierraoh, nevermind
09:14stuartsierraignore me
09:14stuartsierrano, I'm right
09:14clgv,(split-with neg? (range -5 5))
09:14clojurebot[(-5 -4 -3 -2 -1) (0 1 2 3 4)]
09:14stuartsierra`split-with` divides a collection into two lists, one *before* the predicate was true, and one *after*
09:15Bronsacraigglennie: use (comp vals group-by) to get what you want
09:15stuartsierra,(split-with #(= :split %) [1 2 3 :split 4 5 6 :split 7 8 9])
09:15clojurebot[() (1 2 3 :split 4 ...)]
09:15stuartsierrabah, whatever
09:15clgvor `group-by` with destructuring ^^
09:15stuartsierrathat's what it does
09:16stuartsierra,(split-with keyword? [:a :b :c 1 2 3 :d :e :f])
09:16clojurebot[(:a :b :c) (1 2 3 :d :e ...)]
09:16clgv,(let [{negative true, others false} (group-by neg? (range -5 5))] [negative others])
09:16clojurebot[[-5 -4 -3 -2 -1] [0 1 2 3 4]]
09:16craigglenniestuartsierra: ahh, I see… I guess that makes sense, given it’s called “split-with” and not “group-by”
09:17clgv,(let [{even true, others false} (group-by even? (range -5 5))] [even others])
09:17clojurebot[[-4 -2 0 2 4] [-5 -3 -1 1 3]]
09:17clgvcraigglennie: ^^
09:17stuartsierraThe docstring says exactly what it does. "Returns a vector of [(take-while pred coll) (drop-while pred coll)]"
09:18clgvso actually the better name would include a "first" ;)
09:18the-kennyAnyone using weasel with the latest clojurescript/cider/cider-nrepl releases? It seems to "forget" the current namespace when evaluating stuff. Always drops me back into the user namespace in the repl.
09:20craigglennieclgv: thanks, your solution makes sense
09:35the-kennyhm, cider just sets nrepl-buffer-ns when evaluating cider-repl-set-ns. I wonder if either weasel or austin cache the current ns somewhere else. I wonder if cider should emit a call to `in-ns' in such situations.
09:36martinklepschhow big is the memory overhead of having a few million maps vs. a vector just containing the values?
09:36martinklepsch(stored in one big set)
09:36clojurebotExcuse me?
09:39dumptruckmanhmm, can someone tell me why nothing prints on this? http://pastie.org/9610294
09:40dumptruckmanshouldn't seq? return false if the collection is empty?
09:41joegallohttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/seq
09:41dumptruckmanoh, i just want seq
09:41dumptruckmanswitching to that and it still doesn't print
09:43clgvmartinklepsch: you might be force to drop down to java arrays (or specific tuple classes) depending on the scenario - I had problems with millions of maps that needed to fit into 8GB at the same time
09:44martinklepschclgv: I'm fine with 16GB but it's tight
09:45clgvmartinklepsch: that's why I hated the incater approach to use persistent maps for rows
09:46dumptruckmanok so
09:46dumptruckmanhttp://pastie.org/9610317
09:46dumptruckmanit still doesn't print
09:46dumptruckmanand if it's not printing, how is it not stuck in an infinite loop?
09:48clgvdumptruckman: it fails with an exception since you call `pop` on a lazy-seq
09:49dumptruckmanoh?
09:49clgvdumptruckman: https://www.refheap.com/91019
09:49sg2002Hello. Does anyone here uses that breakpoint macro from the Joy Of Clojure book? In the version they provided there's no way to exit the debugger. Maybe someone has an updated one?
09:50sg2002Decided to check here before doing this myself.
09:50dumptruckmanclgv: noooo i wanted to solve it myself D:
09:51clgvdumptruckman: I only fixed your strange usage of range there
09:51clgvdumptruckman: you can still try the version without loop-recur that's based on range
09:52clgvsg2002: afaik that wont work in an nrepl setup anyway
09:52clgvsg2002: since handling *in* and *out* is different there
09:53dumptruckmanclgv: yes, i thought of a way to do it without recurring but this exercise is specifically for recursion
09:55dumptruckmansomething like (defn factorial [n] (reduce 1 (range 1 (inc n)))
09:55clgvdumptruckman: but you should have seen the exception in your previous version
09:55clgvdumptruckman: almost ;)
09:55dumptruckmankoan is not printing any exceptions
09:56clgvthat's bad. so you should probably try out in your own repl to see those
09:56dumptruckmanoh right
09:57dumptruckman (defn factorial [n] (reduce * 1 (range 1 (inc n)))
09:57clojurebotCool story bro.
09:58dumptruckman+)
09:59dumptruckmanhow come you can't pop a lazy seq?
09:59clgvdumptruckman: because it is not a stack
10:00clgvdumptruckman: lists and lazy seqs can only be read from front to back
10:00clgvdumptruckman: you can use `first` and `rest` or `next`
10:00clgvbut the lazy seq was not appropriate in that implementation anyway
10:03atyzclgv: you should be able to use peek too
10:05clgv,(peek (range 10))
10:05clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentStack>
10:05clgvatyz: nope, both are specifically for stacks
10:05clgvatyz: e.g. vector
10:09justin_smith,(peek (list 0 1 2 3 4)) ; or list
10:09clojurebot0
10:10clgv ,(pop (list 0 1 2 3 4))
10:10clojurebot(1 2 3 4)
10:11dumptruckmanclgv: i see
10:11clgvyeah well stacks with different ends ^^
10:11dumptruckmanso just not lazy seq
10:12atyzAh yeah, I know I had used it with lists before, I must have just assumed it was lazy ;)
10:12clgvdumptruckman: you could also restrict to first, rest in the beginning. when preserving types is important you might need those other functions
10:13clgvatyz: though there is actually no good reason why peek/pop don't work on lazy sequences when they do in lists.
10:13atyz,(peek (range 0 3))
10:13clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentStack>
10:13justin_smith,(peek (into () (range 0 3)))
10:13clojurebot2
10:13atyzclgv: Thats what I thought, I was wrong I guess
10:14justin_smithI have never done into () before
10:14clgv,(peek (cons 1 (cons 2 nil)))
10:14clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
10:14pyrtsa,(peek '(0 1 2 3))
10:14clojurebot0
10:14pyrtsa,(into () (range 3))
10:14clojurebot(2 1 0)
10:14clgvnice :D
10:14clgv,(list* (range 3))
10:14clojurebot(0 1 2)
10:14justin_smith,(peek (reverse (range 3)))
10:14clojurebot2
10:15clgv,(peek (list* (range 3)))
10:15clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.ChunkedCons cannot be cast to clojure.lang.IPersistentStack>
10:15justin_smith(def reverse (partial into ()))
10:15clgvmuhaha
10:15justin_smith,(peek (apply list* (range 3)))
10:15clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
10:15clgva rule of thumb to be safe: use peek and pop only with vectors...
10:16pyrtsaclgv: Well, and with clojure.lang.PersistentQueue.
10:16clgvjust made up. but seems reasonable when you consider the above examples
10:16pyrtsa,(peek (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))
10:16clojurebot1
10:16clgvpyrtsa: a queue implements ipersistentstack? TypeMismatchException!
10:17justin_smithpyrtsa: I was going to mention that one :)
10:17pyrtsajustin_smith: _o/
10:17justin_smithclgv: and it works on list, list* does not return a list
10:17clgv,(pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))
10:17clojurebot#<PersistentQueue clojure.lang.PersistentQueue@402>
10:17justin_smith(inc pyrtsa)
10:17lazybot⇒ 8
10:17pyrtsa,(seq (pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)))
10:17clojurebot(2 3)
10:17clgvwoah that's awful naming. Stack != Queue from an algorithmic point of view
10:18justin_smith,(peek (pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)))
10:18clojurebot2
10:18clgv~guards
10:18clojurebotSEIZE HIM!
10:18pyrtsapeek, pop and conj are all quite overloaded names in Clojure. That's their nature
10:18pyrtsaWell, into as well.
10:18clgvpyrtsa: I comlain about the interface that powers peek and pop ;)
10:18clgv*complain
10:19pyrtsaNod.
10:26vermawhen I do a defrecord, how do I make sure that the created record has certain fields in it with some defaults, e.g. I am creating this ModelCache record and I want to have a :state property in it that's an atom?
10:26vermaso far it seems to me like I need to accept it as one of the parameters to (ModelCache. (atom {}))
10:26vermas/to/like
10:27vermaI want to create a ModelCache instance, but make sure that all of them have an internal key named :state or :__state or whatever
10:28clgvverma: write a constructor function for it
10:28vermaclgv can't find any examples
10:29clgvverma: just a plain clojure function that creates the defrecord and initializes it
10:29vermaoh ok ok
10:29vermaclgv like (defn make-cache [] (assoc (ModelCache.) :state (atom {})))
10:29verma?
10:29vermanice
10:31clgvverma: yeah. you could also use (map->ModelCache {:state (atom {})}) - but thats probably a matter of taste
10:31clgv,(defrecord ModelCache [state])
10:31clojurebotsandbox.ModelCache
10:32clgv,(defn make-cache [] (map->ModelCache {:state (atom {})})
10:32clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:32clgv,(defn make-cache [] (map->ModelCache {:state (atom {})}))
10:32clojurebot#'sandbox/make-cache
10:32clgv,(make-cache)
10:32clojurebot#sandbox.ModelCache{:state #<Atom@1921250: {}>}
10:32vermanice
10:35verma(inc clgv)
10:35lazybot⇒ 28
10:43dysfun(into {} (when (map? a) (filter ... seems like a nice idiom for default-to-{} when writing map filters
10:45notofiHi, does someone know why with enlive the h2 tag is not inside the a tag with this example? (html/html-snippet "<a> <h2> Foo </h2> </a>") ->> ({:tag :a, :attrs nil, :content (" ")} {:tag :h2, :attrs nil, :content (" Foo ")} " ")
10:54xeqinotofi: enlive uses tagsoup with closes the <a> when it hits <h2>. https://github.com/cgrand/enlive/issues/110
10:54clgvdysfun: you want to filter map entries? I'd do that with reduce-kv and transient
10:56dysfunreduce-kv is handy too, transient, not so much given the data sizes we're talking about
10:57mikepencehi clojurians :)
10:57clgvdysfun: into uses transients if possible so that point is through ;)
10:57tbaldridgehi mikepence :-)
10:57TEttingerclourers and clojurists too
10:57mikepenceyesterday was my first day actually producing a bit of code in clojure for the day job (Living Social)
10:57TEttinger*clojurers
10:57mikepenceI am wondering where the community hangs out, and is tolerant of newb questions. :)
10:57justin_smithclojurmancers
10:58clgvhaha awakening the dead with lisp
10:58mikepenceah, that is better
10:58TEttinger*I've been up for 17 of the last 24 hours, give me a break
10:58justin_smiththis place is definitely tolerant of newb questions
10:58dysfunclgv: clojure does a lot of smart things so i don't have to
10:58mikepenceI knew technomancy back in the early rails days
10:58mikepenceawesome
10:58xeqihere and the clojure mailing list are both good places for newb questions
10:58mikepenceis the clojure mailing list a google group?
10:58justin_smithyes
10:58mikepencethx
10:59mikepenceI am coming from ruby, and super-excited by everything about clojure
10:59clgvdysfun: that's a trouble some attitude in general since there are usually several choices in clojure where you should choose the appropriate one...
11:00dysfunclgv: practicalities depend on a few things though. i know the size of the data will never be very large so i'm not concerned about performance implications
11:00TEttingermikepence, clojure is a wonderful language and I imagine it would come easily to a ruby pro
11:01mikepenceI have also had the awesome tutelage of ghadi shaban
11:04TEttingerso here's a nice artificial example of some of the strengths of clojure.
11:04TEttinger,(take-while #(> (second %) 1) (sort-by (comp - val) (frequencies "the king james bible")))
11:04clojurebot([\space 3] [\e 3] [\b 2] [\i 2])
11:04knosyshi !
11:04TEttingerthat finds all characters in the string "the king james bible" that show up more than 1 time. there are other ways to do it that are better, but i wanted to show comp and sort-by
11:05grandy___quick question: lein doesn't appear to be loading the files in src, so i have to load them manually and specifiy the paths (in the repl)... is there a way to have it load them automatically when i start the repl?
11:06TEttingergrandy___, have you set a :main namespace in project.clj ?
11:06TEttingernot sure quite what causes that
11:06grandy___TEttinger: i have not
11:07alejandro1grandy___: src should be on your loadpath, so all you should need to do is require them. the issue could be the naming of the files not matching what the namespaces are expected to be
11:07alejandro1I know that's bitten me a few times
11:07grandy___alejandro1: hmm how can i tell what it's expecting?
11:08justin_smithgrandy___: do any namespaces have - in the name?
11:08alejandro1so like src/example/cool_thing.clj => example.cool-thing
11:08TEttingerah, that one.
11:08grandy___alejandro1: i don't believe so
11:08justin_smithgrandy___: what does your require invocation in the repl look like?
11:09grandy___justin_smith: well, i tried to use (in-ns 'myproject.namespace)
11:09grandy___justin_smith: and then it couldn't find it until I typed (load "myproject/filename")
11:09alejandro1grandy___: also, does `lein classpath` have your src directory in the first few entries?
11:10justin_smithgrandy___: that's not how it owrks
11:10justin_smithgrandy___: (require 'myproject.namespace)
11:10grandy___alejandro1: it does
11:10justin_smiththat will load it up
11:11grandy___justin_smith: indeed it does
11:11grandy___thanks everyone!
11:11justin_smithgrandy___: none of your source files are (or should be) automatically loaded in a repl. They must be required first.
11:12grandy___justin_smith: ok i guess that makes sense...
11:13justin_smithgrandy___: there may be a project.clj trick for making the repl auto-require your core namespace (which then requires the rest)
11:13grandy___always nice when the problem was my logical reasoning :)
11:14grandy___can anyone advise me on the best practice for using a repl with cljs?
11:14justin_smithgrandy___: well, it's more about the conventions and expectations of the language - Clojure is often logical, but not so much so that you can figure things out by first principles :)
11:14grandy___:)
11:17mikepenceso structured editing is interesting
11:17mikepenceI am using cursive
11:22dumptruckmanwhat's that function that puts a string inbetween elements of a collection
11:23schmirdumptruckman: clojure.string/join
11:24justin_smithor interpose, if you want the result to be a collection too
11:24justin_smith(interpose "," (range 10))
11:24justin_smith,(interpose "," (range 10))
11:24clojurebot(0 "," 1 "," 2 ...)
11:25dumptruckmanoh
11:25dumptruckmanso join does the same thing but turns it into a single string?
11:26alejandro1dumptruckman: yup
11:26alejandro1,(clojure.string/join "," (range 10))
11:26clojurebot"0,1,2,3,4,5,6,7,8,9"
11:26dumptruckmancool, thanks
11:34vermacan't get :notify-command to work for lein-cljsbuild, anyone tried it/
11:35vermajust saying :notify-command ["pwd"] .. should at least print the current working directory after every build
11:36vermaok worked this time :P
11:46mikepenceI am not sure if I love structural editing yet, but obviously worth getting to know
11:50jcsimsmikepence: you will
11:51TimMcmikepence: You'll become addicted to it soon enough.
11:54mikepencethere has been some discusson on the cursive list about what non-emacs-inspired keyboard bindings to use on os x for structural editing commands
11:54alejandro1mikepence: is structural editing the same thing as paredit in emacs?
11:58mikepenceyes, same thing
12:41magopianare people using the (. foo -bar) notation to stay in line with the (.. foo -bar -baz) notation?
12:42magopianbecause at first, i found the (foo.-bar) notation much shorter and readable, but maybe it's just me?
12:43xeqiI thought (.-bar foo) was the prefered
12:43magopianah, there's also this notation, i forgot
12:43magopian(foo.-bar works, right?)
12:44magopiani'm looking at some code from https://github.com/Prismatic/om-tools#mixin-tools
12:45magopianthere's (. owner -intervals), then (.. owner -intervals (map js/clearInterval))
12:45magopianbtw, would (map .clearInterval) just work the same?
12:47hiredman.clearInterval is not a symbol that is bound to a function object in the environment
12:48hiredman(.clearInterval foo) is syntactic sugar for (. foo (clearInterval)), where . is the interop special form
12:49hiredmanit is not calling .clearInterval as a function
12:49magopianI see
12:49magopianso (foo.clearInterval) wouldn't work either?
12:50Bronsamagopian: it will probably work in cljs for reasons, but don't use it
12:50Bronsait's not clojure syntax
12:50magopianunderstood ;)
12:50magopianso the canonical way of writing is it (. foo clearInterval) or (. foo -className) (or whatever the property name is)
12:51Bronsamagopian: (.-bar foo) if it's a field, (.bar foo) if it's a method call
12:51Bronsaor (. foo -bar) if you prefer
12:51magopianok ;)
12:51magopianthanks a lot Bronsa and hiredman
12:51Bronsabut it's rare to use . directly
13:05andyfFor anyone out there who has dealt with type tags in Clojure a bit, I've written a few paragraphs about them, and ones that the next version of Eastwood will warn about. Interested in corrections, comments, etc. if you do read it: https://github.com/jonase/eastwood/blob/master/README.next.md#wrong-tag---an-incorrect-type-tag
13:06andyfNote: Eastwood 0.1.5 has not been released yet. Any comments you have can be filed as an issue on Github
13:07ambrosebsandyf: looks reasonable to me
13:07Bronsaandyf: I just read it and it looks fine to me -- an aside note, is this https://github.com/jonase/eastwood/blob/master/README.next.md#known-libraries-eastwood-has-difficulty-with still true? the bit about data.fressian/test.generative
13:07andyfBronsa: not sure. Let me check the output from my latest test runs...
13:08Bronsaandyf: I believe they should now get :wrong-tag warnings rather than fail
13:10andyfI'm getting exception with latest Eastwood and latest of data.fressian/test.generative
13:11andyfbecause of weird tags
13:12andyfEastwood still has tools.reader 0.8.4, in case that might have any bearing on it.
13:13m1dnightIs there a way to recur an enclosing loop/function? I found recur-to but it's a proof of concept atm
13:14Bronsaandyf: shouldn't be relevant, I'll look into it later, I'm pretty sure eastwood should be able to handle them now (my guess is that the wrong-tag handler needs some tweaking :)
13:15dbaschm1dnight: I hope there isn't a way :)
13:15m1dnightWell, it's be nice tbh
13:16m1dnightI need it to something like recur loop until condition is met, then recur function
13:16andyfBronsa: Thanks for all the quick bug-turnarounds lately. Feels like December & January over again, albeit with fewer bugs :) Note: TGEN-5 patch you suggested has not been committed, but I guess you plan to make t.a(.j) changes that avoid throwing exception even without that test.generative change.
13:16m1dnightill just have to rethink my code i guess
13:29zenoliSo, I need to consume a continuous stream of HTTP data and do something with each chunk. Recommendations for the best library?
13:29zenoliI've been trying with http-kit's client, but it looks like it might be trying to read in the entire (infinite) stream before returning anything.
13:30Bronsaandyf: yeah it looks like I forgot to handle a tag validation path with :validate/wrong-tag-handler, I'll fix that later & data.fressian/test.generative et all should work & just print a warning
13:31andyfBronsa: Sounds good. Let me know and I'll give it a whirl.
13:32Bronsaandyf: later might mean tomorrow, depending on whether or not I can stay awake long enough to fix it :P
13:33andyfBronsa: No rush on my part. I'm hoping to release 0.1.5 of Eastwood within a week or two, just to get the new linters out there.
13:34bbyler_t_hello! i'm running into the error "goog is not defined" when trying to boot up .. what's a good way to get around that?
13:35bbyler_t_(optimizations: whitespace)...
13:36nullptrbbyler_t_: make sure you're including the goog base.js in your html file
13:38bbyler_t_hmm...is there by any chance a cdn for base.js nullptr ?
13:39bbyler_t_i could do a quick download of closure, but just curious
13:39nullptrno, because you wouldn't (well, _shouldn't_) use base.js in production
13:39nullptrbase.js should get generated somewhere in your project space by cljsbuild
13:39nullptrcd project-root; find . -name base.js
13:41bbyler_t_ah of course! thanks nullptr,
14:11edbondasync question: if I have a (chan 10000), put! some values and close! chan. Values that are not consumed yet will be destroyed?
14:11tbaldridgeedbond: no, data is not destroyed by close!. close! events happen "after" any other puts
14:12edbondtbaldridge, thanks, will have a better sleep now. This question bothered me for some time.
14:13edbondso it's safe to close after all put!s, no need to define :end-of-stream or something
14:13tbaldridgeedbond: right, you should never need a signal value like that
14:15mi6x3mIs there a function like map which ignores the result?
14:15mi6x3museful for side effects
14:16ToBeReplacedjustin_smith: do you know if this ever got resolved: http://stackoverflow.com/questions/21706497/why-is-my-clojure-project-slow-on-raspberry-pi
14:16tbaldridge,(doc doseq)
14:16clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
14:16mi6x3m(f tbaldridge: I don't need bindings
14:16ToBeReplacedthen dorun
14:17mi6x3mToBeReplaced: I need to invoke a function with every element of the seq
14:18mi6x3m(something f seq)
14:18ToBeReplaced(->> coll (map f) dorun)
14:19mi6x3mToBeReplaced: the problem is that my sequence is large
14:19mi6x3mand map constructs a new sequence
14:19dbaschmi6x3m: why do you need to realize your sequence for side effects?
14:19ToBeReplacedpeople often use (doseq [x coll] (f x)) because it better matches the execution paradigm -> you want to side effect, in order, so it's actually imperative
14:20mi6x3mdbasch: it's a bit hard to explain but there's also another way
14:20mi6x3mToBeReplaced: yes, a good compromise
14:20mi6x3mit's nicely explicit
14:21justin_smithToBeReplaced: hmm - are you trying to do audio with clojure on a pi?
14:22ToBeReplacedjustin_smith: yes; i'm actually trying to do much more and getting a little frustrated since i lack the systems knowledge to debug the performance issue
14:22ToBeReplacedi reduced down to just playback a file as in the stackoverflow question and am seeing skipping as well
14:22justin_smithToBeReplaced: the behavior described in the question indicates that either there is too much work being done in the processing thread for the tiny CPU, or, more likely, lack of CPU-cache line coherency in the processing task
14:23tbaldridgeToBeReplaced: the rpi is a very, very slow machine. I'm surprised people get a JVM running on it at all.
14:23justin_smithToBeReplaced: so if you just play back a file, and nothing else, you see skipping? What if you make a minimal java program that plays the file?
14:24hiredmanpffft
14:25justin_smithToBeReplaced: reconsidering my response to the question before, it could be the context switch from the audio data to the clojure data between buffer writes that is killing perf
14:25ToBeReplacedthanks guys... i don't have a size or power restriction, i just need some hardware IO, so i think i might just run a more powerful computer and a usb gpio chip, like the FTDI FT245R
14:27ToBeReplacedjusting_smith: yeah i was using AudioSystem/getClip and AudioSystem/getInputStream... i didn't override any of the defaults
14:28m1dnightUgh, I'm stuck with my actors :p
14:28justin_smithToBeReplaced: hmm, come to think of it, that might mean that none of clojure was competing for the cache line, so it's just the device / the quality of the jvm on that device to blame
14:28m1dnightI guess it could write a part in Java.. :p
14:28ToBeReplacedi need to ship somewhat soon... and i'm undecided between a) run down the pi rabbit hole and see what i can do... b) upgrade to something like beaglebone black... c) run a more powerful and learn the shenanigans for serial gpio over usb
14:31justin_smithToBeReplaced: I've had excellent luck with using a csound process for audio processing controlled by a clojure process (either using the OSC protocol over UDP on localhost, or using stdio). csound runs very smoothly on tiny devices. I've done spectral manipulation and resynthesis without glitches on arm devices weaker than an rpi using csound.
14:33justin_smithof course supercollider (the audio backend for overtone) has a nicer api, but it will not run nicely on an rpi
14:33ToBeReplacedjustin_smith: good to know... yeah, it's odd... i was able to run sphinx (voice recognition) without hassle... option d) rewrite in python
14:33hiredmanToBeReplaced: which jvm are you using?
14:33ToBeReplacedyeah i tried reading in keyboard notes via overtone and it creeped along
14:33ToBeReplacedopenjdk8
14:34ToBeReplacedpidora, openjdk8, uberjar aot compiled
14:34hiredmanToBeReplaced: sure, but is it using shark or whatever?
14:35hiredmanshark is the jvms portable non-optimizing compiler, basically, until somewhat recently it was the only thing available on the pi
14:35ToBeReplacedah i didn't know that... is there a command line check?
14:36hiredmandunno, on systems that use apt it tends to be part of the package name when you install a jvm
14:37ToBeReplacedohhhhhh i think that's what i'm on... the package name doesn't say that... but java -version gives me: OpenJDK Zero VM... gotta mean non-optimizing? (build 25.5-b02, interpreted mode)
14:37hiredmanI've used clojure on my beaglebone for various things (home automation, simple robots) using oracles jdk and it has worked just fine
14:37hiredmanyeah zero
14:38hiredmanhttp://openjdk.java.net/projects/zero/
14:39ToBeReplacedhiredman: thanks that's really interesting... i'll see if oracle gives me anything better... that would be the triple fistpump success story
14:39hiredmanhttp://www.oracle.com/technetwork/articles/java/raspberrypi-1704896.html has some instructions that may be adaptable
15:04mikerodThere was a cool webapp that I found one day where you could search for clojure function usages across many of the known popular libraries.
15:04mikerodNow I can find this with a search, my bookmarks, history, etc
15:04mikerod:(
15:04mikerodDoes anyone know the link to what I'm describing
15:06mikerod?*
15:07dbaschmikerod: you mean http://crossclj.info/ ?
15:08mikeroddbasch: yes!
15:08mikerod(inc dbasch)
15:08lazybot⇒ 12
15:08mikerodThanks, I couldn't figure out how to refind that....
15:09mikerodTurns out if I would have though "search clojure ecosystem"
15:09mikerodI would have found a reddit
15:09mikerodthat would hvae linked to this :P
15:45michaelr524hmm
15:45michaelr524so, multiple cider sessions - is it supposed to just work - I don't get it from the documentation..
15:45michaelr524?
15:46michaelr524do i have to be an alien for this emacs voodoo to ever make sense to me? :)
15:47michaelr524_everything_ works exactly the way you wouldn't expect it work
15:56m1dnightUgh, I need some help guys. I've been breaking my head over this the entire day, I have something that shows what I want but now how I want it.
15:56m1dnightDoes nyone have a minute?
15:56clojurebotI don't understand.
15:57michaelr524m1dnight: shoot
15:57cbpDoes anyone who knows cider.el know with what the 'cider-find-or-create-repl-buffer' function was replaced?
15:58m1dnightI have a thread Y, and that thread has to look over a queue. I can say in that thread "get element X" and then that thread has to look at a ref/atom/.. and see if it has an element in it. If not, it has to block until that ref/atom has one. If it never gets one, the function never returns.
15:58m1dnightI have this, and it works. The point is, that function that blocks util an element is available spins and thus uses A LOT of cpu power, which I don't want.
15:59m1dnightIn java, i'd go about using .wait() and .notify(), but that's not really possible in clj, afaik. So i'm not sure how to go about it..
15:59michaelr524m1dnight: sounds like a task for core.async - have you looked at it?
15:59m1dnighthttp://pastebin.com/0Z3e6eW1 <- This is what I have at the moment but not really good
16:00m1dnightHmm, I was reading that a few hours ago and that looked promising indeed. It's CSP, right?
16:00m1dnightI'll have a look at it :)
16:00m1dnightThnx
16:01michaelr524m1dnight: also, I see there that you are importing LinkedBlockingQueue
16:01michaelr524Why don't you use it?
16:02michaelr524m1dnight: check this also: http://clojuredocs.org/clojure.core/seque
16:05dbaschm1dnight: btw, (if (not (nil? match)) ...) is almost the same as (if match ...)
16:05dbaschthe only difference is that the first will return true when match is boolean false
16:08m1dnightmichaelr524: Yeah, that was for an implementation I already had. I constructed a minimal example to figure out how to go about implementing it in the code I already have. That one involves macros and stuff so not comfy to start experimenting in it.
16:09m1dnightPerhaps I'll use a Java object to do it and use .wait and .notify. I'm not really sure yet
16:10michaelr524m1dnight: usually the most intimidating clojure code is the most gratifying when you finally understand it :)
16:12m1dnightWell, that's very much true though! :)
16:13m1dnightI was happy to accept to challenge to implement almost all concurrency models in clojure for my thesis
16:13m1dnight"Actors are going to be the easiest so i'll start with that"
16:13m1dnightthe challenge*
16:14justin_smithm1dnight: maybe you mistook the simplicity of a description of actors for simplicity of implementation?
16:16ToxicFrogYeah, speaking as someone who has implemented actor-like APIs on two different platforms, they're a lot easier to describe than they are to implement robustly.
16:16m1dnightjustin_smith: I did, as well as my promotors :p
16:17m1dnightit's not a lack of a feature, it's a feature something something
16:29michaelr524who is using cider with emacs-live here?
16:30m1dnighti'm using cider and emacs, no clue what emacs-live is though
16:30michaelr524m1dnight: C-c C-p does it popup a window or somtehing for you?
16:30tbaldridgemichaelr524: I've used it on and off, sadly I've found it too heavy for my day-to-day use.
16:30m1dnightmichaelr524: Undefined
16:31tbaldridge...so I now use Cursive. Sad when a Java IDE is more responsive than emacs.
16:31michaelr524cursive is great - once the new machine arrives by mail I might switch to it :)
16:31michaelr524I'm currently on a T60
16:32ro_sttbaldridge: admittedly very tempted to try cursive, really enjoy seeing it in your vids. but i'm just so used to my keybinds in emacs now
16:32michaelr524C-c C-p is described as "Evaluate the form preceding point and pretty-print the result in a popup buffer."
16:33michaelr524but instead of poping up something it just displays a one line buffer at the bottom of the screen - a bit similar to the "echo area" of C-c C-e
16:33ro_stwhen i use C-c C-p i get the popup buffer
16:34michaelr524I suspect it's the combination of cider with emacs-live..
16:34tufthello clojureverse
16:34michaelr524I really like the fact that cursive has a clojure debugger
16:34nooniani found the emacs setup from brave clojure to be pretty nice, and i'd heard previously from people who tried emacs-live that it felt a little bloated
16:34michaelr524it saves me lot's of time once in a while
16:34noonianhello tuft
16:35ro_sti use rkneufeld's gist with some addons. very light and simple
16:35michaelr524ro_st: url
16:35ro_sthttps://gist.github.com/rkneufeld/5126926
16:36michaelr524thanks
16:36ro_stits out of date because nrepl.el -> cider
16:39erdoshello everyone. i need some help with defrecords, please. i would like to type annotate an argument of my function, but when the function is called, i get the following exception: "erdos.ps.PSto" cannot be cast to "erdos.ps.PSto". the type names do match here, howerver the `instanceof?` call on the value of argument also fails. it is like there are two versions of the type with the same name, despite being defined only once. thank you
16:39tbaldrid_erdos: are you doing this at the REPL?
16:39hiredmanoh, well it isn't defined only once
16:40hiredmaneverytime clojure runs a defrecord it defines the type again, so if you are loading the namespace code more than once then there you go
16:40ro_styup. restart jvm and see if the problem persists
16:41michaelr524tbaldridge: oh, btw - could you share your key bindings for cursive?
16:41tbaldridgeyou don't really have to do that, just re-eval the functions that use the record
16:42erdostbaldrid_: yes, on the repl, even after completely restarting it.
16:42tbaldridgewell hiredman is right, something is re-evaling your defrecord
16:46erdostbaldridge: so you mean that requiring an ns twice from two differenc places creates the type twice?
16:46tbaldridgeerdos: no, that's fine, I mean either two defrecords, or evaling a defrecord twice
16:46mi6x3mdoes anyone know how to easily get the post parameters out of the body with httpkit?
16:46hiredmanor requiring with :reload and :reload-all
16:48hiredmanor if you are aot compiling and have a generate class file sitting on disk
16:48hiredmanthat can cause these issues
16:48hiredmana generated
16:48erdoshiredman: "lein clean" does remove these classes, right?
16:49hiredmanerdos: I forget, it seems like it should
16:49hiredmanif are aot compiling, stop
16:49hiredmanif you are
16:52justin_smithmi6x3m: are you using ring?
16:52mi6x3mjustin_smith: no
16:52justin_smithany particular reason not to use ring? because it's easy to get the post parameters with a ring middleware
16:53justin_smithand there is a ring adaptor for http-kit
16:53amalloyit's probably pretty easy with http-kit too, justin_smith, we just don't happen to know it
16:53mi6x3mjustin_smith: because this is a demo application with nothing related to a web module :)
16:53mi6x3mI just use httpkit to demonstrate something
16:54justin_smithso http, but not at all web?
16:54mi6x3mjustin_smith: yes :)
16:54clojurebotCool story bro.
16:54amalloy(inc clojurebot)
16:54lazybot⇒ 46
16:54mi6x3mjustin_smith: meh, I'll just parse them myself
16:54justin_smiththere is an apache library for that sort of thing
16:55amalloymi6x3m: it sounds like you are making things harder for yourself because the goal is "simple", as if you believe the default choices are hard to use but parsing http requests by hand is easy
16:55justin_smithamalloy: I think more likely http-kit gives you a stream for the body, and lets you leverage the various libs available for parsing or utilizing it
16:56mi6x3myes it's just (slurp :encoding "UTF-8") in my case
16:57justin_smithwell, that gets the text, but doesn't do the parsing - probably easier to hand the stream to the apache.data.codec or whatever it was called rather than construct a string then parse it by hand
16:59mi6x3mjustin_smith: I can't seem to find that library :/
17:07justin_smithhttps://github.com/clojure/data.codec I misremembered, it's clojure/data.codec and it uses apache commons codec
17:07justin_smitherm, never mind, that's not it
17:12borkdudeis http kit now seen as the future replacement for jetty also for local development?
17:12amalloyi can't imagine why. i'd just use jetty
17:13amalloyor aleph/netty if asynchrony is important to me
17:13noonianwell, i always use http-kit now just because of its support for websockets and stuff
17:13noonianbut i had already stopped using the ring leiningen plugins in development so lack of tooling support didn't affect me
17:15dbaschwhen I see questions like this one, I just want to answer "use clojure" http://stackoverflow.com/questions/26149732/how-to-sort-an-arraylist-using-two-sorts#26149840
17:16mi6x3mjustin_smith: indeed i'll just use form-decode in ring.util
17:16amalloydbasch: it was tempting to answer http://stackoverflow.com/q/26129172/625403 with "use haskell"
17:17dbaschI'm tempted to upvote that answer just because it's long!
17:17amalloyand you'd upvote "use haskell" because it's short! everybody wins!
17:18m1dnighthttps://github.com/puniverse/pulsar/blob/master/src/main/clojure/co/paralleluniverse/pulsar/actors.clj#L479 This is the receive code for Pulsar. Why on earth would I be able to do it with less :p
17:19tbaldridgem1dnight: you don't need all that crap for actors, you only need it if you're trying to duplicate erlang processes
17:20tbaldridgem1dnight: the stuff here is way simpler http://www.dalnefre.com/wp/
17:20m1dnighttbaldridge: Yeah, I kinda have to duplicate the actor model in clojure.
17:20justin_smithtbaldridge: it's like the difference between having a digital movie as accurate as film, vs perceptibly identical to film (the latter being orders of magnitude larger a task)
17:20m1dnightI might be better off doing it in Java though. I havent thought it through yet.
17:21tbaldridgethat's kindof what I'm saying, Erlang isn't "the actor model" it's "the actor model plus a ton of stuff that complicates everything"
17:21m1dnightOh, okay that's what you meant
17:21m1dnightSorry I can't really brain properly anymore :p
17:22noonianthe actor model is really very simple
17:22tbaldridgehttp://www.dalnefre.com/wp/2010/06/actors-in-clojure-why-not/ <- the Blog's author vs comments Rich made about actors
17:22tbaldridgefor the record, I agree with Rich when it comes to actors, but that post points out some really important misconceptions people have about actors
17:27m1dnightThat was a very very very good read tbaldridge
17:28m1dnightHowever, I senses a bit of passive agression in Rich's statements, or is it just me?
17:28muraikiI'm trying to choose between erlang and clojure for concurrency currently, so that article should be a big help. thanks
17:29m1dnightI had a LOT of fun writing Erlang! :) But clojure has a more modern feel to it. I can't put it into words :p
17:30devnhow do people just run a .clj file as a script (basically relying on whatever clojure version that's bundled with lein)?
17:30technomancydevn: lein run -m clojure.main/main myfile.clj
17:30technomancy(is one way)
17:30gfredericksdoes anybody know if core.matrix is extensible wrt scalars? or does a new scalar type require a new matrix impl?
17:31gfrederickswhat I want in particular are complex scalars
17:31technomancygfredericks: have you tried using SBT?
17:31devntechnomancy: thanks -- didn't want to have to grab lein-oneoff or something
17:32muraikim1dnight: that's good to know, and also the sense that I got. I've also considered elixir, but I'm not sure if it's ready yet, and it seems like I'd also have to learn erlang anyways to really take advantage of the ecosystem
17:32technomancydevn: the downside is that will work differently if invoked from a project directory
17:33gfrederickstechnomancy: haven't heard of that
17:33gfredericksnor is google helpful
17:34hiredmangfredericks: scala joke
17:34hiredman(scala build tool)
17:34gfredericksit all makes sense now
17:34gfredericksI should expect technomancy to make jokes about build tools.
17:34technomancylots of complicated scalars there!
17:35technomancycomplex
17:35technomancywhatever
17:35technomancycomplected
17:35gfrederickshey technomancy so three build tools walk into a bar
17:36gfredericksno they don't.
17:37amalloyhiredman: is the s in sbt scala? i thought it was supposed to be simple
17:37hiredmanwhichever
17:37gfredericksor smalltalk
17:37gfredericksor sea++
17:37dbaschamalloy: scala was supposed to be simple
17:38dbaschor maybe it wasn't
17:38justin_smithif it was, that reflects badly on their design skills
17:39gfrederickswhat does it take to get `lein repl` to use a forked version of nrepl?
17:39dbaschI would have called it Javaskell
17:39technomancythat joke works better with a non-rhotic accent, so sorry all non-commonwealth persons
17:39justin_smithhaskpresso
17:41m1dnight:D
17:41cflemingmichaelr524: The next drop of Cursive (in a day or two) has a panel to configure your keybindings in one go.
17:41m1dnightIf Hitler ever made a programming language, I think it would Haskell
17:41m1dnightI just tried Cursive, but the formatting is WAY off :p
17:42m1dnight(formatting of source)
17:42dbaschHa ࿕kell
17:42cflemingmichaelr524: It has two sets, basically what I use (see https://cursiveclojure.com/userguide/paredit.html) and Emacs
17:42cflemingm1dnight: What are you seeing with formatting?
17:42cflemingm1dnight: There are various options.
17:43m1dnightParts that hav too much tabbing. A manual indentation, with a tab too much, followed by a format did fix it though
17:43m1dnightmight be because I edited in emacs
17:43cflemingm1dnight: Can you show me an example?
17:43michaelr524cfleming: Great! Thanks :)
17:45m1dnightlet me look it upt cfleming it's a few commits back
17:45cflemingm1dnight: Thanks - a few people have mentioned this when starting with Cursive but I've never seen an example.
17:52gfredericksso I see tools.nrepl is included with leiningen's :base profile; does that mean the only way to exclude tools.nrepl is to somehow exclude the :base profile?
17:53gfredericksor is there some special merge feature I'm unaware of?
17:53technomancygfredericks: it should defer to nrepl in :dependencies if one is present
17:54technomancyoh, unless you're changing the group-id?
17:54technomancyin that case you can shadow :base by putting :base {} in project.clj
18:01gfrederickshmm
18:01gfredericksokay
18:01gfredericksI guess a local install with the same group ID is probably easiest
18:01gfredericksalthough none of these options in :base look too crucial
18:02technomancygfredericks: hm; oh right you would lose some other :base things
18:04user9865anyone around?
18:04technomancynope
18:05justin_smithuser9865: if you have a question you can go ahead and ask
18:06user9865Persistent data structures - can they be shared safely between threads outside STM?
18:06justin_smithif used as intended, yes
18:06hiredmanof course
18:06hiredmanby definition
18:07hiredmanthey are immutable
18:07user9865so what is the point of refs? Safe update of a single reference ?
18:07jeremyheileryes
18:07hiredmanuser9865: I recommend rich's "our we there yet talk"
18:08justin_smithrefs are a reference to an immutible datatype - the ref changes, the data it points to does not
18:08user9865OK i see - threads can share PDS's but single ref updates have to be co-ordinated
18:08hiredmanI would also pretty much recommend ignoring the stm
18:08m1dnightSimply put: if you "change" a data structure in clojure, it tries to share as much with the original as possible
18:09hiredmanuser9865: they are by definition coordinated
18:09m1dnightif you cons 1 to '(2 3 4) you have a pointer to a list that starts with 1, but '(2 3 4) are shared.
18:09m1dnightCorrect me if im wrong
18:09user9865yep that is as I understand it
18:09noonianyep, and all the core datastructures work that way
18:10user9865@midnight - why ignore STM ?
18:10hiredmanI am pretty sure I said that
18:10user9865yeah sorry you did
18:10hiredmanin practice the stm doesn't really get used
18:11hiredmanit of course depends a lot on what you are doing, maybe if you are writing a big simulation or something you may use refs
18:11technomancyuser9865: most state change is either trivial (no need for coordination) or cross-server, where STM doesn't help
18:11noonianuser9865: the 'ref' reference type uses the stm but you usually don't need that level of coardination between multiple mutable refs, most clojure programs have 1 or maybe 2 mutable things in them if any
18:11gfredericksI used refs once and it was almost as a joke
18:11hiredmanbut generally you might use an atom here or there
18:13user9865ok i can see why refs wouldn't be used much if you have PDS's anyway - the book i am reading made a big deal of them though
18:13technomancythey are conceptually very cool
18:14gfredericksjust like erlang
18:14technomancythese days almost all server-side software is distributed systems, where thety don't help at all
18:14hiredmanI dunno, most large clojure shops use it for large data processing jobs, the stm just isn't useful there
18:16hiredmanrich's example of the stm is the ants simulation, and in my limited circle I don't know people who write things like that
18:17technomancyif clojure got used for non-server things, STM would get used more I bet
18:18hiredmanwell, thinking about, I think the ants simulation is really a demo, if I was charged with writing such a thing, I don't think I would write it like that
18:19gfredericksmy use was qubit simulation....so that goes with the simulation theme
18:20hiredmanit seems like the best way to run a large scale simulation is to figure out how to formulate it as matrix algebra and turn some fortran library loose on it
18:20hiredmanso I dunno
18:20vIkSiThello all
18:21vIkSiTin a clojurescript om app, I'm getting an issue using transact! and update!
18:21vIkSiThttps://gist.github.com/viksit/ffe8a79a50e84f623128
18:21hiredmanan important thing to realize though is the STM is just refs, the other reference types are not part of the stm (agents are slightly coupled, but entirely useable without it)
18:21vIkSiTUncaught Error: No protocol method ITransact.-transact! defined for type cljs.core/Atom: [object Object]
18:21noonianvIkSiT: you need to use transact! and update! on a cursor that Om passes your component, not on the atom itself
18:21vIkSiTDo you guys know what I'm doing wrong?
18:21hiredman(not that I really use agents for anything either)
18:22vIkSiTnoonian, ah - how do I simulate what om passes?
18:24noonianvIkSiT: are you trying to use Om? or just update your atom?
18:25vIkSiTnoonian, well, I'm using Om.
18:25vIkSiTI'm just trying to also figure out what's different in doing (om/root timeline-view timeline-state {:target (. js/document (getElementById "main"))})
18:25vIkSiTvs updating it myself
18:26vIkSiThow does that cursor get formed, exactly and how do I simulate to test whether it works?
18:26noonianvIkSiT: thats my one gripe about Om, if you want to have toplevel things affect toplevel app state you need to do some hacks to make the root cursor available
18:26vIkSiTbecause right now, I haven't figured out yet how to write an om component with the Irender and whatnot
18:26vIkSiTnoonian, ah :/
18:27vIkSiTnoonian, what kind of hacks? any documented ones/I can read about somewhere? gists?
18:27noonianvIkSiT: your timeline-view in that example will get passed a cursor that looks and acts like app-state that you can transact! on
18:28vIkSiTnoonian, right- but right now, that (get-posts function isn't integrated into my view
18:28vIkSiTsince I haven't quite figured out the lifecycle yet
18:28vIkSiTI know I need to do a reify (IWillMount (..)))
18:29vIkSiTbut still hacking through that hehe
18:29vIkSiTI figured if I call (get-posts) before
18:29vIkSiTatleast my app state is populated
18:29vIkSiTand my view will render it
18:30noonianyeah, i can't help more right now; at work, but i usually use core.async to coordinate, a simple hack for testing would be in your views IWillUpdate lifecycle protocol store the root cursor in a top level atom
18:31vIkSiTah
18:31vIkSiTk thanks. Will check
18:57theseb2 newb questions....1. Why/how does clojure use brackets?...[] ....I thought there was an unspoken law that lisps had to only use parens?!? 2. Does Clojure have wrappers to call Java functions?...I don't get how that works since Java functions are in a different language
18:57thesebany help appreciated
18:58hiredmanclojure compiles to jvm bytecode just like java does, so clojure can emit the same jvm bytecode for a method call as java to call a java method
18:59hiredmanclojure has more data structure literals than traditional lisps and uses them as part of its syntax
18:59hiredman[] for a vector, {} for a map, #{} for a set
18:59thesebhiredman: thanks..but by allowing brackets doesn't that interere with desire to have code and data look the same?
18:59technomancyschemes use square brackets too; the "parens are the only true form of homoiconicity" is a CL trope
19:00hiredmantheseb: how so? vectors are both valid code and data in clojure
19:00hiredmantechnomancy: being scheme it of course depends on the scheme
19:00technomancyhiredman: hm; I thought it was in r5rs
19:00thesebhiredman: ok....so they at least only allow parens, brackets and braces..at least they kept the deviations to a minimum
19:00technomancybeen a few years so I could be thinking of something else
19:01technomancytheseb: there's no "deviation"
19:01thesebhiredman: and lastly how call Java libraries from Clojure?
19:01hiredmantechnomancy: could me I just read stuff that refers to old schemes
19:01technomancydata structures are valid code
19:01hiredmantheseb: checkout clojure.org or one of the many tutorials on the internet that google can find for you
19:01technomancythough I guess you don't see any core macros using sets; you could certainly write your own
19:02thesebok thanks
19:03hiredmantechnomancy: well, you don't have to use them in a macro to be code, a literal is code
19:06noonianthey probably don't use set syntax for code because the # makes it uglier than the other literals available
19:07technomancyit would scare away those with perl allergies
19:07hiredmancode that evaluates in an undefined order is weird
19:07hiredman(which is technically true of maps to, but array maps sort of get around that)
19:07hiredmantoo
19:17vIkSiTeeh
19:17vIkSiThow do you guys parse json in clojure?
19:17vIkSiTusing transit?
19:17amalloycheshire
19:17vIkSiTah
19:18vIkSiTamalloy, cheshire vs transit? any thoughts?
19:18justin_smithtransit is a whole other thing. It isn't a json parser.
19:18noonianthank god transit came out, it was getting rediculous not being able to parse json :P
19:19vIkSiThehe
19:19hiredmantransit is a new set of formats above and beyond json
19:19hiredmanchesire is a json parser
19:19justin_smithvIkSiT: data.json comes with clojure, but many of us prefer cheshire
19:19hiredman(as is clj-json and data.json)
19:19dbaschibm needs to come up with transitx
19:19technomancyjustin_smith: "comes with" clojure?
19:19vIkSiTah hmm
19:19vIkSiTI didn't realize data.json was included?
19:19technomancyvIkSiT: it's not
19:20vIkSiT*whew*
19:20justin_smithtechnomancy: oh, I was wrong about that
19:20vIkSiTof course, I wish it was :)
19:20dbaschvIkSiT: use cheshire
19:20justin_smithcheshire is better anyway, yeah
19:20noonianyeah, it's named after a cat
19:21justin_smithand would you believe, it handles smile data?
19:21vIkSiTah
19:21vIkSiTthanks for the info!
19:23vIkSiThaha
19:24vIkSiT*small problem* - clojurescript vs clojure. sigh
19:24vIkSiTI forgot I was writing clojurescript.
19:25dbaschvIkSiT: in that case just use the native js parser
19:30technomancyaka eval
19:32dbaschwell, it's eval after verifying that's it's actually json
19:32dbaschotherwise the web would be a horrible(r) place
19:34dbaschI'm convinced that all the unnecessary json generation/parsing we do is one of the root causes of global warming
19:42{blake}I'm having trouble figuring out dependencies.
19:43{blake}I've got a rather complex project with many files. One of them :requires clj-time.core (for example).
19:43{blake}But I don't have clj-time (anything) in my project.clj.
19:43justin_smith{blake}: lein deps :tree
19:44{blake}justin_smith Well...that's...a thing.
19:44hiredman{blake}: that is bad, if it works at all it is because some other dependency you do depend on is pulling in clj-time, so you are getting it transitively
19:45{blake}hiredman, aha...so that actually answers all of my questions. Since the next one was going to be: "Not only is it not in the project.clj, the version being used is horribly out-of-date."
19:45hiredmanyou should not directly depend on (via require, etc) any code that lein thinks you only transitively depend on
19:45{blake}There it is...it's in compojure.
19:47{blake}Boy, does that seem bad. I can use different versions in the same code I presume.
19:48hiredmancan't
19:49{blake}hiredman, Well, that seems like a problem. I need a newer version but rely on code that uses an older version?
19:50hiredmanwell, if the api hasn't changed, you can tell lein to ignore compojure's dependency and then specify your own dependency
19:50technomancyor if the API has changed only in additive ways
19:50hiredmanright
19:51hiredmanif not then that won't work
19:51{blake}I think it's only additive. If I specify a particular clj-time in the project.clj, that'll override?
19:52technomancyyeah, direct deps win over transitive ones
19:52hiredmanI'd suggest using :exclude too
19:53hiredmanyou could upgrade your version of compojure, it doesn't look like clj-time is in the project.clj for the latest
19:53amalloyit seems pretty weird for compojure to depend on clj-time anyway
19:54hiredmanyeah
19:54{blake}hiredman, To exclude...? And, actually, I'm not sure why compojure is in this project at all. It might just be a leftover. (Old, large project, never refactored.)
19:54hiredmanI am trying to figure out when compojure ever depended on clj-time, and I don't see that anywhere
19:55justin_smith{blake}: was clj-time being used directly by compojure, or by one of compojure's deps?
19:55hiredman{blake}: then rip it out
19:56{blake}compojure 1.1.5 used ring/ring.,core 1.1.7, which in turn used clj-time 0.3.7, if I'm reading this correctly.
19:57amalloy{blake}: yep, sounds right to me
19:57justin_smithit's pulling it in for calculating intervals and seconds in cookies
19:57justin_smithhttps://github.com/ring-clojure/ring/search?utf8=%E2%9C%93&amp;q=clj-time
19:57amalloyin fact latest compojure still depends on clj-time transitively
19:58hiredmanah
19:58hiredmanI assumed "it's in compojure" meant "compojure directly depends on it"
19:58{blake}Muchas gracias, clojuros. Very educational.
19:59{blake}hiredman, apologies for the imprecision.
20:01hiredmanI should have known better than to assume, and it didn't really matter anyway
20:02{blake}Is there any way to tell from inside a repl what version of a lib you're using?
20:02gfrederickssorta
20:02gfredericksit takes a lot of fumbling
20:02amalloy{blake}: not really. library versions don't exist at runtime
20:03{blake}Bummer. I notice there seems to be some sort of lag between Cursive and...well, things NOT Cursive. It can be very confusing.
20:04hiredmanthe dependency stuff comes from maven, which lein grafts on top of clojure with a lot of other stuff
20:05{blake}And lord knows, I'm grateful. They keep threatening to make me go back to Ruby, and I get the cold sweats thinking about gemsets.
20:05hiredmanif you are new to clojure a good 50% of what you think of as clojure is behaviour from lein and not "clojure" per se
20:06{blake}hiredman, Very true. I picked that up pretty fast, I think.
20:07{blake}(It's probably the only thing I've picked up fast in Clojure. That and the REPL.)
20:08{blake}See, now I've got clj-time/core 0.8.0 in my app, and it knows all the functions up to line 599.
20:13dbaschcompojure depends on ring which uses clj-time only for cookies
20:14justin_smithdbasch: as I showed with my above github link
20:14dbaschyes, that's what I was looking at. Was I typing out loud again? :P
20:52vIkSiThmm
20:52vIkSiTI think I'm missing something here : https://gist.github.com/viksit/8079734bf051ee1a435f
20:52vIkSiTwhat's wrong with this JSON?
20:53irctc,(time (repeatedly 10000 (vec 0)))
20:53clojurebot#<RuntimeException java.lang.RuntimeException: Unable to convert: class java.lang.Long to Object[]>
20:54irctc,(time (repeatedly 10000 #(vec 0)))
20:54clojurebot#<RuntimeException java.lang.RuntimeException: Unable to convert: class java.lang.Long to Object[]>
20:54justin_smith,(do (time (repeatedly 10000 (vector 0))) (time (doall (repeatedly 10000 (vector 0)))))
20:54clojurebot"Elapsed time: 0.046326 msecs"\n#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>
20:55justin_smith,(do (time (repeatedly 10000 #(vector 0))) (time (doall (repeatedly 10000 #(vector 0)))))
20:55clojurebot"Elapsed time: 0.123552 msecs"\n"Elapsed time: 11.683289 msecs"\n([0] [0] [0] [0] [0] ...)
20:55justin_smithit's 100 times faster when you don't realize it
20:55irctc,(time (doall (repeatedly 10000 (vector 0))))
20:55clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>
20:56mdeboardAnyone using Cursive with IntelliJ?
20:56irctc,(time (doall (repeatedly 10000 #(vector 0))))
20:56clojurebot"Elapsed time: 4.741657 msecs"\n([0] [0] [0] [0] [0] ...)
20:56mdeboardI'm curious if it's possible to start a new Clojure project somehow with it, and I'm just missing something
20:57amalloyirctc: please /msg clojurebot any test expressions you aren't intentionally making public
20:58irctcthanks
20:58amalloyvIkSiT: that's not json, it's an object. json is a string representation of a javascript object
20:58dbaschvIkSiT: you're assigning an object to a variable
20:58dbaschthere's nothing to parse
21:00irctci think clojurebot is ignoring me :(
21:00irctcoh, nm, new window
21:04thesebis clojure authore some kind of lisp genius? he had strong options about mutability and concurrency.....most people don't even know what those terms mean let alone know enough to go their own way in lang development?!
21:04thesebs/authore/author
21:04dbaschmost people don't create programming languages
21:05cflemingmdeboard: Yep, what's up?
21:05thesebdbasch: is clojure getting the love from clispers and rest of lisp community?
21:05thesebdbasch: it seems to attempt to solve a lot of gripes people have with lisp
21:05cfleming{blake}: What is the problem you're seeing with lag?
21:06mdeboardcfleming: Trying to sort out how to start a new project but I see that they recomend just doing lein new
21:06dbaschtheseb: clojure is obviously quite popular within the list community for several reasons
21:06dbaschs/list/lisp
21:07cflemingmdeboard: Right (I develop Cursive) - there's no way to create a new lein project from within Cursive right now, sorry
21:07dbaschbut also pretty much everyone who has had to deal with concurrency has strong opinions about concurrency
21:07mdeboardit's no problem
21:07mdeboardjust wanted to make sure I wasn't missing something
21:07thesebdbasch: is there any reason lispers would *not* love clojure?
21:07cflemingmdeboard: No, there's an issue out there about it and it's on at least one to-do list
21:08mdeboardcool
21:08mdeboardI'm coming from emacs and stuff so this is pretty normal workflow
21:08mdeboardto me
21:08justin_smiththeseb: it's not common lisp, it has syntax and symbols that common lisp does not use
21:09dbaschtheseb: perhaps the fact that it hard to use clojure properly without having some knowledge of java and the jvm
21:09justin_smiththeseb: when I first started using clojure I found the many differences from other lisps annoying (now I love them)
21:09cflemingmdeboard: Ok great. Let me know if you have any issues.
21:10dbaschespecially if you need to optimize for performance
21:11mdeboardseems awesome. emacs is pretty flakey on Windows (for me anyway) so I'm looking for a way to work on projects when I'm playing a game or watching Netflix (I do neither on Linux). And I've heard great things about Cursive
21:12cflemingmdeboard: Great, glad to hear it! Windows support is one of the reasons I want to be able to create a project from within Cursive actually, since people often aren't as used to using the command line.
21:13mdeboardyeah, no doubt
21:13mdeboardI assumed it was like a pretty easy thing to build into a plugin for IntelliJ since "Create Project" is right there on the splash page
21:13mdeboardbut I guess not
21:15dbaschthis is somewhat offtopic, but I went back to my kinesis Keyboard a few days ago and I'm trying to figure out a layout for the modifier keys that works well with emacs as well as the rest of osx. Suggestions welcome.
21:16mdeboardcfleming: cursive was mentioned at strangeloop in the typed clojure talk actually
21:16mdeboardas adding support or some such
21:17cflemingmdeboard: Yeah, there's some preliminary support in there I added recently. There's no doc for it yet unfortunately.
21:18cflemingmdeboard: If you're interested, you can type check your current ns using Tools->REPL->Type check current NS
21:19mdeboardoh I don't use typed clojure whatsoever
21:19mdeboardbut the talk was interesting
21:19cflemingmdeboard: Errors are marked in the editor and so forth.
21:19cflemingAh, ok
21:19cflemingYeah, I haven't watched it yet
21:19mdeboardbtw do you have a theme besides darcula you use? Too much orange
21:19mdeboardI have an orange house with an orange window. Orange is the color of all that I wear
21:20amalloymdeboard: you can also run emacs in a linux vm, if don't want to learn a new editor
21:20mdeboardamalloy: naw I like IntelliJ actually, I have the emacs keybinds all set up and so forth
21:20cflemingmdeboard: I'm old school, I have black on white. You can get a lot of themes (solarized etc) around.
21:20amalloycfleming: old school is black on white?? i think you mean orange on black
21:21amalloymdeboard: i tried the emacs bindings for eclipse, and found myself in a kind of uncanny valley where some things worked well enough to make me surprised and angry at the millions of things that didn't work at all
21:21cflemingamalloy: Or green on black, I guess. But all the cool kids seem to be on some kind of dark theme these days.
21:22amalloycfleming: i do use green on black for my terminal, although i think orange predates it a bit
21:22amalloya nice solid 0000FF on 000000, no compromises
21:22amalloyerrrrrr, 00FF00
21:24dbaschanything but a black background would destroy your monitor quickly back in the day
21:25amalloyinteresting. "An amber screen was claimed to give improved ergonomics, specifically by reducing eye strain; this claim appears to have little scientific basis." i remember my dad telling me this is why he bought amber screens instead of green for the house
21:25dbaschthe first monitor I bought looked like this http://cdn.arstechnica.net//wp-content/uploads/2012/06/s_p_11716_1__49099_zoom.jpg
21:25dbaschit was significantly nicer than green
21:26amalloydbasch: that's what i grew up around; i was far too young to buy them, but not so young that i don't remember them
21:26dbaschI went from a color tv to that, and it was much more tolerable
21:27cflemingamalloy: Yeah, 0000FF on 000000 might be a bit subtle - only for those really dark coding caves
21:31thesebsay...clojure uses first and rest instead of car and cdr.....how does it access the SECOND element of a cons cell....does it is use rest?
21:31thesebthat is only place were rest seems awkward
21:32justin_smith,(second '(0 1 2))
21:32clojurebot1
21:32justin_smithor do you mean in terms of implementation?
21:32thesebjustin_smith: does clojure have cons cells like (a . b) ?
21:33thesebjustin_smith: how would you access the b?
21:33justin_smithno
21:33thesebjustin_smith: whoa...clojure hides the list implementation details of cons cells?
21:33thesebjustin_smith: i'm interested
21:34thesebjustin_smith: i personally wrote a list that hid that...i'm intrigued that clojure author avoided cons cells too
21:34justin_smith,(type (cons :a nil))
21:34clojurebotclojure.lang.PersistentList
21:34justin_smiththe source is open, if you want to check out how it was done
21:34mdeboardcfleming: Only thing I've bumped into so far is that some of the default keybinds (Ctrl-W for example) bump into emacs keybinds. You mention this somewhere in the docs, but I'm not sure how/where to modify this. Can you point me in the right direction?
21:35dbaschtheseb: it's an interface called ISeq that has many different implementations
21:35justin_smiththeseb: cons is not as primative and universal in clojure
21:35mdeboardmeaning, you explicitly address the "shipping default keybinds is hard because of conflicts" issue in the docs
21:35justin_smiththeseb: we use many different data types, without building them out of conses
21:35dbaschtheseb: more detail here: http://clojure.org/sequences
21:35cflemingmdeboard: Right - there's actually a new panel coming in the next build to help with setting that up.
21:35thesebjustin_smith: for *years* i've hearing in lisp docs about how lisp are "really conses"
21:36cflemingmdeboard: You're using emacs bindings, right?
21:36mdeboardoh, keymap, derp
21:36mdeboardYeah
21:37cflemingmdeboard: Yeah, it's under Settings->Kemap. Cursive actions will take precedence in Clojure settings, so you should only have to rebind the built-in actions that your keybindings conflict with.
21:37justin_smiththeseb: many data structures in clojure are not lists, and are in no way made of lists. It ends up being pretty useful to do things that way.
21:38mdeboardcfleming: The list of keybinds under the Cursive section is pretty small-ish, are the Ctrl-W/Ctrl-P etc. binds under Editor actions
21:38dbaschtheseb: probably one of the nicest features of clojure is the data structures and the functions to interact with them
21:38mdeboardIf this is annoying doing tech support like this let me know :P
21:38cflemingmdeboard: Hehe, no worries. Check the bottom of the page here: https://cursiveclojure.com/userguide/paredit.html
21:39cflemingmdeboard: There are a couple of groups, the easiest way to find them is from Main Menu in the tree.
21:39mdeboardahso
21:39cflemingmdeboard: The REPL commands are all under Tools->REPL
21:40vIkSiTamalloy, dbasch - yeah, I realized that - something in the way I'm returning json data I guess
21:43mdeboardcfleming: aha! great re: the docs nestled at the bottom there. May be worth breaking out into a "Keyboard Navigation" section in the docs or something.... maybe. With all the time I'm sure you have
21:43mdeboard:P
21:43cflemingmdeboard: haha, I'm lounging in a hammock with a cocktail right now.
21:44cflemingmdeboard: Amazingly I actually have updated those docs for the next drop, which has the new config panel
21:44mdeboardwell look at you
21:44mdeboardwith your cocktails
21:44mdeboardand your hammocks
21:45cflemingmdeboard: Sadly it was a total lie
21:46mdeboardgood
21:46mdeboardMisery loves company
21:48raspasovLightTable vs cursive - opinions?
21:48mdeboardcursive
21:49mdeboardlighttable will be abandonware eventually
21:49mdeboardif it's not already
21:49mdeboardraspasov:
21:49raspasovok 0:1, more takes? :)
21:49justin_smithcursive
21:49raspasov0:2 :)
21:49justin_smithoh, I know the right way to do this
21:49justin_smith(inc cursive)
21:49lazybot⇒ 1
21:50raspasovLOL
21:50cflemingraspasov: I'd say Cursive but I develop it, so that's worth half a point at best
21:50raspasovoh, haha lol
21:50raspasovok 0:2.5 :D
21:50mdeboardraspasov: I'm basing my comment on http://www.chris-granger.com/2014/10/01/beyond-light-table/
21:50justin_smithcfleming: raspasov: the fact that the developer of cursive is here talking to users about bugs, docs, and features and the developer of lighttable is not is worth ∞ points.
21:50mdeboardwell
21:50mdeboardnow let's be fair
21:51mdeboardchris was a fixture in here for a long, long time
21:51justin_smithOK
21:51mdeboardbut, yeah, in practical terms...
21:51cflemingIt's actually a shame LT is gradually becoming abandonware, it had some nice ideas I think
21:52cflemingIt's still great for getting started with Clojure
21:52mdeboardYeah, that's what I heard on all points
21:52cflemingFor something like ClojureBridge it's probably still really good.
21:53mdeboardYeah I need to test that hypothesis
21:53cflemingBut I think a lot of the live-REPL ideas don't work so well once you have more complex code with state etc.
21:53mdeboardMy girlfriend is going to the next cljbridge down here in Austin, whenever it is, wonder what they recommnd editor-wise
21:53cflemingI'm still planning to implement painting REPL results in the editor at some point, but I need to inc my swing-fu
21:54raspasovcfleming: what do you mean painting REPL?
21:54mdeboardjustin_smith: Actually the creator of light table IS in the channel :P
21:54raspasovlike color the REPL output?
21:55justin_smithmdeboard: OK
21:55cflemingraspasov: No, Light Table's main selling feature is that the REPL is not in a separate editor pane like in Cursive or Emacs, when you evaluate things in the REPL the result is shown right in your editor.
21:55cflemingraspasov: Along with intermediate results like let-bindings and so on.
21:55mdeboard:(
21:55justin_smithmdeboard: my point was more about activity / responsiveness of the main developer, long term future of the tool, etc.
21:56raspasovcfleming: yea I know... not sure if I really see the benefit of that past the fact I have to click-erase that damn bubble in the middle of my page :)
21:56justin_smithin case that wasn't clear
21:56mdeboardjustin_smith: I understand
21:56mdeboardtext chat, easily misunderstood, etc., etc.
21:56cflemingraspasov: Yeah, it's not so useful to have them sticking around long term - I guess it should be easy to clear them though
21:57raspasovcfleming: are you the guy responding on Twitter as well?
21:57mdeboardI think ReactJS/Om would lend themselves quite well to live-REPL'ing, if done right
21:57cflemingWatches were also an interesting idea, but I heard they didn't work very reliably
21:57cflemingraspasov: Yup, that's me.
21:57mdeboardsince there's a "football" of state that's being handed off from component to component (in the worst case)
21:58raspasovcfleming: cool! are you doing cursive by yourself? in any case, keep up the good work!
21:58mdeboardin the... what's the word, pathological case?
21:58cflemingraspasov: Yep, it's just me, right now at least.
21:58raspasovcfleming: I would definitely be a buyer whenever it's ready
21:59mdeboardwell-behaved React & Om applications don't pass state around that much at all
21:59mdeboardcfleming: what, I thought cursive was a biz
21:59cflemingraspasov: Great, that's the best way to make sure it stays maintained :-)
21:59mdeboardlike you had multiple people maintaining
21:59cflemingmdeboard: Yup, I set up a company the other day and everything.
21:59mdeboardoh, wild
21:59cflemingBut it's a small company of one.
22:00mdeboardSo I know nothing about IntelliJ-as-a-platform development, I assumed it was like WordPress, and that the people (!) behind Cursive were in a company that did multiple plugins as their source of revenue
22:00mdeboardapparently not
22:01cflemingmdeboard: No, Cursive is kind of unique actually, no-one else who isn't jetbrains is charging for plugins.
22:01raspasovmdeboard: not at all, anyone can make I plugin I believe
22:01cflemingmdeboard: There's quite a lot of unknown around how that will work, but I'm optimistic.
22:01mdeboardWell yeah but anyone can make WordPress themes/plugins too, but there's an industry around it etc
22:02cflemingAnd I'd like to branch out into more plugins once Cursive is stable if there's a market and time allows.
22:02cflemingOCaml, Julia or Rust, maybe - there are already OSS plugins for Go and Erlang
22:02mdeboardSeems like best bet might be to find some wealthy entity out there who would benefit from wider Clojure adoption?
22:03mdeboardElixir
22:03mdeboardThere's a gy working on one of those here in Austin
22:03mdeboardwe were commisserating over syntax highlighting being difficult ot get right (I maintain elixir-mode for emacs)
22:03cflemingYeah, I think Cursive could really help drive Clojure adoption in enterprise, atcually
22:03mdeboarder, s/syntax highlighting/indentation/
22:03mdeboardYa no doubt
22:04mdeboardI am a workaday Python programmer who uses emacs exclusively but PyCharm is pretty sweet.
22:06cflemingYeah, no doubt - I'm a huge fan of JetBrains and their products
22:06raspasovJetBrains rocks
22:07cflemingmdeboard: Interesting, Elixir looks really cool - I've heard a few people talking about it recently
22:07cflemingBut it does look like something you'd have to parse properly rather than regexing
22:07mdeboardYeah it builds on Erlang pretty well. But from a language mode maintainer's perspective, the syntax is so squishy. So many ways to express everything
22:07cflemingmdeboard: Tell me about it!
22:08mdeboardhahaha, yeah I guess preaching to the choir with a lisp
22:08mdeboardbut fortunately Emacs has pretty decent faculty for doing comprehensive indentation handling. It's just a bear to get productive in it
22:09mdeboardIn Cursive is there a command for "Send this form to the repl"
22:09cflemingYeah, formatting code is amazingly hard.
22:09cflemingSteve Yegge talked about it in his article about JS2 mode - it's well worth a read if you haven't read it already
22:09mdeboardYeah, it's one of those things that you never think about. Something as "simple" as triple-quoted strings """like this""" is... so hard.
22:09mdeboardOh man I need to re-read that, been a long time
22:10cflemingYup Tools->REPL->Run form before cursor/Run top form
22:10raspasovmdeboard: you can setup custom key combination for it as well
22:10mdeboardraspasov: do tell
22:11cflemingThat article really brings home how hard it is to retrofit proper syntax analysis to an editor that isn't built for it from the ground up
22:11raspasovfyi I was never a Emacs person - what are some Pro tips for arranging ()?
22:11raspasovthe only thing I know is
22:11mdeboardoh there it is, the thing for the repl keybind
22:12cflemingmdeboard: Settings->Keymap then find the action in the tree under Main Menu->Tools->REPL
22:12mdeboardcfleming: I got it this time, I think I see how the keymap thing is laid outnow
22:13mdeboardraspasov: What do you mean, arranging ()? cider has pretty sensible defaults, and paredit works wonders (though I don't use it)
22:14raspasovI'm talking about the Slurp, Barf, Move Form Up, Down etc
22:16mdeboardoh, I don't know that stuff. I might be the most unproductive emacs person
22:16mdeboardno paredit, no structural editing, etc.
22:19cflemingAnyone here who might be able to help with a test.check problem?
22:20reiddrapercfleming: sure
22:21cflemingreiddraper: You sound like just the man. I'm trying to get the recursive generation working - we exchanged a couple of mails about it on the mailing list.
22:21reiddraperokie
22:21mdeboardAnyone know of a template for liberator projects
22:21mdeboardlein template*
22:22cflemingreiddraper: This is what I have: https://www.refheap.com/91043
22:22mdeboardhttps://github.com/flyingmachine/liberator-templates
22:22mdeboardOh this isn't what I need at all.
22:23cflemingreiddraper: primitives and (compound primitives) work fine
22:24cflemingreiddraper: (gen/sample (gen/recursive-gen compound primitives)) also works
22:24cflemingreiddraper: But I'd like object to generate objects that can recursively contain other objects
22:24cflemingreiddraper: I get an NPE when I try that
22:25reiddrapercfleming: it seems to me that your example should work, and will contain recursive objects
22:26reiddrapercfleming: for example, your refheap example should generate vectors of vectors of nil
22:27cflemingreiddraper: I get this: https://www.refheap.com/91044
22:28reiddrapercfleming: okie, let me try locally
22:28cflemingreiddraper: Thanks
22:30reiddrapercfleming: oh
22:30reiddrapercfleming: you want (def object (gen/recursive-gen compound primitives))
22:30reiddrapernot (def object (gen/recursive-gen compound object))
22:31cflemingreiddraper: But then will the objects recursively contain other objects?
22:31reiddrapercfleming: yes
22:32reiddrapertry it
22:32cflemingreiddraper: You're absolutely right, they do - thanks!
22:32reiddrapercfleming: no problem
22:35bcmanyone own an ergodox?
22:40scottjbcm: you might want to ask you specific question in, say, #geekhack
22:40scottjbcm: there are people here with ergodox, best to just ask your question
22:46bcmscottj: that was my only question :(
22:46scottjbcm: oh :)
22:47scottjway to troll the ,anyone police
23:08mdeboardidk if any cursive users are still around, but do I have to do anything specific for cursive to know where leiningen is keeping the projects it downloads?
23:09mdeboarde.g. configure Maven settings to know there are jars in C:\Users\matt\.m2
23:09cflemingUmmm, I'm not sure what you mean - are you talking about the libs or the sources?
23:09cflemingmdeboard: You shouldn't have to, Cursive will find them (via lein)
23:09mdeboardah ok
23:10cflemingHow are you setting your project up? Are you importing from your lein project?
23:10cflemingmdeboard: It should Just Work (tm) if you do that.
23:10mdeboardI followed the instructions (I think), everything seems to be going ok. I imported from VCS
23:10mdeboardrepl works and everything, that stuff is ine
23:10mdeboardfine*
23:10cflemingOk, cool
23:10mdeboardjust getting an error notification with the following block of code
23:11mdeboardhttps://gist.github.com/mattdeboard/a93d80c21b28340cd172 ... complaining about the first 'section' there after defresource
23:12mdeboard"section cannot be resolved". I figured it might be because it hasn't processed the defresource macro or some such
23:12cflemingmdeboard: So this is the biggest problem with Cursive - there's no way for it to know what macros are doing.
23:13cflemingmdeboard: I've taught it about a lot of them, and Cursive is built around an extension api that people will be able to use to contribute support for libs they use or write.
23:13cflemingmdeboard: But that's not open yet, it's not totally stable yet.
23:13mdeboardahh ok
23:13mdeboardinteresting
23:14cflemingmdeboard: I keep finding new functionality I have to add to it as I add refactorings and so on, but it's getting there.
23:18mdeboardFor my purposes (I'm in bottom 10% of users easily) I just wanna turn off the error notification :(
23:36cflemingmdeboard: You can do that - Settings->IDE Settings->Clojure->Highlight unresolved symbols
23:43joshuafcole_What's the most idiomatic way to loop through a seq and do side-effecty things that can provide the current index?
23:43joshuafcole_e.g.
23:44amalloymap-indexed
23:44justin_smithjoshuafcole_: dotimes
23:44joshuafcole_(do (map my-fn some-seq (range (count some-seq)))
23:44justin_smithfor side-effecty
23:44joshuafcole_ah, map-indexed is already a big improvement
23:44amalloyjustin_smith: dotimes won't work, unless you want to call (nth mycoll n) and make it O(n*n)
23:45justin_smithahh, right
23:45joshuafcole_thanks amalloy!
23:45joshuafcole_(inc amalloy)
23:45lazybot⇒ 172
23:45justin_smithjoshuafcole_: putting it in a do will ensure none of the side effects happen
23:45justin_smithuse dorun instead
23:45joshuafcole_none of them?
23:45amalloyyeah, indeed
23:45joshuafcole_oh right
23:45joshuafcole_that's what I meant
23:45joshuafcole_that would have been fun to debug
23:46joshuafcole_heh
23:46justin_smithahh, sorry, there was nothing else in the do block - so it would have *maybe* run :)
23:46justin_smithif there was anythinhg else after it, it would be guaranteed not to
23:46joshuafcole_you're right though, I would've just typed do thinking I'd done dorun and been in for a bad time