#clojure logs

2013-12-26

00:01logic_progwhen using cljs with :optimizations :none, where do I get goog.base and all the standard libraries to include ?
00:01logic_prog(I don't want the slow goog closure library to run on every time)
00:11TEttingeryedi: http://blog.malcolmsparks.com/?p=67 might be of interest
00:13yediTEttinger: thanks, will take a look
00:20bitemyappI just created my first Twitter list.
00:23arrdembitemyapp: a what?
00:24bitemyapparrdem: you can add people on Twitter to lists.
00:24bitemyapparrdem: I created one called "Assholes" and the first inductee is @maccaw.
00:25arrdemclassy
00:25bitemyapparrdem: I realized I was juggling too many people in my mental "naughty" list, so I decided to start recording.
00:25logic_prog (compojure.route/resources "/out/goog/" { :root "/public/out/goog/"}) <- how do I make this recursive, i.e. handle /out/goog/bar/foo/test.js -> /public/out/goo/bar/foo/test.js ?
00:25bitemyapparrdem: vidya?
00:25logic_progright now, it seems to only do requests of pattern /out/goo/blahblah.js , where "blahblah" is a file, and does not include a directory within it
00:32logic_progn/m, I'm a dumbass
00:32logic_progit worked
00:34arrdembitemyapp: yeah lemme kill the miner and I'll be down for a game
00:34bitemyapparrdem: doters or dayzers?
00:34arrdembitemyapp: doterz perferred.
00:34bitemyappyou got it.
00:35bitemyapparrdem: mumbur
01:15OneFourSevenAnybody use clojurescript.test?
01:37devnhttps://github.com/weavejester/reagi looks pretty cool
01:38devnspeaking of cool -- hoplon. my favorite thing in clojure land right now.
01:50TEttingerdevn, wow, hoplon does look amazing
01:54sm0kewhats so great about holpon?
01:56sm0ke*hoplon
01:57sm0keeh looks like clojure is not about having simple lightweight libraries anymore
01:57sm0kewe have giant frameworks now
01:57sm0kelike pedestal and hoplon
02:00TEttingerI couldn't really tell how big it is
02:53logic_progin cljs, when using js/WebSocket. -- is there a way to specify a timeout? i.e. the max amount of time allowed for .-onopen to be called before giivng up and saying "fuck it, this doesn't work"
04:15abaranoskyho ho ho!
04:18nones,(def t 100500)
04:18clojurebot#'sandbox/t
04:18nones,t
04:18clojurebot100500
04:19sm0keoh!
04:19broquaintsm0ke: AIUI pedestal is a collection of complementary libraries rather than a big ol' framework.
04:20nones,(ns user)
04:20clojurebotnil
04:20nones,t
04:20clojurebot100500
04:20sm0kebroquaint: collection of libraries + large learning curve = big ol' framework
04:20sm0ke,(defn inc [x] (dec x))
04:20clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
04:21nones,foo
04:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)>
04:21sm0ke,(def inc dec)
04:21clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
04:22nones,(def foo (fn [x] (inc x)))
04:22clojurebot#'sandbox/foo
04:22nones,(foo 7)
04:22clojurebot8
04:22nones,(def inc (fn [x] (inc x)))
04:22clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
04:22sm0keha!
04:23noneswhat about infinite loop?
04:23nones,(def foo (fn [x] (foo x)))
04:23clojurebot#'sandbox/foo
04:23Raynes&(#(recur))
04:23nones,(foo 7)
04:23lazybotExecution Timed Out!
04:23ddellacostawhat are people using to figure out test coverage?
04:23clojurebot#<StackOverflowError java.lang.StackOverflowError>
04:25noneswhat difference between lazybot and clojurebot?
04:25nones#foo
04:25abaranoskyI saw Caribou mentioned on the mailing list. Anyone done any coding with it?
04:25sm0ke, (inc 1) ; ##(dec 1)
04:25lazybot⇒ 0
04:25clojurebot2
04:25nones##foo
04:26nonessmth ##foo
04:26nonessmth ##(foo)
04:26lazybotjava.lang.RuntimeException: Unable to resolve symbol: foo in this context
04:26Raynes&(while 1)
04:26lazybotExecution Timed Out!
04:26sm0kelazybot is faster than clojurebot
04:26sm0ke, (inc 1) ; ##(dec 1)
04:26lazybot⇒ 0
04:26clojurebot2
04:27RaynesI highly doubt that to be true.
04:27RaynesThe network is perhaps faster.
04:27RaynesLazybot does significantly more sandboxing than clojurebot does.
04:27sm0keyep, perhaps network is faster, where have you hosted them?
04:28nones##(def inc (fn [x] (inc x)))
04:28lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
04:28abaranoskyClojure on Caribou just doesn't have the same ring to it
04:28abaranosky... and the acronym wouldn't be as good as RoR either
04:28Rayneslazybot is hosted on a linode.
04:28RaynesIn particular, the same one running 4clojure and refheap.
04:29sm0keand clojurebot?
04:29RaynesI don't actually know.
04:29Rayneshiredman would know
04:30RaynesYou'd have to ping 'em though, I don't think his client sees my messages.
04:30sm0kemay be he's using irssi
04:30sm0kesucks to not have notification
04:30RaynesWell, maybe, but that's not why he doesn't see my messages :p
04:31RaynesHe has had me on his IRC ignore list for approximately 4 years.
04:31RaynesI'm still not entirely certain why, but I was 15 at the time and likely deserved it.
04:31Raynes;)
04:31sm0kehmm wow! when did you even start coding?
04:32ddellacostaabaranosky: I find that the impetus that some have (coming) in (-to) the Clojure community to seek out a monolithic convention-over-configuration web framework is misguided. </rant>
04:32RaynesAround 13.
04:32RaynesHaskell. Was interested in the Diablo 2 hacking community. Never actually hacked a single thing related to that game, but it got me interested for sure.
04:33sm0keweird you started with Haskell? very uncommon choice
04:33RaynesThe guy who essentially sits on top of the blizzhacker kingdom is a Haskell programmer.
04:33RaynesSo I just copied whatever he was doing.
04:34RaynesBecause he was clearly much smarter than me.
04:34sm0keheh
04:34TEttingerso, the issue I had earlier with print-dup and read-string and such? thanks to justin_smith it works for 1d arrays, but now I need to have some way to reconstruct a 2d float array from some source...
04:34sm0kesmart decision
04:34sm0kewhy are you not hacking in haskell anymore then?
04:34sm0keis clojure better?
04:35RaynesI occasionally write Haskell still.
04:35TEttinger(defmethod print-dup (Class/forName "[D") [a out] (.write out (str "#=" `(double-array ~(vec a))))) ;; this works for 1D arrays, but I have no idea how to extend it to 2D
04:35RaynesI just rarely get a good opportunity.
04:35RaynesI don't think Clojure is 'better'. Clojure is nicer to you.
04:36RaynesMakes you feel like a friend instead of a student after a while.
04:36RaynesHaskell mostly just keeps you feeling like a student. Which is great, there aren't a ton of languages with a seemingly endless supply of things to learn from. It's just sometimes you just want a friedn.
04:36Raynesfriend*
04:36TEttingerfriedn works
04:37TEttingerclojure does use edn
04:37RaynesHah
04:37sm0kehmm true. clojure has indeed less barrier to entry
04:37RaynesNot that I ever stop learning things from Clojure ;)
04:37ddellacostaRaynes: nice, I like that explanation. Rings true with my experience (of Clojure, still a Haskell n00b): Clojure is forgiving of my mistakes, and helps me out in important ways that I always appreciate.
04:38abaranoskydellacosta: I've never felt any need for one myself, but am still *slightly* curisou about it... as if maybe I'm missing some line of reasoning
04:39sm0kehmm clojure people are becoming spiritual i see
04:39RaynesWe're just really emotional.
04:39Raynes(I actually sniffled, I am quite ill)
04:39abaranoskygroup hug
04:39TEttingerI LOVE YOU GUYS
04:39ddellacostaabaranosky: yeah, I hear you--that is totally valid. I still feel like I have some obligation to check out Caribou, as it may contain some good ideas. I don't mean to dismiss it out of hand.
04:39Raynesabaranosky: Hah! Bronchitus!
04:40RaynesBronchitis too!
04:40TEttingerhaha
04:40sm0keBrochitijure
04:40abaranoskyddellacosta: I tend to think it has an aweful lot of LoC
04:40ddellacostaabaranosky: Lines of Code? Does it? I haven't even cloned the thing, I'll admit.
04:40sm0kei hate that patch from technomancy for `jure` suffix!
04:40abaranoskymy initial worry is that it is overengineered... but that's just worry.. not founded in experience with th eframework
04:41TEttingerso anyone have any idea on how best to deconstruct/reconstruct 2D arrays into strings?
04:41TEttingerjust mapv vec to deconstruct, then...
04:41ddellacostaabaranosky: yeah. I mean, one thing I've found to be true up to now in Clojure is that concise, "surgically applied" libraries really end up being more productive than larger all-encompassing libs. I end up scraping away cruft to get at the useful parts.
04:41abaranoskyjure suffix is horrific
04:42sm0keare you saying clojure is awful name?
04:42TEttingerhaha
04:42ddellacostacan we agree that it is awkward? I *still* feel funny saying it out loud
04:42abaranoskywhen you're as l33t as Clojure the language you can call yourself whatever you want
04:42ddellacostaI just end up saying "Closure" most of the time.
04:42ddellacostaheh
04:43RaynesWell.
04:43RaynesGood.
04:43RaynesBecause that's how it is pronounced.
04:43abaranoskyyep
04:43abaranoskythey are pronounce the same
04:43sm0keis clojure infulenced by clozure?
04:43Raynesddellacosta doubts himself too much.
04:43sm0keclozure is definitely better!
04:44ddellacostaRaynes: is it? Great. I don't hang out with folks in person (kinda hard being thousands of miles away from conferences/community), so I miss these kinds of things...
04:44Raynesddellacosta: Yes, and REPL is not pronounced as an acronym. I learned this the hard way.
04:44ddellacostaRaynes: well, ya know...there's always a lot to doubt, heh.
04:44abaranoskyRaynes: hehe, that's pretty funny :)
04:44sm0kesince clojure is not tied to just JVM anymore can we call it `closure` instead?
04:45abaranoskyI remember when I first heard someone call SQL "seekwell"
04:45ddellacostaRaynes: ah...yeah, that one I was always too lazy to say as an acronym anyways.
04:45TEttingerjavascript has a j too
04:45sm0kewell clojure is on .net too
04:45sm0kecloj.ure
04:45TEttingeryou mean .jet
04:45ddellacostasm0ke: I thought I remember Rich Hickey stating that part of the reason he chose it was for search-ability
04:45RaynesTEttinger: I'm gonna need you to get off IRC.
04:45RaynesBefore you hurt yourself and those around you
04:45TEttinger:-(
04:46abaranoskyso is Clojure officially mainstream yet?
04:46sm0keyea well python is searchable too.
04:46ddellacostaTEttinger: I don't know the answer to your question, btw, but maybe turn 'em into vectors and pr-str 'em? :-/
04:46ddellacostasorry, I got nothin'
04:46ddellacostaabaranosky: I feel like the answer is no
04:46TEttingeryeah the real problem is constructing the 2d array from a string of sorts
04:47TEttingerI can use #=
04:47ddellacostaTEttinger: huh, is there anything in Clojure like the #js token in ClojureScript? That is a super awesome thing right there.
04:48ddellacostaTEttinger: that could theoretically solve your problem, depending on how your data is structured
04:48ddellacosta...if you were using ClojureScript
04:48TEttingerit's just a 2d array
04:48TEttingerfloats
04:49abaranoskyTEttinger: I don't really undestand your problem spec. If I did, maybe I'd kow how to solve it
04:50TEttingerok uh... so I have a 2D float array in each of a number of maps.
04:51TEttingerI want to be able to pr-str the maps, with everything inside them, then read-string back the string later
04:51TEttingerI can do this for 1d arrays
04:51TEttinger(defmethod print-dup (Class/forName "[D") [a out] (.write out (str "#=" `(double-array ~(vec a))))) ;; like so
04:52TEttingerthe key there is the `(double-array ~(vec a))
04:52abaranoskyI see... and you can't just cheat and store them as vectors?
04:52TEttingerwell I don't really know how to form a 2D array without doing a lot of setting
04:53TEttingerand I do store as vectors I think
04:53TEttingerbut it's the restoring that's tricky
04:56sm0keHey guys, is it possible to have a provided dependency in github and ask travis to build against different versions of it?
04:57sm0keis some doing something similar for their clojure projects?
04:57TEttingerhttp://amalloy.hubpages.com/hub/Dont-use-XML-JSON-for-Clojure-only-persistence-messaging gives some background btw
04:57sm0kesomeone*
04:59ddima,(pr-str (map vec (into-array [(float-array [23.32 42.23]) (float-array [1.3 2.4])])))
04:59clojurebot"([23.32 42.23] [1.3 2.4])"
04:59ddimahm
05:06ddimaslightly OT, but would you recommend a lenovo T530 with the 1080p display? I hate glossy displays, so macbook pro is a no go, but the cheaper displays like on my personal L530 are not very convincing either (dead pixels after 6 months, contrast etc)
05:10abaranoskyddima: you killed the convo with your off-topic stuff
05:10abaranoskyjust messing with you.... I used to hate glossy monitors as well
05:11abaranoskyI've got a macbook pro for work though, and either they have gotten less glossy, or i've gotten more used to it
05:12TEttingerddima, my brother loves his lenovo T series, it is older by a bit though
05:12ddimaabaranosky: I used osx for a couple of years before and now I'm very happy with my 'awesome' setup, so thats another thing
05:12ddimayeah, the older ones are good, but there's at least some criticism of the recent models
05:12RaynesI'd just spray paint nyan cat onto the screen of the macbook pro.
05:12RaynesIt's all you really need to see there anyways.
05:13ddimawell, sorry for killing the cozy emotional moments, please proceed ;)
05:16TEttingerhell yes
05:16TEttinger,(let [data (mapv vec (into-array [(float-array [23.32 42.23]) (float-array [1.3 2.4])])) sz (count data) arr (make-array Float/TYPE sz (count (nth data 0)))] (doseq [a (range sz)] (aset arr a (float-array (nth data a)))) (mapv vec arr))
05:16clojurebot[[23.32 42.23] [1.3 2.4]]
05:16drorbemetHi, I am about to put a batch insert for neo4j REST API together. I have to deal with milions of unique nodes.
05:16drorbemetDoes any body of you know what the current usage of neocons for batch insertions into neo4j is? The functionality of neocons overlaps with the cypher query language for neo4j.
05:16TEttingerwhere's bitemyapp when you need him
05:17TEttingerwait no, I think he uses datomic
05:17TEttingerhm
05:18drorbemetDo I have to let neocons just send cypher strings? Or are there some efficient functions left in neocons to perform batch insertions over REST?
05:19drorbemethere are the pages I am currently looking at ...
05:19drorbemethttp://clojureneo4j.info/articles/populating.html
05:19drorbemethttp://docs.neo4j.org/refcard/2.0/
05:19ddellacostais there a way to COPY with clojure.java.jdbc?
05:19ddellacostaer, without being super user that is
05:19ddimadotemacs: there are batch functions
05:19drorbemetIt's a mix of old and new ways to do the same operations ...
05:21dsrxletting neocons handle cypher strings is how we ended up with prism :(
05:21ddimadotemacs: I think I used nodes/create-batch (couple hundred k)
05:21sm0kedoes lein has docs on what different inbuild profiles are for ? :base :system :user :provided :dev
05:21dotemacsddima: sorry ?
05:22ddimasry, drorbemet
05:22dotemacsah, ok :)
05:24drorbemetdsrx: so, that means I have to put together cypher strings in clojure in order to perform an efficient batch insert?
05:25dsrxit was a bad political joke about the nsa, sorry
05:27drorbemetdsrx: ah ... I think I got you :-)
05:27drorbemetbut anyway I will have to find an answer soon
05:28abaranoskyWhat do you all think of this article?: http://programming-puzzler.blogspot.com/2013/12/frustrations-with-namespaces-in-clojure.html
05:29ddimadrorbemet: http://reference.clojureneo4j.info/clojurewerkz.neocons.rest.nodes.html -> create-batch
05:29abaranoskyI work on very large projects at work, and don't feel any of the pain he is mentioning in the article, so I'm very interested in hearing other peoples' experiences regarding namespaces
05:30ddimaabaranosky: where would that magical place with large clj projects at work we? ;)
05:30ddimabe
05:30abaranoskyddima: Staples Innovation Lab (formerly Runa)
05:31abaranoskywe're in San Mateo, CA
05:32ddimacool. not gonna move from berlin to the us atm though ;)
05:32drorbemetddima: thanks, yes I will have to check that out, I will have to combine it with unique constaints and lables though
05:33abaranoskyddima: I know of at least one Clojure shop in Germany
05:33Cr8abaranosky: I only use it for small things (I'm the only person at work I've convinced.)
05:33Cr8but
05:33TEttingerok, so the method to produce 2d arrays, works. but there's one more hurdle relating to I believe macros
05:33TEttinger(defmethod print-dup (Class/forName "[[F") [a out] (.write ^java.io.FileWriter out (str "#=" `(let [dat ~(mapv vec a) arr (make-array Float/TYPE (count dat) (count (nth dat 0)))] (doseq [a2 (range (count dat))] (aset arr a2 (float-array (nth dat a2)))) arr))))
05:33TEttingerthis gives an error about let needing a vector for its binding
05:33Cr8while I run into a few of these things, I tend to prefer the state of my project after applying the "workaround"
05:34Cr8e.g. avoid the circular namespace problem by having namespaces be small and single purpose
05:34Cr8which they tend not to be when I start, but I get forced to make them so
05:34drorbemetabaranosky: which is it?
05:35ddimaabaranosky: tell us, if thats not a trade secret :)
05:35abaranoskyI forget the name of the place :|
05:35abaranoskylet me see....
05:35Cr8and it actually comes in handy when I get the occasional patch by folks who don't cloj' and they don't have to read/understand as much
05:36ddimaCr8: I managed to convince 3 people without trying to convince by a) showing how much nicer storm topologies are in the clojure dsl b) having a couple of small/understandable export/import tools from hbase, to neo4j etc.pp. and suddenly people started messing with that code
05:36Cr8ddima: I've got our *support team* wanting to learn it ;)
05:36ddimathough, I don't think one necessarily has to convince anybody to do anything
05:36TEttingerawesome guys
05:37abaranoskyCr8: I agree the "workaround" for no cicular dependencies means you end up with a better system design
05:38TEttingerso does anyone know why that code that I pasted would have something other than the shown vector for the binding?
05:38TEttingersomething about ` , which I don't know much about?
05:45Cr8TEttinger: works here..
05:46TEttingeronly on decoding does it fail, Cr8
05:46TEttingersorry should have said this is supposed to yield something that you can read-string
05:46Raynesabaranosky: Do you live in the bay area?
05:47Cr8AH
05:47Cr8I see what you're doing
05:47Cr8TEttinger: so, ` will qualify any symbols inside the quoted form
05:48TEttingerso should I quote dat in some way?
05:48Cr8you probably want a gensym'y thing. Put a # after any names that are local to the `
05:48Cr8,`(let [dat# foo] (do dat#))
05:48clojurebot(clojure.core/let [dat__25__auto__ sandbox/foo] (do dat__25__auto__))
05:48TEttingeruh ok, will do...
05:48Cr8TEttinger: dat, arr, any names that are local to your generated code
05:49TEttingerand when I refer to them?
05:49Cr8a2 I think as well
05:49TEttingerdo I have the # in there too?
05:49Cr8TEttinger: in any place you use them
05:49Cr8yeah, you see above that I used dat# twice, and it got the same generated symbol in both places
05:50Cr8,`(let [dat# foo other# bar] [other# dat#]))
05:50clojurebot(clojure.core/let [dat__50__auto__ sandbox/foo other__51__auto__ sandbox/bar] [other__51__auto__ dat__50__auto__])
05:50abaranoskyRaynes: yeah, I live 30 minutes south of San francisco
05:50Raynesabaranosky: It's 2:48AM.
05:50Cr8where a different name gets a different generated symbol (but again, reusing that name gets the same one, at least inside the same `)
05:50abaranoskyvacation :)
05:51RaynesOnly reason I'm awake is cuz insomnia.
05:51TEttingerhm, didn't help, Cr8
05:51TEttingerIllegalArgumentException dat__243__auto__ requires a vector for its binding in dk.spritecore: clojure.core/let (core.clj:4043)
05:51abaranoskyI regularly stay up this late. For better or worse
05:52abaranosky... I think I like the quiet
05:52TEttingerabaranosky, same here
05:54TEttingerthat' using the messy
05:54TEttinger(defmethod print-dup (Class/forName "[[F") [a out] (.write ^java.io.FileWriter out (str "#=" `(let [dat# ~(mapv vec a) arr# (make-array Float/TYPE (count dat#) (count (nth dat# 0)))] (doseq [a2# (range (count dat#))] (aset arr# a2# (float-array (nth dat# a2#)))) arr#))))
05:57Cr8well this is weird
05:57Cr8if I just paste the output into the REPL it evals alright
05:57Cr8ah
05:58Cr8but not with the #= in front of it
06:01TEttinger,((fn [a out] (.write ^java.io.FileWriter out (str "#=" `(let [dat# ~(mapv vec a) arr# (make-array Float/TYPE (count dat#) (count (nth dat# 0)))] (doseq [a2# (range (count dat#))] (aset arr# a2# (float-array (nth dat# a2#)))) arr#)))) (make-array Float/TYPE 2 2))
06:01clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval28/fn--29>
06:01TEttinger,((fn [a out] (.write out (str "#=" `(let [dat# ~(mapv vec a) arr# (make-array Float/TYPE (count dat#) (count (nth dat# 0)))] (doseq [a2# (range (count dat#))] (aset arr# a2# (float-array (nth dat# a2#)))) arr#)))) (make-array Float/TYPE 2 2) *out*)
06:01clojurebot#=(clojure.core/let [dat__54__auto__ [[0.0 0.0] [0.0 0.0]] arr__55__auto__ (clojure.core/make-array java.lang.Float/TYPE (clojure.core/count dat__54__auto__) (clojure.core/count (clojure.core/nth dat__54__auto__ 0)))] (clojure.core/doseq [a2__56__auto__ (clojure.core/range (clojure.core/count dat__54__auto__))] (clojure.core/aset arr__55__auto__ a2__56__auto__ (clojure.core/float-array (clojure.co...
06:02TEttingeragh
06:02Cr8okay
06:02Cr8I have *no idea why it works*
06:02Cr8but wrapping it with an eval works
06:02Cr8https://www.refheap.com/22231
06:02TEttingeryeah, it's supposed to be read-string'ed
06:02TEttingerbut I didn't guess eval would be needed
06:03Cr8I am not really sure why it is
06:03Cr8,(read-string "#=(let [a 1] a)")
06:03clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
06:03Cr8oh right
06:03TEttinger#= is supposed to read and eval
06:03Cr8anyway that doesn't work
06:04hyPiRion,(binding [*read-eval* true] (+ 1 2))
06:04clojurebot3
06:04Cr8ah
06:04Cr8,(binding [*read-eval* true] (read-string "#=(let [a 1] a)"))
06:04clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/let>
06:04Cr8,(binding [*read-eval* true] (read-string "#=(eval (let [a 1] a))"))
06:04clojurebot1
06:04TEttinger,(binding [*read-eval* true] (read-string "#=(let [x 1] x)"))
06:04clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/let>
06:05TEttingerwhaaaaat
06:05Cr8Ah
06:05hyPiRionyesh, #= is not some arbitrarily function call guys
06:05Cr8AH
06:05Cr8#= doesn't do macroexpansion, for some reason
06:05TEttingerbut I have it doing that in other calls
06:06TEttingerI think...
06:06TEttinger(defmethod print-dup (Class/forName "[C") [a out] (.write ^java.io.FileWriter out (str "#=" `(char-array ~(vec a))))) ;; this works , I think
06:06Cr8,(binding [*read-eval* true] (read-string "#=(inc 1)"))
06:06clojurebot2
06:06Cr8,(binding [*read-eval* true] (read-string "#=(-> 1 inc)"))
06:06clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/->>
06:06Cr8no worky, -> macro doesn't expand
06:07Cr8or.. only expands once
06:07TEttingerahhhh
06:07Cr8it looks like it expanded once
06:07Cr8wacky
06:07TEttingerso either i write it without macros, or use eval
06:07Cr8,(binding [*read-eval* true] (read-string "#=(eval (-> 1 inc))"))
06:07clojurebot2
06:07Cr8works though
06:08hyPiRionhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1019 <- the actual source
06:10Cr8okay
06:11TEttingerCr8, with eval it does work
06:11Cr8so if the thing after #= is a list, and the first element is a symbol, that corresponds to a var that can be resolved in the current NS, it will use that var as a Fn
06:11Cr8on the rest of the read-stuff
06:11Cr8it's not actually an eval
06:11TEttingerok
06:12Cr8#=(eval stuff) is what you want if you want to be able to write arbitrary clojure
06:12Cr8#=(foo ...) won't do you what you expect if foo is not a fn and if ... contains any macros that you expect to expand
06:52ddima"The core problem is that Lisp makes programmers selfish. Giving programmers so much flexibility is inviting the alienation of other programmers; Lispers think: how can I express this problem best, for me?" (http://chrisdone.com/posts/emacs-users-are-like-igor) - here we go ;)
06:56bitemyappddima: sounds about right.
06:59ddimaI'd say attitude comes before the language and remains after that as well - sure, personally everybody does whatever he pleases, but is that really true for well-adjusted non-egomaniac lisp-developers in a team?
07:01ior3knot if you do code reviews
07:01bitemyappddima: simply not using macros goes a long way.
07:01bitemyappif you're doing FP correctly, that'll happen anyway.
07:01ddimaior3k: or feel like your decisions depend upon/affect others ;)
07:01ior3kddima: yes, but even if you don't, there's no way selfish code will pass a code review
07:02ior3ksaying this by experience
07:02ior3kfrom*
07:02ddimabecause ignorance/constant (bad) reinvention of stuff and ignorance towards understandability is also very prevalent with your average 9-5 java dev ;)
07:03ddimaI'm just still wondering about the constant "bashing" on the lispers mindset. I have not been using lisp since the 70s or anything, but isn't that a constant theme: lispers are egomaniacs, dont like sharing, bash on others ;)
07:03bitemyappit's always fun watching people in OOP langs trying to leverage inversion of control.
07:03ddimaand so far with the clojure community this has not been the case at all
07:03bitemyappThat sort of thing is insanely painful if you're not using a nice FP lang.
07:04Cr8ddima: yeah, it's just kind of a conversation stopper
07:05bitemyappddima: hum. the propaganda against lispers is true WRT to Common Lispers
07:05ddimathe only reason I could imagine for this being "true" to some extent is if you'd assume that lisp has mainly been used in academic circles in the past decades - most are just not really interested in coding itself
07:05bitemyappthey're arrogant !@#$s and look down on anything that isn't actually Common Lisp.
07:05bitemyappddima: Clojurians are a bit more social and cooperative, culturally. Flatter, more idiomatic code styles too.
07:06ddimabut it's the same way with python/java/c code from some academics
07:06ddimahm
07:06bitemyappseriously, try talking to somebody like lispm on HN. CLers are fucking insufferable.
07:06Cr8there's more of a pragmatic/practical use focus
07:06ddimabut in a good way, without sliding towards ruby-community "awesomeness" ;)
07:06ddima<duq>
07:07ddimabitemyapp: why do you think that is?
07:07bitemyappClojure's community is nice. It's a good balance of FABULOUSSSSS, practicality, and interestingness.
07:08bitemyappddima: I'm an ex-CLer. We were so much better than everybody else for so long that it went to our heads and stayed that way even after it stopped being the case.
07:08ddimaoh, ok :D
07:08bitemyappyou can do a lot better than CL these days, they just haven't figured it out yet.
07:08ddimabut they are so much better per definition!
07:09Cr8I wrote a bit of CL but I could feel myself becoming antisocial ;P
07:09ddimagoes straight into your head
07:10ddimabitemyapp: I like how for most a default way to start out a java project is to depend on as many spring components as you can get your hands on ;)
07:10bitemyappCr8: CL lends itself to desert island programming where you build some weird alternate universe out of macros.
07:10ior3kddima: I am a full time ruby programmer (would love to move to clojure full time). I can attest there's too much "awesomeness" in the ruby community
07:10bitemyappior3k: too much pop culture and drama, not enough coding.
07:10bitemyapptenderlove is subsidizing like 20% of the practical work that happens in that community.
07:10ior3k"drama" is the keyword there
07:11ddimaior3k: didn't really mean it negatively, have been doing ruby (sometimes even with rails) for a couple of years, but couldnt really bond with all that awesomeness
07:11bitemyappwell the pop culture bit matters too. too many people trying to be "involved" that aren't contributing anything.
07:11ddimaior3k: generally not finding too many things "oh so awesome" ;)
07:11ior3kddima, bitemyapp: agreed
07:12ddimain the end the lack of "serious" libraries like numpy/ntlk etc made me move to python for the greatest part, which i like
07:12Cr8I managed to wield Common Lisp as if it were PHP ;)
07:12Cr8that is, mostly with mudballs of mutable state
07:12ddimawell, then me not writing macros until the pain really becomes bad, seems to be a good approach
07:13Cr8and the only reason anything worked is that i destroyed the world all the time
07:13ior3kwith ruby it feels as if people are still extolling the qualities of horse carriages while clojure people are building rockets
07:14ior3kbut I'm not trying to become a smug clojurian
07:14ddimanice try ;)
07:14ior3kit just feels like a totally different league
07:14ior3kheh, sorry
07:14ior3kI wonder what the right attitude is, though
07:15ddimajust do your thing and dont compare, I'd assume
07:15ddimaI mean, they are probably muuuch better at css and stuff!!11 ;)
07:15Cr8I'd say that the different langs and their communites *value* different things
07:15Cr8or have different sensibilities
07:17ior3kmaybe... I remember what attracted me to ruby at the time was how much better it felt to use ruby over java. But what attracts me to clojure is how it makes much easier for me to build software that works (and that's from very limited experience)
07:18ddimathanks to hickey a lot of stuff seems to be much more thoughtful and motivates to think more in contrast to just spit out code the way one has done 100s of times, especially since many things can be written quickly WHEN a solution is found - that's what it feels like to me. combined with an unspoken love for sucklessness ;)
07:18ddima(not only to him, but I guess his talks helped when bootstrapping the community)
07:19ior3kdefinitely, I think the focus on simplicity is a very important part of the clojure community
07:19ddimathought that's nothing you couldn't pursue in java for example, it's just culture i guess
07:20Cr8well there's something to be said for having sharp tools that are fun to work with
07:22ddimaI was amazed at how quickly and enthusiatically a collegue at ex-work picked up clojure and pimped a tool I wrote without ever having done lisp before and it didn't even look to bad - so I don't buy the elitism/nobody gets it argument anymore
07:22ddimathat was also the reason why I wanted to learn a lisp for the last 10 years but never came far, just a mindset thing
07:23ddimawhich was entirely my fault ofc
07:23ddimaso thanks, dear clojure community, for such a nice tool :)
07:24ddimahave to go and paint some walls with physical tools now ;)
08:05fizrukhello! can I somehow use map as format parameters? e.g. (format "%(name)s %(surname)s" {:name "John" :surname "Doe"}) ?
08:06mdrogalisfizruk: Not that I'm aware of, but that's pretty neat.
08:08justin_smiththat's not far from what a moustache based template engine does
08:09fizrukyeah I think template engine suits better for my purposes
08:11fizruknonetheless in python they have something like "%(name)s %(surname)" % {"name": "John", "surname": "Doe"}
08:12fizrukI think it would be cool to have a similar thing in clojure
08:12mdrogalisYaawn, work the day after a holiday. D:
08:12fizruk(sometimes you don't want a template engine)
08:19atomphilcan you not just use String.format?
08:27fizrukatomphil: I can't use argument names in format string that way, only argument indexes
08:27atomphilah I see
08:35hcumberdaleHi there :)
08:36hcumberdaleGetting this strange error after updating to ring 1.2.1: assoc-conj does not exist
08:37hcumberdaleTried to include [ring/ring-codec "1.0.0"] but it does not seem to be helpful :(
08:40mdrogalishcumberdale: Sounds like conflicting versions of the same JAR on your classpath.
08:40mdrogalislein deps :tree might reveal some trouble.
08:40hcumberdalethx mdrogalis, i'll see
08:41justin_smithfizruk: a slightly ugly version of what you are asking for https://www.refheap.com/22233
08:41justin_smithit works
08:41fizrukjustin_smith: :)
08:42justin_smithoops, the escaping is off
08:42hcumberdalelein clean was the solution :) thx mdrogalis deps :tree displayed the issue
08:44mdrogalishcumberdale: Awesome. :)
08:46justin_smithfizruk: I just fixed the paste, escaping now works https://www.refheap.com/22233
08:48fizrukjustin_smith: thanks!
08:48justin_smithany suggestions of making the above cleaner / more readable welcome
08:49justin_smithI like how searchihg for : in the string creates smileys wearing jaunty hats
08:58Guest85538is it possible to create a macro that returns a java static function call. I have a lot of java static calls like this (Javaclass/method x y z). I would like rename the method in a clojure way but i dont want a performance penality by wrapping each static method in a clojure one. Can I do this with a macro? Like (my-method x y z) => (Javaclass/myMethod x y z)
08:59justin_smithwell, I don't know where it would get JavaClass from in your example
08:59justin_smithbut otherwise, yeah
09:06Guest85538I am tring to make a wrapper for lwjgl. It is full of static java calls with each method residing in tis own class(GL11...GL30,...).So I would like to have one clojure file(lwjgl wrapper) with all the Java impports, and inside a bunch of macros that all they do is translate (my-method x y z) to (Javaclass/myMethod x y z) so I would not have to keep track of all th eclasses. So whenever I would
09:06Guest85538like to use lwjgl I would just have to (:use lwjg-wrapper) instead of having to import all java classes. Or Would I still have to import Java classes where I would use this macros, cuz this macros would just translate, and once a method is translated it would still require a java class?
09:07justin_smithno, if the class is found in the file where the macro is defined that works
09:08justin_smithso you would have a macro that expanded (foo ...) to (GL11/foo ...) and another that expands (foo ...) to (GL30/foo ...) etc.
09:08justin_smiththat seems doable
09:09gfredericksGuest85538: it works because the macro file ensures the classes have been loaded, and then in the expansion the class names are fully qualified
09:09gfredericks,`Long
09:09clojurebotjava.lang.Long
09:09Guest85538nice, can you give me an example how to create such a macro. Like (defmacro gl-gen-buffer [] GL15/glGenBuffers) something like this
09:09gfredericksGuest85538: (defmacro gl-gen-buffer [& args] `(GL15/glGenBuffers ~@args))
09:10gfredericksyou can use some specific arity if you know it, which you probably do
09:10Guest85538nice thanks, I will try it out
09:15Guest85538works like a charm, thanks again
09:20gfredericks~macros
09:20clojurebotBarking spiders!
09:23justin_smithGuest85538: another note is if you are concerned enough about overhead to prefer a macro over function here,, the version that specifies the arguments individually will churn a bit less garbage than the ~@args version
09:24justin_smithalso you can use hinting if there are multiple versions of a static method differentiated by input type
09:25justin_smith(reflection to pick a method is more expensive than function dereference is by far)
09:30mdrogalisBarking spiders lolol
09:30gfredericksjustin_smith: I don't think a variadic macro implies reflection
09:31justin_smithno, a variadic macro implies creating and then throwing away a seqeuence
09:31justin_smithI was pointing out two separate concerns
09:34mdrogalisDoes it imply barking spiders?
09:34justin_smithwe could blame the dog instead
09:38gfredericksjustin_smith: that's at compile-time though
09:38justin_smithtrue
09:40justin_smith... barely resisting the opportunity to snark about clojure load time clearly not being an issue
09:40justin_smithpoint taken though, not a big deal
09:47benediktwhat is the state of clojure on android? last time i tried there was a servere lack of documentation and a lot of library "fungus"
09:52ToxicFrogUnder what circumstances will "lein run" re-use some older compiled version rather than using the source as it exists?
09:53justin_smithToxicFrog: with some lein versions I have found the need to lein clean to avoid bugs
09:57justin_smithI don't really have a full formal description of the problem, but I know "when in doubt, lein clean" seemed to take care of it
10:04ToxicFrogjustin_smith: that sorted it, thanks.
10:05ToxicFrogNow I just need to get error messages out of saturnine that aren't complete garbage
10:06justin_smithGood luck with that. Gigo is a bitch.
10:07ToxicFrogGigo?
10:07justin_smithgarbage in garbage out
10:08justin_smiththe dominant philosophy of error handling in the clojure world
10:08ToxicFrogYeah :/
10:08justin_smith"if the input is meaningless, the output can be meaningless"
10:10ToxicFrogMakes it hard for me to recommend it.
10:11justin_smithI wish windmove and org mode didn't clash :(
10:12justin_smithToxicFrog: I gave up trying to talk anyone into a lisp ages ago
10:12justin_smithI use it, it works for me. Being an advocate is hard work.
10:13ToxicFrogjustin_smith: the thing is, clojure is the first lisp I've really enjoyed using and would like to recommend
10:13ddimajustin_smith: that's also a fundamental principle in natural language processing and statistics ;)
10:14ToxicFrogBut then I have to hedge it with "just be aware that any sort of syntax or runtime error will result in a terminal full of trash with, if you are lucky, the real error in there somewhere"
10:14ToxicFrogWhereas if I recommend, say, Lua, it's a less capable language but the error reporting actually doesn't suck.
10:14justin_smithddima: but this isn't a natural language, we can have heuristics, or strict enough rules to verify the error and report it cleanly
10:15ToxicFrogddima: on the other hand, garbage in to a compiler should at least get it to tell you why it is garbage.
10:15ddimajustin_smith: true, but still, if you fail to do so... ;)
10:15ddimayes, true, true. I just like the saying
10:16ddimathis is for sure one of the rougher aspects, easpecially with lazy seqs
10:16ddima-a
10:16justin_smithalso, I work with audio, and sometimes garbage in, perfection out is even an option (totally outside the programming world now, I am not advocating for perl)
10:17justin_smithddima: yeah, with lazy seqs tracking down where the actual error is can be maddening
10:19ddimajustin_smith: last time i had something like this just a simple indicator that it actually was during realization of a lazy seq would have helped. but haven't digged into the code to see if this can be easily done
10:19ddimacost me like 2 hours of my life
10:21ddimaare there attempts at improving this part (havent checked any roadmaps)?
10:29Guest85538justin_smith: thanks for the tips about the optimization. Do you know any good resource about various optimization tips for clojure?
10:46lnostdalanyone tried running clojure on java 8? how did it work out?
10:47mdrogalislnostdal: I remember Andy tried it a while ago and it worked mostly okay?
10:47mdrogalisThere's a post on the Clojure-dev mailing list about it.
10:48mdrogalis"It failed a few tests involving reflection, which I tracked down to a problem that exists in earlier JDKs, too."
10:48mdrogalis"It also had a few more warnings while compiling one Java source file about the use of the identifier _."
10:48mdrogalis"With both of those applied, latest Clojure master compiles and passes all tests with no more warnings (1) than when using Oracle JDK7."
10:48mdrogalisShould be fine.
10:49lnostdalinteresting, thank you .. i'm gonna give it a spin :)
10:58Tekhne(I'm a newbie to Emacs and Clojure. Trying to learn both.) How can I eval my current Clojure form in my cider REPL? The cider docs kind of assume more Emacs knowledge than I have, so I don't understand.
10:59technomancyTekhne: pick one to learn first
10:59technomancytrying to do both is just going to end in sorrow
11:00Tekhnetechnomancy: Oh, nevermind. I think I figured out my problem. I needed to put my point (cursor?) after the last paren of my form.
11:00Tekhnetechnomancy: ...then do the Emacs command.
11:05mdrogalistechnomancy: Just saw the To the Moon talk.
11:05mdrogalisThat was incredible.
11:12technomancy<3
11:13technomancyglad they got that one posted
11:13mdrogalisYeah, me too. It was moving sitting here watching it myself. I can't imagine the energy in that room.
11:14gfredericksis this about that video jame?
11:15mdrogalisEh?
11:16ior3kEloquent Ruby... I knew I had heard of Russ Olsen before
11:16JampoL.
11:28KahviIslaamilainRaynes, are you there?
11:39shiranaihitohas anyone got experience working with Clojure using Ant (instead of Leiningen/Maven)?
11:40shiranaihitohas anyone got experience working with Clojure using Ant (instead of Leiningen/Maven)?
11:40shiranaihitowhoops.. sorry for the double post
11:42sdegutisWelp.
11:42sdegutisTried my hand at an IDE and got pretty far before I completely lost all steam.
11:42shiranaihitohm? :P
11:42shiranaihitoyou mean instead of Lein? .. or instead of Emacs or something?
11:42sdegutishttps://github.com/sdegutis/leviathan
11:43sdegutisNot instead of anything. Just an IDE.
11:43gdevshiranaihito, yes, I wouldn't recommend it...unless you have to for legacy reasons
11:44sdegutisOh, different conversation. Sorry.
11:44shiranaihitogdev: well, it's just that i'm annoyed by the "Java-baggage" that Clojure has inherited.. for example, I wanted to play with Datomic, and after adding it as a dependency, Lein started exploding with a complaint about commons-codec.. Apparently, the AWS SDK uses codec 1.3, and other stuff depends on 1.6.. so.. there we go
11:45shiranaihitosomeone suggested setting some kind of "exclusion" to circumvent the problem, but that might.. cause some instability issues with whatever depends on commons-codec, or something.. ? i don't really know
11:46shiranaihitothey're all probably just using "codec" for Base64 anyway
11:48shiranaihito.. so, i'm left wondering if i should try using Ant instead, or .. just give up on Clojure or something? :P yeah, that would probably be too drastic, but still.. all the baggage is really annoying
11:49shiranaihitogdev: what kind of problems did you run into with Ant?
11:49sdegutisAlso, while I'm here, I want to clear something up. The last time I was here, I was upset about a "crazy feminist" as I called her. And I still stand by what I said. But her being crazy has nothing to do with her being a feminist, and says nothing about my views about feminism. She's just a crazy person who also happens to be a feminist. I figured you guys all understood that, but someone PMed me explaining that I should keep my opini
11:49sdegutison on feminism to myself.
11:50shiranaihitosdegutis: people are way too touchy about feminism anyway (and a vast array of other stuff too, of course)
11:51sdegutisI intentionally try not to talk about that kind of stuff, because there's always someone who will take offense at anything you say.
11:51sdegutisI wrote about how I think we should talk about that kind of stuff: http://sdegutis.github.io/2013/11/18/how-professionals-should-do-politics-and-religion/
11:51shiranaihitoyeah, it's silly, to put it mildly :P
11:53sdegutisSo anyway, I wrote this IDE. It uses some really fun C tricks, but it uses Cocoa so it's not portable unfortunately.
11:53lgs32aEmacs/nrepl question: Can you point me to a way to get a command that puts the current sexp in the nrepl buffer and evals enter
11:53lgs32ameaning evals it like I have pressed enter
11:54gdevlgs32a, Meta-W, Ctrl-x right , Ctrl-Y
11:54lgs32agdev: lol
11:55lgs32aevery cognitect person has a specific command for that in their presentations
11:57lgs32ayou also forgot the C-x C-b, *nrepl*, M-Shift, M->, (C-y), Return
11:58gdevshiranaihito, how is dependency management "java baggage".
12:00gdevshiranaihito, using Ant I ran into the same problems you're having
12:00shiranaihitogdev: not dep management itself.. an example of the baggage is everyone and their neighbour's dog depending on various commons-whatever -jars, mostly just for the sake of re-use, even though whatever little tidbit they needed could have been implemented with not much difficulty
12:00rovar_awayshiranaihito: would you rather they roll their own utility library rather than depend on a commons-*?
12:01shiranaihitorovar_away: perhaps.. i guess "it depends"
12:02shiranaihitoi've got a java background myself.. and i remember it was common practice to have a "lib" directory with pretty much everything in it, include everything there in the classpath and just hope things run smoothly
12:02shiranaihito.. and that was mostly because everything depended on so many of the same libraries, etc
12:02rovar_awaylein does help mitigate that
12:03rovar_awaybecause it does make it easy to pull down new libs in an ad-hoc manner, so you don't need to start out depending on everything
12:03shiranaihitofor example, i'd have loved to have only a hibernate.jar .. but nope, it depends on commons-whatever and commons-even-more-stuff, and so on
12:04gdevshiranaihito, oh okay, but what you were originally trying to do was play with Datomic. How did it all go so wrong?
12:04shiranaihitorovar: yeah, that's nice and all.. but maven and the like are mostly just a "band-aid" over this problem
12:05shiranaihitohttp://pastebin.com/KVsdczNx - this kind of thing
12:06nDuffshiranaihito: would you mind using a pastebin without ads? refheap.com is a good choince (being written by one of our own); likewise, gist.github.com.
12:06shiranaihitonDuff: sure, refheap is fine with me.. i just didn't remember it now
12:07gdevyeah, refheap doesn't get websensed to death
12:07kzarRegretfully not been looking at Clojure for a while but was having a look at this example in the hope to get back into it again. Confused by the recursion in it though, could anyone explain? (def fib-seq (lazy-cat [0 1] (map + (rest fib-seq) fib-seq)))
12:07shiranaihitoi kind of feel like this baggage is a serious problem for Clojure too.. but i really want to use Clojure for everything i do these days, so i'm kind of torn
12:08kzar(I mean I get the general idea, I guess but...)
12:09nDuffkzar: could you be a little more specific about what part needs explaining?
12:09shiranaihitohttps://www.refheap.com/22234 <-- here's the same thing again, in case someone wanted it
12:09kzarnDuff: Well I understand the idea of adding the last two items of the list to create the new one
12:09rovarshiranaihito: almost all of that is clojure libs, it's not java's fault. Normally I'm happy to blame java developers for everything.
12:10rovarseems like its a pace-of-iteration thing
12:10rovarring is a small and young project.. datomic, relatively less so..
12:10kzarnDuff: I've not seen / used lazy-cat before but I roughly understand the idea of concatinating two sequences together and returning a lazy one
12:11kzarnDuff: I guess I just don't understand how the new item is appended on to the sequence each time
12:11shiranaihitorovar: well, i'm not blaming either _language_.. just expressing my discontent with java's "culture of overzealous re-use" and the neglectfulness that's resulted from it
12:11kzarnDuff: as (rest fib-seq) must be returning different things, how is the definition of fib-seq changing?
12:12rovarshiranaihito: IMO the real problem here is that datomic is not open source. If it were, I'd just say pull down the repo, flip the dependency to 1.6 and then lein install.
12:12kzar(What I don't understand is fuzzy, I just know that I don't fully understand it)
12:12nDuffkzar: there's only one rest sequence. Map moves over it.
12:12rovarshiranaihito: it might be worth putting that question to the mailing list to see about proper solutions for reconciling the conflict.
12:12kzarnDuff: oh I see
12:13rovarkzar: it's also interesting to note that it is an infinite sequence, it will recurse forever
12:14shiranaihitorovar: yeah that might help too, but it seems it's AWS that depends on 1.3 .. i guess i'd have to modify that too? -actually i saw someone had opened an "issue" in the aws project, asking about updating commons-codec to 1.6, but it's 2 months old and didn't seem to get any attention.. i've never actually contributed to an open source project myself (yeah, i know.. a sad excuse of a programmer :p), so i don't
12:14shiranaihitoknow that i could just go ahead and "contribute" the change either, etc..
12:14kzarrovar: Yea I understand that
12:14rovarmost of amazon's stuff is open source..
12:14rovarmaybe you could just mod it locally.
12:14sdegutisWhat's a good cross platform C GUI API, for writing a Clojure IDE in?
12:15rovarwhat's annoying is that datomic might not even actually need the aws stuff if you're not using it.
12:15rovarsdegutis: does it have to be written in C?
12:15rovarsdegutis: I guess the core of emacs is in c and its cross platform. I'd recommend that.
12:15rovarif not that, then vim
12:15sdegutisrovar: hmm I see.
12:16rovaremacs has a long, steep learning curve, but at the top of that curve you will achieve enlightenment
12:18shiranaihitorovar: yeah.. i don't know.. then i guess i'd have to re-apply the "local patch" whenever aws gets updated etc, it's all very silly.. and i'm not sure it even really makes sense for me to complain.. i just feel like things are somewhat horribly wrong in this regard
12:18sdegutisnDuff: that's one of the main reasons I don't use Light Table actually.
12:18sdegutisrovar: I'm not looking for an IDE, I'm already writing one.
12:18lgs32agdev: I have now implemented it myself in elisp: https://www.refheap.com/22235
12:19sdegutisI'm just looking for a way to run it on other OSes, not just OS X.
12:19sdegutisRight now it uses Cocoa for GUI.
12:20sdegutisnDuff: It may be my OCD, but I really don't like using things that I know are overly complicated. That's one reason I hate browsing the web. (There's no browser that I know of where I can browse the web on my laptop and *not* hear my fan spin up to full speed.)
12:20sdegutisSo using an HTML layout engine to render text is just overkill to my OCD-riddled brain.
12:20gdevlgs32a, is this for live coding and presentation purposes? whats wrong with C-x C-e ?
12:20rovarsdegutis: have you looked at wxWidgets?
12:20nDuffsdegutis: ...eh. You're on top of a huge, complex stack no matter what.
12:21nDuffsdegutis: ...using Emacs certainly doesn't get you away from that.
12:21sdegutisnDuff: I'm not opposed to complexity, just unnecessary or unrelated complexity.
12:22lgs32agdev: for most people i guess. But I am kind of tired of editing large forms in the *nrepl* buffer after i pulled them out of the history. I want to edit them in a seperate buffer so that I can save them into a file and e.g. later create tests from them.
12:22rovarI think wxWidgets is one of the only libs that has native finish implementations on all platforms.
12:22Guest85538is there a way to compare tow keywords by their characters, like this (let
12:22Guest85538 [b :test] (if (= (:test b)) (println "equal")) (if (= (:test1 b)) (println "notequal")))
12:22scottjsdegutis: when you use light table does your fan spin up?
12:23sdegutisscottj: honestly I haven't tried it for that long.
12:23sdegutisscottj: it's not the only reason I don't prefer LT.
12:23gdevlgs32a, ah okay, that's an interesting work flow
12:26sdegutisrovar: hmm I haven't, but I will now.
12:26sdegutisHmm, it requires C++
12:26sdegutisGuess it's not much different than ObjC in terms of ugly dependencies.
12:28gfredericksGuest85538: does (= :test b) not do what you want?
12:28technomancysdegutis: you could contribute to NightCode
12:28technomancysomewhat less likely to run out of steam if you have other people helping you
12:29gfredericksthe nightcode website is the first time I've seen the phrase "targeting the command line"
12:29sdegutistechnomancy: I would but I don't agree with the philosophy of NC.
12:30technomancyso I feel like I should start a novelty twitter account that just retweets markov bots that happen to use the word "clojure" in their strings
12:30technomancythere are some really good ones
12:30sdegutistechnomancy: I wanted an IDE that's basically emacs but extremely custom to Clojure and without any emacs baggage and without RMS.
12:30sdegutis(And with a more Clojure-like scripting language.)
12:32kzarI think next year I'm going to have another push at groking clojure
12:33kzarbeen a bit slack for a while there
12:35sdegutistechnomancy: Let me very briefly try to explain mine.
12:36sdegutistechnomancy: Whenever I have to write ObjC, I minimize emacs and use Xcode. (I minimize emacs instead of closing it because Magit is awesome for any project.)
12:37sdegutistechnomancy: Because Xcode is way more integrated with ObjC than emacs is (at least that I know of). It shows me syntax errors in my code *as I'm typing*. It loads every framework and library into memory and analyzes their types properly.
12:37sdegutisBasically, Xcode *knows* about ObjC intimately, so it can do way more than a generic text editor can (even with plugins that try to emulate this externally).
12:38sdegutisThat intimacy is what I want for Clojure.
12:39technomancythat might make sense if I knew xcode or objective C
12:40sdegutisI think you understand what I mean just by context.
12:40sdegutisThe same could probably be said with IntelliJ and Java.
12:40technomancynever used those either
12:41sdegutis:P
12:42augustlI tried to explore the elasticsearch Java codebase with the terminal, then emacs, then wanted to burn my house down. Had to open IntelliJ for that. There's just so many _things_ in an OO codebase, hard to navigate.
12:42augustlthis is rather fuzzy.. But I've never felt that need in a Clojure codebase
12:44technomancyis objc really such a terrible ecosystem that it's easier to suffer through xcode than teach a better editor how to understand it?
12:44technomancy(from what I hear this is true of Java)
12:45augustltechnomancy: afaik all the ObjC know-how in Xcode is in llvm
12:46edwtechnomancy: I do ObjC development, and while I balance my checkbook in Emacs, I use Xcode for ObjC.
12:48technomancymust pay well
12:48edwObjC development?
12:50pippociao
12:50pippolista
12:50technomancyedw: xcode doesn't sound like something you'd use by choice
12:51edwtechnomancy: I (just) developed an iOS analytics framework for our clients to provide us in-app data. I hear iOS development pays well. Very few people do in-house development because, you know, you actually need to know what you're doing. Seg faults and all. Your typical PHP/Javascript ninja is not cut out for such work.
12:54arubinedw: Many apps are built using things like PhoneGap though.
12:54arubinEmbedding a browser in an app and writing the actual app in HTML/JS is very common.
12:55scottjarubin: where many = a very small percentage of apps, right?
12:55arubinscottj: No.
12:55edwarubin: Yeah, we run into a lot of people who do things like that. Keep the revolver securely locked away in the safe.
12:55arubinPhoneGap is very popular.
12:55sdegutistechnomancy: It's not that it's a terrible ecosystem (although it kind of is), it's that Xcode makes it so much easier and faster to write than other IDEs and editors do.
12:55edwscottj: It all depends on the type of app.
12:55sdegutisJust being pragmatic.
12:55arubinscottj: Even companies like Facebook did such things for quite a while.
12:56edwarubin, scottj: Yeah, and LinkedIn finally stopped drinking the app-as-WebKit container Kool-Aid cup.
12:56technomancysdegutis: hm; maybe there's just a low overlap between the kind of people who know enough elisp to make things better and the kind of people who choose a career path with a high level of vendor-lock-in
12:57sdegutistechnomancy: that could be it too; elisp is extremely painful for many of us
12:57sdegutistechnomancy: Not just the language but the API.
12:57sdegutis(both)
12:57justin_smithGuest85538: regarding your earlier question, there is a book, http://www.packtpub.com/clojure-high-performance-programming/book but based on your other questions you may want to get a bit more familiar with clojure basics before you jump into that
13:00sdegutistechnomancy: I was only trying to explain my angle to you. I wasn't hoping to convince you. I know we won't see eye to eye, since I'm the kind of person who actually likes writing in C and you don't :P
13:00technomancyI'm writing C right now
13:00ddimaheh
13:00technomancywell, not liking it though
13:01technomancyhttps://github.com/technomancy/ergodox-firmware/commits/master
13:05sdegutisFun :)
13:05sdegutisTo be fair, I really don't like a lot of C.
13:05kzartechnomancy: Oo is that keyboard any good?
13:06sdegutisThe primitive control structures and lack of useful built-in types is frustrating.
13:06sdegutisThat's where Clojure shines.
13:06sdegutisBut I love the turing-machine aspects of C and how low-level it is. I love allocating memory on the stack and passing it to other functions as a pointer, pretending it's on the heap.
13:07technomancykzar: I haven't used a lot of mechanical keyboards, but it's the best I've tried
13:08technomancykzar: ^ is the tl;dr of http://technomancy.us/172 if you are really curious
13:09technomancyfor my purposes and condition it's the best, anyway
13:13technomancyjust ordered some lighter key switches for the modifiers and pinkies
13:13kzararg internet here is dodgy
13:14kzartechnomancy: curious about that keyboard, is it worth looking into compared to kinesis etc?
13:14technomancykzar: the kinesis advantage costs more and is more bulky, which put me off
13:14kzarI used to use it but I sold it a while back
13:14technomancyalso you don't get to choose your switch type; I like the tactile clicky response vs the low-force, muted brown switches on the Advantage
13:15technomancybut the matrix layout (non-staggered) is similar, and I love that now that i've adjusted
13:15technomancyplus the thumb clusters
13:15kzaris it expensive?
13:15technomancyheh... well you have some options
13:16technomancythe base price of the kit is US$235 if you include the keycaps
13:16technomancybut if you already have some of the parts, the design is all OSS
13:16rovarif i needed to write firmware I'd probably start with https://github.com/whitequark/picobit
13:17rovarbut I don't really mind C so much
13:17kzaroh cool
13:17technomancyso you can get your case laser-cut into acrylic at a local makerspace or something and scavenge your switches+caps from an existing keyboard
13:18rovarone day when I have time, I'll make a proper dvorak keyboard out of that.
13:18technomancyin that case it'd just be US$40 for the printed circuit board plus whatever they charge for the acrylic cutting
13:19technomancyand $16 for the microcontroller I guess
13:20maravillastechnomancy: do you have any thoughts on determining what flavor switch one likes best, aside from trial and error?
13:20technomancymaravillas: seems like gamers like blacks. for hackers it just depends on your co-workers' tolerance for clickiness =)
13:21technomancyI work alone, so I got the noisy blue switches
13:21technomancyand some people like the low-force browns, but they feel a bit mushy for me
13:22technomancyI just ordered some browns for my pinkies though
13:22maravillasdo you find there's a tradeoff in noise vs comfort? or are they unrelated?
13:22scottjmaravillas: you can buy a cheap kit that has one of each switch. or buy and return a couple keyboards. imo just try blue and brown and skip black and red. idk about clear/green.
13:23scottjmaravillas: blue and brown are roughly equally popular.
13:24maravillascomfort/appeal/good-ness
13:24marcopolo`technomancy: have you tried the kinesis advantage? what are your thoughts on that vs the ergodox?
13:24technomancymaravillas: browns trade silence for (IMO) comfort, but some people like them better
13:25technomancyif you don't like the low-force feel of the browns but can't get something loud supposedly the clear switches are somewhere in between
13:25technomancymarcopolo`: it's cool, but it's too bulky to bring to coffee shops like I do. also I like the blue switches better, and the ergodox is cheaper and more hackable.
13:26technomancybut I haven't spent enough time on the bowl layout to have a qualified opinion on that aspect; the ergodox is totally flat
13:26technomancymaravillas: unless you have a lot of fatigue I'd go with either clear or blue, depending on noise tolerance
13:27technomancymaravillas: but it'd probably be easier to give the browns a test run since they're in the kinesis advantage
13:27technomancydepending on where you live, I guess
13:31scottjmaravillas: there are also lots of used mechanical keyboards that you can buy used on ebay and resell after a month for no loss other than shipping and ebay fees
13:33technomancybuilding an ergodox from scavenged switches would actually be a lot ofd fun
13:36technomancylots of tedious work, but I find that kind of thing relaxing
13:37maravillasi have a ms 4k natural and despise the buttons...it sounds like browns will feel more like that than i'd like
13:38maravillasgood ideas, thanks guys
13:42sdegutis,(->> (range 100) (reverse) (partition 2 1))
13:42clojurebot((99 98) (98 97) (97 96) (96 95) (95 94) ...)
13:42sdegutisCommence bottles-of-beer song.
13:46gfredericks(range 99 -1 -1) for more efficient singing
13:47rovaris there an example of serializing functions into maps?
13:48rovarI have a need to pickle functions to disk for later evaluation..
13:48rovarI was thinking of just mimicking defn with a macro which includes the doc string, params, and makes a symbol of the executable bits..
13:48rovarperhaps a string
13:49rovarnot a symbol of the bits, a quoted list..
13:53gfredericks$google serializable-fn
13:53lazybot[technomancy/serializable-fn · GitHub] https://github.com/technomancy/serializable-fn
13:53gfredericksrovar: ^
13:54rovargfredericks: <3
14:10jergasonWhat is the use case for do?
14:10jergasonWouldn't things with side effects still work fine if not wrapped in a do?
14:10gdevjergason, side effects
14:10rovarjergason: do doesn't return a value, so it kind of implies that the action you're performing is for its side effects..
14:10AimHereThere's also cases where you want to bundle more than one command in a place that only wants one command
14:11jergasonGerm
14:11gdevjergason, do actually does return a value, the last expression in the do block
14:11jergasonDang iPhone keyboard. Meant hrrrrm
14:11AimHereOne case would be (if wibble (do ... lots of things) (do ... other things))
14:11gdev,(do (print "oh hai") (+ 1 1))
14:11clojurebotoh hai2
14:12jergasonAh that one makes sense
14:12jergasonTy friends
14:12gdev,(do (+ 2 2) (+ 1 1))
14:12clojurebot2
14:12mdrogalis(if (true? true) (do (thing1) (thing2)))
14:12AimHereUseless use of true?!
14:13rovarindeed
14:13AimHereAlso if you're returning nil on falsy values, then use 'when' instead of 'if'
14:13rovarin almost all cases true? is useless
14:13jergasonOkay, it is starting to make sense.
14:13AimHere,(map true? [true 3])
14:13clojurebot(true false)
14:14AimHereThere is some sort of use case there somewhere
14:14gdev,(true? (is-useless 'true?))
14:14clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: is-useless in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:14mdrogalisYou get the point. ;[
14:15gfredericks~true
14:15clojurebotHuh?
14:15gfredericks~false
14:15clojurebotTitim gan éirí ort.
14:15mdrogalisBarking spiders.
14:15gfredericksclojurebot: true is false
14:15clojurebotIn Ordnung
14:15edwAimHere: `when` is most useful to imply that somethin' imperative's going on. If you're doing something that doesn't involve mutation, an explicit nil is the classy thing to do.
14:15gfrederickspresumably now clojurebot can prove anything
14:16gfredericks~false
14:16clojurebotCool story bro.
14:16gfredericksclojurebot: that's sexist
14:16clojurebotCool story bro.
14:16justin_smithedw: or "and" even, if it is purely functional and value oriented
14:16justin_smith,(and true :OK)
14:16clojurebot:OK
14:17edwjustin_smith: I get yelled at by my peeps when I do that.
14:17justin_smithweird
14:17edwWerd.
14:18justin_smithand means "all of these values, or else false - and there are no concerns about side effects here"
14:18justin_smiththat's what it means to me at least
14:18justin_smithwell "the last value if all or true"
14:19edwjustin_smith: These people are not fans of C's ternary operator either.
14:20gdev,(and (= 1 2) 3 4)
14:20clojurebotfalse
14:20gdev,(and (= 2 2) 3 4)
14:20clojurebot4
14:21justin_smithgdev: usually more like (and (cond-1 input) cond-2 result)
14:22gdevjustin_smith, yeah I was just showing how it only cares about the last value when they're all true
14:23justin_smithgotcha, right
14:24gfredericks(#'and true false)
14:24gfredericks,(#'and true false)
14:24clojurebottrue
14:24gdevI've seen people see code like (and (cond-1 input) blah blah result) and think, ah, I know the code block that is the "result" so this should work too (and (cond-1 input) result blah blah)
14:25gdevand I've only been teaching Clojure for a few months
14:28gdevthis is usually because some people are used to putting return statements anywhere in a method to short circuit it
14:29justin_smithof course
14:33gdevteaching java devs anything other than "yet another java framework" is quite a masochistic task
14:35rhg135hello, i have a (probably obvios) qquestion, how do you manage mutable java objects for, say, concurrency?
14:35justin_smithrhg135: you can put it in an atom, and wrap the ops in swap! calls
14:36rhg135justin_smith, i don't exactly understand, you'd still be mutating the same state
14:36rhg135and not all calls are idempotent
14:37justin_smithright, but with an atom at least there is some negotiation of access and mutation
14:37justin_smiththere is also the option of using the (locking ...) call
14:38justin_smith(locking some-mutabale-object ...)
14:38rhg135ya... I saw that, but didn't understand why it worked
14:38justin_smithbut it is up to you in that case that all access is wrapped in a locking call
14:38gfrederickswait what
14:38gfrederickswe're talking about a mutable java object
14:38justin_smithyes
14:39gfredericksusing an atom means your update functions are subject to being run multiple times
14:39justin_smithoh shit, you are right
14:39justin_smithdon't mind me
14:39justin_smithan atom is exactly the oposite of what you want there
14:39rhg135oarticularly sockets and Readers
14:40gfredericksso you _could_ use an agent instead; but I think what you want depends on what you're doing
14:40gfredericksso yeah if you have an object shared between threads and you want to make sure only one thread is calling methods at a time, you could use locking or an agent
14:40rhg135i think bitemyapp chewed me out for using atoms for this once lol
14:41rhg135gfredericks, agents does sound right
14:41gfredericksatoms work best when used with immutable values
14:41rhg135why must mutability be over-complicated
14:41gfredericksyeah not only do atoms subject your functions to retries but they also can run on different threads at the same time
14:41justin_smithgfredericks: maybe we could upgrade that to "atoms should never be used for mutable things"
14:41gdevrhg135, there are a lot of talks that answer this question
14:42rhg135i know
14:42rhg135and yet ppl still do it :\
14:42justin_smithrhg135: at a root level, unless you reject concurrency altogether, mutation *is* complication
14:42rhg135justin_smith, agreed
14:53gdev,(clojure-version)
14:53clojurebot"1.6.0-master-SNAPSHOT"
14:53gdev&(clojure-version)
14:53lazybot⇒ "1.4.0"
14:55gdev,(interleave)
14:55clojurebot()
14:55gdev&(interleave)
14:55lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core$interleave
14:57gfredericks,(doc interleave)
14:57clojurebot"([] [c1] [c1 c2] [c1 c2 & colls]); Returns a lazy seq of the first item in each coll, then the second etc."
14:59gdev&(doc interleave)
14:59lazybot⇒ "([c1 c2] [c1 c2 & colls]); Returns a lazy seq of the first item in each coll, then the second etc."
15:16rhg135if I understand the docs, agents use a thread pool, any way to have it run on one thread?
15:17justin_smithrhg135: you could use core.async and have a process reading from a channel
15:18rhg135i guess, but i thought 1.5 added this type of thing
15:18justin_smithrhg135: why do you need the agent to always be in the same thread - is it not good enough to know it will only be running in one thread at a time?
15:18lnostdalhi guys, does cider use the same server component as nrepl.el? ( https://github.com/clojure/tools.nrepl )
15:19justin_smithrhg135: an agent will block until the previous task is done
15:19rhg135justin_smith, ah perfect
15:20rhg135tought asynchronous meant it didn't wait
15:20rhg135but ok
15:20justin_smithcheck out the output of (doc agent) in your repl
15:21justin_smithwait, never mind
15:21justin_smiththat is not as comprehensive as I thought it would be
15:22justin_smithhttp://clojure.org/agents rhg135: see the enumerated list on this page
15:23justin_smithor more to the point "At any point in time, at most one action for each Agent is being executed."
15:23rhg135ah ic
15:26justin_smithI think I have some stuff in my code base that could be better represented as agents, now that I consider it actually
15:28rhg135is the thread pool set to a reasonable size?
15:29justin_smithhttp://stackoverflow.com/questions/11316737/managing-agent-thread-pools-in-clojure
15:29justin_smithrhg135: the key thing is to know when to use send versus send-off
15:29justin_smiththat helps it use the pool intelligently
15:30rhg135what is the difference
15:30justin_smithyou can also, as the so answer mentions, use your own ExecutorService to override the default
15:30rhg135the docs are scarce here
15:30justin_smithrhg135: same link I posted to clojure.org above explains it
15:31justin_smithsend for CPU heavy, send-off for IO-bound
15:32rhg135ah
15:32solidus_does one use agents as threads with message queues?
15:32rhg135send uses a bounded pool
15:33rhg135send-off doesn't right?
15:39justin_smithI think send-off allows sharing of one of the threads
15:39justin_smithlike a lighter-weight thread
15:39justin_smithI could be wrong though
15:39justin_smithsolidus_: you can - it is like an inverted message queue though, the agent has the value, and you pass it a function that acts on the value
15:40rhg135meh
15:40rhg135specifics
15:40justin_smithsolidus_: but I think you can do nice messge-queue like things with that design
15:40rhg135i get the main idea
15:40justin_smithrhg135: that SO link I posted linked to the actual source
15:40justin_smithat this point it would be easier to read that then speculate
15:42justin_smithrhg135: based on the source of send / send off you should look at pooledExecuter and soloExeter respectively
15:43rhg135justin_smith, "The send-off pool (also used for futures) is a cached thread pool and will grow without bound. This allows an arbitrary number of background tasks to wait for I/O"
15:43justin_smithahh
15:43justin_smithmakes much more sense than my first guess did, thanks :)
15:43rhg135it's from the so answer
15:45justin_smithyeah, reading comprehension ftw
16:10gdevit's more important than list comprehension
16:12Guest85538With macros I am tring to encapsulate all static java calls and all the Java import to a single file, so wherever I need this Java functionality I just have to import this macros. Translating only methods calls works, but when I am tring to add parameters it reuires to import Java classes. Here is a short snippet of he problem http://pastebin.com/Ej2Xw2kD. Any ideas?
16:13gdevpastebin gets websensed on my network, can you paste it into refheap.com?
16:14Guest85538https://www.refheap.com/e962558e200e1ac2186194754
16:14Guest85538here
16:16justin_smithGuest85538: could those args be at any position in the argument list, or are they in predefined places?
16:16Guest85538predefined
16:17Guest85538the args list should retain the order
16:17justin_smithin that case you may want to use an explicit arg list instead of & rest args
16:18Guest85538are predefined, and some java methods are overloaded so this would solve for all those methods
16:18Guest85538but if it is not possible
16:18Guest85538i ll try the other way
16:19justin_smith(defmacro gl-bind-buffer [buffer-type & args] `(GL15/glBindBuffer ~(get {:gl-element-array-buffer GL15/GL_ELEMENT_ARRAY_BUFFER :gl-array-buffer GL15/GL_ARRAY_BUFFER} ~@args)))
16:19justin_smithsomething like that maybe
16:19justin_smithalso why are you quoting the GL15 constants? that may be your issue
16:20Guest85538otherwise are not htey evaluated?
16:20justin_smiththey are constants
16:21justin_smithif you quote it you get a symbol
16:21justin_smithif you don't you get the constant value
16:21Guest85538get it
16:21justin_smithyou want the latter I think
16:21gdevGuest85538, are you the one trying to write a Clojure wrapper for JLWGL?
16:21Guest85538jes
16:21gdevyou're awesome
16:21gdevgood luck with that
16:22Guest85538justin_smith is not the result the same if I quote or not
16:23Guest85538in once case i get integers else i get GL15/GL_ARRAY_BUFFER which when executed gets the same result
16:24mandu_Hi everyone!
16:24justin_smithGuest85538: a quoted symbol is just the symbol
16:24Cr8you could write out the fully qualified class name
16:25justin_smithGuest85538: if you want quoting, do what Cr8 describes
16:25justin_smithotherwise just drop the quoting and you will get the right result I think
16:25justin_smiththe extra level of quoting delays the evaluation until the usage namespace, which is why the symbol is not being resolved properly
16:25justin_smith(unless you import in the using namespace, or fully qualify the symbol, of course)
16:26mandu_Is there good a way of filtering more than one collection at a time? Like map with multiple collections that will take a function with multiple arguments and return a collection of filtered collections?
16:26justin_smiththere is hardly ever a reason to quote a constant
16:27mandu_currently i'm doing this: http://pastebin.com/GvEs1HgV
16:27mandu_but i'm not sure if this is very efficient
16:27Guest85538if I drop quotes it works without the need to import. Seems like I do not fully understand how macros work :/
16:28justin_smithmandu_: maybe something like (filter (fn [a b c] (and (p1 a) (p2 b ) (p3 c))) (map list s1 s2 s3))
16:28justin_smith(filter (fn [[a b c]] (and (p1 a) (p2 b ) (p3 c))) (map list s1 s2 s3)) sorry, this one
16:28justin_smithGuest85538: quotes delay evaluation
16:28mandu_but then i'd have to unzip the result again right?
16:29justin_smithmandu_: depends what you want to do with the result
16:29mandu_i need them separately...
16:29justin_smiththe unzip is easy to write
16:30mandu_yeah, just seems inefficient
16:30justin_smith(reduce (fn [[a b c] [e f g]] [(conj a e) (conj b f) (conj c g)]) zipped)
16:30justin_smithmandu_: that is the point of laziness, there is really just one traversal
16:31justin_smithunless it is forced in between, it only looks like you walk it more than once, really the operations are composed
16:31justin_smiththough there are of course the small lists created / unwrapped again
16:32mandu_okay, cool.. thanks
17:09rhg135one more question (for now), I don't really see the use case for a channel over a seq.
17:10rhg135i mean i do get what they are meant for, but i don't see why you would need them
17:10justin_smithrhg135: if somebody gets a value from a channel, it is gone
17:10justin_smithseqs are immutible
17:10justin_smithso you can have multiple go blocks reading the same channel, only one will read a given value
17:11rhg135sounds like it's back to a queue
17:11justin_smitha channel is a nice way to use a queue
17:11justin_smithexactly
17:11rhg135i see
17:12rhg135but i still don't see an use case
17:12justin_smiththe use case is core.async
17:12justin_smithcore.async is a dsl for calculating things via channels
17:13rhg135doesn't j.u.c already have queus
17:13rhg135?
17:13justin_smithit does
17:13justin_smithcore.async is a particular abstraction over queues
17:13justin_smithsimilar to futures vs. threads
17:13rhg135just a nice wrapper?
17:14justin_smithwell, a nice wrapper for queues with some threading / concurrency stuff mixed in I guess
17:15BobSchackrhg135: core.async also extends queue to clojurescript
17:15rhg135BobSchack, so true
17:16rhg135i'm kind of out of ideas for making my server behave
17:17rhg135i'm so sure it's due to my lack of understanding about java concurrency
17:17justin_smithwhat behavior do you want from it?
17:17rhg135normal server behavior
17:18rhg135namely listen, aceept, respond in a new thread and close
17:18rhg135it goes fine until the respond part
17:18rhg135it doesn't at all
17:20rhg135but idk it seems i'm only talking to the client on one thread
17:21justin_smithhave you narrowed down where things break down? not responding could be caused in a bunch of different layers
17:22rhg135i've tried too but i seem to get different results
17:22justin_smithmaybe try stubbing things out at different levels
17:22justin_smithso first just reply with the same string to every request - verify you can reply at all...
17:23justin_smiththen stub out a layer below that, etc.
17:23rhg135my most recent attempt has much more seperation in that sense
17:24rhg135i'll try that the actual json code is seperate anyway
17:24rhg135the socket code is standalone
17:26rhg135the code i refer to is https://bitbucket.org/rhg135/jimjure/commits/6e6451e16a57e902ebe0b70fdfec22ad056c807e#chg-src/jimjure/core.clj btw
17:29justin_smithrhg135: what in the code you pasted would make the server stay alive long enough to serve a second request?
17:29justin_smithit could be I am missing it
17:30justin_smithalso in jim-server you create a future to start the server, but that returns immediately, and on the next line you close the server
17:30justin_smithso it won't even run once
17:30justin_smithmaybe you intended to deref the future so it would block until it completed?
17:31rhg135justin_smith, i think the doseq in json-handler won't finish until the stream ends
17:31justin_smithbut even so, you would want to change json-server so it looped or something
17:31rhg135hmm
17:31justin_smithrhg135: the server gets closed as soon as the future is created
17:32justin_smithyou seem to in general be using futures as if they blocked until completion
17:32rhg135so close the socket in the same thread it runs AFTER i'm done
17:32justin_smiththey do not
17:32justin_smith,(future (Thread/sleep 1000000000000) :hello)
17:32clojurebot#<SecurityException java.lang.SecurityException: no threads please>
17:32rhg135justin_smith, but the server is open
17:32justin_smiththe above will show you waht I mean in a repl
17:32rhg135it does accept
17:32justin_smithok
17:32rhg135it lets you sen stuff
17:32rhg135just no reply
17:32justin_smithbut you are closing it regardless
17:33justin_smithyou are closing server on the next line after starting the json-handler
17:33rhg135i understand, but it doesn't explain the behavior
17:33justin_smithI think it does
17:33rovaris there a standard function to take the last n of a sequence?
17:33justin_smithit tries to use the socket, socket is closed, so it cannot reply
17:34rhg135i thought if you stop a server it closes al lclients connected to it
17:34justin_smithrovar: take-last
17:34rhg135but i guess not
17:36rovarthat is close, I'll take it
17:36rhg135justin_smith, can you specify the line as I don't see it?
17:37justin_smithlines 46+47 run start-server on a socket called "server"
17:37justin_smithline 48, which will likely run before the future does, closes "server"
17:37justin_smithit is inteterminite, maybe the future gets a chance to initialize first
17:38justin_smithbut it is very likely to serve a request before that close runs
17:38rhg135justin_smith, line 48 is in the future body
17:38justin_smithnope
17:38justin_smithcheck your parens
17:38rhg135damn
17:38rhg135you're right
17:38justin_smithmy eyes are better than your editor, lol
17:38justin_smithsorry, that was uncalled for
17:38rhg135i feel so stupid
17:39rhg135ofc json-handler isn't called lol
17:39justin_smithto be fair, seeing future called by close made me immediately suspicious, given the bug you were complaining about
17:39rhg135i wondered why that trace-ns call did nothing
17:39justin_smiths/called/followed
17:40rhg135i'm going to try that
17:42mandu_hey, justin_smith
17:42justin_smithyo
17:42mandu_i did it your way and then it struck me to do the entire thing in one "reduce"
17:42justin_smithcool!
17:42mandu_the latter is significantly faster
17:42rhg135i should of caught that with the rainbow-parentheses
17:43justin_smithrhg135: I catch many of those things by only auto-indenting and not allowing any manual indentation
17:43rhg135justin_smith, i was :(
17:44rhg135i'm just bad at this
17:44mandu_here are the 2 listing in case anyone is interested http://pastebin.com/RTJ8QzSg
17:44rhg135mandu_, not lying my mouse batteries died
17:45justin_smithmandu_: I don't get why you use apply there
17:46justin_smithin any of the places you use it
17:46mandu_ah that's just my datastructure
17:46justin_smithyou know map is varargs right?
17:47justin_smithoh, is it because your args to map are all in one sequence?
17:47mandu_yeah, my "values" is a vector of vectors
17:47mandu_it's basically time series data
17:47mandu_dates are the vector with dates
17:47justin_smithahh, got it
17:47mandu_values are columns of data corresponding to those dates
17:48cjfriszjustin_smith: has map always been varargs in Clojure or am I just confusing it with the fact that reduce isn't?
17:48justin_smiththe latter
17:48mandu_the second method is roughly twice as fast
17:48mandu_so i think the first one does transverse twice
17:48justin_smithit at least has been varargs for a very long time
17:49cjfriszI guess I just remember being frustrated the one time I wanted vararg reduce and couldn't have it
17:49cjfriszOr rather I just had to be a big boy and do it differently
17:49justin_smithmandu_: interesting, I wonder why it would traverse twice.
17:50justin_smithbecause laziness should at least allow it to traverse once
17:50rhg135justin_smith, still nope and trace-ns still says nothing
17:51mandu_<cjfrisz> clojure is making me extremely lazy and picky
17:53cjfriszmandu_: I write a lot of Scheme, and it's taken lots of effort to un-Scheme-ify my Clojure code
17:53justin_smithrhg135: looking closer, jim-server returns a closure that would close the server, but does not invoke it
17:53cjfriszTreating them as different things has made me much happier
17:53justin_smithin the original version you shared
17:54mandu_what's the main difference so far? pairs vs vectors?
17:54justin_smithI would imagine laziness would be the huge one
17:54Bronsacjfrisz: generally when I want to reduce multiple colls i do (reduce (fn [[a b] ..) (map list a b))
17:55cjfriszBronsa: that's what I ended up doing
17:55rhg135justin_smith, thats kind of the point
17:55mandu_well i've just started clojure, haven't really "needed" laziness so far
17:55mandu_or concurrency
17:55mandu_hope to change that soon
17:55cjfriszjustin_smith: the laziness has surprisingly never bitten me
17:56rhg135not to close it but allow to stop the server
17:56justin_smithright, just saying my previous diagnosis was wrong
17:56rhg135similar to http-kit
17:56cjfriszmandu_: actually the differences are a little hard to put my finger on right now for some reason
17:56rhg135returns a nullary closure
17:57cjfriszThough I do kinda miss pairs
17:57justin_smithright. I'll repeat my earlier suggestion: start at the stage that the request first hits your code, write a string to their socket, verify that works
17:57mandu_for me the big difference from what little scheme i had is the datastructures and the core library
17:57justin_smiththen go one step at a time back from the point of request to the rest of the code, mocking up and verifying that layer works
17:58rhg135so... ignore input for now and test if it even writes?
17:58justin_smithyeah
17:58justin_smiththen verify at that same level that you get the input
17:58justin_smithonce both those are verified, go one level deeper in your code (one level further from the code that opens the client request)
17:59justin_smiththat's how I would do it at least
17:59rhg135i don't understand how to test the whole json stream idea
18:00rhg135can't get it until the stream closes and then you can't write
18:00rhg135well not print it
18:00justin_smithwell, you break things down into pieces you can verify first, right? or keep rewriting the whole thing blindly hoping you get it right, but the latter sounds much more difficult and more likely to waste your time
18:00mandu_okay guys, thanks a lot
18:00mandu_off to bed
18:09justin_smithrhg135: also, does the :default multimethod def for handle actually work?
18:10rhg135justin_smith, idk, but it's not getting called anyway yet
18:10justin_smithhow do you know? if :action is returning nil, you write nil to the socket and close it
18:11mandu_btw, I'm trying to make a time series library for financial analysis and such at https://github.com/xmonkee/clj-time-series
18:12mandu_would love any suggestions etc
18:12justin_smithrhg135: oh, ok, :default does work, I was not aware that worked
18:15justin_smithrhg135: another debugging technique that may help - (def debug (atom [])), then open a repl from inside the server
18:15rhg135hmm
18:15justin_smithrhg135: then conj data onto it, indicating where the data was found/ what it is, etc.
18:15justin_smiththen you can investigate it from the repl
18:15justin_smiththat can be more informative than printlns
18:15rhg135justin_smith, seems the let isn't finishing as the handler in server.clj is never run but client does exist
18:16justin_smithwell a simple println would narrow down where it stalls
18:16justin_smiththere is the classic (let [_ (println "got this far") ...] ...)
18:17rhg135i add a debug call in the let it runs, in the let body before the future, it doesn't
18:17justin_smiththat's why I am suggesting inside the binding block
18:17rhg135yup
18:17justin_smiththe binding block is evaluated sequentially
18:17rhg135but gotta go eat now
18:17justin_smithso you start from the top, do a binary search, see where it halted
18:18rhg135bbiab
18:22deadghostI started programming three years ago
18:23deadghostand I still feel like I'm terrible at it
18:23justin_smiththree years is not long for a skill like programming
18:24justin_smithhell I have been at it for nearly two decades and I am still bad at it
18:24jared314There was a day, years ago, where I actually felt like I knew what I was doing. That feeling passed quickly.
18:24bbloomdecade here. yup, pretty bad at it, just like everybody else :-)
18:25bbloomin fact, there was a time where every new thing i learned, i felt i knew less
18:25bbloomb/c the rate of stuff i was learning was slower than the rate at which i learned of things i had yet to learn
18:25deadghostI don't know whether I need to read more code, write more code, read more books, concentrate on one language, learn more languages or what
18:25deadghostpossibly all of the above
18:25bbloomdeadghost: the answer is always write more code
18:26bbloomdeadghost: b/c you'll need to learn more languages, read more libraries & other people's code, and use one language more all at the same time :-)
18:26bbloomcreate goals & then just go accomplish them, or learn something failing to do so
18:27jared314and don't forget to pair program with other humans from time to time
18:27bbloom*shrug* that works for some people & not others
18:27jared314that's fine
18:27deadghostalso doesn't help the only people I know who use clojure are in this channel
18:27hyPiRionIt is not a bad idea to prepare for the journey too. Finding good books is hard, I think
18:28deadghostI've been trying to find a home language
18:28deadghostsince people who focus one down seem to get more done
18:28bbloomwhat is a "home" language?
18:29deadghostI guess one language that you primarily use
18:29deadghostthat are you proficient in
18:29bbloommost good coders i know have a few of those
18:30bbloomusually it's something like choose one of python/ruby/perl + java/c++/go + clojure/haskell/scala/erlang + sql/css/html/etc
18:30bbloom+ javascript
18:30bbloomsince depresssignly, everybody needs to know js these days
18:32deadghostI know one guy that prefers to use js for everything
18:32deadghostI still think he's not quite right in the head
18:32deadghostbut he gets things done with it mostly
18:34bitemyappyou can get things done with toothpicks and paste too.
18:34brainproxyit's possible to be pretty productive in js, but I think to "big things" done you end up building support for a lot of meta-programming
18:34bbloomjavascript is proof that our entire industry is not quite right in the head
18:34justin_smithI think the thing with js is it is the most universal platform now
18:34brainproxylockerdome.com used to be a mix of tech, but their engineering team moved all the backend code to node.js over time
18:35deadghostnodejs is funny
18:35deadghostbecause I either totally don't get it
18:35brainproxybut to go "pure js" they invested a huge amount of time into some DSLs and metaprogramming stuff, of their own making
18:35deadghostor a huge chunk of programmers are insane
18:36bbloomdeadghost: in short, it's a brilliant example of "worse is better"
18:36hcumberdale:)
18:37hcumberdaleSomeone said once if you review your code years later and you don't think WTF!? you've made no progress :)
18:37TEttingerdeadghost, why not both?
18:37deadghostmy first project was a pornhub clone
18:37deadghostand I ended up writing and finishing it
18:37deadghostwithout knowing how functions worked
18:37hcumberdaleawesome :)
18:38deadghostin php of course
18:38deadghostneedless to say I don't want to look at it
18:38hcumberdaledeadghost: for yourself? or have you been charged
18:38hcumberdalehttp://xkcd.com/844/
18:39deadghostpersonal project
18:39hcumberdaleI like php. Well done with smarty & templates it is nice.
18:39deadghostthen I messed around with learn python the hard way and didn't like it
18:39deadghostand picked up k&r
18:39hcumberdaleSuch a project as job will be nice. Get money for it and have fun knowing the "business insides" :D
18:40TEttingerdeadghost, this is pretty mind-blowing http://www.stefankrause.net/wp/?p=144
18:40hcumberdaledon't like python too. But with extensions you can write native c in it and it gets nice again
18:40deadghostI'm fine with python
18:40deadghostI just didn't like the book I used
18:40TEttingeron some platforms, clojurescript on node.js would outperform clojure on the jvm, it seems.
18:41TEttinger(because dalvik is not so great)
18:41akaI think python is great but the hoops you have to jump through when using it to server http requests is annoying
18:41akacompared to php
18:42akathat being said I prefer python over php and just deal with the extra work
18:43hcumberdaleI really like php when it's done right. Most people just mixed the whole markup with the code. That's causing the bad memories
18:43hcumberdaleand array_a array_assoc, ...
18:43ddimaaka: ever tried flask?
18:43akayeah I think PHP is def in a better place than it was
18:44deadghostI haven't used enlive much but I'm liking it
18:44deadghostit's different
18:44akaI don't mind PHP as much as a lot of people I know but it def lacked conventions in a lot places
18:44akafunc naming, arg order, etc.
18:44hcumberdaleI've had a look at symphony, cakephp and so on but they are overkill :(
18:44akaddima: I love me some flask
18:44deadghostdjango is ok but big
18:45akait's what I use when building web services and sites in python
18:45hcumberdaledeadghost: I don't like enlive because you are mixing things up again when using it. CSS selectors / Styles and page layout
18:45akayep used django too but don't care for it
18:46akaPHP's ecosystem is a lot better too. Composer seems nice.
18:46ddimaaka: ok, just thought there are not very many hoops to jump through to serve, unless you mean "quick hacks" like directly embedding a little bit of code directly into your markup, which is a nono ;)
18:46akahttp://laravel.com/ << that framework seems clean too
18:46hcumberdalehttps://github.com/kremers/clojurewebtemplate << I prefer stencil / moustache templates
18:47hcumberdaleddima: code / markup seperation is generally a good idea! Mixing things may be okay in different use cases (where hiccup is also fine)
18:48akaddima: yeah I meant in comparison to PHP's integration with apache. I am usually doing more advanced architectures that include caching proxies and what not but for the basic web developer I think PHP can be easier
18:49hcumberdaleaka: do you know why heroku went away from caching proxies and why they prefer "per application / instance" caches?
18:50akaI also have always been the type of person that rather use PHP as the templating language rather than using another abstraction like smarty. I seperate templates of course but still just use PHP in templates
18:50hcumberdaleFor the ruby stack it's still there
18:50deadghostI might need to get a job soon
18:51deadghostHN makes it sound like people will throw money at any decent dev
18:51hcumberdaleHN?
18:51deadghosthackernews
18:51justin_smithhell, they throw money at incompetent devs too
18:51akanews.ycombinator.com
18:51justin_smithI don't think the competence / money target thing is all that strong :)
18:51justin_smithall that strong a correlation that is
18:52justin_smithhell I got a salaried job
18:52akahcumberdale: I'm not sure. I don't use heroku currently. Are you referring to the rapgenius drama several months back?
18:52hcumberdaleNo, rapgenius?
18:53akanm I think they use ruby
18:53akaI was refering to this btw http://news.rapgenius.com/James-somers-herokus-ugly-secret-lyrics
18:54ddimaaka: ahok, thought code-wise. yeah, mod-wsgi is slightly more complicated
18:54logic_progis there a javascript tool for converting a pdf to a png? (pdf.js I thikn converts pdf to css/svg/html)
18:54akalogic_prog: you can output png with phantomjs I believe
18:55logic_progas in pdf.js + phantom js + take a virtual screen shot?
18:55logic_progoh shit, I'm in #clojure, not #javascript
18:55logic_progapologies
18:55deadghostjustin_smith, is the job market really that soft for devs?
18:55ddimadeadghost: well, market is good right now (at least in EU, i guess US too), but competence and compensation are not always linked ;)
18:55deadghostsince I have no degree and have really no benchmark for what qualifies as hireable
18:56ddimaso never worked as dev?
18:56deadghostnope
18:56justin_smithdeadghost: I have no post-highschool credentials and got very bad grades in highschool
18:56justin_smithI was in special ed until the saw the books I was reading in my free time
18:57ddimadeadghost: still doable, I started and had good jobs before studying years later (and earned sh** as a student/parttime ;))
18:57TEttingerjustin_smith, you're special, just not in that sense
18:57hcumberdaleaka: wow. but that they haven't recognized it from the beginning. Nearly 1sec should be noticable
18:57justin_smithon the other hand, I had some experience with lisp family languages, and someone was ramping up clojure on their backend, so they welcomed me with open arms and I started learning clojure as fast as I could
18:57justin_smithTEttinger: thanks, I think
18:57ddimadeadghost: just have something to show, read, know your linux and be a quick learner (you'll have to convince a little) - done ;)
18:58justin_smithwhen I say experience, I mean "hacked with it on the weekends while working in a warehouse"
18:59ddimajustin_smith: interesting path :D
18:59justin_smithit was fun to be sure
18:59TEttingerheh, I went to sorta a special ed high school. meant for high-functioning autism kids, aspergers kids, kids with a lot of symptoms from adhd, and so on.
18:59akaI didn't graduate highschool or college. I just slowly built up experience. I believe the most important thing to many companies is experience/proven ability. For senior roles anyways.
18:59hcumberdaledeadghost: you are searching for a full time position as dev? EU ?
18:59deadghostwhat kind of warehouse puts you on linux
18:59akaNever had issues with my lack of diploma or degree
18:59deadghostnope US california
18:59justin_smithI am just lucky I found a hobby that is somewhat rare as a skill, and lucritive
19:00akajustin_smith: that's exactly how I feel
19:00justin_smithdeadghost: hell they didn't even let me use a computer in the warehouse
19:00justin_smithI was hacking on the weekend
19:00ddimaI was into OpenVMS as a kid, but no diagnosed autism or anything ;)
19:00akahaha
19:00deadghostI wish I started earlier
19:01deadghostbut I was never introduced to programming early on
19:01deadghosthighschool had one java course that they stopped teaching after one run
19:01deadghosttaught from o reilly's headfirst java
19:01hcumberdaleouch
19:01TEttingerhead injury first
19:02justin_smithI was introduced, but my father was a weirdo conspiracy nut who refused to get a computer, so I didn't start really programming until much later in life. Due to the "alternative school" path I didn't actually really learn to use a computer until I was in my '20s
19:02hcumberdalehating this books. Still seeing "Head first servlets" in my sleep. Hunting me ...
19:02deadghostI thought headfirst html was good
19:02deadghostthe sql and php books not so much
19:02hcumberdaleAll clojure / lisp books were pure gold compared to Head first whatever
19:03justin_smithhttp://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html I like this one just for the title
19:03ddimait's never too late, I know mulitple people who became really good within two years full-time job, which some prior knowledge, but really juniorjunior in the beginning. Starting out as a kid doesnt necessarily help too much with complex problem solving ability and thinking. many just write small webapps or CMS in PHP or stuff like that, which doesnt go very deep. so no worries ;)
19:04ddimajustin_smith: well, he was right, look at the NSA now! ;)
19:04deadghostI have a friend that's always ranting about google and the nsa
19:04deadghostI mean
19:04deadghosthe was right
19:04deadghostbut he's still nutty
19:04ddimajustin_smith: What I really liked (non clojure/lisp stuff) were Andrew Tanenbaums books, especially modern operating systems and skienas algorithm design manual
19:04akaeveryone knew the NSA was spying on us... right?
19:04akaI mean I just assumed they were.
19:05ddimaaka: on the internet, yes, since the late 80s ;)
19:05justin_smithhell, they wouldn't even aknowledge the NSA existed, so come on
19:06deadghostI want to say RMS is crazy but he's kind of always right
19:06ddimawe need people like this, but not too many
19:07ddimaI like some of his essays (dont like his talks): https://www.gnu.org/philosophy/right-to-read
19:07hcumberdaleRMS is super awesome :D
19:08deadghostI thought he just wrote one talk
19:08deadghostand kept giving it for 20 years
19:08ddimaHe "felt" the "war on general purpose computing" in 97...
19:09ddimacory doctorow also has an interesting talk on that subject from the 28c3 if anyone is interested
19:09ddima(not looking at apple <cough>)
19:09akaRMS is galvenizing :D
19:10deadghostpeople would probably take him more seriously if he wasn't an overweight neckbeard
19:10deadghostwith a video of him eating something from his foot
19:10ddimawhat?
19:10clojurebotwhat is exceptions
19:10deadghostddima, http://youtu.be/I25UeVXrEHQ
19:11deadghostI think that was it
19:11justin_smithddima: a classic, he was an expert witness in some court hearing iirc
19:11justin_smithand starts eating his toe fungus
19:11justin_smithor something off his toes
19:11justin_smithmaybe he was keeping pieces of jerky under his toenails
19:11ddimadeadghost: he just hides acid blotters between his toes
19:12justin_smiththat would explain it
19:12justin_smiththat would also explain emacs
19:12ddimahehe, well, havent seen that one so far, but still, he has done a lot
19:12justin_smith(as I type that into erc)
19:17ddimaso, we learn once again: dont watch stallman, just read ;)
19:20radsdnolen: I have some ideas for om but I'd like to write a little about them first. where would be the best place to post them? github issue, link to a gist, wiki?
20:02dnolenrads: feel to free to open up a github issue to start the conversation
20:03dnolenrads: some things are changing soon
20:03dnolenas far as how paths are handled, and I think I have a decent solution for rendering "lists" of children
20:17hcumberdaleHow to use deftype? I don't understand it :(
20:19hcumberdaleNo implementation of method: :dsave of protocol: ...
20:21gfrederickshcumberdale: might be an arity mismatch
20:28gfredericks(defprotocol I (m [_])) (deftype T [] I (m [_] 42)) (m (T.)) ;; => 42
20:38hcumberdalegfredericks: In all examples I find 'this' or '_' as the first parameter of every method
20:39hcumberdaleIsn't that bad design if there is no use for it?
20:39justin_smiththe argument will be the thing dispatched on
20:40decaf(javadoc Math) opens url in swing. how can I tell it use the flippin web browser?
20:40justin_smith_ is a conventional name for things you don't use
20:40justin_smithdecaf: your jvm is misconfigured for your OS
20:40hcumberdaleYeah, but for java interop I carry unused things over my interfaces
20:41decafI shouldn't use that alpha stage package builder script
20:41justin_smithhcumberdale: someone implementing a protocol / method implementation can choose to use an inpout arg or not
20:41justin_smith_ is a clear way to indicate the value is unused and does not matter
20:42justin_smith*input
20:42gfrederickshcumberdale: I've used the first arg occasionally, especially if I have a defrecord and want to preserve metadata/extra-keys
20:43gfredericks(e.g., (assoc this :foo 42) rather than (->Record 42)
20:43justin_smitha common pattern for me is to implement a record that specializes my protocol, and use fields of the record to further specialize for each record instance
20:43justin_smith(this is in putting together a plugin system)
20:45hcumberdaleI want an abstract datasource. For example the ability to choose filesystem or database.
20:46technomancyhcumberdale: using _ as the dispatch value means you're dispatching on something essentially meaningless. usually a sign that you're letting protocols dictate the arity, which means you should be using multimethods unless they're too slow for the task at hand.
20:46hcumberdale(defprotocol xy_storage
20:46hcumberdale (dsave [_ dd])
20:46hcumberdale (dload [_ dd]))
20:47justin_smithso the information in the individual storage instance is not useful while saving or loading?
20:47justin_smiththat seems an odd design choice
20:48justin_smithwhy not initialize the thing that can be stored / loaded with some data that tells it how to do so?
20:48hcumberdalehttps://www.refheap.com/22240
20:48justin_smithI don't see why that is even a protocol, it is just a function on dd
20:49hcumberdalejustin_smith: remembering how it would be done in java. maybe a bad idea
20:49justin_smiththe natural thing (to me) would be to put the info for the storage directory / database connection in the type
20:49hcumberdaledefprotocol generates an interface. This would normally be my choise/way here
20:49justin_smithand dd would just be the data to store or load
20:50justin_smithright
20:50justin_smithI am just saying, the thing implementing the protocol can actually store some useful information
20:50hcumberdalejustin_smith: then I'm ending up with a tight coupled dispatching method
20:50justin_smithI have no idea what that means
20:50justin_smiththe type still decides how to use its fields
20:50justin_smithbut it may as well cary its config
20:51justin_smith*carry
20:51hcumberdalejustin_smith: that has different downsides I think
20:51justin_smithif all the info for loading/storage is in dd, then you are doing all the work by hand
20:51justin_smiththat the protocol / deftype could be doing for you
20:51hcumberdalefor example the redundant information. Not both db and fs should be used.
20:51justin_smithright
20:52justin_smithso one type has a db field
20:52justin_smithit has its implementation of the protocol
20:52hcumberdaleFor example how I would do it in java with spring
20:52hcumberdale1. Create interfaces 2. implement it n times with different logic 3. wire it up & success
20:52justin_smiththe type should have fields appropriate for configuring that type, and the protocol implementation should use those fields in order to do its job
20:53justin_smithok a protocol is an interface
20:53justin_smiththe logic is in the protocol's type specific implementation
20:53justin_smiththe configuration is in the type's fields
20:54hcumberdaleyeah. I do not have the wiring and have to write it by myself, sure
20:54justin_smithotherwise you are just doing redundant work matching up the right config to the right type by hand
20:54justin_smiththat is what that first arg is for
20:54justin_smithit is the thing with those config fields you would use
20:54hcumberdalejustin_smith: seen my refheap?
20:54justin_smithyes
20:55justin_smithyou are not using the type at all, it may as well be (Object.)
20:55justin_smithyou are doing the work the system should be doing for you, by hand, by using dd
20:55hcumberdaleyeah, understanding my issue? I want seperated functional, testable code
20:55justin_smithabsolutely
20:56justin_smithI don't see what that has to do with this though
20:57hcumberdaleHaving the information about how to persist data in the type means that all the logic to choose different strategies belongs to the type/implementation
20:58justin_smithand you think that is a bad idea?
20:58hcumberdaleYes. That's what I learned :)
20:58justin_smithI don't know why you are using a type in t hat case
20:59hcumberdaleYou can't swap implementations. That is the power the interface provides
20:59justin_smithjust write a function
20:59justin_smithyou don't need types if that is the design you want
20:59hcumberdalejustin_smith: I need defprotocol to generate an interface, right?
20:59justin_smithwhy do you need an interface?
20:59justin_smithjust write a function
20:59justin_smithpass it some args
21:00hcumberdalehmpf.
21:00justin_smithprotocols are for when you have a type that specializes a behavior
21:00justin_smithusing a protocol but ignoring the type is silly
21:01hcumberdalejustin_smith: that's not possible.
21:01hcumberdaleI "use" the type. I'm not ignoring it.
21:01justin_smithall you care about is which protocol specialization is attached to it
21:01justin_smithwhy use a type
21:01justin_smithjust pick a function
21:02hcumberdaleand how to use defprotocol and replace them by configuration?
21:02hcumberdaleIt will result in a bunch of functions like create,read,update,delete
21:02justin_smithsure
21:03hcumberdaleAll implemented different for database, filesystem or whatever
21:03hcumberdaleand you want me to implement all of them with different names? Without protocols / interfaces?
21:05hcumberdaleAnd have a big dispatching function that resolves the right function everywhere?
21:05justin_smithhttps://www.refheap.com/22241 this is what I mean
21:05hcumberdaleOr thousands of (if then else else else ) bricks around every persistence touching action
21:06justin_smiththe type itself should be used
21:06bstro9000hey, i'm trying to understand the following line, that spits out a lazy sequence of fibonacci numbers... can anyone explain to me what the [[ a b ]] bit means? It looks like arguments to the anonymous function, but why is it wrapped in double brackets? => (def fib (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))
21:06bstro9000^ clj noob here, btw.
21:06justin_smithbstro9000: it is destructuring
21:06justin_smith,(let [[a b c] [1 2 3]] [b a c])
21:06clojurebot[2 1 3]
21:07arrdem(inc justin_smith)
21:07lazybot⇒ 22
21:07logic_proghow does react/om handle which svg element is on top?
21:07justin_smithit mirrors the shape of the data it refers to
21:07hcumberdalejustin_smith: that is just a configuration value passed... don't know how that should solve my problem
21:07bstro9000justin_smith: thanks a bunch!
21:08bstro9000that makes sense
21:08justin_smithhcumberdale: I thought you were complaining that the first argument to protocols was useless / bad design
21:08justin_smithI am showing how it is typically usefull
21:08cgagis there a way to lookup a key in a map that'll throw an exception if the key isn't there?
21:09arrdemcgag: you could have a (throw (Exception. "well crap")) as your alternative value...
21:09arrdem,(get {} :foo (throw (Exception. "FUUUUUU")))
21:09clojurebot#<Exception java.lang.Exception: FUUUUUU>
21:09hcumberdalejustin_smith: agreed.
21:10justin_smitharrdem: you need laziness for that to work properly
21:11cgagarrdem: yeah that's pretty nasty though, i've got a better idea for my particular use case, was just curious
21:11bstro9000justin_smith: referring back to my question, what is [[a b]] destructuring to? there doesnt appear to be another vector to decompose it to, as there is in your example
21:11cgagjustin_smith: good point
21:11fakedrakehello!
21:11justin_smithbstro9000: the argument to the function
21:12justin_smith,(get {:a 0} :a (lazy-seq [(throw (Exception. "Not Found"))]))
21:12clojurebot0
21:12justin_smithkind of a hack
21:12bstro9000justin_smith: i guess i just dont understand why the function isnt merely asking for two arguments. whats the advantage of the double brackets over single brackets in this case? (feels like i'm missing something here)
21:12hcumberdaleWhat's the common way to dispatch to the different interface implementations in clojure?
21:12justin_smithbstro9000: because it is recursive and a function cannot return two values
21:12bstro9000huh! i feel like i just learned something.
21:12fakedrakesome time ago i came across a project of which clojure was supposed to use a superset to parse the program structure. It's name was an acronym like eda or sth but I cannot remember exactly
21:13justin_smithfakedrake: edn
21:13bstro9000justin_smith: thanks again
21:13justin_smithnp
21:13arrdemfakedrake: yeah it's just edn
21:13fakedrakeedn eys! thank you
21:13arrdem$google clojure tools reader
21:13lazybot[clojure/tools.reader · GitHub] https://github.com/clojure/tools.reader
21:14fakedrakeand there is a python implementation! what could go better?
21:15arrdemhehe yeah. why would you ever use json again? :P
21:15arrdem$google javascript edn reader
21:15lazybot[Implementations · edn-format/edn Wiki · GitHub] https://github.com/edn-format/edn/wiki/Implementations
21:16cjfriszStyle question: when doing let bindings in a for, when do you use the :let in the for's binding vector vs. a let expression in its body?
21:16cjfriszAny convention on that?
21:16arrdemcjfrisz: the :let is provided to make your code more consise. using it is a good thing, but optional.
21:16technomancycjfrisz: no real reason to ever avoid :let
21:17cjfriszarrdem technomancy: that was my default, but I wanted to see if there was an implicit rule about :let bindings referring to the for's bindings
21:17cjfriszIt would seem that's not the case, though
21:18justin_smithbstro9000: this may be better, in terms of preventing an overeaber misfire: (get {:a 0} :a (future (throw (Exception. "Not Found"))))
21:18justin_smithstill feels hacky though
21:18bstro9000I am certain that I don't understand what you just typed. But maybe someday I will.
21:18justin_smithbstro9000: oops, misdirected that
21:19arrdemjustin_smith: I don't know if that works... the future could create the exception in a different threead and then everything goes to hell
21:19bstro9000haha ok
21:19justin_smithcgag: the above was meant for you, sorry ^^
21:19arrdemjustin_smith: useing (contains?) to force lazyness is probably the nicest way to do this...
21:20justin_smitharrdem: I guess there could just be an (assert (contains? ...)) too
21:20arrdem,(fn griping-get [m k] (when (contains? m k) (m k) (throw (Exception. "Crap not found."))))
21:20clojurebot#<sandbox$eval25$griping_get__26 sandbox$eval25$griping_get__26@11b2664>
21:20arrdem,(doc assert)
21:20clojurebot"([x] [x message]); Evaluates expr and throws an exception if it does not evaluate to logical true."
21:20justin_smitharrdem: when?
21:20justin_smitharrdem: maybe you want if
21:20arrdemjustin_smit: yeah if.
21:21arrdemmeh
21:21justin_smith(#(do (assert (contains? % %2)) (get % %2)) {:a 0} :a)
21:21justin_smith,(#(do (assert (contains? % %2)) (get % %2)) {:a 0} :a)
21:21clojurebot0
21:22justin_smith,(#(do (assert (contains? % %2)) (get % %2)) {:a 0} :b)
21:22clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (contains? p1__101# p2__102#)>
21:22justin_smithtoo bad about the ugly macro names though
21:25arrdemjustin_smith: eh gensyms. got a better way to name 'em?
21:27ddellacostais this the best way to get CI integration w/Jenkins? https://github.com/jenkinsci/leiningen-plugin
21:28bitemyappddellacosta: jenkins lets you just write little scripts, I usually give it a directory and a leiningen command to run
21:28hcumberdaleIf some instance is defined for defprotocol, how to access it without the specific name?
21:28bitemyappddellacosta: usually just lein test for testing, lein uberjar for build artifacts.
21:29ddellacostabitemyapp: yeah, that's what I was thinking initially. Maybe that's the best approach anyways...
21:29justin_smith,((fn [haystack needle] (assert (contains? haystack needle)) (get haystack needle)) {:a 0} :b)
21:29clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (contains? haystack needle)>
21:29bitemyappddellacosta: it's simple.
21:29technomancyddellacosta: I'd just check a bin/test script into your repo and have jenkins run that
21:30technomancybin/bootstrap if it's nontrival to set up a fresh checkout, and then bin/ci if you have jenkins-specific stuff
21:30bitemyappjustin_smith: http://hackage.haskell.org/package/base-4.6.0.1/docs/src/Data-List.html#isInfixOf
21:30bitemyappddellacosta: ^^
21:30technomancythat way your commands are tracked in git too.
21:30bitemyappjustin_smith: your haystack/needle thing reminded me of the code I just linked. I rather liked the code.
21:30ddellacostatechnomancy: yeah, I will do a test setup and see what works--that sounds like a pretty good setup, thanks!
21:31technomancyhaving to coordinate changes in git with changes in jenkins config is a nightmare, which you get if there's anything more complex than "run bin/ci" in your jenkins config
21:31ddellacostatechnomancy: yeah, in my past life doing RoR CI with jenkins, we had a much more complicated setup that was, as you say, a nightmare...
21:32bitemyappthis is probably why we don't actually do CI at my company
21:32bitemyappit's just a test server.
21:32bitemyappit doesn't check anything in or push anything.
21:32bitemyappthat would require me trying to convince my coworkers to exert more discipline than they're currently wont to do.
21:33technomancybitemyapp: it just logs each run off to a well-documented and accessible location?
21:33ddellacostabitemyapp: I just want something that automatically runs tests in a centralized location (our team is pretty distributed) after checkins to a main branch, and notifies people/logs/all the above
21:33bitemyapptechnomancy: we just look at the build history on Jenkins itself.
21:33bitemyappddellacosta: that's all ours does. Triggers a run of the tests on check-in.
21:34hcumberdalehttps://www.refheap.com/22240
21:34ddellacostayeah, I mean, fundamentally that's all I need...but Jenkins comes with a bunch of other stuff that could be useful to leverage
21:34hcumberdaledo I have to use type hints ?
21:35justin_smithhcumberdale: you need to implment xy_storage on the my.namespace.param
21:35justin_smithright now, from what you show, it is only implemented for xy_storage, which you are not passing in
21:36hcumberdalebut when I use something like (dsave (->xy_storage) x) I need to tell about my strategy at this point :(
21:37justin_smithhcumberdale: you would create the strategy when creating the xy_storage instance, yes. If you need a different strategy you make a different instance of xy_storage
21:38hcumberdalejustin_smith: meaning all the code for all different data stores is in xy_storage?
21:38justin_smithis in the individual instances of xy_storage
21:39hcumberdaleahh okay.
21:39justin_smiththat's why I suggested xy_storage should have fields, specializing how it stores
21:39justin_smithbut you would need to add fields to the type, and use those fields in the protocol impl
21:39justin_smithas I tried to show above in my version of your paste
21:39hcumberdaleisn't there a way to include implementations (conditional) by the reader, talking only to the interface?
21:42justin_smithI don't understand that question, sorry
21:42hcumberdalelike a namespace app.storage.db and app.storage.fs ? Where I can choose what implementation is loaded from the reader?
21:43hcumberdalejustin_smith: example: 1 file with the db implementation for persistence
21:43hcumberdale2. file with the filesystem implementation
21:43justin_smithhow I use a protocol: the base library implments a protocol, and has functions that call methods on that protocol
21:44justin_smiththe end user of the lib creates things that implement the protocol, and pass them to functions in the base lib
21:44hcumberdaleTo write an conditional include shouldn't be the problem. But how to access the methods behind.
21:45justin_smithit flattens out dependency loops, because all the underlying library cares about is the protocol methods it defines, it is up to the user to pass something in that will work
21:45justin_smithso for your example, the base lib just calls dsave or dload on the object passed in
21:45justin_smiththe end user decides on how those are implmented
21:47hcumberdalejustin_smith: okay. that's another way how to deal with it (inside out)
21:47justin_smithfor the rightside out case, you don't need a protocol
21:47justin_smiththe library defines a function, the end user calls it
21:47justin_smithend of story
21:47hcumberdalecoming from java I've only know about the best practices there and how EJB3 services and so on work
22:08cjfriszHmm...how do you look at a stack trace using cider in emacs?
22:08cjfriszAs in, the thing I just typed into the repl blew up and I want to look at the associated stack trace
22:12Raynescjfrisz: It didn't just pop the stack trace up?
22:13RaynesI mean, you can use (clojure.repl/pst *e) to slightly-pretty-print the stacktrace.
22:13RaynesBut it should open a buffer with the trace automatically afaik.
22:13cjfriszRaynes: nope, just printed the source of the exception inline in the repl
22:13RaynesBut then again, I haven't used Emacs since before cider was cider.
22:13cjfriszPlus, I didn't see a stacktrace buffer in my buffer
22:14cjfriszYeah, this seems to be a change with cider, because I also remember getting a stacktrace buffer automatically in nrepl
22:15arrdemif so it's a new change to cider. the cider version I'm running does pop an error buffer.
22:16cjfriszarrdem: I'm using whatever version is on marmalade
22:17cjfriszShould I be using bleeding edge?
22:17cjfriszIs it still too early to be using cider instead of nrepl?
22:17technomancycjfrisz: it says in the readme how to turn on what you want
22:17technomancysome setq
22:18technomancykind of baffling that it doesn't do it for you, but whatever
22:18cjfrisztechnomancy: Ah, yeah, forgot to go check that piece of docs
22:18cjfriszThanks
22:18technomancynp. I'msure you could find it with apropos-variable too
22:18arrdemcjfrisz: I've heard it said here that cider is still too new to use, I haven't personally had issues with it yet.
22:19cjfriszarrdem: I've mostly had good luck with it, but Stuart Sierra said he was wary via the Twitters some time back
22:20arrdemcjfrisz: yeah. I'm an Arch Linux user, so bleeding edge is my norm. Which also implies some willingness to fix your own tools...
22:21arrdems/implies/demands/g
22:21gfredericksI've been using cider
22:21cjfriszarrdem: same here
22:21gfredericksthe only big thing I've noticed is that `cider-restart` doesn't seem to work
22:21arrdemyeah can confirm that cider-restart craps out.
22:21gfredericksso I just cider-quit & cider-jack-in or whatever manually
22:22arrdem{we|I} should open a ticket...
22:22cjfriszarrdem: I bet we both have the same problem of "oooh, a shiny new version of a thing I use!" /me upgrades and promptly has tons of trouble
22:22cjfriszI guess they call that being an early adopter
22:22cjfriszaka sucker
22:23arrdemhehe. As long as I have enough of my system either cached or under version control to roll back and achieve a sane state I'm OK with some of that.
22:23gfredericksarrdem: I'll go open a ticket
22:23gfredericksarrdem: if you'll back me up
22:23arrdemgfredericks: totally.
22:25gfredericksarrdem: https://github.com/clojure-emacs/cider/issues/439
22:26arrdemgfredericks: thanks
22:27gfredericksphew now I don't look crazy
22:27gfredericks...for submitting the issue at least
22:27arrdemhaha. nice currying library btw!
22:28arrdemI hadn't seen it before...
22:30gdevpeople ask why I like watching UFC. after reading "x language vs y language" articles all the time its nice to see things that can actually verse each other and have a clear winner at the end
22:31arrdemgfredericks: the qbits toolkit is hillarious. very nice.
22:31gfredericksarrdem: oh the readme?
22:31gfredericksand such
22:32gfredericksarrdem: thanks on both accounts
22:35gdevcider is just a renaming of nrepl.el right? I haven't seen a difference since the key combo for jack-in is the same
22:35gfredericksarrdem: the qubits was fun to write because it made OOP seem anomolously appropriate: http://hacklog.gfredericks.com/2013/07/23/object-oriented-qubits.html
22:36gdevI do like how it opens up the repl buffer as a split window under my current buffer instead of sending me to the single buffer view
22:38arrdemgfredericks: that's why I was entertained reading the README. It makes a mockery of the things that Clojure usually insulates you from.
22:38arrdemgfredericks: the side-effecting read is still cute, abet accurate.
22:41gfredericksI think that might have been the only time I've had a legit use for coordinated updates w/ refs
22:55gdevrhg135, okay I just found it. it's C-c M-p
22:57rhg135whaa
22:57rhg135gdev, what did I do?
22:58Clomei heard something about UFC, shits going down on 29th
22:59gdevrhg135, were you asking earlier today how to put a form in the repl buffer?
23:00rhg135i don't even use emacs, gdev
23:00gdevrhg135, so that's a no
23:00rhg135gdev, nope lol
23:00gdevwell shit now I need to read the logs
23:02gdevoh and of course, lgs32a isn't even online now
23:02gdevthat's who was asking
23:03technomancywho's looking for a library name? https://www.adafruit.com/blog/2013/12/24/turbo-encabulator/
23:03justin_smithmmm, turbo enchiladas sound yummy
23:05gdevtechnomancy, cool, now I just need a library
23:40rhg135well now the handlers do run but after the client closes the sockets
23:44rhg135ok this is weird af
23:45rhg135now it's running in real time and i get it in my log, but it's not writing to my socket
23:59rhg135https://bitbucket.org/rhg135/jimjure/src/f27e70281846513c7170246e4b89246030704e9a/src/jimjure/json.clj?at=dev#cl-18 isn't doing anything