#clojure logs

2014-03-04

00:01dsrxthe with-channel macro ain't too bad https://github.com/http-kit/http-kit/blob/master/src/org/httpkit/server.clj#L135
00:05technomancyminikomi: if you don't plan on making changes, just use lein install
00:06firefauxcan anybody think of an elegant way to iterate over the values of 2 maps with the same keys? I can't think of anything that wouldn't be terrible
00:07minikomisorry, I'm not sure how if the version I want is not on clojars..
00:07firefauxso (f {:a 2 :b 3 :c 4} {:b 1 :c 2 :d 3}) => ([3 1] [4 2])
00:08technomancyminikomi: I mean from the checkout
00:08minikomiah
00:08minikomiright, makes sense sorry :)
00:08technomancynp
00:10minikomiwell, that went well :D
00:23amalloy(for [k (keys m1)] ((juxt m1 m2) k)), firefaux
00:24firefauxthank you, amalloy
00:24TEttingeramalloy, subtle bug there
00:24amalloyor if you're really bothered by the unnecessary map lookups, (for [[k v] m1] [v (m2 k)])
00:24SegFaultAXWhat if they have different keys?
00:24amalloywell he did say "with the same keys"
00:24firefauxI just want the keys that match
00:24SegFaultAXSomething like:
00:24TEttingerthe example given has an :a key in one and a :d in the other
00:24firefauxsorry
00:24SegFaultAX,(#(map (apply juxt %&) (apply clojure.set/intersection (map (comp set keys) %&))) {:a 1 :c 6} {:b 2 :c 3})
00:25clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>
00:25SegFaultAX,(require 'clojure.set)
00:25clojurebotnil
00:25SegFaultAX,(#(map (apply juxt %&) (apply clojure.set/intersection (map (comp set keys) %&))) {:a 1 :c 6} {:b 2 :c 3})
00:25clojurebot([6 3])
00:25firefauxI was saying I just wanted it to use the values to shared keys
00:25firefauxwhat's this %&
00:25firefauxI've never seen that
00:25TEttingerthat's a good one SegFaultAX
00:26SegFaultAXTEttinger: Juxt to the rescue!
00:26amalloy(for [[k v] m1 :let [e (find m2 k)] :when e] [v (val e)])?
00:26TEttingerit's like [a b & c] goes to %1 %2 %&
00:26firefauxoh
00:26firefauxthat's good to know
00:26TEttingerit's a vital part of swearjure is the only reason I know it, haha
00:27SegFaultAXI think there should be 2 functions here: get the intersection of the keysets, then find all the shared values for those keys.
00:28SegFaultAXMine is clearly hard to follow and complects those two things.
00:28TEttingerthat's a very reasonable idea
00:28TEttingershould be more reusable anyway
00:29SegFaultAXI like amalloy's but it doesn't generalize to n-maps
00:29SegFaultAXNot to be confused with nmap, a useful network utility. :)
00:29amalloyyes, good point; it's very special-cased
00:29firefauxI've never used juxt
00:29amalloy~juxt
00:29clojurebotjuxt is usually the right answer
00:29SegFaultAXfirefaux: It's like magic.
00:29SegFaultAXSo simple, so obvious, but so powerful.
00:29firefauxsounds like it from the docs
00:30seancorfieldI'm amazed how often I use juxt...
00:30SegFaultAXseancorfield: Yup, me too. And I very frequently reimplement it in Python and Ruby when I'm working in those langs.
00:31firefauxman, I wish I had started out with functional programming, and not OO
00:31firefauxthen things like this would be more natural
00:31firefauxby now
00:31SegFaultAXMeh.
00:31firefauxI'm getting there, thoguh
00:32SegFaultAXBoth models have things to teach you. If you had grown up in FP, you might be saying "man I wish I would have started with OOP..."
00:32firefauxclojure's really opened my eyes a lot more than Common Lisp did
00:32firefauxI suppose, but FP is just so much more elegant and powerful
00:32TEttingerI do think that having an understanding of OO helps when you need to use a java lib, certainly. and debugging clojure, since it does compile down to java-compatible .class files, so even basics help.
00:32firefauxthat's true
00:32firefauxdidn't think about that
00:33firefauxmaybe I wouldn't have started with clojure, then
00:33SegFaultAXThe fact that OOP is basically an industry standard makes it essential knowledge anyway.
00:33TEttingerreally the more you have in your toolbelt the better IMO
00:33firefauxthat's true
00:33SegFaultAXNot basically. It /is/ the industry standard.
00:33firefauxyou can always try and apply functional strategies to OOP
00:33TEttingerSegFaultAX, is cobol industry these days?
00:33firefauxI hope not
00:34TEttingerI think there's still a pretty massive amount of non-OO legacy code being maintained
00:34SegFaultAXfirefaux: With varying degrees of success... and pain... sure.
00:34amalloyTEttinger: i don't think understanding OOP helps at all with .class file debugging. like, knowing OOP is great, but you don't need any of the "oriented" or the "programming" to understand a classfile. you just need to know what an object is
00:34seancorfieldI grew up in FP and I've _never_ said "man I wish I would have started with OOP..." SegFaultAX :)
00:35SegFaultAXseancorfield: Maybe you just haven't needed a sweet ass type hierarchy yet. :)
00:35firefauxamalloy: I have no idea what debugging a .class file is like :D
00:35seancorfieldBut of course when I started OOP wasn't a "thing", at least not in the workplace :)
00:35SegFaultAXFP was?
00:35seancorfieldSegFaultAX: sure I have, but that doesn't mean I wish I _started_ that way ;)
00:36amalloyyou'll never have to, firefaux, unless you're really excited about squeezing every last drop of performance out of things. then it's handy to check the compiler is generating the code you wish it would
00:36TEttingeryeah, I guess amalloy. I seem to recall some times where I've said "oh! that's why I'm having problems, it's this gen-class/proxy/whatever isn't up-to-date, or this anon function compiled to that class file so...."
00:36SegFaultAXYou're taking my words too literally. firefaux said he wished he'd started /so that FP stuff would already be second nature by now/. Starting in one or the other doesn't really matter as long as you get around to both.
00:36firefauxI'll probably be able to read .class files after I take Compiler Construction next semester
00:37firefauxI, like many before me, will be writing mini-java
00:37firefauxand compiling it to bytecode myself
00:37firefaux:S
00:37TEttingerand from there you can make mini-clojure heh
00:37firefauxlol
00:38amalloyi remember writing mini-java
00:38firefauxwhat language did you write it in?
00:38amalloyit was during the year that they were transitioning from teaching the class in c++ to teaching in java, and so it was a complete mess
00:38firefauxlol
00:39amalloyi don''t think the prof/ta ever got things working well enough to actually run student code, so they probably graded by guessing
00:39SegFaultAXamalloy: Bummer.
00:39firefauxthat sucks
00:39amalloyeh, it was still pretty educational
00:40firefauxluckily I'll be taking it with the same person who always teaches it in the same language
00:40SegFaultAXamalloy: Still, it's never fun to be in that situation. I've been in a class that was a total shit-show like that and it was not awesome.
00:41amalloySegFaultAX: it was actually one of my favorite classes. really good lectures and assignments, just not well managed on the other end
00:41seancorfieldSegFaultAX: i was exposed to FP at uni and started commercial dev in '80 part time... i first learned OOP in '92
00:41TEttingerI do think that clojure's strengths are almost entirely in how well-made the standard lib is, that and the way the different data structures are used for fitting purposes (not any complex compiler stuff that I'm aware of), rather than the compiler being a heavyweight type-inferring optimizing thing that takes a minute to compile hello world like some OTHER languages...
00:42SegFaultAXamalloy: Oh well that's good then.
00:42amalloyTEttinger: welllllll, all of those nice things don't mean squat unless you have a good compiler
00:42TEttingerI still remember waiting 10 minutes for MLton to compile hello world
00:42SegFaultAXseancorfield: Was it scheme?
00:42amalloyclojure really generates quality bytecode fairly quickly, and reliably
00:43seancorfieldSASL, Miranda, ML mostly
00:43SegFaultAXWhoa, Miranda? That's the Haskell pre-cursor, no?
00:43seancorfieldplus LispKit (Henderson's subset of Lisp)
00:44seancorfieldHaskell appeared about five years after I stopped working on my PhD :)
00:45seancorfieldI always hoped Haskell would go mainstream... sigh...
00:45SegFaultAXI used to work with a guy who was PhD-brothers with Wadler. He did a couple research projects back then in Miranda which he told me about. Pretty interesting stuff.
00:46n_bHaskell is getting increasingly mainstream
00:46n_bPeople have to go from Scala to somewhere sane, right? ;)
00:46SegFaultAXI don't know if I would say it's going mainstream.
00:46seancorfieldSegFaultAX: Prof Turner would have been my external...
00:47minikomiUnsatisfiedLinkError .. uh oh.
00:48SegFaultAXseancorfield: Are you going to Clojure/West?
00:50amalloythis year will be my first clojure/west
00:50amalloy(he said, not that anyone asked him)
00:50SegFaultAXamalloy: Awesome! Mine too.
00:50SegFaultAXI'll find you and introduce myself.
00:51SegFaultAXamalloy: You're from SoCal, right?
00:51amalloywell, i live there now. i grew up in the bay area
00:51firefauxI need to dabble more in haskell some time
00:51firefauxI once played with an online REPL for about an hour
00:52firefauxthat's my experience with haskell
00:52SegFaultAXamalloy: Are you near Raynes?
00:52amalloyi was glad to see that the company i'm now working for (factual) is one of the main clojure/west sponsors
00:52amalloyyeah, he moved to LA for the same job i did
00:52RaynesBut then life separated us by about 3 miles on most days.
00:53SegFaultAXRaynes: Life is cruel like that.
00:54SegFaultAXamalloy: How're you liking factual?
00:54SegFaultAXAlso, what do you do there?
00:54RaynesPrograms, I'd guess.
00:54Raynes;)
00:54amalloyi take over projects from ztellman
00:54Rayneslolol
00:54RaynesI build debian packages. ;)
00:55amalloybut seriously, it's only been a couple weeks. mostly i ask questions, and make trivial edits
00:55SegFaultAXI was waiting for you to add in a sick burn there.
00:55amalloymaintain a clojure webapp and the java libraries it uses. that kind of stuff
00:56TEttingeroh no I'm in san gabriel valley... do I need to come and socialize clojurists?
00:57amalloyall the cool kids are in santa monica
00:57TEttingerphew, san francisco
00:57SegFaultAXTEttinger: You should register soon, it'll probably fill up if it hasn't already.
00:58SegFaultAXamalloy: Is factual based down there or are you remote?
00:58amalloyfactual's headquarters are in century city, so just a few miles to commute
00:58TEttingernah, I barely leave the house. if anything I'll be on IRC chatting with people who aren't there.
00:58amalloywe have an SF office for ztellman and some of his ilk
00:58RaynesI take the 405 briefly every day now.
00:59RaynesLuckily, the direction I'm going is not that bad in the morning.
01:00SegFaultAXRaynes: You've become a local; you can tell because you said "the" 405.
01:00TEttingeranyone know what happened to bitemyapp?
01:00TEttingerI think he's in san francisco
01:00SegFaultAXHe actually moved last weekend to Austin.
01:00SegFaultAXI know, because I had dinner with him the night before he moved.
01:01amalloyhe also moved to #haskell
01:01SegFaultAX(Although he's still doing clj at work)
01:01TEttingeryeah it did seem kinda odd how he was in #clojure and always talking about haskell
01:02TEttinger&seen oakes
01:02lazybotjava.lang.RuntimeException: Unable to resolve symbol: seen in this context
01:02amalloy$seen oakes
01:02TEttinger$seen oakes
01:02lazybotI have never seen oakes.
01:02lazybotI have never seen oakes.
01:02TEttingerhm
01:02TEttingerhe seems to make a bunch of things I use
01:03systemfaultHmm, I find it weird that even though Scala is more popular on the tiobe index than Clojure... #clojure has about twice as many people as #Scala
01:03TEttingerperhaps the tiobe index isn't reliable? gasp.
01:03maxthoursiesystemfault: where did you get those numbers?
01:04systemfaultTEttinger: Seems fair to be... C and Java being on top
01:04systemfaultmaxthoursie: Here vs #Scala
01:04systemfaults/to be/to me
01:05SegFaultAXMaybe it's a less IRC-centric community in general for whatever reason.
01:05systemfaultProbably
01:05maxthoursieah
01:06TEttingerhow did F# go from 69 to 12?
01:06SegFaultAXI've never really had the impression (perhaps wrongly so) that Java is not heavily focused on IRC. It's much more forum and mailing list based.
01:06systemfaultSegFaultAX: You could be right, #Java has 340 members
01:06SegFaultAXAnd a lot of scala people are former java people.
01:09TEttingerapparently they only count the search "% programming" where % is the language name. so if a few books came out called F# programming, that would skew it in its favor
01:10systemfaultMakes sense
01:10systemfaultBecause I'd be REALLY surprised if F# suddenly became that popular.
01:11TEttingeralso they have to explain in every post, the F stands for Functional Programming.
01:11TEttingerat least for MS
01:11SegFaultAXI've read a bit about F# and watched some talks on it. It actually looks like a pretty amazing language.
01:12systemfaultYeah... waayyy to amazing to be popular
01:12systemfault*too
01:12TEttingerha and Lisp is separate from clojure.
01:12TEttingerwhich I can kinda see
01:12TEttingerbut it's a very strange distinction when the different SQL "languages" are there too
01:13SegFaultAXLisp is separate from Clojure.
01:14TEttingerso they have lisp, common lisp, emacs lisp... what's going on here
01:15TEttingerJ# I don't think there are new jobs in, seeing as it's been discontinued for years
01:16systemfaultTEttinger: Now that I looked a bit more at it, I would say that only the top ones make sense...
01:16systemfault1-10
01:17systemfaultLISP is 16.. what is LISP? I thought there wasn't a language called LISP (
01:17systemfaultOnly Common Lisp.. but it's also there at position 29
01:17systemfault*39
01:20TEttingerI am guessing it's because they changed a metric that allows # in searches somewhere
01:20TEttingerexplaining J# and F#
01:21n_bIs F# popular anywhere outside of finance?
01:22TEttinger(also, the F# channel is almost dead despite a bunch of people in it. it seems very hard to actually get a question answered even with a fair number of people joined)
01:23TEttingern_b, it doesn't appear so. it looks like an excellent language that's languishing with a lack of official attention paid to it and a dwindling .NET platform (MS seems to want to kill all that they made that was good, but that's something slightly different)
01:24systemfaultI wouldn't be surprised if MS kills .net :P
01:24systemfaultAren't the new APIs native?
01:24seancorfieldSegFaultAX: yes, I'll be at Clojure/West with one of my team (Fumiko) who does Clojure full-time
01:24systemfault(I don't know...)
01:24TEttingeryeah, the RT crap
01:24n_bI don't believe so
01:24TEttingerRT I think is C#, C++, and VB only
01:25n_bVB.NET/C#/F# all compile to IL
01:25n_byou can do f# on WP8 at least
01:26systemfaultFrom wikipedia, Windows Runtime is pure C++
01:27TEttingern_b, yeah it seems to be possible, but not supported
01:29TEttingerhttp://msdn.microsoft.com/library/windows/apps/bg125378 these are your choices for winRT unless you add a dependency to .NET (and that may require some fiddling with sealing classes, I would look but I don't care for windows 8)
01:32SegFaultAXseancorfield: Sweet!
01:32SegFaultAXamalloy: Question: How much of factual is Clojure-based?
01:33amalloylike 25%? i'm not sure
01:34SegFaultAXThat's pretty significant.
01:35SegFaultAXamalloy: Are you working only on Clojure there? What other techs do they use?
01:35amalloyi'm doing like 1/3 clojure, 2/3 java
01:35amalloylike any corporation, factual uses every tech under the sun :P
01:36amalloybut the backbone is hadoop, hbase, that kinda stuff
01:36SegFaultAXI meant to say language, but it sounds like Java is the other main one.
01:36amalloyyes. there's a bit of python, ruby, and js, but mostly jvm
01:37SegFaultAXHave you picked a team yet? Like, do you know which part(s) of the factual products you'll be working on?
01:38amalloymore or less
01:40amalloylike i said earlier, a clojure webapp, and the mostly-java libraries it uses, which are mostly for hbase and hadoop
01:40SegFaultAXSo is that the customer facing stuff, then?
01:40SegFaultAXOr internal tooling?
01:40amalloytooling
01:41amalloywell, internal stuff anyway
01:43muhoois there a way in cljs to conditionally compile stuff only if it's in not-advanced mode?
01:43SegFaultAXamalloy: I'm asking because I find factual interesting from both a product and engineering perspective.
01:43SegFaultAXSeems like a pretty awesome place to work.
01:43muhooamalloy: cool, congrats on landing at factual (if i'm reading the backscroll correctly)
01:46amalloySegFaultAX: i've started helping teach the internal clojure classes some of the engineers are taking
01:47SegFaultAXamalloy: Oh, that's awesome!
01:55amalloyspeaking of factual, i asked someone at work today why a diner in pittsburgh turns up when you ask look up clojure on factual
01:55amalloyturns out that's where the clojure meetups in that area are hosted
01:55amalloyi don't remember who was asking, but if you're here now, that's why
02:05firefaux(map f [a b c] [d e f]) does ((f a d) (f b e) (f c f)), but what if I had ((a d) (b e) (c f)) and wanted to do (f (a b e) (d e f)) ?
02:06firefauxI sort of want the inverse of map
02:08ambrosebs(map #(%1 %2) ...)
02:09ambrosebsoh nvm
02:09ambrosebstoo many letters
02:09ambrosebs;)
02:09SegFaultAXWhat you want is commonly referred to as an unzip
02:09firefauxyeah
02:09SegFaultAXSince the other direction is commonly referred to as a zip.
02:09firefauxI know this is pretty common
02:09firefauxI used to know what to do in Common Lisp
02:10firefauxand in python I would have used zip()
02:10firefauxwhich is also unzip()
02:18firefauxalright, another night up past 2 writing clojure
02:18firefauxtime for bed
02:18firefaux'night everyone
02:34voldymananyone ever tried html5 server-side events with compojure
03:11muhooalright, i made a hello world in om. https://github.com/kenrestivo/blinker fwiw
03:32sm0keso if i have a macro which has let binding for x# can i use x# in a different macro which is supposed to be nested inside the first one?
03:33ambrosebssm0ke: it will be a different x#
03:33ambrosebssm0ke: it's actually syntax-quote that handles this.
03:33sm0keambrosebs: hmm any ideas for this kind f thing?
03:33ambrosebssm0ke: what do you want to do?
03:33ambrosebssm0ke: do you want them to be the same x#'s?
03:34sm0keambrosebs: yes
03:35ambrosebssm0ke: can you show an example?
03:36ambrosebsone idea might be to have a top level def that contains a gensym. Then you can use that gensym instead of x#
03:37sm0keambrosebs: yes infact i can use a ~'weird-name-which-cant-be-repeated, also ?
03:37ambrosebssm0ke: sure
03:37ambrosebssm0ke: that's all gensym is
03:37sm0kehurm.,,i though this would be cleaner
03:37ambrosebssm0ke: sounds a bit odd that two different macros need the same binding
03:38sm0keyea? may be i am doing it wrong again
03:39sm0keseems like i have this itch for writing a macro, i need to think over it again if this is not a common practive
03:41szymanowskihello, how could i turn :B/C into "B/C" ?
03:41ambrosebs,(symbol (str (namespace :B/C)) (name :B/C))
03:42clojurebotB/C
03:42ambrosebs,(str (symbol (str (namespace :B/C)) (name :B/C)))
03:42clojurebot"B/C"
03:42szymanowskigreat thank you!
03:46ddellacostaquestion about getting meta data from pointers (local variables) to functions: how do I get the metadata from the function at :foo {:foo ns/some-fn}?
03:46ddellacostaseems like it should be simple, but I'm banging my head against the wall right now
03:48ambrosebs,(-> {:foo (with-meta #() {:meta 1})} :foo meta)
03:48clojurebot{:meta 1}
03:48ambrosebsnot sure if that's what you meant?
03:49ambrosebsoh you mean non-local variables?
03:50ddellacostaambrosebs: well, what I want to do is something like this (assuming I have {:foo ns/some-fn}): (get-meta-from-fvar :foo) -> returns ns/some-fn's metadata
03:50ddellacostaambrosebs: yeah
03:50ddellacosta(meta #'clojure.core/str)
03:50ddellacostawhoops
03:50ddellacosta,(meta #'clojure.core/str)
03:50clojurebot{:arglists ([] [x] [x & ys]), :ns #<Namespace clojure.core>, :name str, :column 1, :added "1.0", ...}
03:50ambrosebsddellacosta: there's probably some trick that works most of the time.
03:50ddellacostacan I def stuff here?
03:50ambrosebsmaybe?
03:51ddellacosta(def foo clojure.core/str)
03:51ddellacostaarg
03:51ddellacosta,(def foo clojure.core/str)
03:51clojurebot#'sandbox/foo
03:51ddellacostaah
03:51ddellacostanice
03:51ddellacosta,(meta foo)
03:51clojurebotnil
03:51ddellacostaright
03:51ambrosebscan you just use the var in the map?
03:52ddellacostaambrosebs: maybe that's the answer, I'm probably thinking about it the wrong way
03:53ddellacostaright...
03:53ddellacosta,(def foo-map {:foo 'clojure.core/str})
03:53clojurebot#'sandbox/foo-map
03:53ddellacosta(meta (resolve (:foo foo-map)))
03:53ddellacosta,(meta (resolve (:foo foo-map)))
03:53clojurebot{:arglists ([] [x] [x & ys]), :ns #<Namespace clojure.core>, :name str, :column 1, :added "1.0", ...}
03:53ddellacostaambrosebs: yeah, that's the way to do it ^
03:54ambrosebswhy not just use the var?
03:54ambrosebsyou probably want find-var.
03:55ambrosebsunless you're using aliases.
03:55ddellacosta,(def foo-map {:foo #'clojure.core/str})
03:55clojurebot#'sandbox/foo-map
03:55ddellacosta,(meta (:foo foo-map))
03:55clojurebot{:arglists ([] [x] [x & ys]), :ns #<Namespace clojure.core>, :name str, :column 1, :added "1.0", ...}
03:55ddellacostaambrosebs: yeah, I guess that's best
03:56ddellacostaambrosebs: thanks for pointing out the obvious (seriously). :-)
03:56ambrosebs:)
03:56ddellacostaambrosebs: yeah, a little explanation--I'm building something that is looking up functions based on map keys, but we have full control over how it's specified. So using the var makes the most sense I think.
04:26sm0keso if i have a function with signature like (foo 123 :a 1 :b 2 :c 3), can i destructure the last key value pairs into a map?
04:27sm0kei mean oob, obviously i can do a (into {} (map...)) kind of stuff
04:30ambrosebssm0ke: what do you mean?
04:30sm0keambrosebs: i mean something like (defn foo [x & more]) where more is a list can i have a map instead?
04:31fredyrsm0ke: so you want the opposite of destructuring? collapse arguments into a map?
04:31sm0keyes kind of
04:31sm0keits still destructuring imo
04:32fredyrum i wouldn't say so but no matter
04:32sm0keyep, not the point
04:33pyrtsasm0ke: Do you mean (defn foo [x & {:keys [a b c] :as m}] ...) ?
04:33sm0kepyrtsa: well i have to define a b c
04:33sm0kewhat if there are unbounded arguments
04:34pyrtsasm0ke: (defn foo [x & {:as m}] ...) works as well.
04:34sm0keoh ok
04:34ambrosebs,((fn [& {:as m}] m) 1 2 3 4)
04:34clojurebot{1 2, 3 4}
04:34sm0keawesome
04:34sm0ke(inc pyrtsa)
04:34lazybot⇒ 2
04:34fredyroh nice
04:34sm0ke(inc ambrosebs)
04:34lazybot⇒ 7
04:34ambrosebsalso works with let
04:35ambrosebs,(let [{:as m} '(1 2 3 4)] m)
04:35clojurebot{1 2, 3 4}
04:35ddellacostahow do I reload a type in the repl (if I'm referring to it in a namespace that is)?
04:35pyrtsaMind you, unlike with [x & more], [{:keys [x] :as args}] will leave args with all arguments, x included. So it's more similar to [x & more :as args].
04:36ddellacosta:reload doesn't seem to pick up the edits.
04:36ddellacostaI guess I should consider using Stuart Sierra's workflow...may help
04:36ambrosebsddellacosta: try and save all your files and :reload-all?
04:36ddellacostaambrosebs: sorry, as an argument to what, require?
04:36ambrosebsyes
04:37ddellacostaambrosebs: yeah, that doesn't seem to do it. :-(
04:37ambrosebsddellacosta: probably needs a restart + clean
04:37ddellacostaambrosebs: I assume it has something to do with re-compiling the Java class that is hanging out in cache somewhere
04:37ddellacostaambrosebs: ugh, didn't want that to be true but not sure what else to do
04:40ambrosebsddellacosta: dirty REPLs cause so much trouble. Sometimes you need to know when to give up ;)
04:40ddellacostaambrosebs: this is very true. :-)
04:41BartAdvI wonder what's world record in REPL time without restart
04:41ddellacostaambrosebs: however, I should probably suck it up and get my project working inside of https://github.com/stuartsierra/component or https://github.com/zcaudate/vinyasa or something
04:42ddellacostaBartAdv: I've heard cemerick say he goes weeks without restarting, but dunno if that's the record. I can imagine someone's broken the months/year barrier...
04:42clgvddellacosta: yeah vinyasa was advertised with java class reloading
04:42ambrosebsI'm the wrong person to comment on those, core.typed does some crazy things which I've internalised ;)
04:43ambrosebsgotta get those startup times down..
04:43ddellacostaambrosebs: ha...I can only imagine.
04:43clgvweeks without restarting? I always restart the REPL on weird errors to make sure it's not the current repl state that's messed up
04:44ddellacostaclgv: I know, I was a bit surprised. It's not THAT big of a deal...but I guess some people have different ideas of what inconvenience means. ;-)
04:44ambrosebsclgv: weak ;)
04:44ddellacostahaha
04:44ddellacostaambrosebs: harsh man, harsh
04:44clgvmy record are approximately 5 days
04:44ambrosebs:D
04:45ambrosebsscheme people are laughing at us. *obviously* restart the REPL!
04:45ddellacostaI'm not sure, I've left a repl going for a while and not realized it. Probably I've gone a week before, but I never do it on purpose.
04:45ambrosebs:)
04:45clgvwell usually I shutdown my development machine at closing time ;)
04:45koreth_Is there any way to install a hook such that code gets called whenever a symbol is defined? I want to trigger a browser reload with the LiveReload plugin whenever I update a function definition from the REPL.
04:45ddellacostaclgv: ah.
04:45ddellacostakoreth_: I think https://github.com/technomancy/robert-hooke/ does that
04:46ddellacostakoreth_: er, assuming you can hook to defn or however you're designing it, not sure.
04:46ddellacostadesigning -> defining
04:46koreth_defn is a macro, so I'm not sure if that'll work.
04:46BartAdvclgv> well usually I shutdown my development machine at closing time ;) <- is there a way to save REPL session state? With common lisp it was easy
04:46koreth_But can't hurt to try!
04:47clgvBartAdv: not that I know of.
04:47clgvddellacosta: koreth_: you can definitely hook "defn" but not "def"
04:48clgvif the var already exists you can add a watch
04:48koreth_clgv: defn is good enough for my purposes. Thanks.
04:48ddellacostaclgv: ah, okay, good to know.
04:49clgvddellacosta: that's the problem with thos special forms^^
04:49ddellacostaclgv: yeah...d'oh.
04:49clgvddellacosta: though probably the right way would be to watch the changes on a namespace
04:50ddellacostaclgv: yeah, I haven't ever needed to do so much heavy namespace wrangling myself. I find if I'm getting to that point there is something wrong with my design...but I don't write a ton of libraries.
04:51clgvddellacosta: I did some hooking into defn and deftype for a debug tool
04:51ddellacostaclgv: ah, that would be a good example of appropriate use I'd think
04:51koreth_Watching the changes on the namespace is workable but slightly annoying because I'd have to watch changes on *all* the namespaces in my app (since I want to trigger the reload no matter which bit of the code I'm editing).
04:52clgvkoreth_: yeah, I meant that namespace should support add-watch and trigger the function on changes ;)
05:08ddellacostaomfg, testing types is such a pain in the ass. There must be an easier way.
05:11koreth_Ah, beautiful. This is like magic now. Edit function, hit "cpp" to make fireplace-vim send it to the REPL, and boom, the browser instantly reloads without me having to switch window focus. http://pastebin.com/REaQebPG
05:11koreth_(Not sure if that's the best way to touch a file.)
05:17quizdry'all think merge-with will result in a sorted map if the arg maps are sorted-maps?
05:19alewyou would have to use (into (sorted-map) ...)
05:19jowagquizdr: result is of same type as the first map (second arg)
05:20quizdralew appears as though jowag suggests into sorted-map would not be necessary
05:21alewhe's right
05:21pyrtsaquizdr: The documentation of merge-with implies the result will have the type of the first argument: "Returns a map that consists of the rest of the maps conj-ed onto the first. (...)"
05:22pyrtsaSo you can rely on it
05:22jowagexactly
05:22quizdrthat's great.
05:22quizdrif I have a map like {:a [1 2 3] :b [4 5 6]
05:22quizdrand I want a new map like {:a 3 : 6} where values are the last arg of the vector, is update-in an option here?
05:22quizdrI can't figure out how to use it. I'm using into/for combo
05:23pyrtsaquizdr: You could do (into (empty m) (for [[k v] m] [k (last v)])) for example.
05:24pyrtsaUnfortunately, there's no standard function for mapping a function over the values of a map.
05:24pyrtsa(I put (empty m) there only to preserve the sorted-map'ness of m, because that was your previous concern. You could use (into {} ...) as well.)
05:25quizdrok, that's what i'm doing currently, but the docs for update-in seemed to suggest there might be a possiblity here
05:25pyrtsaupdate-in only updates at one key.
05:26pyrtsaYou'd need to do something like (reduce #(update-in %1 [%2] last) m (keys m)), which probably isn't as optional.
05:26quizdroh ok
05:26pyrtsas/optional/optimal/
05:26quizdrok, i'm getting used the into/for idiom, so i'll stick with that.
05:28jowagquizdr: you can also use something like (zipmap (keys m) (map f (vals m)))
05:29alewI don't think that's guarranteed anymore
05:29pyrtsaalew: No, the opposite, it *is* guaranteed now.
05:30jowag^what pyrtsa said
05:30pyrtsaRich involved in the email discussion and confirmed the implementation does the only right thing it should do: have consistent order for (seq m), (keys m) and (vals m).
05:30alewwell thats fantastic
05:31pyrtsaHere's hoping it's also written down and added to the docstring in Clojure 1.6.
05:44jowagpyrtsa: it's there, http://dev.clojure.org/jira/browse/CLJ-1302
05:57systemfaultIs there any way to see what's printed on the console with cider?
06:00systemfaultNevermind... updating cider to the latest version fixed the problem
06:11tomjackconsider a 'distinct' reducer
06:12tomjackhttps://www.refheap.com/8f8bc4fa9580a8dc6209131aa
06:13tomjackd'oh, I should have tried it first
06:14tomjackwell, my point was that that doesn't work
06:15tomjackthough I thought it worked more than it does..
06:15tomjackseems like you need an atom?
06:23sm0keany nice method to recursively apply function to all map keys?
06:23sm0kemaps value can be map
06:24tomjackwhat if the function is not injective?
06:24sm0kei am talking about simple functions
06:25sm0kelike str to keyword
06:25sm0kenothing fancy
06:25tomjackah, by simple you mean injective, I guess :)
06:25sm0keseems like there is nothing to map on a map directly
06:25sm0kerecursively is far fetched idea
06:26tomjack(reduce-kv (fn [ret k v] (assoc ret (f k) v)) {} map) ?
06:26tomjack:/
06:28sm0kewhat is that for?
06:28sm0keis it recursive?
06:29tomjackno
06:29sm0ke(into {} (for [[k v] m] ..)) is better
06:29tomjackprobably
06:31pyrtsajowag: Yay, great!
06:33tomjacksm0ke: you don't actually want to stringify keys, do you?
06:33sm0ketomjack: actually i want opposite
06:33tomjackit appears clojure.walk/stringify-keys provides a recursive example in any case
06:33tomjackthere is keywordize-keys too
06:33minikomiah nice, got webcam working with quill, fireplace
06:33minikomilive video manipulation :D
06:33tomjackI was going to suggest a clojure.walk impl next and then noticed that again :)
06:35sm0kenice
06:35sm0ke,(clojure.walk/keywordize-keys {"a" 1 "b" 2})
06:35clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>
06:36sm0kenice its recursive all right
06:36sm0kei have another problem now
06:36sm0kehow do i recursively conver a java map to clojure map
06:37sm0ke(inc tomjack)
06:37lazybot⇒ 2
06:38tomjack#(if (and (instance? java.util.Map %) (not (map? %))) (into {} %) %)
06:38sm0keooh (into {}...) works
06:39sm0ketomjack: yes thanks
06:39tomjackwith a walk?
06:39sm0ketomjack: one more think is there a walk function for applying ustom functions?
06:39sm0kecustom*
06:39tomjackmy function above was for clojure.walk/prewalk
06:39tomjackbut I'm not sure that makes sense
06:40sm0keok wait, so many questions
06:40sm0kei was asking is there a clojure.walk with custom function on keys?
06:41tomjacklook in clojure.walk and read the docstrings
06:41tomjackalso read the source of keywordize-keys and stringify-keys
06:41sm0keok thanks
06:41tomjackthere is no such function but you can copy stringify-keys to write it
06:42sm0keand yes into {} seems recursive
06:42tomjack&(class (:foo (into {} (doto (java.util.HashMap.) (.put :foo (doto (java.util.HashMap.) (.put :bar 42)))))))
06:42lazybot⇒ java.util.HashMap
06:42pyrtsa(into {} ...) itself isn't recursive, but of course you can use it with a recursive function.
06:43tomjackI guess a postwalk makes sense?
06:43sm0kehmm really?
06:44sm0ketry this in repl, (clojure.walk/keywordize-keys (java.util.HashMap. {"a" 1 "b" {"c" "b"}}))
06:44sm0keand this, (clojure.walk/keywordize-keys (into {} (java.util.HashMap. {"a" 1 "b" {"c" "b"}})))
06:44pyrtsasm0ke: It's keywordize-keys that is recursive there, not into.
06:45sm0kebut then how come it doesnt work on the first case?
06:45tomjackit's because into is not recursive
06:45tomjackoh, hmm
06:46tomjacknot your example
06:46pyrtsaNo, it's because clojure.walk only deals with IPersistentMaps and java.util.HashMap isn't one.
06:46tomjack&(clojure.walk/keywordize-keys (into {} (java.util.HashMap. {"a" 1 "b" (java.util.HashMap. {"c" "b"})})))
06:46lazybot⇒ {:b #<HashMap {c=b}>, :a 1}
06:46pyrtsaSee (source clojure.walk/keywordize-keys).
06:47pyrtsa,(map? (java.util.HashMap. {})) ;; in particular.
06:47clojurebotfalse
06:48tomjackah, which is also why postwalk doesn't work
06:48pyrtsaYeah.
06:48sm0ke,(map? (into {} (java.util.HashMap. {"a" 1 "b" {"c" "b"}})))
06:48clojurebottrue
06:48sm0ke,(map? ((into {} (java.util.HashMap. {"a" 1 "b" {"c" "b"}})) "b"))
06:48clojurebottrue
06:48sm0kesee
06:48tomjackbut prewalk is going to (into {}) each hashmap just to rebuild that map anyway?
06:48sm0keinto is in fact recursive
06:49sm0keoh ok got it..
06:49sm0ke:P
06:49sm0ke,(map? ((into {} (java.util.HashMap. {"a" 1 "b" (java.util.HashMap. {"c" "b"})})) "b"))
06:49clojurebotfalse
06:49sm0kehaha
06:49sm0keso is there a way to recursively convert a java map to clojure?
06:50tomjackcall prewalk with the anon function I gave above
06:50tomjackand the two walks can't be zipped!
06:50tomjacknot that it probably matters
06:51tomjacks/zipped/fused/ I guess
06:51sm0kei could use a form
06:56clgvuse postwalk, then each map is changed only once
06:58pyrtsasm0ke: (defn f [m] (if (or (map? m) (instance? java.util.Map m)) (into {} (for [[k v] m] [k (f v)])) m))
07:00sm0kepyrtsa: why are you not using walk?
07:00pyrtsaWhy use walk?
07:00sm0kelook convenient
07:00sm0kelooks*
07:02sm0keok this fails, (clojure.walk/postwalk (fn [x] (if (instance? java.util.Map x) (into {} x))) jm)
07:03sm0ke(def jm (java.util.HashMap. {"a" 1 "b" (java.util.HashMap. {"c" "b"})}))
07:03pyrtsaOne thing to watch out, regardless whether you use clojure.walk or a recursive function like the one above: self-referential data structures will cause an infinite loop (broken with a stack overflow).
07:03pyrtsaThat won't really happen with persistent data structures but may happen with java.util.Map.
07:04sm0kepyrtsa: your functions works well
07:04pyrtsasm0ke: Like I said above, the trouble with clojure.walk is it expects Clojure maps, not Java.
07:05sm0kepyrtsa: it works on plain forms, if i am reading the docs correctly
07:05sm0kehas nothing to do with maps
07:06pyrtsaBtw, my function f above won't recur into sequences and vectors, only maps. You'd need to add another condition for that.
07:06sm0kepyrtsa: i am copying another one of your functions
07:07sm0kei remember i copid something related to lazy seq one time
07:07pyrtsaNo problem.
07:08sm0keoh i see the porblem, yes you are right i think this cant be done with walk
07:08pyrtsasm0ke: What comes to documented vs. actual behavior... use the source (macro), Luke.
07:08sm0keas its not a seq which clojure can walk
07:17hhenkel_Hi all, I'm currently trying to parse the server response of zabbix (https://www.zabbix.com/documentation/2.2/manual/appendix/items/activepassive#active_checks => Server Response after sending collected data).
07:18hhenkel_I'm currently failing on parsing the json part, as it seems like there are "NUL" chars within my result.
07:19hhenkel_I allready tried to write the response to a file and there I see the NUL chars but I'm not completly convinced that the server is sending me this.
07:20clgvhhenkel_: what are NUL chars? a string with content "NULL"?
07:21clgvor character of value zero?
07:21quizdrjowag that zipmap idea is very clear and elegant, thanks!
07:22pyrtsaclgv: "foo\u0000bar"
07:23clgvpyrtsa: thats what I want to know from him. what exactly he means...
07:23pyrtsahhenkel_: If that's the only problem (and you consider JSON input containing NUL chars valid, which I don't), you could do (clojure.string/replace input #"\u0000" "")
07:23hhenkel_clgv: https://www.refheap.com/51801
07:24hhenkel_pyrtsa: I also thinks those are valid...and so does cheshire as it fails. I'll give your suggestion a try.
07:24clgvhhenkel_: the trailing 0s you mean?
07:25hhenkel_clgv: I guess it will allready fail with the leading nul
07:27clgvso that file is the body of an http response?
07:27pyrtsahhenkel_: I don't know of Zabbix but to me it seems like you're getting broken data. The docs say it should start with "<HEADER><DATALEN>{", and the three zero chars don't look like a header.
07:27pyrtsa...nor a data length.
07:27hhenkel_pyrtsa: That is right, it is only the "data" part I posted.
07:28hhenkel_clgv: It's not http, they are using there own protocol.
07:28pyrtsaAre you sure you're parsing it right?
07:29hhenkel_pyrtsa: that's a valid question, I'm able to extract the header and the length - but maybe there is a better way.
07:29pyrtsaThe datalen is probably 4 bytes or something like that. Are you sure you're using it right?
07:29pyrtsa8 bytes, according the docs.
07:29hhenkel_I'll post what I currently got.
07:34hhenkel_pyrtsa: https://www.refheap.com/51804
07:34hhenkel_pyrtsa: I guess problem could be that I initialize a byte-array that is to big?
07:35pyrtsahhenkel_: (. (:in @conn) read datalen 0 5) ...
07:35pyrtsaShould be 8.
07:35pyrtsaAnd you should use the value of datalen for message length, instead of a fixed 1024.
07:35hhenkel_pyrtsa: yes, you're right.
07:36pyrtsa(Protip: datalen comes little-endian, i.e. first byte contains the least significant part of the Long.)
07:36hhenkel_pyrtsa: TRACE: "5900000000000000"
07:36pyrtsaYou should treat that value as 0x0000000000000059
07:42hhenkel_pyrtsa: I'll give it a shut. Thanks so far!
07:48pyrtsahhenkel_: This could help: http://stackoverflow.com/a/14827440/26981
08:00clgvpyrtsa: byte order confusion yay!
08:20szymanowskiis there a function to get the n lasts elements of a coll?
08:21pyrtsatake-last
08:21szymanowskiok thank you :)
08:22pyrtsaIn case it's a vector, subvec is better.
08:59hhenkel_pyrtsa: you're still around?
09:30mikerodIs it correct to say that the clojure.lang.Compiler$Expr#emit method would only be called when compiling to a file ("static" compile/AOT compile)?
09:34ambrosebsmikerod: sounds about right. Not sure tbh.
09:34pyrtsahhenkel_: Back.
09:55mikerodambrosebs: yeah, it's my assumption so far
09:55mikerodwhich should make sense.
09:59llasrammikerod: Kind of. All AOT compilation does is write out the class files for generate classes while also performing "normal" compilation/evaluation
10:05mikerodllasram: that was my impression.
10:07hhenkel_pyrtsa: https://www.refheap.com/51845 Is this a sane way to do things?
10:12llasramhhenkel_: There are several problematic aspects
10:12pyrtsahhenkel_: You should use getLong. The following probably reads better: (.. (ByteBuffer/wrap datalen) (order ByteOrder/LITTLE_ENDIAN) getLong)
10:13llasramhhenkel_: The biggest IMHO is that there's no nead for a ref -- you can just use `loop` and do normal Clojure tail recursion until the exit condition is met
10:14llasramhhenkel_: I agree with pyrtsa that your use of the `.` special form should be replaced, but I'd argue that `->` and `.method` forms has become the most common
10:15pyrtsallasram: Heh, I was actually first suggesting that form, but I thought someone just suggested otherwise. I think (-> x (.foo) (.bar)) reads better for Java interop.
10:15llasrampyrtsa: 100%
10:15llasramSomeone has an older style guide which says to use `..`, but I think it's just wrong :-)
10:15pyrtsaNod.
10:16llasramMy justification is that `->` works w/ both functions and interop method invocation, and results in more consistent-reading code
10:16llasram(I note for hhenkel_'s benefit)
10:17fredyrbut I'd argue that `->` and `.method` forms has become the most common
10:17fredyr16:14 < pyrtsa> llasram: Heh, I was actually first suggesting that form, but I thought someone just suggested otherwise. I think (-> x (.foo) (.bar)) reads better for Java interop.
10:17fredyr16:14 < llasram> pyrtsa: 100%
10:17fredyrouch
10:17fredyrsorry about that
10:17llasramtut tu ttu
10:17pyrtsafredyr: No offense taken. Why?
10:17llasrampfft
10:19fredyrselecting text and clicking was apparently a bad idea in the terminal window i run my irc client
10:20pyrtsaHaha. Thought you were disagreeing.
10:20fredyrnono, just massively misclicking
10:20TimMcMiddle-click?
10:21fredyrnot really wanna reproduce it right now
10:21fredyr:)
10:21hhenkel_llasram: okay, not completly sure what you meant regarding the ref. Should I better loop till there are no more bytes?
10:21llasramhhenkel_: Right now `conn` is a ref, right?
10:21hhenkel_llasram: pyrtsa: I'll try to rework the java interop then.
10:21fredyrbut perhaps middle-click yeah
10:21pyrtsaA great feature in OS X Terminal: double clicking a paren/bracket/brace selects everything to the matching pair.
10:21hhenkel_llasram: yes.
10:22llasramhhenkel_: But AFAICT, it's only a ref so that you can mutate it to change the value at the `:exit` keyword to `true`, yes?
10:23llasramOr maybe I've misunderstood the broader context
10:24hhenkel_llasram: yes, probably. To be hones I did not think much about that part so far, I took it from this sample: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/
10:26Wild_Cathhenkel_: you might like to be made aware of https://github.com/Raynes/irclj
10:27clgvWild_Cat: wild guess. I dont think he wants to implement an irc client. ;)
10:27Wild_Caturk. Apologies, I didn't read the whole conversation.
10:27Wild_CatI need coffee.
10:28hhenkel_Wild_Cat: Thanks, I will look at it but clgv is right...I'm not working on an irc client. ;)
10:33llasramhhenkel_: huh. I have no idea why that code uses a ref
10:33llasramhhenkel_: I'm afraid that isn't really a very good example
10:36hhenkel_llasram: okay, that's good to know then...any suggestions for a better example? the irc client Wild_Cat mentioned before?
10:37clgvhhenkel_: example for what?
10:37clgvhhenkel_: communication with some remote service?
10:39hhenkel_clgv: good example for using sockets for low level communication.
10:40llasramhhenkel_: The thing is the basic Java standard library there is pretty straightforward, so it's pretty much just normal Clojure + that library
10:40llasrams,that library,the standard library,
10:42hhenkel_llasram: okay, then I will try to dive in there deeper.
10:43Wild_Catllasram: irclj uses a ref for "irc" objects, which each represent a connection to a specific server. The reason they're refs is that they mainly hold a big bunch of state, which changes throughout the life of the IRC object (e.g. a server is connected to, then channels are joined/parted, statuses are set...).
10:43Wild_Cat...and of course by "IRC objects" I actually mean "maps", in classic Clojure tradition :p
10:44llasramWild_Cat: I was referring to the blog-posted example hhenkel_ linked to. I haven't looked at irclj before :-)
10:45Wild_Catllasram: and I, in another characteristic display of caffeine deprivation, was actually answering hhenkel_'s highlight. :p
10:45llasramho ho ho
10:46Wild_Cattoday's lesson: I can do Python in my (near-)sleep. Not Clojure.
10:48CookedGryphonis there a good reason clojure.core.match couldn't be extended to support the following: https://www.refheap.com/51896
10:49CookedGryphonat the moment it complains because it thinks I'm binding two different things to the same name
10:49CookedGryphonI tried implementing it with (_ :guard (partial = x)) instead of the second x, but the first x isn't in scope at that point to use in the guard
10:53pyrtsaCookedGryphon: That's unification, not pattern matching. A bigger topic.
10:54bbloompyrtsa: that is not unification
10:54bbloompyrtsa: unification means that there are variables on both sides of the match
10:54pyrtsaNo?
10:54pyrtsaOhh kay.
10:55bbloomCookedGryphon: frankly, i'm surprised that doesn't work already. seems like it should generate an equality guard
10:55CookedGryphonbbloom: that's what I thought too
10:55ambrosebsseems like it should just work
10:55bbloomCookedGryphon: i don't use core.match, but dnolen_ hangs around here & maybe he can give you rationale or tell you "contributions welcome" :-P
10:55ambrosebspretty sure Racket's match works like that
10:56dnolen_bbloom: that feature is actually quite rare outside of Erlang
10:57dnolen_ambrosebs: I'd be surprised if it did, but perhaps they added it. It's not common in FP langs.
10:57bbloomdnolen_: why? because universal equality is rare outside of erlang?
10:57ambrosebsdnolen_: yea, I need to check :)
10:57dnolen_ML derived I mean
10:57bbloombut we've got it :-)
10:58dnolen_bbloom: it's nice for expressiveness but it isn't particularly simple to implement (at least as far as I've thought about it)
10:58bbloomdnolen_: you've got pattern guards, right?
10:58dnolen_if you think about it doing it right in the general case
10:58dnolen_bbloom: you need to think about about scoping + nesting
10:58fredyrhttp://docs.racket-lang.org/reference/match.html
10:59fredyrseems like they do have something like that
10:59bbloomdnolen_: i'm not sure how scoping and nesting complicate this
11:00dnolen_(match [z] [{x :foo} [x _ x _ {{x :bar} :baz] ...)
11:00ambrosebsI've only got proof that it's there, not any docs. Reuses `p` with some sort of equality https://github.com/plt/racket/blob/master/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt#L176
11:01CookedGryphondnolen_: what if we gensymed a new name for each of the duplicates and then test for equality as the last stage and use the first occurence as the binding?
11:01dnolen_CookedGryphon: nope
11:01dnolen_CookedGryphon: the only thing I'm going to consider is something that is fast and correct
11:02dnolen_thus I haven't bothered
11:02dnolen_someone tried it in the past and realized it's more work than it looks at first
11:02dnolen_which why we just disallow for now
11:02bbloomdnolen_: i'm not trying to suggest it's easy nor do i have any stake in this (i don't use core.match), but i'm trying to understand the scoping/nesting issue... that match you just showed seems sane to me...
11:03bbloomdnolen_: are you concerned about creating efficient decision trees using knowledge of equalities to optimize?
11:03dnolen_bbloom: you can read the source and see the problems
11:04bbloomdnolen_: i've written a non-optimizing pattern matcher with this feature & it was trivial to implement...
11:04bbloomdnolen_: hence my question is if you're concern is the decision tree optimization
11:07pyrtsaTIL: The above kind of match pattern is called non-linear. E.g. Haskell only allows linear patterns, but you can use guard expressions to refine the match.
11:09ambrosebspyrtsa: makes sense
11:09pyrtsaIt does.
11:10fiorellinociao :D
11:10fiorellino!list
11:15seangrovednolen_: Ah, sorry, just saw the "No pull requests at this time" for Om, I'll close the PR and open an issue
11:15seangroveI just had the changes since I needed to make them locally anyway
11:16ambrosebsdoes racket's match have optimised branching?
11:16CookedGryphonSo reading a little on the implementation of core.matrix, is the issue that in order to generate an optimal decision tree you would also need to score and rearrange the rows as well as the columns in the match? Potentially leaving you with tricky ordering issues
11:18ambrosebscore.matchrix
11:18CookedGryphonoops
11:18CookedGryphon:P
11:18CookedGryphoni obviously meant to say core.match there
11:26dnolen_bbloom: sorry I'm not saying it's conceptually challenging - just that the implementation in core.match is gonna be some work - lots of tests since core.match has a lot of features
11:27bbloomdnolen_: ah ok, makes more sense :-)
11:33sdegutis,:foo
11:33clojurebot:foo
11:56vermais #lighttable the official lighttable support channel?
11:57TimMcverma: Chris Granger is in that channel, so I'd assume so!
11:57vermaTimMc: thanks :)
12:17gfrederickslatest adventure -- having trouble using clojure at work because of fortran
12:18justin_smithweird
12:18bbloomwut?
12:18ptcekfortran is good :)
12:19gfredericksapp -> incanter -> jblas -> fortran
12:19gfredericksthat last arrow is broken
12:19winklol
12:20bbloomha, wow
12:20TimMcgfredericks: You have the strangest problems.
12:21gfrederickssays the man who cannot abide gen-class wanting to compile to a class file
12:21hiredmangfredericks: try using j instead of i
12:21TimMcssshhhh
12:21gfrederickshiredman: jncanter?
12:21TimMcgfredericks: It's not *so* weird wanting to store my code in a database, is it?
12:22gfredericksTimMc: s/code/bytecode/
12:22S11001001TimMc: well, you're in g.... company. http://mindprod.com/project/scid.html
12:22TimMcgfredericks: http://techblog.netflix.com/2014/03/the-netflix-dynamic-scripting-platform.html
12:24bbloomTimMc: aawwww yeah dynamic/reflective/funtimes
12:25TimMcI'm giving up on using Clojure for the actual scripts, for now.
12:25TimMc*filters
12:27llasramTimMc: Oh, you know, I totally forgot about another option
12:27llasramTimMc: https://github.com/llasram/shady
12:28llasramIntegrates `gen-class` with the Clojure 1.3+ DynamicClassLoader
12:28TimMcoooh
12:28llasramAnd removes the requirement for it to actually drop a class file to disk
12:28TimMcWhat's the catch?
12:28llasramTimMc: It's little-tested
12:29llasramI thought I needed it, wrote it, and didn't
12:29llasramAnd I think the most recent release might be bugged. I switched to generating the classes at run-time instead of macro-expansion time. Which I think will usually be fine, except when it isn't
12:29llasramIf you always call it at top-level, it shouldn't matter
12:30llasramBut if you ever call it in a function, the `shady` version will generate a new class on each call
12:30llasramOTOH, -- why would you ever do that?
12:30TimMcRight.
12:31llasramAnd if it's not clear from the doco, you can use the DynamicClassLoader-integrated `gen-class` w/o the `defclass` attempt at sugar
12:31TimMcThe only thing left to do would be to exfiltrate the Class name to the compiler's caller, which I could do with a var.
12:32llasramIn fact, you might be best off justs copying the code from https://github.com/llasram/shady/blob/master/src/shady/gen_class.clj into your project
12:32Anderkentllasram: is it a drop-in for genclass? Can I inject it and have protocols and types that reevaluate nicely in repl?
12:32Anderkentwait, does defprotocol expand to genclass?
12:32llasramAnderkent: No :-)
12:32llasramTo the latter
12:32Anderkentbah.
12:33Anderkentactually now that I think about it my issue is exactly the reverse, i.e. reevaluating a namespace with defprotocol even if it hasnt changed breaks compatibility
12:33Anderkentso I guess I was really confused when I wrote the above
12:34TimMcllasram: Cool, I'll give this a try!
12:34llasramAnderkent: It's kind of a hard problem. I mean, defmulti/method does essentially the opposite thing, with it's own class of confusing results
12:34llasramTimMc: I hope it works! Curious to know :-)
12:37notofiHello everybody. At my team at work we have made the experience that we can not use hash-maps for our datastructures for a big application, because keyword lookup just returns nil if some value is not in the map. I am wondering if there would be a way to use strict hashes in clojure
12:38notofiAs I see it, implementing a strict hash that would throw an exception if the key is missing would break the contract of keyword lookup
12:38technomancynotofi: unfortunately no such thing exists afaik
12:38technomancypeople use preconditions or something like prismatic schema instead
12:39patchworknotofi: (contains? map key) returns true or false depending on whether the key is in the map
12:39notofipatchwork: sure, you could write a function and call (strict-get entity :id) everywhere. but thats rather verbose
12:40Anderkentnotofi: nothing like that AFAIK, also looked for it a year or two ago;
12:40Anderkentpatchwork: wrapping every access with contains? is not a solution
12:40gfredericksI get a lot of questions about debuggers -- is ritz still viable?
12:40technomancynotofi: it's going to be verbose no matter what, sadly
12:40llasramIt'd be pretty easy to write such a strict map, but somewhat difficult to ensure all the maps you cared about were-and-remained this new map type
12:40notoficurrently at my workplace we have a bunch of protocols about 30-40 and types that implement these. so we use functions like p/id or p/name instead of keyword lookups everywhere
12:41llasramouch
12:41notofiin that way we have short accessors, but we lose all the advantages of maps like destructuring
12:41ambrosebsnotofi: somewhat related, in core.typed I have a custom defrecord type internally that throws if you `get` a missing field.
12:41AnderkentI think at some point you have to just bite the dynamic bullet and trust your tests
12:42notofiambrosebs: yeah thats the solution I was thinking of, but it breaks the contract of 'get' AFAIK so we cant do it
12:42notofiSo I was wondering , maybe we should extend the language somehow or change contracts or something
12:43notofiI am also not quite sure what is my question ;)
12:43notofitechnomancy: preconditions and schemas are fine, but for example if you create a string and some value is not in the hash then this will just be nil, so it is a limited approach
12:43patchworkAnderkent notofi: If that is really what you want, I see nothing wrong with implementing a (get! …) and (get-in! …) that throw exceptions
12:44technomancynotofi: agreed; I don't think there's a good solution for this problem in clojure.
12:44clojurebotExcuse me?
12:44Anderkentnotofi: so there's a difference between a hash that you expect to have a constant set of keys (basically, a container data structure), and a hash where you expect a key might be missing
12:45notofipatchwork: sure but the problem is you want a hash which always throws so you can use the idiomatic keyword access
12:45Anderkentnotofi: for the first one, schema does okayish; validate your args at function entry point (with a macro, perhaps?)\
12:45Anderkentthen trust the hash contains the keys you need for the rest of the function
12:45patchwork(defn get! [m k] (if (contains? m k) (get m k) (throw "NO")))
12:45patchworknotofi: Yeah, but that is a small price to pay
12:46patchworkIf the whole problem is you want to preserve keyword access, I barely use that anymore anyway
12:46notofiAnderkent: that seems to be fine, but then you cant use normal functions
12:46Anderkentnotofi: how so?
12:47TimMctechnomancy: s/Clojure/any language I can think of/
12:47notofiAnderkent: well, every function that works on your data structure would need to be one of those
12:47notofithat assert it
12:47clojurebotExcuse me?
12:47TimMcclojurebot: shush
12:47clojurebotGabh mo leithscéal?
12:47technomancyTimMc: racket throws on not-found if you don't provide a default value
12:48TimMcAh, avoiding having the problem in the first place.
12:48technomancyand using option types when the compiler can't determine whether you'll get a sensible value helps a lot
12:48Anderkentnotofi: yeah, but that's just a question of changing defn into (defnv ..) or something; you can of course use external functions that don't validate; in theory it'd be sufficient to validate only in external api calls, and trust your tests internally
12:49technomancybut you need pervasive pattern matching for that
12:49notofiAnderkent: hmm ..
12:50TimMcnotofi: Is this for normal data flow, or for catching exceptional cases?
12:51notofiTimMc: for normal data flow
12:51Anderkentnotofi: but I know your pain, had a prod bug because of a typo in keyword in a rare path that caused a value that was supposed to be a set to become nil, and then be conjoined onto in further executions, becoming a seq and breaking contains?
12:52notofiIf many people have this issue, maybe we can allow strict-hashes in clojure and change the 'contract' of lookup valAt and get to allow throwing ? That would solve the problem nicely. I am not sure if something like that is possible
12:52notofiyou couldnt do things like (or (:foo data) (:bar data)) anymore because if foo is not there then boom
12:52Anderkentnotofi: the problem is in keeping your strict-hash a strict-hash
12:53Anderkentwould have to change all things like update-in etc. to preserve strictness
12:53notofiAnderkent: actually you would only have to implement basic map interfaces.
12:54notofiAnderkent: But we were thinking of only implementing lookup anyway and no other interfaces, so a lookup-only data structure
12:54Anderkentnot for things that look at the map as a seq, surely
12:56notofiAnother solution I was thinking of is creating a deftype that only implements IFn , it would look a bit odd and not sure if it is unidiomatic
12:56gfredericksnotofi: can't you do whatever that does with just a function?
12:56notofiso you say (my-data-object :foo) and it calls strict-get on an internal map
12:56notofigfredericks: sure you can but (my-data-object :foo) is shorter than (strict-get my-data-object :foo)
12:56llasramnotofi: Will you never need to create modified versions of these values?
12:57gfredericksnotofi: no I mean
12:57notofillasram: We have a big application and chose to initialise our values in one central place
12:57gfredericks(defn make-getter [m] (fn [k] (assert (contains? m k)) (get m k)))
12:57gfredericksnotofi: ^ as I understand your proposal, that's equivalent but w/o deftype
12:58gfredericksi.e., a deftype that only implements IFn is essentially a function, and you can already make functions without deftype
12:58llasramnotofi: If you really never need to modify / create modified versions of these things after initial creation, then you have tons of options
12:58Anderkentgfredericks: doesnt prevent someone using (get) on it.. (or can you get on a deftype anyway?)
12:58notofigfredericks: oh yeah, sure lol
12:58gfredericksAnderkent: sure it does; you can't call get on (make-getter {:foo 12})
12:58notofiAnderkent: there is already an issue where they want to change that in clojure.core, that it throws when you call get on something that isnt a lookup like (get 3)
12:58gfredericks,(defn make-getter [m] (fn [k] (assert (contains? m k)) (get m k)))
12:58clojurebot#'sandbox/make-getter
12:59gfredericks,(get (make-getter {:foo 12}) :foo)
12:59clojurebotnil
12:59llasramhaha
12:59llasramOh, `get`
12:59Anderkentnotofi: if it's not modifiable then just never expose the map and just make sure your getters in the namespace are correct
12:59gfredericksoh wait
12:59gfredericks,(get (Object.) :foo)
12:59clojurebotnil
12:59gfredericksI take it all back
12:59gfredericksI guess if you want get to throw you need deftype
12:59gfredericksor reify
12:59notofigfredericks: yeah but then it breaks the contract of 'get'
13:00llasramnotofi: I don't think that's a problem
13:00AnderkentI'm not sure about that. get doesn't say it never throws exceptions
13:00patchwork,((make-getter {:foo 12}) :bar)
13:00clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (contains? m k)>
13:00notofi,(doc get)
13:00clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
13:00AnderkentAFAIK anything can throw anything unless it explicitly says it never throws
13:00Anderkentor is that not the common understanding?
13:00llasram(inc Anderkent)
13:00lazybot⇒ 9
13:01Anderkentyay! imaginary internet points!
13:01llasram:-)
13:01notofiAnderkent: I dont know
13:02notofiAnderkent: the docstring says otherwise, I think it would be worth doing but my teammates say it breaks the contract
13:02patchworkthat sounds obstructionist
13:02llasramnotofi: Your teammates need to decide which problem they think is worse :-)
13:03notofillasram: hmm
13:03llasramWhat are they concern about wrt "breaking the contract of get"?
13:03ambrosebsFWIW every lookup in this namespace throws an exception if not found, and I can sleep at night https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/cs_gen.clj
13:04llasram(inc ambrosebs)
13:04lazybot⇒ 8
13:04notofillasram: get explicitly says it returns nil
13:04AnderkentI can't read typedclojure :(
13:04llasramWow, only 8? ambrosebs: you need to get your core.typed posse on that
13:04llasramnotofi: So?
13:05llasramThat only matters if you pass the map to a function which calls `get` for a value which doesn't exist in the map
13:05llasramWHich is exactly the situation you are trying to fail fast when happens
13:05AnderkentWRT breaking contracts, it's generally a smell; but if there's good reason to do it or you're not exposing the broken contract then you're still okay
13:06notofillasram: I know. I am all for this approach, but the guys which are in my team argue that it is worse if we break the contract
13:06ambrosebsit would be breaking the contract if you returned false.
13:06ambrosebsthrowing an exception.. not so much IMO
13:06ambrosebsbut whatever.
13:06llasramnotofi: Then you might consider replacing your teammates with other teammates when they are asleep
13:06Anderkentyeah I also feel it's acceptable
13:07llasramnotofi: Or just tell them that the author of core.typed disagrees with them :-p
13:07notofillasram: I havent looked into that yet
13:07Anderkentbut even if you had a really good reason to return ::no-value, for example, as long as you never give the breaking object back to someone else in an external api, you're still good
13:07notofillasram: that might be a nice counter-argument, what exactly are they doing in core.typed?
13:07llasramnotofi: Well, ambrosebs just linked you to the code :-)
13:07ambrosebslet me dig for the impl..
13:08notofillasram: its 1700 lines ;)
13:08llasramA pleasant afternoon read
13:08ambrosebshttps://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/utils.clj#L402
13:08ambrosebshaha DONT read cs_gen
13:08ambrosebs;)
13:08notofiambrosebs: very interesting
13:09notofithis is really helpful ;)
13:09Anderkent>commented out code. This better be a WIP!
13:10notofiwhat exactly is this def-type thing?
13:10Anderkentambrosebs: https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/utils.clj#L502 heresy! :P
13:10llasram~guards
13:10clojurebotSEIZE HIM!
13:11Anderkentambrosebs: Lots of respect though for core.typed, I'm just poking fun.
13:11ambrosebsAnderkent: oh you mean the extra dash?
13:11ambrosebsAnderkent: love dem dashes
13:11Anderkentthe paren on a line of its own
13:11ambrosebsoh
13:11ambrosebshaha
13:12ambrosebsif you follow the other end it's a tc-ignore.
13:12ambrosebsDONT TYPE CHECK
13:12ambrosebs:)
13:12Anderkentgah :P
13:12notofiambrosebs: Do you know why they are doing it strict? is this some special case or just useful for their library?
13:12ambrosebsnotofi: def-type defines a kind of defrecordy thing
13:12Anderkentit's missing the ;end tc-ignore comment then :(
13:13ambrosebsAnderkent: true. For mine eyes only
13:13ambrosebsme and my 4 contributors
13:13Anderkentnah, is cool, matching parens 140 lines higher with no indent of contents is what I eat for brewakfast
13:13ambrosebsLOL
13:14ambrosebsnotofi: this is my own library.
13:14ambrosebsnotofi: I know how crazy it can be finding these kinds of lookup bugs.
13:14ambrosebsnotofi: so I implemented this .. thing
13:15notofiambrosebs: can you show me some example code of yours were these types are created and used with keywords?
13:15notofiambrosebs: cant find any in cs_gen
13:16ambrosebsnotofi: here's the def-type for Function https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/type_rep.clj#L634-L649
13:17ambrosebsstepping back a bit I realise all that stuff in the definition seems insane
13:17ambrosebsbut again, sleep
13:17ambrosebsand when I use a Function type, I just need a precondition like this https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/cs_gen.clj#L1183
13:18ambrosebsthen all these lookups are robust to typos https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/cs_gen.clj#L1191-L1196
13:18notofiambrosebs: I see, thank you.
13:19notofiambrosebs: the Precondition has nothing to do with this lookup topic right?
13:19ambrosebsnotofi: not directly
13:20notofiambrosebs: maybe we should use core.typed ;)
13:20ambrosebsnotofi: that could be a bigger investment ;)
13:21ambrosebsFWIW core.typed follows the normal lookup semantics
13:21ambrosebsit has to, because macros and stuff
13:21notofiambrosebs: what do you mean?
13:21ambrosebsnotofi: this type checks as nil: (get {})
13:22ambrosebs(get {} :foo)
13:22ambrosebsrather
13:22notofiambrosebs: ok. anyway i am signing off, good evening
13:22ambrosebscya
13:23AnderkentUGT strikes again :D
13:24ambrosebscombating contrib pull requests: make your project as complicated as possible
13:24ambrosebssuccess
13:26Anderkentnot sure if sarcasm; I've seen more projects saying 'please do not make pull requests' recently. All I can say is I wish I had that problem :P
13:27technomancy"You know the error is there, I know the error is there. Let's just say it goes away and we forget about this PR." I loled https://github.com/clojure/test.check/pull/1
13:27ambrosebsthat's a classic
13:28Anderkentand it went away!
13:29S3thc0nHello #clojure people :) It occurs to me that often multimethods are used when the need does not seem obvious, be it in core itself or other code. Specifically I'm talking about cases like this one: http://clojuredocs.org/clojure_core/clojure.core/partial#source
13:30S3thc0nIs that for performance reasons? If not, why then?
13:30AnderkentS3thc0n: that's not a multimethod; that's just multiple arities
13:31Anderkentbut yeah I'd guess it's for performance reasons
13:31S3thc0nOkay, mixed that up then. Multimethods only are sued with different types or so I guess. I'll reread about that; thanks. But my question persists.
13:31mindbender1Are there any examples out there of the new enliven library?
13:32dnolen_S3thc0n: for perf reasons
13:33S3thc0nOkay, thank you two. Already thought something like that.
13:37arcatanpull requests are a pretty nice way to point out typos
13:41gfredericks,(some? false)
13:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: some? in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:44gfredericksI submitted a typo PR to some clojure project recently and a few weeks later the maintainer made his own identical commit and closed the PR
13:44gfredericksso now I won't get my internet money
13:45ambrosebsgfredericks: :)
13:45ambrosebsgfredericks: I lost all my cred to the `clojure` github organisation
13:46ambrosebsjust realised core.matrix isn't contrib. What's the deal there?
13:46S3thc0nHave a banana instead, here. \____/-
13:47ambrosebs"The plan is to become an official Clojure Contrib language extension once the API has been well tested."
13:51hiredmanthe internet has enabled misunderstandings at an accelerated rate
13:55SegFaultAX(inc hiredman)
13:55lazybot⇒ 37
14:00TimMcllasram: The Compiler is now yelling at me about not being able to find the containing namespace on the classpath. -.-
14:00llasramTimMc: Awww. *Is* the containing namespace on the classpath?
14:01TimMcZuul uses gradle, so I have no idea. :-P
14:01llasramThe static initializer for gen-class'd classes `require`s the implementation namespace, so...
14:01llasramOh
14:02hiredmanambrosebs: I suspect it went something like <Guy> hey clojure mailing list, how cool would it be to have a matrix library in contrib? <Random Mailing List People> that would be super cool!
14:02TimMcBut the ns should already be loaded when I compile it, yeah?
14:02llasramTimMc: Class loader fun times.
14:02hiredman<Guy> great, I'll go do that
14:02ambrosebshiredman: :D
14:02hiredman(time passes)
14:03llasramTimMc: The code in shady may be using the wrong classloader as the parent of the dynamic class loader instance
14:03ambrosebshiredman: I'm impressed it's not just called matrix. analyze -> jvm.tools.analyzer, match -> core.match, typed -> core.typed
14:03llasramDepending on how much yak-shaving time you have, you might be able to figure out the right thing to do...
14:03hiredman<Guy> hey clojure/core, I made a matrix library for contrib <Clojure/Core> lol wut?
14:03technomancy...awkward silence
14:04ambrosebshaha
14:04llasramI think the API hasn't entirely settled down yet
14:04llasrammikera was still adding things last time I checked in
14:04TimMcllasram: I don't have a big yak-shaving budget at the moment.
14:04llasramTimMc: Alas :-/
14:05hiredmantechnomancy: http://www.youtube.com/watch?v=9SULsR9-lbw
14:05tolstoyIn OM, if I set the shared option {:shared {:key "value"}} how come (om/get-shared owner) is null?
14:06TimMcllasram: I'll probably take a swing at it again in a couple weeks.
14:06Pate_Hi everyone, I'm new here. :) @ibdknox: thank you for Light Table.
14:07seangrovegoldfeld: We've moved the cljs meetup to the 27th, and found a new speaker from Prismatic for it
14:07ambrosebsPate_: welcome!
14:09abphow can i include javascript files from jars when building with cljsbuild and :optimizations :none?
14:09Pate_thanks, ambrosebs :). I come from a .NET background, but I was compelled by the Clojure+Datomic+Om stack to switch. Recently built a large application in Python+AngularJs, and now I want to rebuild everything in Clojure!
14:12noprompti'm a bit confused about resources in compojure
14:13nopromptwe're using a different configuration for resource-paths and we're not using the :root "public"
14:14nopromptwe keep getting 404s. :(
14:15rasmustowhat's the deal about keys/vals not having a deterministic order anymore?
14:16tolstoyHm. om/root seems to require that "shared" key be in {:opts}.
14:20ambrosebsrasmusto: they are deterministic.
14:20ambrosebsrasmusto: Rich says seq order == key order == vals order
14:21rasmustoambrosebs: okay. I must have misinterpreted a jira ticket or something. thanks :)
14:22seangroveambrosebs: Wasn't that more or less accidental?
14:23seangroveThe discussion was awhile ago though, I've forgotten the conclusions
14:23dnolen_tolstoy: how shared propagates is a bit of an implementation detail at the moment, om.core/get-shared is the only way you should access it
14:24hiredmanafter years of rich saying the order of keys matches the order of vals, for some reason stu decided to stir things up by telling people that is an implimentation detail
14:24tolstoydnolen_: om/get-shared is returning null unless I use {:target ... {:opts {:shared {:key "value"}}}}.
14:25dnolen_tolstoy: going to need a minimal failing case, there's a working example in the repo
14:25abpdnolen_: can i add js files from a jar in a :optimizations :none build? trying to use react-cljs
14:26goldfeldseangrove: you guys are awesome!
14:27dnolen_abp: there's no good way to do that under :none
14:29dnolen_tolstoy: just confirmed shared example in repo still works, so need a specific example where things go wrong.
14:30tolstoydnolen_: Yes, I've seen the example. Very strange. I thought it might be because my components take "opts" but that's not working.
14:30tolstoydnolen_: I'll see if I can figure out how to do a "minimal case". ;)
14:33tolstoydnolen_: fwiw: https://gist.github.com/zentrope/9353859
14:33CookedGryphondoes anybody have any ideas how I can effectively debug a gummed up core.async state machine (i.e. figure out what it's waiting for)
14:34CookedGryphonthough i suppose that's a silly question as it's waitin g on everything which is why it's doing nothing...
14:34dnolen_tolstoy: I prefer all Om minimal cases only involve Om, can you do a new gist sans and even better sans core.async
14:34dnolen_sans sablono
14:35tolstoydnolen_: Okay.
14:58tolstoydnolen_: Here's a minimal version: https://gist.github.com/zentrope/9353859.
14:58tolstoydnolen_: Do you need a complete project for these sorts of things?
14:58dnolen_tolstoy: nah this is good thanks
14:59dnolen_tolstoy: so frame-component is not valid here
14:59dnolen_tolstoy: you must return IRender or IRender reify instance
14:59dnolen_you can't just call build like that
14:59tolstoyHeh.
15:00dnolen_er IRenderState
15:00tolstoyYet it renders! ;)
15:00tolstoyThat fixed it. ;)
15:00dnolen_tolstoy: and a bunch of things break - the docstring / docs are quite clear
15:00dnolen_tolstoy: cool
15:00tolstoyOy. I've done LOTS of OM prototypes and never made that mistake.
15:01tolstoydnolen_: In other words, I think it's clear in the docs, just my mistake.
15:01dnolen_tolstoy: I might put in a run time assert for this that you can elide under production
15:01dnolen_tolstoy: sure, but it's an easy mistake to make and I've seen other people do it.
15:03dnolen_tolstoy: https://github.com/swannodette/om/issues/133
15:04tolstoydnolen_: Thanks! Makes sense.
15:04dnolen_tolstoy: thanks for the report and doing the minimal case
15:16atyzDoes anyone know any good alternatives to incanter
15:16atyz?
15:18llasramR
15:18justin_smithatyz: do you need both the statistical and graphic components?
15:19SegFaultAXIPython, pandas
15:19justin_smithif you only need the visualization, cljs / d3 may be an option
15:19atyzjustin_smith: I mostly want the statistical components
15:19atyzllasram: the syntax is so weird!
15:19SegFaultAXatyz: Are you looking for clj alternatives or just alternatives in general?
15:20llasramatyz: Have you looked at Apache Commons Math?
15:20llasramatyz: hahahahah
15:20atyzSegFaultAX: clj alternatives preferably, but I don't mind trying something new
15:21atyzllasram: I haven't looked at Apache Commons Math
15:21SegFaultAXatyz: Apart from R, python is becoming one of the de facto standards in data science.
15:21SegFaultAXIPython and Pandas are definitely worth a look.
15:21isaacbwhow would you all recommend someone learning clojure who is already somewhat familiar with common lisp and functional programming?
15:22isaacbw*learn
15:22isaacbwfairly familiar with FP, somewhat with common lisp
15:22isaacbwalso know the basics of clojure already
15:22isaacbwI did all the clojure koans a while back
15:23atyzisaacbw: then I would suggest they just pick something and go at it
15:23SegFaultAXisaacbw: Or read JoC
15:23atyzThere is clojure for teh brave and true.
15:23isaacbwSegFaultAX: JoC?
15:23atyzJoy of clojure
15:23nopromptit's funny how a language w/o good facilities for functional programming would be regarded as a "de facto" for any kind of science.
15:24isaacbwah!
15:24isaacbwactually it's on my amazon wishlist already. Maybe I'll go ahead and order it
15:24harmspamisaacbw: buy the second Joy of Clojure directly from manning, you get a free copy of the first edition
15:24hyPiRionoh wow, https://github.com/clojure/test.check/pull/1 just exploded it seems
15:24Anderkentnoprompt: why do you think pythin has no facilities for functional programming? functions are first class members there AFAIK; you can have high order fns etc.
15:24hyPiRionI'm tempted to say that it literally exploded, but I won't go that far.
15:25nopromptAnderkent: pythons fp tools are a joke. it's lambdas are a joke.
15:25Anderkentelaborate?
15:25isaacbwharmspam: ah, cool deal! So I can prorder and have something to read in the meantime
15:26arcataneh
15:26turbofailAnderkent: well you can only do "expressions" in a lambda, not "statements." and you can only do one of them
15:26turbofailthe distinction between those two is in itself kind of goofy
15:26nopromptAnderkent: ^
15:26isaacbwharmspam: though it's $10 more than amazon. Probably worth it for the 1st edition ebook
15:27harmspamisaacbw: there was a promotional code for quite a bit off of the preorder floating around, you can probably find it if its still active
15:28turbofailand of course python doesn't get scope right. you can only have one level of scope per function, so if you try to capture an iteration variable in a closure, then surprise! you're hosed!
15:28nopromptAnderkent: mutability and lack of referential transparency are default, imho thats a pretty bad start already for doing science.
15:29nopromptnot just in python but any language that encourages the use of those properties.
15:29atyznoprompt: don't underestimate the effort people have put into their libraries though
15:29turbofailright, the python data structures being mostly mutable also makes things harder
15:29nopromptatyz: i don't. i was just stating a silly opinion.
15:30ToBeReplacednoprompt: that's a little unfair... ex. scientific python; mutability is a requirement for performance
15:30nopromptatyz: what i'm saying is the impedence mismatch between science and computing w/ respect to using a language like python is greater than say haskell or clojure.
15:31isaacbwharmspam: schweet, found an active one. Thanks
15:31nopromptToBeReplaced: maybe at some level sure.
15:31nopromptToBeReplaced: but that's an implementation detail the consumer shouldn't have to worry about.
15:32nopromptif x = 1 doesn't mean that "x is 1" what good is that?
15:32ToBeReplacednoprompt: my take for the last few years wrt scientific computing has been that all operations need to be unambiguous and unmistakable above anything else, and that has nothing to do with mutability
15:32ToBeReplacednoprompt: and something that core.matrix is not doing (by conscious decision), for example
15:34nopromptToBeReplaced: what do you mean by "unambiguous and unmistakable"?
15:34ToBeReplacednoprompt: it's fair enough to comment on the toxicity of mutability for exposed interfaces in scientific work, but that's rarely been the real source of error that i've seen in practice
15:35PinkPrincessIf a function returns a chan intended to be "exhaustively read", what's the best way to convey the expected number of data structures that will be put on the chan?
15:36nopromptToBeReplaced: well it's sounds like you know from experience and that's definitely worth something. still something inside me feels doubtful and distrustful. :P
15:36nopromptnot of you but the concept of doing data science w/ a language that has bad defaults.
15:36scttnlsnis there a way to specify a default implementation of a protocol? i.e. something like (extend-type <any type> (-some-fn [this] ...))
15:36scttnlsni mean... (extend-type <any type> IMyProtocol (-some-fn [this] ...))
15:36isaacbwyou're probably a mutability spy sent here to lie and create disorder
15:37nopromptscttnlsn: extend-type Object i think is what you're looking for. be careful w/ that though.
15:37scttnlsnnoprompt: will that work on clojure primitives as well?
15:37nopromptisaacbw: ha! you caught me.
15:38noprompt:S
15:38ToBeReplacednoprompt: consider "multiply"... what should semantics be for matrix * vector, matrix * matrix, matrix * constant, matrix * matrix * matrix, 3d matrix * some-other-structure, etc?
15:38ToBeReplacednoprompt: then consider it with "add" or other operators where things like "element-wise" and "matrix-wise" mean the same thing ... then you've got sources of confusion
15:39nopromptToBeReplaced: i'm not sure. i don't do a lot of that type of work. at first blush i'd probably think of composing transforms before doing any "real" work.
15:39isaacbwhas anyone here used tern.js? I'm wondering if there's something like it for clojure for inspecting (inferred) type signatures of functions
15:39nopromptactually i don't do any, but i understood the performance concern.
15:40ToBeReplacednoprompt: and you're not the typical data scientist ;)
15:40isaacbwof course it doesn't work when a function can take multiple types, but that sort of function shouldn't be too common anyway
15:40nopromptToBeReplaced: ha! guilty as charged.
15:40noprompt:)
15:41ToBeReplacednoprompt: it's tricky because the academic notation is varying as well... these problems are all really hard
15:41nopromptToBeReplaced: i would imagine.
15:42nopromptToBeReplaced: but it seems like that's a place where symbolic computation would excel.
15:42ToBeReplacednoprompt: i'd love to tell someone "you don't need your view"... never works telling someone "oh, you want rollups? you have that... it's called reduce"
15:47ToBeReplacednoprompt: i'm not sure what you mean by symbolic comp... but i wonder what would happen if a set of libraries mandated that you "introduce a suitable notation" prior to using it
15:48ToBeReplacedavoid the "pick the best of the bad options" situation and instead force the user to always elect their interpretations
15:49nopromptToBeReplaced: basically the idea that something like "x" "x^2" etc are just placeholders that don't evaluate anything until you say given this expression evaluate with x.
15:49ToBeReplacednoprompt: ah, sure
15:49nopromptToBeReplaced: so in an OO perspective a Symbol "x" would expose methods for +, *, and so forth.
15:52nopromptso essentially like math. if i have the polynomial expression "a^2 + b^2" and i say evaluate when a = 2 then i just get back a new polynomial "4 + b^2"
15:52llasramnoprompt: Have you seen https://github.com/clojure-numerics/expresso ?
15:52nopromptllasram: oh yeah! heh, i totally forgot about that. :)
15:56pcnBuffer 17
16:00ToBeReplacedPinkPrincess: can you elaborate?
16:00PinkPrincessI can try.
16:00ToBeReplacedPinkPrincess: usually you just have the producer close! the channel and the consumer read until nil (or use into! if that's the intent)
16:00PinkPrincessI have a function called all-cards, which will do a lot of really heavy IO to fetch a huge list of cards. I want the function to immediately return a channel, and then start putting a lot of these cards onto the channel.
16:00daccPinkPrincess: could you just send a termination message of some kind on chan?
16:01PinkPrincessOh.
16:01PinkPrincessThat'll work perfectly, I think.
16:01PinkPrincessSo closing it will send a nil?
16:02ToBeReplacedPinkPrincess: nil cannot be put onto a channel; if a channel is closed, then when anyone tries to read from it, they will receive nil instead
16:02ToBeReplacedPinkPrincess: after any items already on the channel are consumed *
16:02PinkPrincessThat's exactly what I need, then.
16:02PinkPrincessThanks, ToBeReplaced.
16:04PinkPrincessSo I'd just consume it like (simplified): (while (<!! the-chan) ...)
16:04PinkPrincess?
16:04PinkPrincessThere's no risk of non-truthy values being put on the channel.
16:09ToBeReplacedPinkPrincess: that would work, yes... i recommend (go-loop [] (when-let [msg (<!! ch)] (recur))) as pseudo-code
16:10PinkPrincessAh, there's even a macro for it.
16:10tim____PinkPrincess: you can put a false on a channel, but not a nil
16:10PinkPrincessHandy.
16:10tbaldridgePinkPrincess: so when-let can sometimes do the wrong thing, but the best answer is often "don't put false in a channel"
16:11ToBeReplacedtim___: PinkPrincess: yeah, you should use "when-some" if you are on clojure 1.6 already ;)
16:11PinkPrincessI'm in the lucky position of never having to worry about falsy values (except nil when closing), so that's not going to be an issue.
16:12PinkPrincesswhen-some sounds pretty cool. When's 1.6 scheduled for release?
16:16stuartsierraPinkPrincess: When it's done. beta2 just came out.
16:18PinkPrincessI suppose that's the obvious answer. With this being a hobby project, I guess there's nothing wrong with betas, though.
16:20sdegutisPinkPrincess: Clojure is a hobby project?
16:20PinkPrincessAh, nothing of the sort! My project *using it* it, though. ;)
16:20sdegutisAh :)
16:20PinkPrincessis*
16:21sdegutisI'm not so sure Clojure isn't a hobbyist project...
16:22sdegutisI'm not even sure what hobbyist means anymore. Didn't Rich start it as a hobby?
16:23S11001001sdegutis: I wouldn't say that. Taking time off work specifically to work on this thing seems to imply the expected future value of the result is greater than the present value of the opportunity cost of not working for a time.
16:23alewI believe he worked on it full-time when he started
16:24sdegutisOh I didn't know that.
16:24sdegutisCool.
16:25sdegutisWas Rich pretty high up in the tech world before Clojure? Like did he own companies or work for a big company? Or is Clojure his first claim to fame?
16:26sdegutisNeat: https://github.com/clojure/clojure/commit/894a0c81075b8f4b64b7f890ab0c8522a7a9986a
16:27sdegutisThat was 8 years ago, wow.
16:27alewIs that the first commit?
16:28sdegutisFirst code commit.
16:28sdegutisSecond commit. (First one was just IDEA project file.)
16:29sdegutis"added if" -- https://github.com/clojure/clojure/commit/e7f3719fcbe74e0f923243f9628f7450ebed2e4f
16:29technomancyheh, that comment
16:29holowow, such a unique coding style!
16:30technomancywait, the analyzer used to be CL?
16:30alew.lisp file extension
16:30TimMcAll good Java projects eventually end up with a Cons.java.
16:30TimMcA fair number of bad ones, too.
16:32sdegutisfirst commit with CL code: "added clojure.lisp" -- https://github.com/clojure/clojure/commit/30a0f7dfd9caddc149fda7ddff9c211f6cdbf4ff
16:33rasmustoim glad most of those parens disappeared :)
16:33rasmusto:]*
16:34alewwas there plans to have clojure run on a CL implementation?
16:42PinkPrincessSo... my channel flow is working as I want it now, but it's not very happy about 14000 puts. What's the best way to handle a large number of puts on a channel? Split it into multiple channels?
16:46ToBeReplacedPinkPrincess: what is the behavior that is an issue?
16:46PinkPrincessException in thread "async-dispatch-1609" java.lang.AssertionError: Assert failed: No more than 1024 pending takes are a
16:46PinkPrincessllowed on a single channel.
16:47ToBeReplacedPinkPrincess: it looks like you are trying to read from the channel in 1025 places -- maybe a bug in your read code?
16:48PinkPrincessThat's a very real possibility.
16:49PinkPrincessI'm doing something like this: http://pastebin.com/wuXcRyAz
16:50PinkPrincessWhich, I see now, calls for a bit of refactoring.
16:50PinkPrincessBut shouldn't this do one read at the time?
16:52ToBeReplacedPinkPrincess: inside of a go block, you can use <! instead of <!!; i don't know what <!! does inside of a go block
16:53ToBeReplacedPinkPrincess: if you just want to block until all of the operations are complete, change the "go-loop" to "loop"
16:53PinkPrincessI expect most use cases to be "for each card, add it to a database".
16:53PinkPrincessSo blocking may be perfectly fine.
16:54sdegutisYour nicks are the same length. It's hard to tell who's talking.
16:54sdegutisNot complaining, just commentating on a neat phenomenon.
16:55PinkPrincessClearly you need a fancy add-on to color nicks based on their hash value.
16:55PinkPrincessRainbow colors everywhere!
16:55sdegutisThat sounds fun. Let me see if my client does it.
16:56PinkPrincessToBeReplaced: using <! has the same problem. I'll try using loop instead of go-loop.
16:56sdegutisSir or madam, thank you for your suggestion. Unfortunately I regret to inform you that it is not practically feasible in my particular specific case. With my best regards, thanks.
16:57ToBeReplacedPinkPrincess: okay, the code as you've presented it with <! in place of <!! looks okay to me; i would expect that your issue is somewhere else; good luck
16:57technomancyI don't understand how you could do IRC without nick coloring
16:57technomancyit'd be like ... turning off syntax highlighting
16:58sdegutistechnomancy: name lengths and first/last-char auto-heuristics
16:58tolstoyFor some reason, ToBeReplaced and PinkPrincess are the same color in Textual.
16:58technomancysdegutis: that's what google go users say about syntax highlighting
16:58sdegutistechnomancy: You're "te...cy" of medium/long-ish length
16:58PinkPrincessIt's probably somehow in the producer, then. Thanks for all your helpful suggestions, ToBeReplaced.
16:58technomancyt9y
16:58ToBeReplacedi use Empathy b/c gnome integration... sucks as a client though and doesn't have nick coloring
16:59sdegutistechnomancy: Go... syntax.. wha.. how.. ... I'm speechless
16:59seangroveAh, bummer. Is there some clear way of running tests in parallel with clojure.test?
16:59sdegutistechnomancy: you've left me speechless sir, now GOOD DAY!
17:00sdegutisseangrove: I've never heard of a plugin but I can't imagine why you couldn't write one, they're just functions.
17:00seangrovesdegutis: Blows my mind that we still write test runners that run serially by default
17:00sdegutisclojure.test is simple but powerful
17:01sdegutisseangrove: I wonder if it has to do with how we like to read test results linearly..
17:02technomancyorg.clojure/test.noneuclidean
17:02technomancybring it
17:03tolstoyorg.clojure/test.heisenbergian?
17:06sdegutisI really don't think the reverse-DNS style is going to catch on.
17:07sdegutisIt's just so unnatural. In human speech we refer to specifics first and give context as needed. Because ultimately the level of context can go on forever.
17:08llasramExcept where you're actually dealing with DNS
17:08sdegutisSo we say "John" and they usually know we mean "John Smith" but if not, we can elaborate. And even then we can specify "of New York City", etc.
17:08llasramThen you deal with everything reverse-style so that the sort order reflects the hierarchy
17:09alewActually, you deal with a generallity and then go into specifics
17:10sdegutisBut how far back do you go to maintain a hierarchy? Take Java for example, we do com.mycompany/lib, but it could be in Maven or in Clojars, so should that be specified before "com" too? And what if there's another language that uses it, should we say clojure.maven.com.mycompany/lib? And what about other people's forks?
17:10alewJohn isn't very specific
17:10sdegutisalew: THAT.
17:10sdegutisalew: Oh I mean, yes.
17:11technomancysdegutis: the thing is, domain registrations always last forever
17:12technomancyand projects never move on from one company to another
17:12technomancyso actually DNS is a great way to do it
17:12sdegutis:D
17:12sdegutisSold.
17:14sdegutistechnomancy: that sounds pretty intensive
17:14hiredmanobviously you should use tag uris
17:14sdegutisHey now let's not go crazy.
17:16alewwhy not just a globally coordinated incrementing integer?
17:17sdegutis(inc alew)
17:17lazybot⇒ 1
17:18technomancygfredericks just uses uuids
17:18sdegutisOh wait, yes. There are enough UUIDs, why don't we use them for everything?
17:18sdegutisEven our identities!
17:19alewI was also thinking of UUIDs, but we might get a conflict in 10000 years
17:19sdegutis,(def sdegutis #uuid "719c2e7f-49bc-4551-9b97-ed36b0b82b88")
17:19clojurebot#'sandbox/sdegutis
17:19sdegutis,sdegutis
17:19clojurebot#uuid "719c2e7f-49bc-4551-9b97-ed36b0b82b88"
17:19sdegutisWoooo
17:21sdegutisFound a reliable random number generator: &(->> #(java.util.UUID/randomUUID) repeatedly (take 2) (map hash) (reduce -))
17:21sdegutis,(->> #(java.util.UUID/randomUUID) repeatedly (take 2) (map hash) (reduce -))
17:21clojurebot-2169937940
17:21sdegutisYesssss
17:24justin_smithsdegutis: my real name is 4108eca2-bef0-4102-90bb-ff9b9621f483
17:24justin_smithoh shit now he's gonna get a bunch of credit cards and ruin my credit
17:24hiredmanwe can't all be 01590049-7034-49cb-b946-dee3f9ced5f2
17:25lgas_I'd like to enable cemerick.{austin,piggieback} only in development. It's easy enough to add the dependencies to the dev profile but how do I reference the symbols at runtime only if the libraries are present? Is there a good example of a project that does something similar?
17:29sdegutisjustin_smith: Nope, your real name is protected by the public key of your bitcoin wallet or something
17:30sdegutisHence I can't pretend to be you.
17:33ToBeReplacedlgas_: i do this by adding a file with the requisite require statements in a separate directory and then use :source-paths option to include that directory only for development build
17:33danielszmulewiczlgas_: yes, there is a template that saves you all the trouble: https://github.com/aamedina/cljs
17:33justin_smithsdegutis: haha, an official public identification and authentication system that isn't designed so badly as to be indistinguishable from malice? that's crazy talk!
17:35devn10 dogecoin to someone who can give me an idea for a narrative about using agents that doesn't involve logging
17:35TEttingersdegutis: xorshift may be uh... a lot faster?
17:35sdegutisTEttinger: dunno about that
17:36TEttingerdevn: any episode of burn notice
17:36chouserlgas_: you can use the 'resolve' function to discover if a given var in some namespace has been defined or not
17:36sdegutisTEttinger: sounds like premature optimization
17:36lgas_ToBeReplaced & chouser: thanks
17:36TEttingerhttp://www.javamex.com/tutorials/random_numbers/xorshift.shtml
17:37TEttingerheh it just seems like total overkill to be using UUIDs when there's other simple methods out there
17:38justin_smithdevn: a company with departments, each department gets tasks sent to it, and is modeled by an agent. The simulation helps you optimize management / resource allocation strategies.
17:38chouserdevn: http://blog.n01se.net/blog-n01se-net-p-34.html https://gist.github.com/Chouser/32494#file-using-agents-clj
17:38TEttingerhttp://xorshift.di.unimi.it/xorshift1024star.c is similar
17:42TEttinger(source: http://xorshift.di.unimi.it/ )
17:43rasmusto,(replace {0 :a} [0 1 2]) ; confused me for a minute
17:43clojurebot[:a 1 2]
17:48lgas_danielszmulewicz: didn't see your answer before -- thanks!
18:21cespare|homeIs there a single function I can call instead of (doall (map ...)) ?
18:22cespare|homenvm, I can reformulate using doseq
18:24SegFaultAXcespare|home: Also, mapv might be a reasonable option.
18:24SegFaultAX,(realized? (map inc [1 2 3]))
18:24clojurebotfalse
18:24SegFaultAX,(realized? (mapv inc [1 2 3]))
18:24clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPending>
18:25bbloomcespare|home: i've frequently wanted a function-form of doseq. i've got a helper i paste around that i call "each"
18:25SegFaultAXWell there you go. :)
18:25bbloomit's just (defn each [f coll & args] (doseq [x coll] (apply f coll args)))
18:25bbloomer i mean: (defn each [f coll & args] (doseq [x coll] (apply f x args)))
18:26cespare|homeSegFaultAX: bbloom thanks
18:35cespare|homeWhat's a simple way to make a map with integer values that I can add to? Basically a map where the default value is 0.
18:35cespare|homeThink histogram
18:36qbg,(doc frequencies)
18:36clojurebot"([coll]); Returns a map from distinct items in coll to the number of times they appear."
18:36qbgDo you want to do something like that?
18:36rasmustocespare|home: check out fnil
18:37cespare|homeqbg: I saw that. I could probably make it work with frequencies
18:37cespare|homerasmusto: ah thanks
18:37SegFaultAXYea frequencies + fnil is awesome.
18:38rasmusto##(update-in {:a 1} [:b] (fnil inc 0))
18:38lazybot⇒ {:b 1, :a 1}
18:41rasmusto##(update-in {:a 1} [:a] (fnil inc 0))
18:41lazybot⇒ {:a 2}
18:42rasmustook, good :>
18:42isaacbwleiningen zsh completion script with ring subcommand support: https://gist.github.com/isaacbw/99255c98118b165838ea
18:42isaacbwmassive ugly hack :P
18:42isaacbwzsh scripting is... interesting
18:42isaacbw(I just added the ring stuff, the rest comes stock with oh-my-zsh)
18:42hyPiRionisaacbw: shell scripting in general is an amusing thing
18:43hyPiRionhuh, I thought "test!" was removed
18:44hyPiRionand swank, for that matter
18:44isaacbwit's probably an old-ass script that no one bothered to change
18:44technomancythe completion files might be the oldest untouched files in the whole repo
18:46hyPiRiontechnomancy: I was about to say that the license was, but then =/
18:57gvickersWhats the best way currently to add a jar to a lein library? Should I add it to my local maven repository?
19:02zoldarI'm trying to make a resuable component/widget (select scroller - alternative to select input - eventually touch friendly). https://www.refheap.com/52072 Now, I'm having problems with attaching event handler - the one in line 57 does not get called even though the new value gets passed on rerender. How to approach this?
19:02zoldarAh, forgot to mention that it's in Om
19:04qbg:onChange, not :on-change
19:04qbgmaybe not; not sure about sablano
19:04zoldarqbg: sablono converts it
19:06qbgAre you trying to type anything in the field?
19:06zoldarqbg: It was a hidden input field before, I've changed it to textjust to check if the event handler will catch on
19:07qbg:on-change won't be called just because value changes
19:07zoldarI mean, I suppose that the way I'm trying to do this is wrong
19:10bob2gvickers, lein library?
19:10bob2gvickers, if you mean ~/.m2, lein install
19:14gvickersoh
19:14gvickersbob2: thanks
19:45echosaHi. I'm messing around with typed clojure and can't figure out why this isn't working: https://gist.github.com/echosa/9358930
19:51brehautechosa: its possible you need to qualify NonEmptySeqable wiht some type paramater?
19:51echosaI tried some various things, but wasn't able to get anything to work.
19:52brehautechosa: well im just looking at your use of first (as per the type error), your type for grid, and the domains of first
19:52cespare|homeIf I put :main my.namespace in my project.clj, when I start lein repl things seem to work (I can see symbols in my.namespace). When I don't have this in my project.clj, if I do (ns my.namespace), it doesn't work (the symbols I expect are available). Do I need to use one of the other namespace incantations instead?
19:52cespare|homes/available/unavailable
19:52echosabrehaut: tha's what I did too, to no avail
19:53technomancycespare|home: (doto 'my.namespace require in-ns) is what I do
19:53cespare|home:|
19:54technomancyif you want your repl to always open to that ns you can do :repl-options {:init-ns my.namespace}
19:54technomancybut ns by itself won't load existing code
19:54cespare|homeI don't always want that ns, but I want an easy way to hop between them
19:55echosamore specifically, the repl won't, be default, be in the namespace of the file, necessarily
19:55echosayou have to switch to it
19:55technomancywell, hopping to a namespace that doesn't exist isn't that useful
19:55cespare|homewithout evaluating the code there, you mean
19:56brehautechosa: doesnt check-ns take an optional ns as an arg?
19:56technomancycespare|home: what I mean is that you're asking for two different things
19:56technomancyso naturally the solution involves two things =)
19:56echosabrehaut: has a second argument, but I haven't needed it so far.
19:56echosaI've gotten other annotations working, just not this one
19:57echosabecause of the call to first and the type of grid
19:57echosabut I can't figure out the correct way to write the annotation for this
19:59brehautechosa: i suspect its something to do with the domain of count but i dont have the code in a live env to test sorry
19:59brehautechosa: you may find #typed-clojure useful
20:00echosaOh, there's a separate channel? Ha. Of course there is.
20:38firefauxis there any reason using assoc-in on a map would give me an empty map?
20:38firefauxthe map isn't empty to begin with
20:40brehaut,(assoc-in {:a {:b 1}} [:a b:] 2)
20:40clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: b:>
20:40brehaut,(assoc-in {:a {:b 1}} [:a :b] 2)
20:40clojurebot{:a {:b 2}}
20:40brehaut,(assoc-in [:a :b] {:a {:b 1}} 2)
20:40clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap>
20:42firefauxI'm asking because I have a ref to a hash-map, which I populate, and sometimes it just goes back to {}
20:42firefauxand the only function I'm calling to alter it is assoc-in
20:43hiredmanfirefaux: are you reloading the namespace?
20:44firefauxhmm
20:44firefauxohhh
20:44firefauxyeah I am
20:44brehautstep one: defonce, step two: stop holding state in defs/globals
20:44firefauxit never occured to me that reloading cider with C-c C-k
20:45firefauxwas actually going to reset my refs
20:45firefauxyeah
20:45hiredman~I'll be in my trailer
20:45clojureboteverybody take five!
20:45firefauxthere's only 1 ref in my entire program
20:46dsrx,(doc defonce)
20:46clojurebot"([name expr]); defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated"
20:46firefauxooh
20:46firefauxneato
20:47firefauxso reloading the namespace won't reset it, then?
20:47noonianright
20:48firefauxis that all defonce is meant for?
20:48firefauxunless you're calling def inside of some control flow for some reason?
20:48dsrxI think it's suitable any place where you'd expect a namespace to be reloaded
20:49dsrxnot that I have ever done anything like that outside of a repl
20:50firefauxwell, if I'd realized my mistake earlier it would have saved me hours of debugging
20:50firefauxI probably wrote and rewrote functions so many times, and did it properly, but thought it wasn't because I cleared my map
20:53jbrechtelSo if I want project specific tasks in leiningen is ":eval-in-leiningen true" in my project.clj the right way to do it? That seems to break uberjar (can't find my project's core.clj).
20:53jbrechtelI'm guessing that's because eval-in-leiningen should be put in a specific profile to only use for the tasks I want to define?
20:54jbrechtelBut now this feels like I'm going down the wrong path.
21:15moquist3I prefer to name fns that could be anonymous, so that stacktraces are less opaque. Anybody have a recommendation for a convention for naming such fns? e.g.: (defn myfn [] (fn myfn- [] ...))
21:16firefauxI'm also interested to hear what people use for names
21:17firefauxI've only used named lambdas a few times, and it was mainly to figure out which one threw the exception
21:22tomjack(gen/such-that #(some-> % not-empty first zero?) (gen/vector gen/nat))
21:22tomjackwhy is this so slow?
21:22tomjackwell, I see an obvious workaround..
21:23tomjack(gen/fmap (partial into [0]) (gen/vector gen/nat))
21:25tomjackis it just me or does clojure.test.check.generators have argument order problems?
21:25tomjackmaybe the choices make sense somehow
21:26tomjacke.g. seems rather odd though that fmap and bind are flipped
21:31gfrederickstomjack: such-that is just a naive filter
21:31gfredericksand most vectors of numbers don't start with zero
21:31gfredericksso you're doing a lot of throwaway work
21:31tomjackyeah
21:31tomjackwhen I write it as a filter, it seems much faster
21:32tomjack(->> (gen/vector gen/nat) (gen/such-that not-empty) gen/sample-seq (filter #(some-> % first zero?)) (take 100))
21:32tomjackreturns almost instantly
21:33gfredericksthat's weird
21:35tomjackI guess it relies on the size impl details which change with such-that for some reason
21:35tomjacklooks like ~20 out of the first 1000 (gen/vector gen/nat) will start with 0 due to sizing
21:50tomjackbetter way to define the generator applicative? https://www.refheap.com/90638734bcc2c72d934d27b84
21:51tomjacksurprised it's not already there
21:51tomjackmaybe it is?
21:53tomjackI guess (defn lift [f & gens] (gen/fmap (partial apply f) (apply gen/tuple gens)))
21:53tomjackseems backwards, but it works :)
21:54firefaux'night everyone
21:54firefauxI won't be staying up till 2 this evening :)
22:16fowlslegsjoin ##crypto
22:18dissipatewhere can i see the source code for 'shuffle'?
22:18dissipateoh hell no
22:18dissipatethis is horrible
22:19dissipatehorrible, horrible horrible
22:21dissipatedid anyone realize the Java 'shuffle' is bad?
22:21brehautcalling the standard java method is horrible‽
22:21dissipatebrehaut, have you read it?
22:21dissipatehttp://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#shuffle(java.util.List)
22:21brehautno. i dont normally go out of my way to read java code
22:22brehautthats not exactly a whole lot of source code
22:23dissipatebrehaut, you need to understand the theoretical horribleness of the Java shuffle function
22:23brehautactually, no. i dont
22:23dissipatebrehaut, "Randomly permutes the specified list using a default source of randomness. All permutations occur with approximately equal likelihood."
22:23dissipatebrehaut, this is extremely vague
22:24technomancydidn't we have this conversation a couple weeks ago?
22:24dissipatebrehaut, but nonetheless, i guarantee you that the 'default' source of randomness has a fewer number of possible permutations than any collection you can pass into it.
22:25technomancyabout how it's not appropriate to require high levels of entropy for basic default functionality like that because most people just need something fast?
22:25amalloydissipate: that's the best implementation of shuffle that's really possible
22:25amalloyyou can complain about the source of entropy, but the shuffle algorithm is great
22:25dissipatetechnomancy, you realize it is completely unsuited for scientific and statistical applications
22:25technomancydissipate: of course
22:25Schaeferthere is a second shuffle method that allows you to pass in your own random object
22:25technomancyit's a general-purpose shuffle function
22:25technomancyit's fast, it's appropriate for everyday use
22:26technomancyit doesn't consume lots of entropy
22:26Schaeferso if you want cryptographic random, use SecureRandom (or something similar)
22:26dissipatetechnomancy, at a *minimum* it should have a warning for when the size of your collection is larger than the maximum for all potential permutations to occur
22:26technomancydissipate: never in my life have I written code where that would matter
22:26brehautyou know whats also not appropriate for scientific computing? floats.
22:26technomancycool that you do stuff where it does, but I have a really hard time caring
22:26dissipatetechnomancy, guess you never developed an online casino?
22:27brehautoh shit guys, all out casinos are broken1eleven
22:27amalloyonline casinos can be expected to do a little more due diligence than "eh, let's just call shuffle"
22:27brehautthats it. close the clojures, everyone get your things
22:27amalloy$shutdown
22:27amalloy$abort
22:27amalloylazybot: run!
22:29dissipateamalloy, but what about casual users who don't realize not all of the permutations of their collection can be generated from 'shuffle'?
22:29amalloythey don't care
22:29amalloylike technomancy. like me
22:29cespare|homeHow do I create and mutate a java integer?
22:29amalloywhen i shuffle a deck of cards, i know there are two to the squintillion possible shuffles, and of course i won't get all of them. but i'll get a representative shuffle
22:29Schaeferon another topic - has anyone successfully used austin against the latest clojurescript? (0.0-2173). i get an NPE when evaluating (cemerick.austin/repl-env) . i filed a github issue but thought i'd check to see if anyone else has a similar problem
22:30cespare|homeI read the java interop page and whatever else I could find via googling.
22:30dissipateamalloy, BTW, i'm not here to just complain. what can be done about this?
22:30brehauti look away for a minute and we've gone from craziness about shuffle to mutating integers‽ bloody hell
22:31amalloydissipate: use the version of shuffle that takes a Random, if you care
22:31amalloyif you don't care, don't use it. that's really it
22:31muhoohas clojars gone TU?
22:31dissipateamalloy, i do care. i care very much.
22:31brehautmuhoo: its being converted to a casino
22:31hiredmanbrehaut: #clojure requires constant vigilance
22:31muhoobrehaut: like bitcoin?
22:31brehautmuhoo: doge
22:31muhooaye
22:32brehauti think Bodil is in charge
22:32muhooseriiously curl: (7) Failed to connect to 2600:3c02::f03c:91ff:fe96:4d76: Network is unreachable
22:32dissipateBodil Stokke?
22:32muhooand on another machine clojars.org just hangs
22:33brehautmuhoo: downforeveryoneorjustme.com aggrees
22:33muhooand yet another, three different networks, all failed
22:33bob2cespare|home, aren't java integers immutable?
22:33muhoothat's sad. lein anything dies if it can't get to clojars
22:33bob2cespare|home, what was the X part of this XY problem?
22:34muhooso who runs clojars who should be pinged right about now?
22:34brehauttechnomancy might know?
22:35brehautit might be xeqi ?
22:35cespare|homebob2: yes it is, I have an answer now
22:35dissipateholy crap, are you serious? clojars down?
22:35dissipatethat could break sooo many deployments
22:36bob2a good reminder not to couple your own deployments to random sites on the innerweb
22:36brehautFallacies of Distributed Computing #1 The networks is reliable; call it an object lesson
22:36brehauthttp://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing
22:36dissipatebob2, so you cache locally all of your dependencies?
22:36bob2I deployer uberjars
22:37dissipatebob2, and where do you get the jar dependencies inside your uberjar?
22:37bob2lots of places, including clojars
22:37bob2this would definitely break my builds
22:37bob2which is of course shit
22:38dissipatebob2, that's my point. first i find out shuffle was implemented poorly and now clojars goes down. this is a bad night for Clojure. :(
22:38bob2errrrrr ok
22:39dissipatedoes anyone know what the SLA is for the clojar's site?
22:39bob2lol
22:39bob2are you for real?
22:40dissipatebob2, if the SLA was violated, there could be a refund or cash payout
22:40brehautSLA for clojars: some dudes made it gratis and everyones glad they did
22:41xeqibrehaut, muhoo : just saw a ping email about it
22:42dissipatebrehaut, so if a critical application can't get deployed...
22:42xeqidissipate: clojars as a single point of failure has been a worry of mine for awhile
22:42dissipatexeqi, what mirrors are available?
22:43brehautdissipate: … it wont get deployed. seriously its a free service for the community by generous people in the community. you arent paying for it.
22:43xeqiah, I assume its from the ATL linode outage
22:43dissipatebrehaut, i would pay for it actually
22:44brehautdissipate: have you considered that the people who run clojars dont want to be tied to an SLA ? you can always run your own repo or use something enterprisy like sonatypes
22:44muhooindeed. i'm surprised tehre aren't clojars mirrors
22:44dissipatebrehaut, is there a bitcoin donation address for clojars? i would be more than willing to send $20 to that every couple weeks or month.
22:44muhoothey could do like the linux distros do. the problem of free highly-available repositories has been solved for a while.
22:44brehauti have no idea
22:45xeqithere are some people who mirror the repo, but I don't know of any of them being public
22:45dissipatebrehaut, i'm passionate about clojure. that's why when i see 'shuffle' the way it is, it pains me.
22:45xeqidissipate: I'm interested in finding a monetary way to run clojars, but thats in a limbo state while I do stay at home dad stuff
22:46hiredmanwe use a caching archiva setup at work, so any artifacts are builds pull in from other repos are cached in our archiva maven repo for future uses, works great
22:46xeqi* monetary as in self sustaining for a dev or ops person
22:46dissipatexeqi, you are running clojars?
22:46xeqidissipate: a co-maintainer
22:47xeqi+ technomancy and _ato
22:47dissipatexeqi, do you have a bitcoin donation address set up?
22:47xeqiI haven't touched btc
22:48dissipatexeqi, BTW, you can get cash deposited to a bank account from bitcoin donations
22:48dissipatexeqi, see this: https://coinbase.com/merchants
22:48xeqimuhoo: do they solve distributed deploying of new version based w/ access controls, and prevention of a malicous actor?
22:49dissipatexeqi, BTW, are any of the Clojure shops like Relevance donating to Clojars?
22:50xeqimuhoo: also, who pays for bandwidth? a 503 or corp behind the linux distro? (see recent $7k rubygems.org monthly cost)
22:50xeqidissipate: nope
22:50xeqidissipate: all costs are currently paid for by _ato
22:51dissipatexeqi, wow, that is sad. why has no one contacted the clojure shops to chip in?
22:51dissipatexeqi, you should keep logs to see how many time's their IPs hit the webserver. tell them your site needs mirrors.
22:52koreth__Do they take donations? I'd pitch in.
22:52muhooxeqi: 503 seems the right way to do it. bummer one guy is fronting the whole thing
22:52dissipatemuhoo, yeah, i agree, that's bad.
22:52dissipatemuhoo, shameful actually
22:52jimrthy2___<delurk>I may be feeding the troll, but as a drive by: I used to do casino software, and that's pretty much exactly the same sort of shuffle we used (with a software RNG that, honestly, left a lot to be desired). It was more than good enough.</delurk>
22:52dissipatekoreth__, i will too, but i refuse to donate via paypal. they need a bitcoin address.
22:53muhoobitpay.com
22:53dissipatemuhoo, and coinbase
22:53koreth__Heck, I'll mail them a check if that's how they want to do it. I use that service literally every day.
22:53muhoosupposedly supports the new payment protocol (might be in beta).
22:53muhooi've had good luck with coinbase. super easy.
22:53dissipatejimrthy2___, that's just negligent! you can't run a casino on that 'shuffle'!
22:54muhooit's possible that the serious clojure deployments all have private repos with their jars in them, and don't rely on clojars.
22:54dissipatejimrthy2___, there are a huge number of permutations that would never even show up in card games for instance
22:54muhoofyi, clojars is back up.
22:55xeqiI appreciate the enthusiam. As soon as I can devote more then 2 hours a week to clojure I'll be trying to work on the problem of sustaining it
22:55dissipatemuhoo, do you think the Clojure shops that aren't donating to Clojars would donate?
22:55hiredmangiven how much people complain about mailing in cas, asking for mailed checks may just be too much
22:55muhoodissipate: if i'm reading the scrollback correctly, there isn't a way to donate. i think that's why coinbase/bitpay was brought up
22:56muhoohiredman: it could be done as a joke. "to donate, you must submit this form..." and it's a parody of the core CA
22:57muhooseriously, a coinbase seems like a low-effort quick stopgap. long term, a 503 with corporate sponsors seems a better approach.
22:57dissipatemuhoo, a stop gap? paypal is a stop gap
22:58xeqi503(c)s are ugly to setup iiuc, though I've considered it as an option
22:58muhoodissipate: lots of people eschew paypal
22:58muhooxeqi: i've been the treasurer of one. it is a PITA indeed
22:59_ato2clojars outage cause: http://status.linode.com/2014/02/network-maintenance-in-atlanta-march-4-2014.html
23:00dissipate_ato2, is clojars on a CDN?
23:00muhoo_ato2: thanks for the update, and thanks for hosting clojars.
23:01dissipatemuhoo, it seems they don't want donations or help
23:02bob2_ato2, thank you for running clojars!
23:02SegFaultAXI might be late to the party, but is it or is it not currently possible to donate to clojars?
23:02_ato2dissipate: nope, no CDN
23:03dissipateSegFaultAX, apparently it is not possible.
23:03_ato2not currently possible, it hasn't really come up until now
23:03muhooprobably because there's nothing wrong with it. just the occasional linode glitch i guess
23:04SegFaultAXmuhoo: Not about something wrong, just want to do my part is all :)
23:05_ato2uptime history: http://status.clojars.org/584988/history
23:05dissipateSegFaultAX, how much will you donate?
23:06SegFaultAX_ato2: Nice!
23:07muhoothat's pretty damn good. oh well, i guess nothing to see here
23:07SegFaultAXdissipate: Dunno, hadn't really thought about it.
23:07dissipatemuhoo, nothing to see here? the site went down with no failover
23:07SegFaultAXdissipate: Maybe a couple server/months?
23:08dissipateSegFaultAX, how about servers across multiple regions with a CDN in front?
23:09dissipateplus mirrors of course
23:09SegFaultAXdissipate: Well if we're talking AWS, then storage alone is dirt cheap.
23:09koreth__A CDN seems like overkill. It is not a latency-sensitive application.
23:10bob2a cdn is not a replacement for fixing your deployment strategy
23:10SegFaultAXHow hard is it to setup a full mirror right now?
23:10_ato2https://github.com/ato/clojars-web/wiki/About#wiki-can-i-mirror-the-clojars-repository
23:11dissipateSegFaultAX, what do you think of Digital Ocean?
23:12SegFaultAXFor the frontend? It's fine.
23:12dissipateSegFaultAX, i really think there should be a CDN
23:13SegFaultAXdissipate: Sure, but as previously stated the issue is availability, not latency.
23:14muhooriight, i remember, they were working on a releases repository. it held up a version of lein for a while, till it was decided to release it anyway and wait for releases repo later
23:14koreth_I would probably also donate a couple server-months worth, unless my gut feel for how much it costs to run is way off.
23:14SegFaultAXCloudFront is just an optimization for the real underlying problem.
23:15SegFaultAXkoreth_: Lindoe runs from 20 - 360+/mo. If we guess mid-tier, maybe like 80+/mo?
23:15koreth_I was figuring a couple hundred a month or thereabouts.
23:15SegFaultAXLinode, even.
23:15SegFaultAXPer server?
23:15koreth_Yeah
23:16SegFaultAXMaybe, but it seems like overkill to get the biggest boxes for what is essentially a name resolution service.
23:16SegFaultAX_ato2: Can you share any details on the current hardware hosting clojars?
23:16r00k_Hi all. I'm trying to experiment with core.async in a clojurescript project and I'd like to play with it in my REPL. I have core.async in my project.clj, so I'm assuming it's on my classpath when I run `lein repl` (true?). But a (require 'core.async) isn't working. What am I missing?
23:16koreth_Well, don't get me wrong, I'll be thrilled if they spend less than that and my donation will last longer!
23:17bob2(require [core.async :as async])
23:17_ato2SegFaultAX: the smallest linode plan :)
23:17SegFaultAX_ato2: How many instances?
23:17dissipateSegFaultAX, to have such a brittle jar repo is just not professional. IMO this needs to be fixed.
23:17_ato21
23:17xeqir00k_: (require 'clojure.core.async)
23:17SegFaultAXWow, nice!
23:17bob2dissipate, stop being such an ass
23:17koreth_Ah, in that case I'd be willing to pay for more than just a couple months' worth of server costs. But at that price maybe it's just not worth the trouble to take donations at all.
23:17tomjack`r00k_: it's clojure.core.async
23:18SegFaultAX_ato2: And how many mirrors are active?
23:18_ato20
23:18SegFaultAXWhoa, that's awesome!
23:18dissipate1 machine? really? yikes!
23:19TimMcdissipate: You have expressed your surprise, disdain, and concern six ways to Sunday. We get it.
23:19SegFaultAX_ato2: Impressive that you're able to get such high availability/low latency out of one box. Well done.
23:19dissipatebob2, how am i being an ass? i don't see any big players adopting clojure when there is only 1 jar repo that is running on 1 machine
23:20koreth_I think that's pretty far down the list of reasons big players aren't adopting Clojure, sadly.
23:20dissipateTimMc, i offered to donate money, but was offered no way to do so.
23:20bob2dissipate, by going on and on and on
23:20r00k_xeqi, tomjack, bob2: Got it now. Thanks for the help!
23:21SegFaultAX_ato2: What's the current size of the full repository?
23:21TimMcdissipate: Perhaps you should consider that you are offering something that is not desired.
23:21dissipateTimMc, so they don't want money?
23:21_ato2for me it's mostly about time and energy, Clojure is alas not my day job. Luckily xeqi and technomancy have stepped in and done most of the work on clojars recently
23:22TimMcdissipate: I can't speak for the maintainers, but I also haven't heard any positive reactions to the notion of donations...
23:22TimMcI, too, would donate -- and encourage my employer to as well.
23:22dissipateTimMc, that's just crazy
23:22TimMcBut if it would add complication to people's lives, so be it.
23:23dissipateTimMc, how complicated is it to throw up a bitcoin address?
23:23xeqiSegFaultAX: when I checked mid Jan it was 11G https://twitter.com/xeqixeqi/status/424620237724450816
23:23_ato2SegFaultAX: repo size is 12 GB or so. outgoing traffic is maybe 150 GB/month if I remember correctly
23:23TimMcRemember, "free" money still isn't free.
23:23dissipateTimMc, how so? what is this? the mafia?
23:23SegFaultAXGreat! I could probably stand up an s3 bucket with cloudfront in a couple hours.
23:24xeqithe problem with donations is who do they go to? I don't pay for hosting. Maybe _ato2 ? but does that open up other issues?
23:24dissipateSegFaultAX, is the site static?
23:24TimMcSorry, it's past my bedtime. Maybe someone else will explain.
23:24SegFaultAXdissipate: Currently I'm focusing more on the storage strategy than the frontend. One thing at a time my son.
23:24dissipatexeqi, more money more problems
23:24xeqidoes introducing money affect recent US safe harbor rulings (napster) vs currently?
23:24dissipateSegFaultAX, ok, well, that's a good move in the right direction
23:25dissipatexeqi, no, just put the bitcoins through a tumbler. they won't be able to trace them back to you anyways.
23:25SegFaultAXI reckon clojars itself could be setup on a single m1.small or m1.medium on elastic beanstalk for autoscaling and simple deployment.
23:25dissipatexeqi, BTW, a lot of hosting sites accept bitcoin directly
23:26xeqidissipate: if you like tax evasion. Still has to count as income somewhere
23:26cespare|homeHow could I do something like the example here: http://clojuredocs.org/clojure_core/clojure.core/assoc! but update (assoc!) three transients inside the loop at once, instead of one?
23:27dissipatexeqi, i seriously doubt the IRS is going to care about that small sum of money. now if you have political enemies, that could be a problem, i guess.
23:28SegFaultAXCan we refocus on something productive?
23:28dissipateSegFaultAX, how easy it is to deploy clojure apps on elastic beanstalk?
23:28SegFaultAXEntirely trivial.
23:29SegFaultAXuberjar -> s3 -> redeploy. lein-beanstalk already does everything you want.
23:29dissipateSegFaultAX, nice, very nice
23:29dissipateSegFaultAX, can you run python scripts in that uber jar?
23:31SegFaultAXYou can script the deploy, sure. It's just EC2 afterall.
23:31SegFaultAXWhy?
23:31clojurebotwhy not?
23:31SegFaultAX~botslap
23:31clojurebotIt's greek to me.
23:31SegFaultAXAww.
23:32dissipateSegFaultAX, get it going then. set up the mirror.
23:38dpathakjcespare|home: it's not clear to me what you mean. are you reducing over a list of vectors of transients or similar? if so, you can just write a different reducing function that knows about the structure of your data.
23:39cespare|homedpathakj: I just have 3 of them, they don't need to be in a vector or map or anything until I make them persistent at the end.
23:39cespare|homedpathakj: anyway, I eventually figured out I need with-local-vars