#clojure logs

2013-10-28

00:00jared314amalloy: what do you mean by nicer?
00:00jared314amalloy: faster?
00:00jared314amalloy: more readable?
00:00amalloywell, it might or might not be faster, but it's prettier and more readable
00:01jared314(reduce #(assoc %1 (first %2) (apply f %2)) m m))
00:01jared314that is what I ended up with
00:02amalloy(into {} (for [[k v] m] [k (f k v)])), then
00:02dnolenfrom 0 to 60 with ClojureScript, fast recompiles and source maps - zero config http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/
00:04jared314amalloy: if I use into, does it reuse the structure of the original map? or is it an entirely new map
00:08amalloyit builds a new map
00:09amalloywhich is rather cheaper than building copies of the original map which contain entries you're just going to overwrite anyway
00:09jared314unless i make it a transient
00:09amalloyinto does that anyway
00:10muhoosimple static server, https://www.refheap.com/20206
00:15jared314amalloy: ok i'll use into then
00:15jared314amalloy: thanks
00:45ddellacostadnolen: nice. I'm going to write something up this week describing the workflows I've been using and tools that have helped me get going in CLJS. Aiming to be a good companion piece to yours for people getting going, giving them an introduction to ways of using the tools and libraries that are out there as of late 2013.
00:47dnolenddellacosta: excellent!
00:52jared314is there a function that can give me the namespace folder path from the namespace string?
00:53brunokimfolder path? What do you mean?
00:53jared314I have "something.core" and I am looking for "something/core.clj"
00:54jared314but there are character replacements, so I was wondering if there was already a function to do it
00:54brunokimah, ok, just a character replacement, not in fact look for the basis file and such?
00:55dobry-den
00:55jared314brunokim: just the string path
00:57brunokimI guess (-> ns-name (str/replace "." "/") (str ".clj")) could do the trick
00:58brunokimoops, ns-name is already a function
00:58jared314brunokim: i would also want to do a namespace-munge too
01:00brunokimin the REPL, the following worked to find the current namespace name:
01:00brunokim(-> *ns* ns-name (str/replace "." "/") (str ".clj"))
01:00dobry-dennamespace-munge is literally another character replace
01:01jared314dobry-den: i know, but it is maintained by the people working on core
01:01jared314dobry-den: so if it changes my code will still work
01:01brunokimwhat's namespace-munge?
01:01dobry-denyeah, but it's also (.replace s "-" "_")
01:01jared314dobry-den: future proofing
01:01brunokimAre you trying to convert between clojure namespace and java package?
01:02jared314brunokim: the folder names are valid java package names
01:02jared314brunokim: so yes
01:02dobry-denim not saying dont use it, im just saying it's not magical
01:02jared314dobry-den: yeah, i looked at the source before I mentioned it
01:02jared314dobry-den: i know
01:03brunokimwell, since gen-class possibly already does something like that, it doesn't hurt to look for it
01:09bitemyappddellacosta: that write-up would be very helpful.
01:12ddellacostabitemyapp: yes, I think it would be useful on a lot of levels. Among other things, I'd like to spark a conversation to get a better idea of how other people are using CLJS: what libraries they are using, what approaches in terms of workflow for testing and development they are using, etc. At the same time I'd like to get beginners clued in to what is possible with the libraries that are around right now.
01:13jared314thanks brunokim and dobry-den. this is what I ended up with (str (-> "something.core" namespace-munge (clojure.string/replace \. \/)) ".clj")
01:14ddellacostabitemyapp: I think Mimmo has done a great job with https://github.com/magomimmo/modern-cljs, but I think we need something a little more general and lightweight too.
01:20dnolenddellacosta: completely agree. I actually think lein templates are pretty sweet way to do CLJS tutorials so that interested users are protected from the seriously uninteresting work of configuring cljsbuild - they can focus on how to use a library.
01:21ddellacostadnolen: most definitely, that is a great point--I will try to produce some more lein templates too, now that you mention it.
01:24bitemyappddellacosta: dnolen a "lein-try" that "just works" for cljs could be cool.
01:25bitemyappsritchie: welcome to #clojure, here's your allotted picture of a kitten: http://i.imgur.com/Pmyt3SX.jpg
01:25sritchiehahaha
01:25sritchieyessss
01:25arrdem(inc bitemyapp)
01:25lazybot⇒ 6
01:25sritchiethis is the finest programming language community on IRC, full stop.
01:27ddellacostabitemyapp: hmm, I wonder how that would work, since there are big differences in how namespaces and libs work under the covers in cljs vs clj.
01:27ddellacostasritchie: :-)
01:27bitemyappddellacosta: I like to sit down, dream up the tool, DSL, or library I actually want - and then just see how close I can get.
01:28ddellacostabitemyapp: yeah, I definitely hear ya. I do too, and I think dnolen's comment about having some lein templates as a good place to start would help. And I'd definitely love to see something like lein-try for CLJS. But I think we'd need a bit of a different approach. Will think on it.
01:29ddellacostaalso, clearly, more kittens
01:30bitemyappddellacosta: dunzo: http://i.imgur.com/QsJqLTi.jpg
01:30jared314http://placekitten.com/
01:30ddellacostaomg jared314 that is awesome
01:31bitemyapps/web/cat/g developer
01:31ddellacosta(and don't get me wrong, dogs work too)
01:33bitemyappddellacosta: core.async or agents?
01:34bitemyappI mostly need to serialize operations, I'm not convinced I need core.async, but there might be a use-case I haven't thought of.
01:34ddellacostabitemyapp: sorry, in regards to those two, what are you asking about?
01:34bitemyappddellacosta: rethinkdb client for Clojure, connection management.
01:34bitemyappreading and writing to the socket.
01:35ddellacostabitemyapp: oh...well, I'm not sure I can give you a great answer--I haven't used agents in much depth.
01:36ddellacostabitemyapp: I would imagine core.async would work fine there, but an agent may be more appropriate for reasons I can't imagine right now.
01:38dobry-denim using core.async right now for a client/server loop. involves lots of repl restarts.
01:38bitemyappI have some specific API related reasons for using agents that could *possibly* simplify it, but there isn't a substantial difference. It's just to serialize side effects safely and without locks in the end.
01:41ddellacostait's too bad tbaldridge isn't around, I imagine he could give you a great answer.
01:43bitemyappddellacosta: I think I poked him earlier today to no avail.
01:43bitemyappI think my use-case is too boring for him :)
01:43ddellacostabitemyapp: ah, okay...haha
01:47bitemyapptime to reproduce a race condition I suspect exists but haven't proven yet
01:52muhoogawd, the "encryption" available in jgit is fucking useless
01:53muhooit's like ROT13
01:53Apage43for what, credentials?
01:53muhoofor encrypting data. it's MD5 and DES. hello? 1993 called and they've been hacked.
01:54muhooapparently jgit doesn't support actual encryption, just that nonsense.
01:54Apage43why does jgit include data encryption anyway
01:54muhooas an option. for "cloud storage" on s3
01:54bitemyapplol.
01:55jared314is that a new 3.x feature?
01:55Apage43oh.
01:55clojurebotTitim gan éirí ort.
01:55muhoowoudldn't be a bad idea if it was actually somewhat secure.
01:55bitemyapplein-difftest is pretty sweet btw.
01:55bitemyappjust saved my eyeballs and fingers some hassle.
01:57bitemyappooh pretty. I like this plugin.
02:07akurilinbitemyapp, gotta try that, could be useful.
02:13seangroverot12 is useless
02:13seangroverot13 is ok, but if you want to be really serious, it's alwasy gotta be rot 21
02:14seangroveI hear they're working on something new, we're talking like rot23, but I don't think it'll happen this decade
02:14bitemyappWhy can't I reproduce the race condition I thought would happen?
02:15bitemyapp...thread oblivious code is way too robust in Clojure.
02:16bitemyappKinda caremad.
02:17bitemyappAHA
02:26sritchiedo you guys know what the best practice is for pre-routing pages in Compojure?
02:26sritchiesay I want to authenticate a user before they hit some route, for example
02:26bitemyappsritchie: middleware fn (what I do) or Liberator (what the cool kids do)
02:26sritchieI see friend, by cemerick
02:26bitemyappI'm going to be the bad guy and say don't use Friend.
02:26sritchieyeah, I'm trying to get away from sandbar,
02:27sritchieand Friend looks abandoned
02:27bitemyappand instead wrap the "protected" routes (or all routes) with vanilla Ring middleware or consider Liberator.
02:27bitemyappreproducible race conditions make me feel fuzzy inside.
02:28sritchieliberator looks interesting
02:30sritchiebitemyapp: so you're just using something similar to
02:30sritchiehttps://github.com/adeel/ring-http-basic-auth
02:31sritchiethough that's quite old
02:32bitemyappsritchie: kinda. it's homespun and not basic-auth though.
02:32bitemyappsimilar design superficially
02:33sritchiecool, thanks
02:33sritchietrying to convert some calls to "pre-routes" from noir
02:33sritchieover to raw compojure
02:34bitemyappsritchie: not to be a pedant, but for the sake of clarity, any middleware is probably really just concerned with Ring for all intents and purposes.
02:34bitemyappCompojure is off in its own little world, the dispatch is almost immaterial. Compojure is used with Liberator too.
02:35sritchieyes, I was just stating why I'm poking at this - I'm sure Noir just built up a little piece of its own middleware
02:35sritchiebut I want to get a feel for how the ecosystem looks now, so any comment is helpful
02:35bitemyappCompojure makes it trivial to wrap subsets of your application routes, yes, but the middleware code itself only needs or expects Ring and should be compatible with apps that don't use Compojure - not that that's really a thing.
02:36bitemyappCompojure is really just "dumb" routing, it begins and ends there. Does a good job of it, but that's all it is.
02:36bitemyappEverything else is either interfacing directly with Ring or with a library that interfaces with Ring. the whole request and response maps, concentric circles of middleware functions dilly.
02:38bitemyappNoir was an attempt to "and in the darkness bind them" all the libraries but without the tender loving care of Granger it was left to the not-so-tender mercies of people who weren't keen on frameworks and dismantled it in favor of a library ecosystem.
02:38bitemyappthis attitude is common to Clojurians.
02:39sritchiepedestal looks to be trying to jump into the framework role
02:39bitemyappYes but it's attacking a very particular niche.
02:39bitemyappA niche that involves complicated and typically expensive projects.
02:39jared314and it is large enough to require time to disassemble
02:40bitemyappIf you know you're going to go nuts with a complicated CLJS frontend client and all kinds of data flying back and forth between server and client then Pedestal might be a fit. Pedestal has some of the "decision graph" stuff that Liberator offers as a library.
02:40bitemyappI'd prefer libraries.
02:41bitemyappI don't even like the global connection pooling in Korma. I glare with daggers in my eyes at c3p0 at least once a week.
02:48bitemyapphttps://github.com/acfoltzer/cabal-meta This says a lot, and it terrifies me.
02:53sritchiebitemyapp: I'll need to do some studying before getting liberator
02:55sritchiebut it looks like the idea here is that you use these calls to "resource" instead of passing your view functions directly,
02:55sritchieand this makes the auth, etc decision tree explicit
02:55bitemyappYeap.
02:55bitemyapplets you more easily part out and reuse things like auth and to compose resources like data.
02:55bitemyappif you have two routes that are vanilla functions, you can't merge them.
02:56bitemyappyou *can* merge maps with keys pointing to fns.
02:56bitemyappThus, the Zen of Liberator.
02:56bitemyappit's all dataaaaaaaaaa
02:56mullrAnybody know the status of core.typed with clojurescript? I see the source in there, but I'm not sure if it's supposed to work yet...
02:56sritchie:)
02:56bitemyappmullr: no-mans-land. Put on a pair of galoshes and dive in if you're a hearty soul.
02:56sritchiebitemyapp: so, with liberator,
02:57sritchieyou wouldn't need the middleware, since this effectively tacks on resource-specific middleware
02:57sritchieto certain routes
02:57sritchie(if used w/ compojure)
02:57bitemyappsritchie: aye, and you could arbitrarily compose/inherit/merge said resources from parent/siblings definitions
02:58sritchieah, so you make an "admin" that can look up a userid or whatever from the current session, then fork,
02:58bitemyapp(reduce merge {:my-fn #()} [secure-resource checked-resource logged-resource])
02:58sritchiethen you merge that with your page
02:58muhoobummer. clojure.tools.trace/trace-vars doesn't
02:58sritchiebitemyapp: merge-with comp, right?
02:59sritchieto get the functions to stack?
02:59bitemyappsritchie: yep.
02:59muhooprints exactly nothing.
02:59bitemyappit wasn't intended to be perfect code, sorry.
02:59sritchiehaha, just making sure I understood
02:59sritchiebut yes
02:59bitemyappyou appear to have the idea just fine :P
02:59sritchieawesome
03:01muhooand, when trace-ns says no source path, but there's definitely a source path
03:03muhooohh wait, nm. holy crap it's working allright. it just prints to the nrepl repl
03:03muhoonot to stdout or log4j.
03:04muhoosure do wish ther was a way to log this stuff somewhere more sane than that though.
03:04akurilinShould the following work? lein repl :connect localhost:7888 ?
03:06akurilinI keep getting told "port is required"
03:06akurilinthere was a change just in that check about 10 days ago, not sure that might have affected it
03:11muhooakurilin: only one way to find out: try an older lein and see if it works
03:34bitemyappddellacosta: You know what San Francisco needs that Tokyo has? Cat lounges.
03:35bitemyappddellacosta: I want to pay money, get some tea, and be surrounded by cats.
03:35bitemyappNot a cat, a few cats...I want to drown in cats.
03:35bitemyapp*not a few cats
03:35ddellacostabitemyapp: ha, haven't been to one of those places yet, although have heard about them
03:36ddellacostabitemyapp: when you come to Tokyo, we can go. ;-)
03:36ddellacostaI'm betting it's not as idyllic as you would imagine though, knowing how these things go here
03:36bitemyappddellacosta: you'll have to cart me out in a wheelbarrow if we do
03:36bitemyappbecause I'll OD on cats.
03:36bitemyappddellacosta: sure, but...cats.
03:37ddellacostabitemyapp: haha...well, it's on the list then. :-)
03:44TEttingerbitemyapp, you're fairly close to the cat house on the kings I imagine
03:45bitemyapp?
03:47TEttingerit's for when you want way too many cats around you
03:48TEttingerhttps://maps.google.com/maps?hl=en&q=cat%20house%20on%20the%20kings I have no idea how far this is from san francisco
03:48TEttingerthey have 700 cats just roaming the yard
03:48Apage43heh
03:49TEttingerwelcome to #meowjure
03:49bitemyappTEttinger: that is nowhere near me, but that is interesting.
03:50TEttingerI volunteered at a local humane society, it's good work they're doing
03:52TEttingerpasadena HS had to suddenly shelter something like 40 cats that they did not have room for because they were confiscated from a hoarder. and they couldn't be adopted until the criminal trial was settled
03:53TEttingerbitemyapp, if I were you I would settle for kitten cams.
03:54Apage43See also http://en.wikipedia.org/wiki/Buenos_Aires_Botanical_Garden
03:54muhoohttp://www.youtube.com/watch?v=VbyTAtBv7k0
03:54TEttingerhttp://new.livestream.com/tinykittens/jungle
03:55Apage43https://www.youtube.com/watch?v=eSETs3oXwpQ
03:56Apage43So if you ever wind up in Buenos Aires, you know where to go =P
04:11ddellacostasritchie: just to be the devil's advocate to bitemyapp, Friend is not abandoned and works pretty well, and I would also think about using my boss's lib https://github.com/diligenceengine/safeguard which is a hidden gem--but it does *post* routing filtering. We use it not just for validation but for all kinds of filtering; you set up policies and away you go. Very nice lib.
04:12sritchienice, awesome
04:12sritchiethanks for the pointer
04:13ddellacosta(I'm a bit biased since I'm working on this: https://github.com/diligenceengine/safeguard)
04:13ddellacostawhoops, not that
04:13ddellacostathis
04:13ddellacostahttps://github.com/ddellacosta/friend-oauth2
04:13ddellacostabut, the liberator approach seems pretty great too. So, I guess it really just depends on which one suits you the most.
04:14muhoonow this is an interesting wtf https://www.refheap.com/20209
04:14muhoowhat does that even mean. what index is out of what bounds?
04:15ddellacostamuhoo: sounds like you are referencing an index on an array which doesn't exist
04:15ddellacostaif I saw your code I'd be better able to offer suggestions. ;-)
04:15muhooi'm not doing anything of the sort. notice my code isn't even involved in that stacktrace
04:15muhooit looks like pst or nrepl itself is puking
04:16ddellacostaI mean, I don't know what you are doing or in what context, so it's hard to say
04:16SegFaultAX,(nth [] 1)
04:16clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
04:16muhoobut i'm not calling nth
04:16muhoothat's not in my code
04:17muhooit's odd, it looks like clj-stacktrace itself has lost control of its bladder
04:17muhooprobably on the way to reporting a bug in my code, but it never got that far.
04:17ddellacostait may be the indirect effect of something else. But again, can't say without seeing your code, or knowing what you are doing
04:18ddellacostaThis seems key through: NO_SOURCE_FILE:2 user/eval26014
04:19ddellacosta*though
04:21muhoostacktraces usually don't report errors in stacktrace
04:22muhooaha! i restarted the jvm, and now i'm getting a proper stacktrace showing the errors in my code
04:22muhoosomething is.... not right. why is clj-stacktrace getting confused, statefully?
04:23SegFaultAXmuhoo: It's hard to answer questions when you provided absolutely no context. At all.
04:24SegFaultAXOther than increasingly graphic descriptions of stackstraces.
04:26andyfingerhutFriend 0.2.0 was released on Oct 1 2013 and it looks abandoned?
04:27muhooSegFaultAX: the context seems irrelevant. this has happened a few times now on totally different forms in totally diffferent namespaces. it appears to be a problem with the tooling.
04:28SegFaultAXmuhoo: Fix it and file a PR.
04:28muhoofinding problems with the tooling is difficult without the tooling, but yeah, if i track it down, i'll do that.
04:29muhooFWIW, it started going crazy once i added clojure.tools.trace to my classpath.
04:33muhoohmm, and specifically once i require the ns, and trace something. then somethign seems to break in eiither nrepl or clj-stacktrace or something. will have to track it down more.
04:35SegFaultAXandyfingerhut: Abandoned is a pretty strong word. Personally my issue is that friend hasn't matured that much since it first came out, and there still isn't a super mature general purpose authentication library (that I'm aware of) for Clojure.
04:36SegFaultAXI think this inevitably leads to everyone inventing their own solution, which is almost always less than ideal.
04:37andyfingerhutSegFaultAX: I should have been clearer. I was looking through the logs and responding to a comment sritchie made a couple of hours ago, not realizing I was that late in responding. My bad for not providing better context.
04:39sritchieyeah, that was my mistake
04:39sritchiesorry about that
04:40muhoois it possible that not many people are using clojure for complicated social-networkign single-sign-on kind of apps?
04:41muhoomaybe what friend has is more than good enough for what people are actually doing?
05:09makkalothi can anyone help, i'm stuck with that async example http://pastebin.com/Q9HxEcU0 and http://pastebin.com/7PWZxmCw
06:14mmarczykcgrand: ping
06:14cgrandmmarczyk: pong
06:15mmarczykcgrand: that's some quick patching action
06:15mmarczyk:-)
06:16cgrandSo it's line #839 and below where array.length should be replace by 2*this.count
06:16cgrandbecause the array.length == 2*count invariant doesn't hold with nodes produced by tranisents
06:17mmarczykright
06:17cgrandI'm going to check for similar bugs befre sending a patch, a second pair of eyeballs would be more than welcome
06:17mmarczykhappy to lend mine :-)
06:17cgrandas I said: transients are touhy
06:18cgrandtouchy even
06:18mmarczykyes, it's quite amazing really
06:18mmarczykfor some reason the (f) case works in ClojureScript
06:18mmarczykbut the logic seems to be the same
06:18mmarczykso presumably either I made a typo while testing or there's some small difference somewhere which slightly changes the shortest path to the problem...
06:19mmarczykI'm happy to test the patch on both sides if you'd like to provide the ClojureScript version too, or else transfer it once it's tested in Clojure
06:20cgrandin JS does 2 and -1 hash to the same value?
06:21cgrandabout while seq works: seq knows that keys can't be nil and skip them. seq doesn't loo at count for the node
06:22hyPiRionmmarczyk: I would guess the hash is different?
06:22hyPiRionfor the cljs case
06:22mmarczykoh yes, of course
06:23mmarczykok, so it'll be no problem to produce a similar test case with some colliding strings
06:24cgrandmy preferred way to test those is to use two reify producing the same hard coded hashCode
06:24cgrand(thus not dependent on the hash claculsation)
06:24mmarczykgood call :-)
06:26mmarczykbbloom: thanks for asking about core.rrb-vector perf! will be moving forward again soon
06:26makkalotdoes 'dotimes' work for core.async in clojurescript , it seems it got blocked somehow ?
06:28mmarczykI'll have more news on that next time, need to dash now
06:29cgrandOk, I didn't find other similar errors, preparing the patch.
06:29mmarczykcgrand: cool
06:30mmarczykcgrand: I actually must run now, I'll take it for a test drive next time I'm at the keyboard though
06:30cgrandI let you investigate on the CLJS side
06:30cgrandok see you
06:30cgrandthanks
06:45staaflwhat's the rationale for grouping closing parens in code?
06:48staaflinstead of having them on separate lines
06:51honzastaafl: it makes the code look cleaner - if your indentation is right, you don't even have to look at the closing parens
06:53staaflhonza, interesting point
07:29glosoliwould it be right to to check if java.sql.TimeStamp dates are equal using (= date-one date-two) ?
07:30hyPiRionif dateOne.equals(dateTwo), sure thing
07:33glosolihyPiRion: so this means yes I guess heh :D
07:33glosolithanks
07:36hyPiRionnp
07:54mercwithamouthhas anyone ported the light table theme to emacs by chance?
07:55mercwithamouthemacs-live rather
07:59mrhankyhi folks
08:01minimal mercwithamouth: noctilux is pretty close
08:03mrhankyi'm new to clojure, i have clj-file with a namespace (sample-ns). why does "(:use sample-ns)" does not work but "(:use sample-ns.hello)" does?
08:22mercwithamouthhmm using light table and the instarepl fails to connect every time. =(
08:24HolyJakmrhanky: if you could share the code f.ex. via https://www.refheap.com/, it would be easier to help you :)
08:28mrhankyHolyJak, i only want to know why i simply cant do "(:use sample)" (sample is the given ns of a clj-file i got). if i try to use this file with this ns i get "cannot find class", but if i change the ns to "sample.bla" and modify my :use it will work without any problems
08:29mrhankyand i want to avoid changing the ns of the existing clj-file
08:32HolyJakHow is your code and files structured?
08:33mrhankyHolyJak, https://www.refheap.com/20212
08:34mrhankyi dont want to modify impl.clj
08:37mrhankyi think i got it, i moved impl.clj out of the consize dir and renamed it to the ns name
08:37HolyJakns and files/dirs are related to each other. your impl should have ns consize.impl - if not, it won't work properly. I don't know a workaround but i know little about compilatin in clojure
08:37HolyJakgood
08:37mrhankythis stuff is so weird :)
08:37HolyJaknot really, at least if you are used to packages in java
08:37mrhankyi mean the whole clojure thing
08:44sszzqqThe syntax is ok? => (let [[_ _ [_ a]] [1 2 [3 4]]] a)
08:45sw1nnaccount 0 del
08:47Jarda,(let [[_ _ [_ a]] [1 2 [3 4]]] a)
08:47clojurebot4
08:47Jardasszzqq: ^^
08:52mrhanky*sigh
08:55sszzqqJarda: thanks, Let is so powerful,
08:56sszzqqJarda: let could binding any depth local var value.
08:57mrhankymh i copied my leiningen project from my desktop to my notebook. i use jetty for a http service, incl lein-ring to have a dev server. now after copying my project running the server gives me errors in java.util.regex.Pattern: https://www.refheap.com/20214
08:58mrhankythe code works on my desktop
08:58sszzqq,(let [ [_ [_ [_ a]]] [1 [2 [3 [4 5]]]]] a)
08:58clojurebot[4 5]
09:00glosoliis there something inbuilt that would let me replace last occurance of dot ?
09:00glosoliin a string
09:01sszzqq,(do (def var [1 [2 [3 [4 5]]]]) (let [[_ [_ [_ a]]] var]) a)
09:01clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
09:18mdrogalistbaldridge: Would you be okay with me quoting you on the sentence "Test systems, not functions"?
09:19tbaldridgemdrogalis: sure, but I'm not sure I coined that phrase. It's more of a paraphrase of what other Clojure devs have said.
09:20mdrogalistbaldridge: Close enough. :P Have it in my chat logs by you. Hah.
09:21rkneufeldHey, can anyone intimately familiar with leiningen/data-readers internals comment on the kludgy-ness of this change to lein-try? https://github.com/rkneufeld/lein-try/commit/c652ebe780477bfa78463769c77e2482f56dec8d. We're trying to make data-readers work properly outside of projects and this seems to fix our issues.
09:27glosolihttp://bpaste.net/show/rWs9iKTIgLjfTThzLH6F/ any ideas if this is a good way to attach date-time to the file name string, just before file extension
09:39mdrogalistbaldridge: Hot off the press, when you get a few minutes. :) http://michaeldrogalis.tumblr.com/post/65274692089/clojure-understood-the-rush-hour-platform
09:42hyPiRionrkneufeld: Not entirely sure why `(prj/project-with-profiles)` is in there, otherwise it seems fine Leiningen-wise
09:47rkneufeldhyPiRion: having not written that, I don't understand what it does either...
09:47rkneufeldhyPiRion: I can only imagine it helps in the case that project was nil to begin with...
09:48tbaldridgemdrogalis: nice read! It's a cool program.
09:50mdrogalistbaldridge: Thank you!
09:53mdrogalisI have a feeling my micro instance on EC2 might get overwhelmed today.
09:54tbaldridgemdrogalis: I wonder if the output data could be baked, and then run the entire thing from the client.
09:55mdrogalistbaldridge: It absolutely can. If you listen on the websocket that ClojureScript is using, it's just arrays of coordinates.
10:26bordatouewhen starting an exteranl java application using log4j how do we manage to see the log in a the repl. I can't find any logs at all . I am using nrepl. Could anyone tell me how to access nrepl-server buffer
10:34bordatouesay if i got an exteranl .jar file that prints output to the console , system.out.println; how to i see these output on the repl. I am using nrepl. When i kill the application I can see it populates *nrepl-server* buffer, is there any way to see these output as it is generated
11:06instilledit should populate *nrepl-server* buffer in emacs
11:06instilledbefore you kill the application
11:07instilledthat is, you should see it there as soon as you print to the console. This of course also applies if you use a logging library that logs to the console
11:08bordatoue instilled: i can't see anything on *nrepl-server* buffer in emacs, but when i kill the process it appears all of a sudden in *nrepl-server*
11:09bordatoueinstilled: how do I access *nrepl-server* I just typed in C-x b *nrepl-server* is it the correct way to access nrepl-server
11:10instilledyes, basically you switch to that buffer.
11:10vmarcinkohi, is there some URL roadman for clojure v1.6 exists?
11:10vmarcinkoURL for v1.6 roadmap I meant
11:10instilledbordatoue: could be that the buffer is not automatically scrolled to the buttom.
11:10bordatoueinstilled: I didn't have this problem with slime
11:11stuartsierravmarcinko: Roughly, http://dev.clojure.org/display/design/Release.Next+Planning
11:11vmarcinkook, thanx
11:12bordatoueinstilled: the buffer appears to be empty i tried C-x [
11:13instilledbordatoue: how do you jack-in?
11:13bordatoueinstilled: nrepl-jack-in
11:14bordatoueinstilled: *nrepl-server* buffer doesn't come up , I need to explicitly open the buffer
11:18instilledbordatoue: i haven't updated nrepl.el in a while… at least it used to work. btw. nrepl is now called cider https://github.com/clojure-emacs/cider
11:19bordatoueok, I will try that, is it available via package manager in emacs
11:20instilledbordatoue: i haven't updated yet. don't know what changed expect the name of course...
11:21instilledbordatoue: what package manager do you use?
11:21dnolentbaldridge: did the macro line/col thing get into 1.6 do you know?
11:21bordatoueinstilled: thanks very much, i have got the following ELPA,gnu,marmalade,melpa
11:22tbaldridgednolen: I don't know.
11:22instilledbordatoue: follow the readme in https://github.com/clojure-emacs/cider
11:22instilledbordatou: you're welcome. let me know if that worked...
11:23bordatoueinstilled: will keep you updated
11:25bbloomcgrand: looking at your patch for the hash collision nodes fix, i had to smile at the subtlty of the bug in code of a sort i haven't had to look at in a long time :-)
11:29cgrandbbloom: Clojure makes a good job of preserving us from this kind of "subtlety"
11:39staaflis it possible to write in lisp without visual brace matching?
11:40staaflit doesn't seem so to me, but maybe I'm just missing a trick
11:41shoshinping, a clojure newbie question here. i'm trying to take an optional argument to a function but i'm unable to figure out what i'm doing wrong here.
11:41tbaldridgesure it is. See the videos from the 1980's of "SICP". In there they write lisp on a blackboard.
11:41tbaldridgeshoshin: can you post a code sample?
11:41bbloomstaafl: i don't use any kind of paredit, auto paren insertion, or anything like that
11:42shoshin(defn sample [x {:keys [load?] :or {load? false}}] (when load? (println "load? is true)) (println x))
11:42staafltbaldridge, I remember a few times when they had to manually track braces with their hands
11:42shoshintbaldridge ^^
11:42staaflbbloom, what about visual matching/highlighting?
11:42bbloomthe only thing i use is the most basic matching that's standard in vim, same for every other language with {} [] ()
11:43shoshintbaldridge when i call this function just as (sample 2) i get an arity execption
11:43bbloomand i'm pretty sure i could live without that
11:43shoshinwhat am i doing wrong here?
11:43znDuffstaafl: eh; with paredit-type tools, there's nothing "visual" about it -- the editor *won't let you* get into a situation where your content isn't syntactically valid.
11:43bbloomi do use % to jump to the matching brace quite frequently though, couldn't live witout that
11:43ndpshoshin: in your :or map, load? needs to be a keyword
11:44bbloomi know i'm a bit of a heretic, but i *hate* paredit
11:44bbloomof any kind
11:44bbloomi often write syntactically invalid code while i'm thinking
11:44shoshinndp like :load?
11:44bbloomon purpose...
11:44znDuffbbloom: ...I can't stand any kind of _inadequate_ paredit -- if it isn't complete enough to let me write things the way I think of them, it's awful.
11:44tbaldridge<disowned> "bbloom? Never heard of him."
11:44znDuffbbloom: but the emacs version is in my experience good enough that as long as you have its commands in your finger-memory, you can represent anything you need to.
11:45znDuffbbloom: ...though yes, that means you need to scale its learning curve pretty completely before the experience becomes a good one.
11:45bbloomi tend to write something like a demented hybrid between documentation, language comments, real code, pseudocode, lisp, python, and shit i just plain made up
11:45staaflznDuff, paredit looks intriguing
11:45bbloomthen when it looks right, i massage that in to real code
11:46ndpshoshin: yep, just like that
11:46bbloomparedit totally fucks with my brain
11:46shoshinndp (defn sample
11:46shoshin [x {:keys [load?]
11:46shoshin :or {:load? false}}]
11:46shoshin (when load?
11:46shoshin (println "load is true"))
11:46shoshin (println x))
11:46bbloomi had to turn off even the most basic of brace insertion in intellij for java
11:46mikerodIs it possible that every .clj file can be fully AOT compiled to .class files? So say I have a project with some clj dependencies, could everything be compiled AOT into .class files and all of the .clj files removed from the resulting jar? I'm just curious if AOT compilation is "fully-capable".
11:46shoshini still seem to be getting a problem.
11:46shoshin:/
11:47stuartsierramikerod: Yes.
11:47znDuffmikerod: it's a bad idea -- you lose compatibility with future versions of Clojure when you do that.
11:47znDuffmikerod: ...but if you're willing to eat that restriction, yes, it's possible.
11:48mikerodznDuff: I know the incompatibility concerns. I was just curious if AOT compilation is able to fully compile anything from clj source.
11:48stuartsierraAOT-compilation isn't really different from normal on-the-fly compilation: it just writes out the .class files to disk.
11:50mikerodstuartsierra: That was my understanding. I was just curious if you could set up some clj source that could be sneaky and leave some computation uncompiled until called upon or something. If that explanation makes sense.
11:51ndpshoshin: You're also missing an ampersand between x and the rest parameter: [x & {:keys [load?] :or {:load? false}}]
11:51stuartsierramikerod: Yes, if you call `eval`, that expression gets compiled at runtime. But even AOT-compiled Clojure code still depends on clojure.jar, so you always have the compiler available.
11:53shoshinndp aah. okay. but when i call the function with (sample "12") it returns "12" (because of the println). But in the case of adding (sample "12" true) it says no value supplied for they key true. What am i missing?
11:53mikerodstuartsierra: That makes sense. The compiled source is sufficient then on its own.
11:53stuartsierrayes
11:53mikerodI appreciate the quick feedback.
11:54ndpshoshin: If you want to provide a keyword argument, you need to call with a key-value pair like so: (sample "foo" :load? true)
11:55shoshinndp *facepalm* thank you for your help!
11:55ndpshoshin: Also, to be clear, (sample) is returning nil, but it prints the value of x to *out*
11:55shoshinndp ah. okay.
11:55ndpshoshin: Hey, no prob
11:58wakeuphi ho
11:59wakeupI need a crc-24 or equal in clojure (e.g. a 24bit hash), anything available?
11:59wakeupCan only find java's crc32
12:00ndpwakeup: do you need to interoperate with an external system?
12:01wakeupndp: nope
12:01znDuffwakeup: most hash functions can be truncated safely.
12:01znDufferr, hash functions' output
12:02wakeupznDuff: Any one you'd recommend thats available in clojure?
12:02znDuffwakeup: I don't know your use case and parameters, so I'm not in a position to recommend anything at all.
12:03tbaldridgewakeup: it looks like bouncycastle has what you are looking for. http://grepcode.com/file/repo1.maven.org/maven2/org.bouncycastle/bcpg-jdk16/1.43/org/bouncycastle/bcpg/CRC24.java
12:04tbaldridgeI'd be tempted to just port that to Clojure, the code is under MIT.
12:05wakeupNo way
12:05wakeupI don't want to be the one to blame for implementing a broken hash ;)
12:06tbaldridgeor you can just use bouncy castle as a dep, and use it from there.
12:09staaflhelp request: why isn't my implementation of 'reductions' lazy? https://www.refheap.com/20217
12:09staafl(take 5 (scanl (+) (range)) gives me Stack Overflow
12:10TimMcwakeup: What properties does your hash need?
12:10staaflI'm not using any eager functions on xs
12:10TimMcwakeup: CRC is very different from SHA, for instance. (CRC checks for a specific class of errors.)
12:10staafland cons is lazy, so far az I get it
12:11wakeupTimMc: I am not even so sure yet, my client has some wild ideas
12:11wakeupabout a multi-part hashing scheme that is user-input friendly at the same time.
12:11wakeupwith lookup of partial wildcard queries
12:11joegallostaafl: cons is not lazy
12:11joegalloyou might want to include a call to lazy-seq in there
12:11staafljoegallo, oh
12:12staaflso I should wrap the second arg in lazy-seq?
12:12TimMcwakeup: CRC is not collision-resistant, for isntance.
12:12joegalloi mean, (cons 1 some-lazy-seq) is lazy in the sense that it doesn't realize the lazy-seq...
12:12joegallobut it's not like (cons ... ...) will magically generate lazy seqs on your behalf
12:12wakeupTimMc: good point.
12:12joegallostaafl: sure, start with that
12:13wakeupI will probably use a sha variant and truncate that.
12:13staaflyeah, it worked
12:13wakeupand just do a hail mary
12:13staafljoegallo, thank you
12:13wakeupsee what happens
12:13joegalloyou're welcome!
12:15staaflit's a bit weird to me though, since the xs argument *is* lazy
12:15staaflso we have a function that basically cons-es to a lazy sequence, but ends up not being lazy
12:17TimMc&(first (cons 5 (range)))
12:17lazybot⇒ 5
12:17joegalloyou were eagerly consuming the lazy sequence when you generated your non-lazy sequence
12:17TimMcSee? Lazy, after the 5.
12:17instilledin what cases would you usually define :pre and :post conditions in functions? I haven't seen this much in clojure code yet… do you use the at all? any advise?
12:17joegalloTimMc: yeah, exactly
12:18joegallobut the key is that range *was* called, it's not like it lazily avoided invoking the range function
12:18staaflTimMc, oh, I get it
12:19TimMc&(take 10 (cons 5 (range)))
12:19lazybot⇒ (5 0 1 2 3 4 5 6 7 8)
12:19staafli'm just used to Haskell thunking function calls
12:19staaflso I assumed the recursion would be lazy
12:22joegalloah, that's a logical mistake to make, coming from there :)
12:32ro_sti have a seq of non-seq things, and sometimes some things are instead themselves seqs of non-seq things. i want a single seq of things. i don't want to use flatten. what else can i use to expand the nested seqs up into the top seq?
12:33TimMcro_st: You can use clojure.core/for, I think.
12:33TimMcmapcat could also be useful.
12:34TimMcIt's best to avoid ending up with those sorts of heterogeneous data structures in teh first place, of course.
12:35ro_stwell, it's the nature of the source data. datomic log, from which i'm inferring Important Things That Happened. sometimes we only notify one person, sometimes we notify two. i want triggers to be able to return one notice or a handful, and then to walk the whole list of notices and flatten it to a uniform shape for the next step
12:37hlshipSo it looks like protocols and varadic parameters are a no, go? Is this intentional?
12:38dobry-denro_st: have you looked at clojure.walk? it might help to see flatten's simple implementation (uses walk)
12:39ro_stthanks dobry-den and TimMc. sleuthing to do!
12:44clgvI remember a library for graph visualization that was mentioned on the mailing list. what is its name?
12:45hyPiRionclgv: nephila
12:45hyPiRionor, well, that's not a library, but visualizes your namesspaces. Probably not what you want.
12:46clgvhyPiRion: it was from one of the well-known clojure folks that produce a lot of libraries.
12:46hyPiRionclgv: https://github.com/ztellman/rhizome then
12:46TimMcYou probably want one of nephila's dependencies, though.
12:46TimMc^ that
12:47clgvoh right i remembered zach but didnt find a promising name in his repos
12:48clgvcan I label edges in rhizome? the examples do not show anything like that
12:50hyPiRionprobably some value (e.g. :label) to `:edge->descriptor`?
12:51clgvhmm right. reading the source now...
12:53clgvhooray for lein-try ;)
12:54seangroveIf something's been defonce'd, how can I "undef" it so it can be re-defonce'd?
12:54seangroveI'm using a library that does a defonce under the covers, and it's bothering my repl workflow
12:55clgvhyPiRion: ok :edge->descriptor it the tool
12:55clgv*is
12:56hyPiRionah, goodie
12:58dobry-denWhat comes to mind for you if you wanted to use core.async for client/server socket interaction? I don't know design patterns and am arriving at a system where I send outbound messages on out-channel, and I have a listener asychronously listening on in-channel which parses incoming bytes and updates the state-machine.
12:59mdrogalisdobry-den: I do something like that. It works out great.
12:59mdrogalisYou just sit core.async ontop of the socket library.
13:00jared314has anyone put core.async on top of any other forms of IPC?
13:00jared314other than sockets
13:01seangrovejared314: 0mq count?
13:01dobry-denmdrogalis: I'm making progress, but I also feel like I'm programming in a cave. Do you know of any examples that use core.async for networking?
13:01jared314seangrove: i thought that had sockets
13:02seangroveI don't think exclusively
13:02seangroveBeen about 2 years since I used it though
13:02seangroveProbably just sockets
13:03dnolenjonasen: hey trying to get Google Chrome Dev Tools to syntax highlight ClojureScript as Clojure, did you have to configure Code Mirror in any specific way? I thought Code Mirror shipped w/ Clojure support.
13:07grncdrdnolen: nice blog post, I'd recommend you use lein cljsbuild 1.0.0-SNAPSHOT in the project.clj though, 0.3.4 has the crashing bug in `lein cljsbuild auto` that is super annoying
13:07dnolengrncdr: not going to point to snapshot
13:07grncdrfair enough, would 0.3.3 work?
13:08dnolengrncdr: mies will get updated soon enough and so will CLJS, going to wait for that
13:08dnolengrncdr: in the mean time what's there is good enough for people who want to play around.
13:08grncdrok
13:13dnolengrncdr: wanted to thank you again for the earlier feedback, it inspired me to push this stuff along.
13:16grncdrnp ;)
13:16grncdrI'm hoping to do more than complain eventually
13:18dnolengrncdr: articulate complaining is always welcome. Also you're timing was good - if you'd complained a year ago there's not much we could have done - it's been a long road getting here.
13:18dobry-denI'm writing an app that does a lot of work with bytes. It swaps endianness, hex<->bytes, promotes ints, etc. My solution was to represent all bytes in my system as a vector of strings: ["0a" "0b" "0c"]. it makes it easy to, say, checksum with (take 4 (double-sha256 <hex-vector>)). but I was criticized when I showed the approach to some people but not really given any feedback.
13:18dobry-denWhat would be wrong with that?
13:19grncdrdobry-den: speed maybe?
13:20dobry-dengrncdr: Yeah, for sure. That's the thing I decided to defer for later
13:20dobry-denI found working with byte-arrays directly to be insufferable due to constantly mapping int or some bytes->hex helper over them anyways
13:21grncdrok, so if you don't mind me asking: how were you criticized without any feedback?
13:21grncdr"I think this sucks" (walks away)
13:21grncdr?
13:22grncdrI guess what I'm saying is it's difficult to guess what somebody else might've been thinking about ;0
13:22instilledhi. Can someone help? I'm trying to get the class (Class<?>) of a Java object in clojure, e.g. SomeClass.class. How would i do that in clojure?
13:22hiredman,(class String)
13:22clojurebotjava.lang.Class
13:23instilledok.
13:23hiredman,String
13:23clojurebotjava.lang.String
13:23mdrogalisdobry-den: Yeah sorry, popped out for lunch.
13:23instilledcheers!
13:23dobry-denhaha, i didnt mean to make it sound that way. i just didnt walk away with any other approaches
13:23mdrogalisdobry-den: I have a websocket example?
13:24dobry-denmdrogalis: Do you know of any core.async networking examples?
13:24mdrogalisdobry-den: Right. Is one where it integrates with a websocket sufficient?
13:25dobry-densure
13:25mdrogalisdobry-den: https://github.com/MichaelDrogalis/asphalt/blob/master/src/cljs/asphalt/core.cljs#L38-48
13:26mdrogalisPutting a channel over a websocket to obviate using the callback any more than necessary
13:27tbaldridgemdrogalis: *cough* (put! transport-chan data) *cough*
13:29drorbemetHi, I am looking for an 7zip input stream just like BZip2CompressorInputStream in
13:29drorbemethttp://commons.apache.org/proper/commons-compress/apidocs/allclasses-noframe.html
13:29drorbemetbut found only SevenZFile and SevenZArchiveEntry which don't seem to output a stream.
13:29drorbemetDo you have any clue where else to search for an 7zip input stream?
13:30mdrogalistbaldridge: Dang it, I always forget to do that
13:31dobry-denWhy use put!?
13:31dobry-denI guess that's L40
13:31mdrogalisApparently it's much faster.
13:31mdrogalisI would verify that if I could ever remember to do it.
13:32tbaldridgeput! (without the optional callback) is exactly the same as (go (>! c value)). put! does a async put. Since you're spinning up a go and then putting the go version will be slower
13:33tbaldridgeinternally go blocks will re-wire the code into a put! anyways, but there is extra overhead from creating the go.
13:33mdrogalisOh, that makes a ton of sense now.
13:34mdrogalisEspecially after watching the core.async video.
13:34dobry-denyeah, i need to go and watch more vids. it's too easy to get excited about something and the video to diddle about in emacs
13:35dobry-denespecially since everyone in videos is brilliant and gives me false confidence
13:35mdrogalisI have been in videos. Can verify I am not brilliant. \o/
13:36dnolentbaldridge: is there anything holding up getting Read/WritePort in there? I'd even go for just providing the lower level api if just getting Rich to approach api level names is what is holding things up.
13:36dobry-denmdrogalis: How do you maintain an overview of what's actually going through channels when you're working on your app? Particularly when everything is happening in a go block?
13:36dnolens/approach/approve
13:36tbaldridgednolen: did we never port that to CLJS? It's in CLJ.
13:36dnolentbaldridge: heh lemme check
13:36dobry-denMy only solution has been to make an (atom []) for each go-block and conj the message to the atom so i can look at it later
13:36mdrogalisdobry-den: If you're using CSP, you usually don't want an overview.
13:37mdrogalisI think that's true?
13:37mdrogalisdobry-den: What exactly are you trying to do?
13:37dnolentbaldridge: oh wow, ok I missed it, it's there, sweet!
13:38dnolentbaldridge: well the lower level stuff, not the higher level op to take a channel and get a read only port from it
13:39dobry-denmdrogalis: I'm talking to other nodes in a network and I'm not sure how to best open up my channel system to debug things like "why couldn't i parse that message" or "why did my state-machine not transition? oh, the peer sent back :foo before :bar this time??"
13:40mdrogalisIt sounds like you just need better introspection and logging.
13:40dobry-denyeah
13:40mdrogalisWhat's to stop you from dropping those inside go blocks?
13:43dobry-dengood point, i'll try to make a more deliberate mechanism. i suppose go-blocks could conj a logging message onto an agent that writes it to a file?
13:44dobry-denmy ad-hoc mix of printlns obviously fight in repl output
13:44dobry-den-- once there are multiple go-blocks
13:46mdrogalisdobry-den: Have you tried Dire? It can keep all of that cruft out of your app logic.
13:46dobry-denI have a final question: Once you have many go-blocks running, what's a good method for shutting them down and ensuringn they dont run away from you? So far I have a (def running? (atom true)) that all go-loops will check
13:46dobry-denill check dire out
13:47seangrovedobry-den: I pass in a stop-ch to all of them, that I use to shut them down externally.
13:49mdrogalisPretty neat, seangrov.
13:49dobry-dencool, i'll do that.
13:50seangrovemdrogalis: Yeah, allows me to restart my working space instantly
13:51mdrogalisseangrove: What kinda sentinal value are you using for that?
13:52seangrovemdrogalis: Anything - the channel is explicitly used to stop the go-loop
13:52seangrovehttps://github.com/sgrove/jida/blob/master/src/cljs/main.cljs#L111
13:52mdrogalisseangrove: Ohh, I see what you mean now.
13:53seangroveYou can see I use these two lines to rebuilt the ui instantly: https://github.com/sgrove/jida/blob/master/src/cljs/main.cljs#L177 & 178
13:53mdrogalisThat is one hell of a go block.
13:53seangroveYeah, working on the semantics/patterns - going to show this project to the channel in just a second
13:53mdrogalisVery cool.
13:53seangroveBut it's the main ui block, and it's not too bad for what it does
13:54dobry-denI often use (alts!! [channel (timeout 1000)]) to protect myself against my crappy code that will probably block until i restart my repl while i'm still smoothing things out.
13:55dobry-denHow do yall deal with that kind of thing?
13:57dobry-denI guess my entire problem really comes down to the fact that a go-block up the chain will have a problem but everything silently fails since i cant see an exception, and it's been hard for me to pin it down
13:58dobry-deni suppose once i get some better logging system working, it'll be much easier so ill work on that
14:01seangrovebitemyapp: You around? Could use some help on a datomic query
14:04delihiroshi, I'm wondering why memfn is just a macro and not a reader macro...
14:06nightflyBecause it doesn't require new syntax?
14:07delihirosnightfly: yes, it's true, but I feel (memfn getBytes) are more verbose than something like $getBytes
14:08delihirosor is it wrong to use memfn so often?
14:08TimMcYou can also do #(.getBytes %), but yeah, it's a little annoying.
14:09delihirosyes, #(.getBytes %) are better I feel, but than I feel memfn unnecessary
14:13silasdavisSuppose I have a seq of streams
14:13silasdaviscan I expose them as a single concatenated stream?
14:15jared314silasdavis: stream as in file io stream?
14:15mrhankycan i pass a string (which will not be executed as clojure code) to load-file (loading a clj)?
14:15silasdavisjared314: as in some type of java.io.InputStream
14:16jared314mrhanky: do you want the code to be parsed and executed?
14:16myguidingstarI'm interested in https://github.com/liebke/avout but the project seems inactive. Is it widely used?
14:17tbaldridgemyguidingstar: no it's not, and there's actually a few bugs in the lib (from what I've heard).
14:18bitemyappseangrove: sure, what's up?
14:19mrhankyjared314, i have a very small and basic programlanguage written in clojure. the clj file gives a a commandline on execution. now i want to call that clj from another clj and pass a string which will be executed by the loaded clj
14:19jared314silasdavis: http://stackoverflow.com/questions/14295099/how-to-chain-multiple-different-inputstreams-into-one-inputstream
14:20mrhankybut the string i want to pass to the clj is no valid clojure code
14:22jared314mrhanky: not valid clojure? as in not your custom language that needs to be parsed?
14:23mrhankyjared314, the string would be: \ file.txt run say-hi
14:23logic_proggoogling for "http session" brings up all these random tutorials about sessions. I want a throughouh understanding of http sessions -- and how it works in ring/compojure. I suspect this will be two separate tutorials -- where are these two tutorials?
14:24jared314mrhanky: have you posted a code sample anywhere?
14:26bitemyapphttp://heeris.id.au/sites/default/files/ProgrammerInterrupted.png
14:27`cbp:'(
14:27bitemyapp`cbp: I take it you got my email?
14:27bitemyapp`cbp: I started a branch, "connections"
14:28`cbpbitemyapp: I haven't checked my email but i did check github :P
14:28mrhankyjared314, just a sec
14:30`cbpbitemyapp: An explanation of your idea would be nice whenever you have time. Also for the experimental code, a paste or another branch would be fine with me
14:30bitemyapp`cbp: 'tis the branch then
14:31bitemyapp`cbp: so basically I'm componentizing it.
14:31bitemyappThe impure I/O part, the promise, and the pure part.
14:31mrhankyjared314, here is the implementation of the language and on the the command i run from terminal to execute: https://www.refheap.com/20226
14:31bitemyappthe tricky part is you can't really do the serialization of the protobufs in the pure part, because it depends on the current value of the token
14:32`cbpyeah the outer protobuffer at least
14:32`cbpthe Query one
14:37jared314mrhanky: oddly enough, I was playing with something similar about a week ago https://gist.github.com/Jared314/7095415
14:37jared314mrhanky: except i was translating directly to clojure
14:38bitemyapp`cbp: yeah, so it isn't really worth trying to "optimize" that for now
14:38bitemyapp`cbp: so basically an agent or core.async channel serializes writes against the socket
14:39mrhankyjared314, i go eat now, back in a few minutes
14:39bitemyapp`cbp: a dedicated thread is constantly reading from the socket and sends results to the agent who delivers on the promises associated by token
14:39bitemyapp`cbp: so the API is async by default. you just deref the promise returned.
14:43`cbpbitemyapp: good stuff, can't wait :)
14:44bitemyapp`cbp: notably, there's no client-side connection pooling. I don't think it's merited, a good idea, or necessary.
14:44bitemyappI might end up being wrong, but I'd like to try to proceed without.
14:44`cbpthat's ok you mentioned that rdb already provides that
14:45bitemyappyeah they have a separate daemon you run on the machines querying the db.
14:45bitemyapppretty handy.
14:45bitemyapp`cbp: if one wants more querying "parallelism" then you just create more connection objects.
14:46bitemyappordinarily wouldn't matter for obvious reasons.
14:48`cbpI will test the rdb python api doc's examples tonight to make sure everything runs, make those test cases + docs
14:49`cbp+ possibly make an example application sometime this week
14:49bitemyapp`cbp: just look at the test-cases I wrote in the connections branch
14:49bitemyapp`cbp: don't duplicate any work if possible
14:49bitemyappand add to those
14:49`cbpI am currently reading them
14:55jared314mrhanky: i guess you are updating https://code.google.com/p/consize ?
14:57`cbpbitemyapp: the wat stuff is like an (update-in authors [2 :posts] conj {:title .. :content ..})
14:57`cbpbitemyapp: probably will need some more idiomatic helper fns/macros
14:57jared314mrhanky: why not move the parsing you are doing into a VM function and slurp the file and call that a second time?
14:58bitemyapp`cbp: using update-in against vectors is a really bad idea in general.
14:58bitemyappthere's no enforced order, it's implicit state.
14:59`cbpbitemyapp: yea i know. I was just pointing out that the filter gives you the 3rd item of the table
14:59bitemyappthat sort of use-case really screams for lenses.
14:59bitemyapp`cbp: makes sense.
15:00`cbpthe (lambda [row] {:posts (append (get-field row :posts) ... stuff is really nasty
15:00`cbpthat could be changed for an update-in
15:00bitemyapp`cbp: I could think of worse, honestly. The java library doesn't even have lambdas at all yet.
15:00seangroveAlright, this is probably ready to get some feedback on - jidaexplorer is a rewrite of a project wei and I did roughly a year ago: http://www.jidaexplorer.com/?query-uuid=81987df7-3ccc-478b-bbd5-bd1b252b1e29
15:00`cbpbitemyapp: really? I wonder how it works
15:01seangroveIt's essentially a front-end to codeq with some nice additions, like query-sharing/saving, and results returnable by json with CORS. The json endpoint for the query above, for example, would be http://www.jidaexplorer.com/queries/81987df7-3ccc-478b-bbd5-bd1b252b1e29/results.json
15:02seangroveSo you could easily build "leaderboards" for projects with stats you cared about: commits over time, latest commits, new functions created, functions update by authors, etc.
15:03coventryseangrove: You should show the results of the query immediately when you first go to that page, rather than requiring the user to hit "run." As it is, it looks like the datalog query is the point of the page, until you read the whole thing.
15:03`cbpbitemyapp: I take it that you had no problems understanding the rdb connection ritual?
15:03seangrovecoventry: Good point, I'll push that out in a bit when I move to a cafe
15:03`cbpbitemyapp: lmk if you have in case you have to change the stuff dealing with the input/output data streams
15:04bitemyapp`cbp: well, I will.
15:04bitemyapp`cbp: the out stream will belong exclusively to the agent, the in stream will belong exclusively to the delivery thread.
15:04bitemyappthe singleton connection object is getting squashed too
15:04bitemyappFuck *that* noise.
15:05bitemyappLearned our lesson in Korma, never again.
15:05coventryseangrove: Pretty cool, though.
15:05bitemyappNo singleton connections, no singleton connection pooling.
15:05bitemyappBurn my fucking house to the ground before I let that happen again.
15:05`cbpbitemyapp: good to have you here :=
15:05`cbp:)
15:06bitemyapp`cbp: := looks like a person pretending to be a walrus by having chopsticks in their mouf.
15:07`cbp:p
15:07bitemyapphttps://github.com/AvisoNovate/pretty
15:07seangrovecoventry: Thanks, appreciate it. There's something useful here, just haven't *quite* figured it out yet. Making it a service should help open the exploration.
15:08bitemyappPretty cool asset pipeline library: https://github.com/AvisoNovate/twixt
15:08bitemyappweavejester would approve...I think
15:12mrhankyjared314, not updating, i want to build a web-interface for it
15:18bitemyappmdrogalis: just saw Rush Hour, this is really interesting!
15:19bitemyappmdrogalis: Exception in thread "main" java.lang.RuntimeException: No such var: json/pprint, compiling:(cljs/source_map.clj:142:7)
15:22mdrogalisbitemyapp: Thanks!!
15:23mdrogalisbitemyapp: Where'd that come up?
15:24bitemyappmdrogalis: `lein cljsbuild once` in asphalt
15:24bitemyappmdrogalis: maybe relying implicitly on something in your lein profile?
15:24mdrogalisbitemyapp: Weird. Just built it on my work machine alright.
15:25mdrogalisI don't have much experience debugging ClojureScript errors though. Not sure where it could be coming from.
15:26myguidingstarwhat's wrong with this?(.isUpperCase \a)
15:26myguidingstarIllegalArgumentException No matching field found: isUpperCase for class java.lang.Character
15:26znDuffmyguidingstar: where do you find the javadocs saying that isUpperCase() is a thing you can call?
15:27znDuffahh.
15:27znDuffit's static.
15:27mdrogalismyguidingstar: That method is static.
15:27znDuffmyguidingstar: (Character/isUpperCase \c)
15:27mdrogalisbitemyapp: If you send me your Leiningen set up I can try to figure it out for you.
15:28myguidingstarthanks all, but I don't understand :"
15:28bitemyappmdrogalis: https://github.com/bitemyapp/dotfiles/blob/master/.lein/profiles.clj
15:28myguidingstarwhy adding `Character/`?
15:28znDuffmyguidingstar: the (.foo bar) syntax works for calling class methods.
15:29znDuffmyguidingstar: ...it's not the syntax for static methods.
15:29coventryseangrove: I bet a service which notified you when your library is used in another open-source project would be popular :-)
15:29znDuffs/class methods/instance methods/
15:29znDuffbleh.
15:29coventrymyguidingstar: http://clojure.org/java_interop#Java Interop-Classname/staticField
15:30myguidingstarthank you all
15:32mdrogalisbitemyapp: Yep, something in your profile is doing it
15:34mdrogalisbitemyapp: Jark is the culprit.
15:34mdrogalisComment it out and it works. Don't have more time to look into why :)
15:36bitemyapp:(
15:38mdrogalisbitemyapp: At least you have an answer. :P
15:39coventryIs jark in the same space as grench? Is it preferable?
15:39bitemyappmdrogalis: is this spelling intentional? coordindates
15:39mdrogalisbitemyapp: That would be a typo for sure.
15:40bitemyappmdrogalis: it's a consistent typo but it confused me.
15:40mdrogalisbitemyapp: That's what I get for using Emacs autocomplete.
15:40bitemyappmdrogalis: I don't see where jark is coming into this.
15:41bitemyappmdrogalis: dude, I've seen egregious typos proliferated because of Eclipse/IntelliJ/Visual Studio autocomplete.
15:41bitemyappthe error appears to be from attempting to generating source maps.
15:41mdrogalisHeh, yeah it can happen. All I know is that I commented out Jark and it worked.
15:41bbloomi've proliferated egregious typeos without the help of autocomplete, thank you very much
15:42mdrogalisbbloom: I don't need your help to mispell basic words.
15:42bitemyappmdrogalis: that's what I'm saying , I don't know wtf you're talking about
15:42bitemyappmdrogalis: where is jark? what are you commenting out?
15:42bitemyappI don't see anything in asphalt's project.clj or code that says "jark" or "Jark"
15:42mdrogalisIt's in your Lein profile, haha.
15:42bitemyappor anything that looks plausible.
15:42bitemyappoh
15:42bitemyappwell wtf.
15:43mdrogalisHah.
15:43bitemyappthat must be from before I started using grench.
15:43bitemyappgrrr.
15:44mdrogalisLooks like it.
15:48mdrogalisbitemyapp: Let me know if you have any other problems - typos aside.
15:53bitemyappmdrogalis: well, I did, but I don't really have time to follow-up on it right now. I take it I need to init some default state?
15:53bitemyappin the repl.
15:53bitemyappfrom the edn fixtures.
15:53mdrogalisbitemyapp: Are you trying to just run Asphalt or the entire thing?
15:54bitemyappmdrogalis: the entire thing more or less, I just wanted to see it in action.
15:54mdrogalisbitemyapp: Got'cha. There's a live demo online if you didn't see, but the instructions on the Github page should work alright too for local usage.
15:55bitemyappI'll take a look at that, thanks.
15:55bitemyappmdrogalis: what inspired this? this is really cool. The last Clojure dojo led to my fiddling with a simple "predicates as data" thing.
15:56mdrogalisbitemyapp: Well, I was passed out in a park after work when I had no internet, and my brain just started playing with ideas.
15:56mdrogalisRemoving internet for a while does good things.
15:58mmitchellI realize this isn't a clojure question, but maybe some of you have a suggestion? I'm looking for a json/javascript editor/mode that has a configurable indent size... for emacs.
15:59bitemyappmmitchell: https://code.google.com/p/js2-mode/ http://www.emacswiki.org/emacs/Js2Mode
15:59bitemyapp"variable (adjustable) indentation"
15:59mmitchellbitemyapp: nice, thanks!
16:17ivanhttp://www.learndatalogtoday.org/ is fantastic
16:19jonasenivan: thanks
16:20ivanjonasen: I noticed a subtle bug in the second exercise in chapter 8 where the solution allows an actor to be friends with himself
16:20ivanthere is probably no value in fixing it, however ;)
16:22jonasenivan: yes, it would be an easy check I guess to add something like (not= ?p1 ?p2)
16:23ivanfwiw the solution I came up with involved pasting in the associated-with rules, which I had to rename to get past the symbol checker
16:24jonasenivan: I should add that symbol to the whitelist as that is a reasonable solution
16:25jonasensince it's used in the text
16:26dnolenif somebody would like to help improve source maps even further - this is one that needs work - https://twitter.com/jhirn/status/394903906431422464
16:26dnolenjonasen: did you see my earlier question about Code Mirror and ClojureScript syntax highlighting?
16:27jonasendnolen: no
16:27dnolenjonasen: so are you telling Code Mirror that .cljs is just .clj?
16:27dnolenjonasen: I'm assuming CM comes w/ .clj support right?
16:27jonasendnolen: yes
16:28jonasenI use clj highlighting
16:28dnolenjonasen: can you point me to the location where you configure this? I'm trying to get .cljs syntax highlighting enabled in Google Chrome
16:29jonasenhttps://github.com/jonase/cljsfiddle/blob/master/src/cljs/cljsfiddle/core.cljs#L118
16:29dnolenjonasen: by which I mean, I'd like to get Google Chrome patched so that it just work (I already opened a ticket) and it's been assigned but I'd like to link to example of it working in CM
16:29jonasenand it depends on this file: https://github.com/marijnh/CodeMirror/blob/master/mode/clojure/clojure.js
16:32dnolenjonasen: great thanks, for reference, http://code.google.com/p/chromium/issues/detail?id=312271
16:33staaflhelp request :-)
16:33seangrovetbaldridge: I finished up work on a tool for codeq-as-a-service, and wondered if you guys at cognitect had some example queries to share?
16:34staaflthis problem asks to implement a function that guesses the type of a collection
16:34staaflhttp://www.4clojure.com/problem/65#black-box-testing
16:34staaflwithout using the built-in predicates
16:34staaflit's a cool exercise, but I'll probably have to dig through the documentation for hours to figure it out... any suggestions?
16:35coventrystaafl: &(doc empty)
16:36staaflcoventry, that's really smart
16:37staaflyep, that worked
16:37staaflany other suggestions though? I'm curious for the other ways there to skin this one
16:37staafls/there//
16:47muhoo,(doc empty?)
16:47clojurebot"([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"
16:49rasmusto,((complement empty?) [])
16:49clojurebotfalse
16:51arrdemis there a way to force clojure to copy an object?
16:51Jardaa
16:51rasmusto,(if-let [a (seq [])] a 'not-a)
16:51clojurebotnot-a
16:51dnolenarrdem: what do you mean?
16:52arrdemdnolen: obviously with the immutability model there isn't a need for it normally, but because I'm testing a memoized function I'd like to force a memcopy duplicate of some data.
16:52bitemyappmy solution was better than amalloy's, but austin taylor molly-whomped me.
16:53bitemyappstaafl: did you solve it yet?
16:53bitemyappI want to share my answer :)
16:53staaflbitemyapp, yep :-)
16:53tbaldridgearrdem: seems like you need a better memoize function, one that supports reset
16:53seangrovetbaldridge: For example, here's a list of all clojurescript committers and their commit count: http://www.jidaexplorer.com/?query-uuid=81987df7-3ccc-478b-bbd5-bd1b252b1e29
16:53bitemyappstaafl: #(or (and (get (conj (empty %) [:a nil]) 0) :vector) ({{} :map #{} :set '() :list} (empty %)))
16:53seangrovecoventry: Fixed it so results show up automatically
16:54seangrovetbaldridge: But I remember seeing a query rich did where he queried for functions with the highest churn
16:54seangroveWould like to get a few example queries in the library like that
16:54arrdemtbaldridge: that would definitely work too... but to the best of my knowlege the clojure.core one doesn't and neither does my tweak thereof.
16:56bitemyappseangrove: http://blog.datomic.com/2012/10/codeq.html
16:56bitemyappseangrove: you just sum up the number of commits for each def.
16:56staaflbitemyapp, why does get on a list always return nil?
16:56bitemyappstaafl: lists aren't associative yo.
16:57staaflbitemyapp, then why is it implemented at all?
16:57bitemyappthe only other difference between them and vectors is the order of conj, which is what amalloy used
16:57bitemyappstaafl: lol? sometimes you need to conj onto the head instead of the tail.
16:57bitemyappstaafl: they're used to represent code too.
16:57bitemyappYou don't commonly use them in typical code though
16:58staaflbitemyapp, I was referring to get
16:58staaflwhy is get implemented on lists
16:58bitemyappstaafl: get isn't implemented on anything.
16:58bitemyappstaafl: get is a function.
16:58tbaldridgeseangrove: I'm not aware of any such queries, but I haven't worked with codeq for some time.
16:58staaflbitemyapp, you know what I mean :-)
17:00bitemyappstaafl: Clojure believes in GIGO, not proliferating exception handling.
17:00mdrogalisGIGO?
17:00mdrogalisOh, nevermind
17:00mdrogalisGot it as soon as I hit enter.
17:00bitemyapp(get {} :a) returns nil. (get '() 0) returns nil. (get [:a] 1e16) returns nil.
17:00staafl,(pop [])
17:01clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>
17:01bitemyappyou either get a result, or you don't. In the default case, does it really matter which exception got thrown?
17:01tbaldridge,(get 4 :a)
17:01clojurebotnil
17:01bitemyappstaafl: pop isn't a normal coll operation.
17:01bitemyappthe normal coll operations are "Option" typed.
17:01bitemyappI'm quite fond of this, personally.
17:02staaflbitemyapp, so in case of a code error, you have null references all over the place
17:02staafl<span style="tone: irony">sounds neat</span>
17:02bitemyappstaafl: yes, the world is doomed. There's no way you could possibly write safe code.
17:02Bronsa,(get (sorted-map 1 1) :a)
17:02clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Keyword>
17:02Bronsa:(
17:02bitemyappstaafl: back to #haskell with you.
17:03staaflbitemyapp, lol
17:03staaflI was on the other side of this debate only a few days ago
17:03bitemyappthe language has an implicit Maybe monad in most of the coll operations. I prefer it.
17:03tbaldridge(inc bitemyapp)
17:03lazybot⇒ 7
17:04bitemyappPrefer it to Python barfing unnecessary exceptions and to breaking out pointless/meaningless nil cases when I am just going to chain and short-circuit anyway.
17:04tbaldridgeit's never really a problem since everything knows how to handle nils
17:04bitemyapp^^ precisely.
17:04tbaldridge, (-> {} :foo :bar :baz)
17:04clojurebotnil
17:04staafltbaldridge, but how do you trace it back
17:04bitemyapphead [] in Haskell throws an exception.
17:04staaflto the point of error
17:05bitemyappstaafl: if you pass {} to #(-> % :a :b :c) and you get a nil back, does it really matter that :a was the first key to return nil?
17:05bitemyappif you care that much:
17:05stuartsierraOne nil pun I often debate with myself: http://dev.clojure.org/jira/browse/CLJ-1107
17:05tbaldridgestaafl: for me? I use the repl or tests. If you have small functions you probably have < 10 lines of code to proof-read
17:05JardaI have found it very refreshing that the 'worst case' is a returned nil
17:05staafl'tis very new to me
17:06Jardabecause I don't have to surround my code with try/catch
17:06staaflI've always been told that "fail fast, fail loud" is the responsible way
17:06Jardaor a ton of if (foo != null) checks
17:06tbaldridgestaafl: it really starts to be a nice to have when you start writing code like this:
17:06tbaldridge(or (:bar {}) (:baz {}) (:foo {:foo 42}))
17:06tbaldridge,(or (:bar {}) (:baz {}) (:foo {:foo 42}))
17:06clojurebot42
17:07bitemyappstaafl: you short-circuit with and/or if you want to catch a nil midstream.
17:07tbaldridgestaafl: here the get failures return nil, so their result is thrown away.
17:07bitemyappMost of the time, you don't care and there's simply, "an error" if a nil comes out the other side.
17:08staafli'll meditate on this
17:09tbaldridgestaafl: I forget who said it, but I love the fact that Clojure defines nil as "undefined, or unknown" instead of "an error". In OOP nils are deadly since doing nil.foo() just doesn't make sense, but if you define everything via functions and then call nil "unknown" things start to make sense.
17:10staafltbaldridge, summing unknown values doesn't make sense either
17:10tbaldridgestaafl: agreed, and that's where Clojure differs from PHP or JS
17:10staaflafter all, the data the code works on has to map to the real world somehow
17:10tbaldridge,(+ nil 42)
17:10clojurebot#<NullPointerException java.lang.NullPointerException>
17:11staafl,(get nil nil)
17:11clojurebotnil
17:11seangrove,(reduce + [1 1 2 2 2 nil nil 3 3])
17:11clojurebot#<NullPointerException java.lang.NullPointerException>
17:11seangrove,(reduce + (filter identity [1 1 2 2 2 nil nil 3 3]))
17:11clojurebot14
17:11staaflwhat is the semantic difference between summing unknowns and retrievning unknown key from unknown collection?
17:12staaflaren't they both bogus code?
17:12staafldivision-by-zero-bogus?
17:14bitemyappstaafl: not really, no.
17:14tbaldridgestaafl: that could be the debate. Q: "What is the first item in an empty box" You could answer "nothing is the first thing in an empty box"
17:14tbaldridgestaafl: or you could say "how dare you ask that question! now die!!!"
17:14bitemyappstaafl: expecting uniformity of type in a coll isn't unusual, throwing exceptions over the mere non-existence of a key/value pair in a map is silly.
17:19staaflwell, if you ask me, it's not a slam dunk either way
17:19bitemyapp,(reduce (fn [[a v] k] [(get a k) (conj v k (get a k))]) [{} []] [:a :b :c])
17:19clojurebot[nil [:a nil :b nil :c ...]]
17:19bitemyapp,(reduce (fn [[a v] k] [(get a k) (conj v k (get a k))]) [{:a {:b {:c 321}}} []] [:a :b :c])
17:19clojurebot[321 [:a {:b {:c 321}} :b {:c 321} :c ...]]
17:19staaflyou either have to litter your code with null checks
17:19bitemyappstaafl: ^^ get-in with tracing.
17:19bitemyappstaafl: you don't litter your code with null checks.
17:19bitemyappthat's the point.
17:19staaflor you have to remember to explicitly elevate nil values to exceptions
17:20bitemyappstaafl: false dichotomy
17:20staaflOR you just laissez-faire it and end up swimming in nils of unknown origin
17:20bitemyappalso false.
17:20bitemyappyou perform all the data operations you want in one sweep, monadically or ephemerally, and then you decide how to react to the final result without null-checks interspersed.
17:20staaflbitemyapp, that was my second option
17:21bitemyappno it wasn't
17:21staaflyou have to remember to check for nils at some junctions
17:21bitemyappstaafl: just go write code.
17:21joegalloi dunno, what if there's a problem with the code?
17:21joegallobetter do nothing
17:21rasmustomyapp/nil, namespaced nils?
17:21joegallo;)
17:21mdrogalisAwkward comment of the day: "Anyone else going as Rich Hickey for Halloween?"
17:22rasmustocould you tag a nil with metadata?
17:22tbaldridgestaafl: it's kindof one of those things that just isn't a problem in day-to-day use.
17:22bitemyappjoegallo: funny that you would pop-up, I used robert-bruce to reproduce a race condition last night.
17:22joegalloso you're the one!
17:22joegallo:)
17:23bitemyappI'm what.
17:23joegallothe user!
17:23bitemyappmore than one person uses robert-bruce.
17:23joegallophew!
17:23staafltbaldridge, we'll see :-)
17:23joegalloanyway, glad you liked it!
17:23bitemyappjoegallo: yeah super handy.
17:23staaflbitemyapp, since you asked for code
17:24bitemyappstaafl: don't mistake that for my being especially interested in what you're doing.
17:24staaflwhy does this trial division primegen go into infinite loop: https://www.refheap.com/20237
17:24bitemyappstaafl: because you're reducing an infinite sequence
17:25bitemyappstaafl: also why are you lazy-seq'ing range? range is lazy.
17:25staaflbitemyapp, just in case you like giving pratical advice in addition to philosophical :-)
17:25staaflbitemyapp, cargo-culting :-/
17:25bitemyappstaafl: range is lazy, reduce is not. That should tell you everything you need to know about why that's an infinite loop
17:25staaflbitemyapp, well, I assumed "reduced" short-circuits the reduction
17:26bitemyappstaafl: reduced is a function. Why would you (:reduced ...) a value?
17:26bitemyappkeywords-as-fns are assocative "gets" against their argument.
17:26bitemyappstaafl: http://stackoverflow.com/questions/15625341/reduce-a-lazy-sequence-like-a-loop-with-a-condition-in-clojure
17:27bitemyappstaafl: annnnnnd you might also note: http://dev.clojure.org/jira/browse/CLJ-1185
17:27staaflbitemyapp, because 4clojure.com didn't recognize it... I guess it's using an older version of clojure
17:27bitemyappI'm helping you solve 4clojure puzzles?
17:28staaflbitemyapp, no, you're helping me learn how clojure works
17:28staafl4clojure puzzles are incidental
17:29staaflbitemyapp, thank you for your opinionated help :-)
17:29bitemyappstaafl: +1 this: https://github.com/4clojure/4clojure/issues/247
17:29RaynesUgh, please don't.
17:29Raynes:p
17:30RaynesWe've seen the issue. We don't need inboxes spammed with +1.
17:30bitemyappRaynes: I will torment youuuuuu
17:30RaynesI'll see about spending some time this weekend on it.
17:30bitemyappRaynes: tea > red bull
17:30RaynesOr if bitemyapp wants to send a pull request.
17:31bitemyappseangrove: Halloway's video is pretty solid and touches on some design notes that are pretty important: http://www.datomic.com/videos.html#query
17:31Raynesbitemyapp: Yeah, redbull may kill me today.
17:31bitemyappRaynes: seriously? PR'ing 1.4.0 => 1.5.1?
17:31seangrovebitemyapp: Yeah, watched this one earlier today
17:32Raynesbitemyapp: Well, usually a version increment requires testing to make sure there is no breakage. Dependencies might need to be updated, etc.
17:32RaynesThings break in interesting ways sometimes.
17:32staafltbaldridge, thank you for your input as well
17:32RaynesOr maybe I'm just damaged from helping upgrade a rails codebase from Ruby 1.8 to 2.0
17:32bitemyappstaafl: you have your first Clojure chore.
17:32bitemyappRaynes: I don't think it'll go quite so badly in our neck of the woods.
17:32bitemyapp1.8 => 2.0 sounds incredibly brutal.
17:32bitemyappI hope you had tests.
17:32RaynesOh it has been.
17:33RaynesWe did.
17:33bitemyapp1.8 => 1.9 alone was pretty bad.
17:33Raynes1.8 -> 1.9 is worse than 1.8 -> 1.9
17:33RaynesEr 2.0
17:33Raynes1.9 is worse than 2.0
17:33bitemyappRaynes: OTOH, the Python solution to painful language upgrades is to never upgrade.
17:33RaynesMore encoding issues, etc.
17:33bitemyappwheeee Python 2 forever #HeadInTheSand
17:34znDuffbitemyapp: eh. Python at least saved their breaking changes for a major release.
17:35AimHerePerl is saving their breaking changes for the apocalypse
17:35justin_smithmy emacs nrepl buffer is trying to evaluate defrecords twice, is this a known bug?
17:35bitemyappPerl 5 will probably outlast human civilization.
17:36arrdembitemyapp: grrrr 2.7.*
17:36bitemyapparrdem: everything at my company is stuck on 2.7
17:36arrdemztellman: not sure why you'd want to listen to my ravings, but welcome to the broadcast list
17:37arrdembitemyapp: I mean at least 2to3 is a thing...
17:37arrdemand it works really nicely for 2.7. I wonder why.
17:37ztellmanarrdem: happy to be here
17:37bitemyapparrdem: the real problem is dependencies.
17:37rasmustoit's better than 2.5.4
17:38arrdembitemyapp: which is really cool because it's circular.
17:43dcunit3dwhats the best way to use a version of a library that's not available on clojar yet
17:44coventrydcunit3d: I would just make it a lein checkout dependency.
17:47coventrydcunit3d: "lein install" if you really want a jar.
18:02bitemyappToday's theme: whiny people on Twitter.
18:03muhooreally? just today's?
18:05bitemyappmuhoo: there has been a confluence of whiny lazy people on *my* Twitter today anyway.
18:12tsantosI upgraded to OS X Mavericks and now lein ring server launches but I always get not-found when trying to load pages. No errors in stdout or stderr either... anyone else seen this?
18:12tsantosit's bound to all interfaces on port 3000
18:13bitemyapptsantos: no problems here.
18:15muhoowhomever was selling clojre.tools.trace, thank you. it has saved my sanity
18:15coventryNo worries. :-)
18:19bitemyappmuhoo: I definitely babble about it. I have dedicated emacs macros for it :P
18:23rasmustoarrdem: I made my code parallel and use that pmemoize function, the performance leads me to believe it worked
18:23rasmusto(compared to when I used just a pure memoize)
18:24arrdemrasmusto: awesome!
18:25arrdemrasmusto: I realized that there's a potential for significant memory wasting in that a ref will be held to every argumemt to the memoize function :/
18:25arrdemrasmusto: the clojure core fn will do the same, but that isn't much of an excuse.
18:27bitemyapparrdem: pmemoize?
18:27arrdembitemyapp: it'
18:27rasmustobitemyapp: https://github.com/arrdem/useful/commit/77356d78d1908e773c384040af6d8abfc084cb80
18:28arrdemoh. or that.
18:28bitemyapprasmusto: thanks.
18:29arrdemrasmusto: it also made it in here ... https://github.com/aysylu/loom/pull/8
18:29rasmustothe application is memoizing a function that could potentially be called with the same arguments across multiple threads at the same time
18:29rasmustoarrdem: cool
18:30coventrybitemyapp: Wow, your dotfiles repository is 103M??
18:30lazybotcoventry: Uh, no. Why would you even ask?
18:30rasmusto??
18:30lazybotrasmusto: Definitely not.
18:30bitemyappcoventry: we don't talk about that.
18:30bitemyappcoventry: it's about 410k LOC of emacs lisp.
18:31bitemyappcoventry: http://i.imgur.com/uhoSoOk.gif
18:31coventryBwahaha
18:31rasmustothose claws look deceptively cute
18:31arrdemoh gods... oh gods why
18:32rasmusto(((cat)))
18:32arrdemclojurebot: bitemyapp is bitemyapp: CAT PICTURE TIME
18:32clojurebotYou don't have to tell me twice.
18:35bitemyappclojurebot: bitemyapp is CTHULHU FTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP
18:35clojurebotAlles klar
18:35bitemyapp~bitemyapp
18:35clojurebotbitemyapp is bitemyapp: CAT PICTURE TIME
18:35bitemyappgod dammit.
18:35bitemyappclojurebot: forget bitemyapp
18:35clojurebotTitim gan éirí ort.
18:42bitemyapp~bitemyapp
18:42clojurebotbitemyapp is CTHULHU FTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP
18:42bitemyappthat's better
18:50coventrybitemyapp: Anyway, your trace macros look handy. Thanks for sharing.
18:50bitemyappcoventry: np.
18:56winkreally sorry, but I have to correct that
18:56winkclojurebot: bitemyapp is CTHULHU FHTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP
18:56clojurebotOk.
18:57brehautnow it knows both
18:57winkwell, that is semantics ;)
19:01brehautwink: correct fhtagnd are important though
19:02jacktasiais there a clojure code formatter for emacs?
19:04bitemyappjacktasia: tab?
19:04bitemyapptab indents region for me.
19:05rasmustohow about evil-mode ggVG=
19:06jacktasiabitemyapp: i mean like auto format the whole file like eclipse can with java code
19:08rasmustojacktasia: http://stackoverflow.com/questions/992685/auto-formatting-a-source-file-in-emacs ?
19:11augustlI'm doing (map (fn [things] (map (fn [thing] ....) things)) groups-of-things). Is there any built-in way to do that with one call?
19:11augustlno biggie nesting it of course, would just look slightly nicer if it was one call :)
19:12rasmustoaugustl: (for [as xs, a as] (myfn a)) ?
19:13augustlrasmusto: ah, of course, thanks :)
19:13augustlI haven't relaly learned "for" yet
19:14rasmustoaugustl: I guess you lose the nesting with that method, not sure if that's quite what you want
19:14jacktasiarasmusto: thanks, but that doesn't seem to do much other than handling indenting - i was hoping for something that used like a pretty-printer
19:14jacktasia(let [file-contents (slurp "clojure_test.clj")
19:14jacktasia process-file (with-out-str (clojure.pprint/write (read-string (str "[" file-contents "]")) :dispatch clojure.pprint/code-dispatch ))]
19:14jacktasia (println (subs process-file 1 (- (.length process-file) 1))))
19:14augustlrasmusto: ah, I'm also in a threading macro..
19:15rasmustoaugustl: you can do #(for [as %, b as] (foo b))
19:15rasmustoit's a bit weird at that point though :p
19:15rasmustojacktasia: ah, don't know about pretty-printing
19:16bitemyappthose moments in the REPL when you're frantically ^c^c^c^c^c^c^c^c^c^c^c
19:18Morgawr(repeat 4) oh shi- ^C^C^C^C^C^C
19:18augustlrasmusto: ah, cool
19:18arrdem(inc wink)
19:18lazybot⇒ 1
19:18Apage43there's two classes of that
19:18Apage43"aw man, I froze it, now I'm going to have restart my jvm.. and maybe my editor depending on how bad I broke things"
19:18Apage43and
19:18bitemyappMorgawr: the worst is when I spam my Emacs and I have to restart the buffer.
19:19bitemyappHate that.
19:19Apage43"whoops that was the production db"
19:19bitemyappApage43: I use environment variables for a reason :P
19:20Apage43i haven't actually touched anything that was a service I could mess up for a while, so I'm a bit out of practice wrt thtat
19:20Apage43*that
19:21arrdemfixed it again...
19:21arrdem~bitemyapp
19:21clojurebotbitemyapp is CTHULHU FHTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP
19:21arrdemdamnt
19:23rasmustoah crap, `killall emacs` broke something :(
19:27dobry-denztellman is an alien
19:28ztellmanI'm a what now?
19:28bbloomhe responds with alien-like reflexes
19:28dobry-denconstant stream of cool libs
19:28ztellmanaugmented by the insistent beeps of my computer
19:28ztellmantruly, where do I end and the machine begin
19:29radswhen you guys have a constructor function that creates a logical "thing", do you prefix it with "make-" or "create-" or just leave it as the noun it represents?
19:29bbloomztellman is a robot
19:29radse.g. "(make-thing)", "(create-thing)", or "(thing)"
19:29ztellmanrads: I like create
19:29ztellmanit's nice to have a verb
19:30bbloomrads: depends on if the "thing" has value or identity equality
19:30bbloomif it's a value, i just go with "thing", if it's an identity, i go with a nice verb like "create-thing"
19:31dobry-denrads: i use `make` because you generally are binding it to `thing`. (let [thing (make-thing 1)] ...)
19:31dobry-denbecause once make-thing and thing are taken, i've run out of names and creativity
19:32dobry-denand i use intricate -> ->> as-> calls to go the rest of the function without having to thing of a name
19:32dobry-denthing'''
19:34radsyeah, I was having the same problem with an audio player ns. it was called "app.player", but I also have to create things with "player", but I also want to alias the ns as "player" :)
19:35dobry-denthat's why i installed a thesaurus into emacs
19:37brehautrads: clojrue namespaces are different namespace to values
19:37brehautfrex (require '[clojure.string :as str])
19:38radsI see. I thought that would be a little confusing to read, but now that I think about it, I don't think there is really any ambiguity
19:38rasmustorads: so long as you don't :require player :refer [player]
19:59dobry-denztellman: Is there a way to declare padded strings in Gloss? Like padding 5 bytes with 0x00: "abc" <-> [97 98 99 0 0]
20:00ztellmandobry-den: you can define wrappers for encode and decode for any frame
20:00ztellmanso you'd do that as a post-processing step
20:00ztellmancheck out compile-frame
20:06dobry-densimple, thanks
20:21muhoolet is an implicit do, right?
20:22coventrymuhoo: Yes.
20:26muhoothx
20:41mnewhey does anyone know a workaround for this: https://bugzilla.redhat.com/show_bug.cgi?id=1008699
20:42mnewleiningen doesn't work on fresh installs on my fedora machine
20:44hyPiRionmnew: preferably you install leiningen through the installation procedure at leiningen.org. It's not hard, really
20:49ToBeReplacedmnew: is that your bug posting? i think a reasonable recommendation would be to make a new rpm off of a recent stable cut
20:50mnewToBeReplaced, to I just found that bug after encountering exactly the same problem
20:50ToBeReplacedfor just getting done, go through the installation procedure, but it would be nice if fedora updated for fc20
20:50mnewno*
20:52ToBeReplacedmnew: try `lein upgrade` -- not sure if that was around at 1.7 but worth a shot
20:52ToBeReplacedyou might need to sudo since system package and all
20:53mnewoh wow why is it such an old version
20:57ToBeReplacedmnew: i would guess it's due to build requirements that couldn't be met with 2.0 before fc19 was cut -- technomancy might know or #leiningen
21:01mnewI'll just install manually for now, I'll look into updating the rpm but I am a complete fedora noob
21:01satshabadSo I have an experiemnt where I have two matrix multiplication algorithms. One is implemented recursivly (NOT tail recusive) and one uses the nested maps. both have the same big O run time, but the one with the three maps out performs the other by an order of magnitude. Is this due to the general slowness of recursion vs iteration? or is it something clojure specific? or JVM specifc?
21:02satshabadI mean obviously one can only speculate
21:04satshabadAlso: is it possible to recur more than once in a function and still use `recur` somehow?
21:05jared314satshabad: you can use recur in multiple places, but the result is the same, unless inside a loop
21:06satshabadhmmm, but if I use loop/recur, recur has to be in the tail position *only* to get the TCO beneft?
21:09seangroveHow can I add a local lein plugin while I'm developing it?
21:09yeoj___I'm new to clojure, but is there anything in pedastal or luminus that offers scaffolding (django, rails) like features? It seems like adding routes for pages has me jumping around to a bunch of different areas to add boilerplate things.
21:09seangroveTrying to fix a quirk with lein-cljsbuild, have the code cloned and changed, but not sure how to get lein to use it instead of the version that's in my .m2
21:10bitemyappseangrove: lein install
21:11bitemyappFound an excuse to start using CLJS on the @work project.
21:13satshabadbitemyapp: that's awesome
21:16seangrovebitemyapp: Very cool
21:19satshabaddoes anyone know of any good talks/blog-posts/advice on how to take something that is not tail recusion and turn it into something that is tail recursion?
21:22justin_smithsatshabad: in general, you can often take the non-tail-recursive version, make any values it uses extra parameters to the function/loop, then put everything that was after the tail up at the top of the loop
21:23bitemyappsatshabad: a lot of times when you're writing recursive code, it can just be a reduce anyway.
21:23justin_smithyeah, that's a good point
21:23bitemyappseangrove: does "Unable to resolve var: reader/*alias-map*" ring a bell?
21:23justin_smithrecursion is low level in clojure, an iterating or reducing call is better
21:23bitemyappjustin_smith: for a long time, most of my loop recurs (pre 1.5) were just short-circuiting folds.
21:24bitemyappnow that reduced is a thing, I don't even need it for that.
21:24satshabadhmmm
21:24satshabadthat's really interesting
21:25satshabadbut what about functions that recur multiple times?
21:25satshabadi mean they call themselves several times?
21:25justin_smithconditionals
21:25justin_smithor, in the rare case, you need a recursive call but cannot use `recur` because it cannot be a tail call
21:26bitemyappjustin_smith: let-fn ?
21:26bitemyappoh, no, that's mutual recursion.
21:26justin_smithI mean things like quicksort that do not lend themselves to tail recursion
21:26justin_smithor generally when you want to recurse in parallel on two branches of a data structure
21:27bitemyappIn case anybody thinks this is unusual, writing Haskell requires an inordinate amount of time spent thinking about foldl, foldl', and foldr and which one will or won't blow up the stack.
21:27satshabadwell in this spcifc case I'm talking about divide-and-conquer for matrix multiplication. you divide the matrix into 4 and then call divide on those parts and combine the results
21:27bitemyappsatshabad: that's a problem for reducers if I ever heard one.
21:27bitemyappreducers can parallelize the divide/conquer for you too.
21:27satshabadyeah i've seem that
21:27hiredmana function can recursively call itsself fine
21:27satshabadit's exciting!
21:27hiredmanbut you cannot have more than one call in the tail position
21:28satshabadyes so in this case I am not sure it's applicable
21:28hiredmanrecur can only be used in the tail position to provide bounded space recursion
21:28hiredmanbut a function called f, that calls f, is still recursive, recur isn't what makes a function recursive
21:29satshabadjustin_smith: do you think the statagy of putting extra params in a loop /recur construct would work here?
21:30satshabadhiredman: yes, I understand that. The problem i am running into is that it performs way worse than higher order functions
21:30satshabadand I was wondering why and how I could fix it
21:31bbloomsatshabad: can you share the code?
21:31hiredmansatshabad: that is unlikely, so I wonder what you mean by "higher order functions"
21:31bbloomsatshabad: maybe the issue will be obvious to a trained eye?
21:31bitemyappbbloom: he needs to use reducers or mikera's library.
21:31bitemyappyou're going to look at the code and then you're going to end up repeating what I just said.
21:32satshabadbbloom: https://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj#L46
21:32bbloombitemyapp: if he's only going to divide it in to FOUR parts, the communication overhead of reducers is surely not worth it
21:32satshabadhaha I bet
21:32bitemyappbbloom: it's a reduce regardless.
21:32satshabadhigher order == map, reduce
21:33bbloomoh, i misunderstood. it's dividing it up in to four *repeatedly*
21:33satshabadyes, it's turtles all the way
21:33bitemyappis this the part where we get back to agreeing with me?
21:33bitemyappI'd like to skip to that part.
21:33bitemyapp ;)
21:33hiredmanbbloom: reducers are also not just about fold's parallelism
21:34satshabadyeah that's just a bonus right?
21:34bbloomit's a bonus, but hiredman points it out b/c of my comment about communication overhead
21:34bbloomreducers also minimize intermediate data structures, which can be a perf win
21:35hiredmansatshabad: if I had to guess, I would say that if your map/reduce based version is faster you map/reduce based version is not computing the same thing
21:35satshabadoh i se
21:35satshabadhuh?
21:35satshabadthey are run on the same thing
21:35satshabadand map/reduce version is faster
21:37bbloomsatshabad: do you have that code to show too?
21:37hiredmansatshabad: and they have the same result?
21:37satshabadsure,
21:37satshabadhttps://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj#L12
21:37jared314is there a way to use a custom comparator with sets?
21:37satshabadwell they are run on random matrices
21:37satshabadof the same size
21:38ToBeReplacedjared314 what are you trying to do?
21:38jared314ToBeReplaced: a set of maps where I am comparing values in the maps
21:39bbloomjared314: you mean you want custom equality?
21:39bbloomjared314: to the end of custom set membership?
21:39hiredmanboth of these use mapv, it is not clear to me how you are making the distinction, just looking at it, the second one is doing way more
21:40jared314bbloom: maybe, i'm trying to control the duplicate check
21:40bbloomjared314: can you step back and describe the higher level goal?
21:42bbloomjared314: b/c there are a few possible recommendations & i wanna make sure i recommend something sensible
21:42jared314bbloom: i have a set of maps, with various keys and values, and I want to customize the equality check to only use a single key in the map
21:43bbloomjared314: ah, ok. you might find that the simplest thing to do is to just have a map of sets
21:43bbloominstead of a set of maps
21:44bbloom(update-in map-of-sets [(:key m)] (fnil conj #{}) m)
21:45jared314bbloom: i can't get rid of the maps. They are generated before my function, and i'm using them further them down the pipeline
21:45bbloomjared314: i'm not suggesting you get rid of the maps. i'm suggesting you store them in a map of sets, rather than directly in a set
21:46bbloomjared314: study that update-in line i wrote above ^^
21:46bbloominstead of conj/disj-ing to a set, you do it to set values of a map
21:47jared314bbloom: ok, give me sec to see if I can work it in
21:48seangrovetechnomancy: You around to help developing a local version of a lein plugin?
22:16satshabadbitemyapp: you mentioned you thought that divide and conquer could be done using reduce
22:16satshabadI have been thinking about it
22:16satshabadand I don't see how it applies
22:17satshabadcould you give me a hint at what you meant?
22:17bitemyappsatshabad: not really, you're catching me at the tail-end of my day.
22:17satshabadah ok, no worries
22:17bitemyappsatshabad: my brain is fried. Suffice it to say, you'd be reduce 1 -> map 1 -> reduce *
22:18satshabadwhat's 1?
22:18bitemyappthat's how you turn divide and conquer into HOF
22:18satshabadah like * is many ?
22:18bitemyappyes.
22:18bitemyapp* is partitions
22:18bitemyappyou're mapping the reduction across the partitions
22:19bitemyappand reducing the mapped reductions of the partitions
22:19bitemyappsatshabad: think about it man, if divide and conquer can't be expressed in terms of map and reduce...then what is Hadoop?
22:19satshabadhahaha
22:19satshabadyes I was thinking of *just* reduce
22:20satshabadbut with map, it makes more sense
22:20bitemyappsatshabad: you could do it with just reduce.
22:20satshabadreally?
22:20bitemyappsatshabad: you realize map is a dumb fold right?
22:20bitemyappeverything can be made from folds.
22:20satshabadyeah
22:20satshabadoh
22:20satshabadI guess
22:20bitemyappwell?
22:20satshabadi see
22:20satshabadit's all folds
22:20bitemyappRight.
22:21satshabadfunctional programming is cool
22:21bitemyappClojure doubly so.
22:21satshabadOK i will think on it some more and see what i can come up with
22:21satshabadthanks!
22:24`cbpbitemyapp: hi, should i work on the branch connection?
22:24holohi
22:24`cbpbitemyapp: to add to the tests
22:25bitemyapp`cbp: if you like, sure.
22:27holosome fn yelds val for each item of a vector. why does it yeld [key val] for maps?
22:27holo*yields
22:28bitemyapp,(seq {:a 1 :b 2})
22:28clojurebot([:a 1] [:b 2])
22:28bitemyappholo: you are welcome to guess why, given the above.
22:29holobitemyapp, i suppose that's the internal implemenation, but i'm more worried about the semantics of some
22:29bitemyappsome isn
22:30bitemyappisn't going to start doing magic where sometimes it seqs across and sometimes it fucks with the values before seq'ing
22:30bitemyappthat's a really bad idea and before thinking there's something wrong the API you should ask yourself if you've actually thought about it harder than Hickey
22:30bitemyappbecause 99.999% of the time, you havent'
22:30holoi know
22:31bitemyappit makes perfect sense and if you expect key-val pairs then destructure them in the fn you pass to some.
22:31bitemyappor start using Fluokitten.
22:31bitemyappand make a functor-some.
22:31bitemyappffilter, really.
22:31bitemyappbut don't do that. Just fix your code.
22:48`cbpbitemyapp: so run will be (run query connection) right? (writing the docs)
22:48`cbpor uh (run connection query)
22:49`cbpprolly the former for threading with ->
22:51holobitemyapp, thanks. can't fix this map as it's to be searched by key or value. i'll probably name what i want as get-key
22:52holoor get-some-key
23:05muhooand here's my weird, context-free error of the night https://www.refheap.com/20242
23:06muhooany clue where to even look?
23:07amalloymuhoo: at the repl, you typed in (defn foo (let ...))
23:09amalloyor, no, you attempted to load a namespace that contains (defn foo (let ...))
23:09rhg135amalloy, i'm in awe
23:10muhooamalloy: that's it! i had forgoten a [] after a defn
23:10muhoothat's fucking spooky
23:10amalloyi'll be here all night, doing parlor tricks
23:10muhoo(inc amalloy )
23:10lazybot⇒ 4
23:10amalloyexcept that actually i'm leaving now. glad you found it, muhoo
23:11muhooit's all good, thanks again
23:41marcopolo2join #haskell
23:42marcopolo2whoops
23:42`cbp~guards
23:42clojurebotSEIZE HIM!
23:42coventryIt's OK to date other languages.
23:44jonhif only for a short while