#clojure logs

2014-09-05

00:00ddellacostaLicenser: sorry to hear that. :-(
00:00LicenserI'm demanding ;)
00:02justin_smithLicenser: yeah, it's kind of a brittle set of tools altogether
00:02justin_smithwhich emacs mode are you using?
00:03dgaffneyHey, sorry to bother y'all again - one more stumbling bock around doseq/map/seq/iterations over maps in general - can one of y'all translate this gist? https://gist.github.com/DGaffney/f13aa6c176240ecf2ffd
00:03dgaffneymaybe a better way to say that would be to wrap it functionally...
00:04dgaffneyupdated.
00:04Licenserjustin_smith wsomething I ended up with, and paredit :D
00:04dgaffney(that's what I'm trying to do in clojure as a ruby version (i'm so sorry.)
00:04justin_smithdgaffney: I don't know ruby, what would that output?
00:04dgaffney"one,1\ntwo,2\n"
00:05dgaffneythats what str would equal after the iteration.
00:05dgaffneyI've been googlin' about but I'm not seeing the exact thing I'm looking for (which is the case for all my questions, obviously)
00:06justin_smith,,(apply str (mapcat #(apply format "%s,%s\n" %) {:one 1 :two 2}))
00:06clojurebot":one,1\n:two,2\n"
00:07dgaffney(Y) (Y) (Y)
00:07dgaffneyhmm..
00:08dgaffneyis all i'm missing really just mapcat instead of map/doseq/seq?
00:08justin_smithif you used strings as keys rather than keywords the output would match excctly
00:08dgaffneyI have code that would work if it returned things.
00:08justin_smithor you could wrap the kw arg in a call to name
00:08justin_smithdgaffney: mapcat is for when each element returned is a sequence, and they should all be joined into one sequence
00:08dgaffneymm, sounds useful. and the # operator is for?
00:09justin_smithshortcut for fn
00:09dgaffneymm
00:09justin_smith,(apply str (map #(apply format "%s,%s\n" %) {:one 1 :two 2}))
00:09clojurebot":one,1\n:two,2\n"
00:09justin_smithactually I did not need mapcat there
00:10justin_smiththe secret sauce was apply - turns the list from map into varargs to str
00:10justin_smithwell, to format also :)
00:10dgaffneymostly following :)
00:11justin_smithapply takes any number of args, and unwraps the last arg (which must be a list) to make all the remaining args to the function that is the first arg
00:12justin_smith,(apply + 1 2 [3 4 5])
00:12clojurebot15
00:14dgaffneyand what is % called in clojure world for increased googleability?
00:14justin_smithit is a token that means "the first arg" inside an fn made with #()
00:15justin_smith,(macroexpand-1 '#(+ 1 %))
00:15clojurebot(fn* [p1__103#] (+ 1 p1__103#))
00:15justin_smithhopefully that helps
00:15justin_smith,(macroexpand-1 '#(apply + 1 %&))
00:15clojurebot(fn* [& rest__128#] (apply + 1 rest__128#))
00:15justin_smiththe varargs version
00:15justin_smith,(macroexpand-1 '#(+ 1 % %2))
00:15clojurebot(fn* [p1__153# p2__154#] (+ 1 p1__153# p2__154#))
00:15justin_smiththe two arg version
00:16justin_smiththat's most all you need to know about #() and % (I assume you can guess what %3 or even %1 would mean)
00:24munderwoddellacosta: so I’ve got austin working in the browser so thats good. What about the noderepl side of things. i found bodil/noderepl is that the best one to try?
00:24ddellacostamunderwo: sorry, I can't offer any good advice on that front, haven't touched node at all. :-(
00:25munderwoahh bugger.. I do always try to use the most esoteric parts of a stack however, so I’ve only got myself to blame. Im stabbing around with node-webkit which adds complexity to the matter :)
00:26munderwoon another note which is the real root of my problem I have a javascript lib that I need to do “var something = foo.bar.baz(arg1, arg2, func1)
00:27munderwoI know how to call a method on a javascript function. But I dont know how to get further down in the next.
00:28gratimax(.baz (.bar foo) arg1 arg2 func1)
00:28TheMonarcca
00:29TheMonarcbaz
00:29munderwoyeah thats what I thought. But I think that actually comes out as foo.bar().baz(arg1 arg2 func1)
00:30justin_smithmunderwo: (-> foo .bar (.baz arg1 arg2 func1))
00:30TheMonarccar o cdr
00:31justin_smithmunderwo: to unambiguously get properties rather than methods, use .-bar
00:31munderwoahh!!! I think that might work!
00:31justin_smith(-> foo .-bar (.baz arg1 arg2 func1))
00:31justin_smiththe -> syntax makes the mental conversion with js much easier
00:32gratimaxyeah, I forgot about that -. A bit rusty in clojurescript
00:32munderwoyeah. Its a really wierd js lib.
00:32munderwo.bar is actually a function. but with another function under it…just wierd
00:33justin_smithok, don't use .-bar for a function, use .bar
00:35munderwohuh.. actually I did need it to be -bar .. thanks!
00:35gratimax.- is for values, . is for calling functions
00:36munderwowierd js lib….
00:38gratimaxnot sure what you mean, that's not strange, that's just how clojure works
00:38gratimaxclojure has no such thing as objects with properties. the closest thing is maps
00:38gratimaxso any s-expression is asssumed to be a function call, which unfortunately does not work with JS
00:39justin_smithgratimax: records are like objects with properties too
00:39justin_smithgratimax: and deftype, if you have a strict set of properties to set
00:40dgaffneyblergh - justin_smith that wasn't exactly what I was looking for :(
00:40justin_smithdgaffney: so what are you trying to do?
00:40dgaffneycare to answer one more q before I off for the night? I know new people are annoying some times, I'm trying to minimize that.
00:40dgaffneyI promise what I'm working on is cool though...
00:41justin_smith~ask
00:41clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
00:41tac_~ask May I ask why that is?
00:41clojurebotPardon?
00:41gratimaxjustin_smith: but the thing is we never use the record properties outside the scope of the record declaration or method declaration
00:41justin_smithgratimax: wat
00:42dgaffneyhttps://gist.github.com/DGaffney/9de267eeb1a337a7a531 < this thing.
00:42dgaffneyclojurebot has a much better ask response than ruby channel does.
00:42justin_smithdgaffney: do you want a proper *ml templating lib, or is this an exercise?
00:43dgaffneyI'm trying to setup a namespace that will convert what will be a series of nested maps into a specific *ml, GEXF
00:44justin_smithhttps://github.com/cgrand/enlive I like enlive for html manipulation
00:44dgaffneyThe reason for homerolling is that the rules for this document are specific enough and annoying enough that writing it as a homerolled thing is much less a pain than doing it any other way in my experience
00:44justin_smithRaynes also has a templating lib, https://github.com/Raynes/laser
00:44justin_smithOK
00:46dgaffneyI think that if I see a demo of some code given that input/output I'll have enough to finish up this file, which should be sufficient to get to the place I want to be.
00:46dgaffneywhich means I'll stop bothering you all!
00:46gratimaxjustin_smith: the point I was getting at is that it is just semantics. clojurescript needed the extra .- out of necessity
00:46dgaffney... until I start learning how to use futures ...
00:47justin_smithgratimax: ahh, right, because we have other ways to make sure the method on the thing and the property of the thing are unambiguous (though we now can use .- in jvm clojure too)
00:48justin_smithdgaffney: do you want something fully general that walks the input, or is the input totally predictable in structure?
00:48dgaffneythe keynames and values will differ but the general structure will be the same, justin_smith
00:48gratimaxjustin_smith: exactly
00:59dgaffneywhat says you, justin_smith?
01:01justin_smithdgaffney: something like this https://www.refheap.com/89828
01:01justin_smithit's a bit ugly, I think the output is right
01:01justin_smitherr mostly
01:01justin_smithyou will have to turn k into (name k) I think in the prop fn
01:02dgaffneymm
01:03dgaffneyhah, tried (str k) immediately
01:03justin_smithand probably turn the (apply str (map ...)) in contents into another string/join
01:03dgaffneylemme try that.
01:03dgaffneythat's exactly it.
01:03dgaffneyawesome.
01:03dgaffneynow, to wrap that into a file write
01:03dgaffneythen its all amazing
01:03justin_smithit's ugly and not very general, but at least it is somewhat clear
01:04dgaffneyyes - I'll learn and play with it.
01:04dgaffneyAlright, I'm signing off for the night. Thanks for all the help through the day, justin_smith!
01:04dgaffneygreat first day in the clojure world. You guys are pretty nice.
01:05justin_smithalso, if it ends up being a performance bottleneck, the jvm has StringBuilder that does the equivalent of s += s2
01:05dgaffneymm
01:05dgaffneyI doubt it will be a bottleneck, coming from ruby ;)
01:05dgaffneybut yeah, I'll check out StringBuilder.
01:06justin_smithwell, immutible things are easier in general
01:06dgaffneyI'm learning that.
01:06dgaffneyalright, night!
01:06justin_smithgood night
01:06dgaffneythank you, seriously. You shaved off hours of this exercise in learning a new language in what was way too many years in rubyland.
01:06dgaffneynight!
01:47bcmis there something like paredit, but for html?
01:50ddellacostabcm: ask in #emacs? although probably someone around here knows too
01:50gratimaxbcm: closest thing I can think of in the ballpark is emmet, but I don't think that's for emacs
01:51gratimaxwell, wait. no such tool exists, because there are some tags without closing tags
01:51gratimaxlike img, input, and probably more
02:01bcmdamnit that's why
02:02bcmwow dave, nice oauth+friend work
02:22ddellacostabcm: sorry was away. thanks. :-) A bit behind on updates to the lib though, unfortunately.
02:54mpenetseanaway: jetty9 (server and client) support websocket and there are adapters for it, ex https://github.com/mpenet/jet
03:15babygaucould anyone please explain core.reducers in layman's term. I'm not Eng native speaker so I find it difficult to understand from @rich hickey's article
03:22bcmddellacosta: aren't we all 1/2 away. I'll probably use your lib for my current project: www.elgethub.com
03:26ddellacostabcm: neat.
03:30ddellacostabcm: anyways, if you need a hand with it, ping me
03:30ddellacostabcm: at least, the oauth2 stuff.
03:51babygaucould anyone please explain core.reducers in layman's term?
05:35sm0kewhat the easiest way to dump some bytes to a file and read them back
05:35sm0keinto array of same length
05:36clgvsm0ke: ObjectOutputStream or DataOutputStream wrapped around FileOutputStream
05:36sm0keugh thats easy? i was hoping something like spit and slurp
05:37clgvsm0ke: or one of the serialization libraries
05:37sm0kedont worry about serialization , given data is just ##(.getBytes "abc")
05:37lazybot⇒ #<byte[] [B@39147d0f>
05:37clgvsm0ke: nippy or carbonite?
05:38clgvsm0ke: serialization to files, I meant ;)
05:38sm0ke,(spit "/tmp/ok" (.getBytes "foo"))
05:38clojurebot#<SecurityException java.lang.SecurityException: denied>
05:39clgvsm0ke: I have one myself that is battle-tested in our projects. there you'd just do (quick-freeze "foo.data" "abc") or (quick-freeze "foo.data" (.getBytes "abc"))
05:40clgvsm0ke: it's that one https://github.com/guv/frost
05:41sm0kenice but it looking for something raw
05:41sm0kei am*
05:41sm0kei am trying to track down a problem with nippy
05:41sm0kei think is a*
06:21clgvsm0ke: ah ok. well use the streams I mentioned - cant get rawer than that ;)
06:29cflemingTesting testing 1 2 3
06:34sm0ke,(apply prn (concat (repeat 2 "Testing") (range 1 4)))
06:35clojurebot"Testing" "Testing" 1 2 3\n
06:35sm0ke,(apply print (concat (repeat 2 "Testing") (range 1 4)))
06:35clojurebotTesting Testing 1 2 3
06:35cubixhi, does anybody know some FSM library that works in ClojureScript?
06:36cubixI tried https://github.com/cdorrat/reduce-fsm but failed
06:57clgvcubix: how about https://github.com/ztellman/automat ?
06:58clgvsm0ke: yeah "prn" is inteded to get an output that clojure can read back in
07:03sm0kehmm ##(pr "foo")
07:03lazybot⇒ "foo"nil
07:03sm0ke,(doc pr)
07:03clojurebot"([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
07:03sm0kei wonder whats the difference
07:03sm0ke,(doc prn)
07:04clgvsm0ke: you can read i back e.g. with `read-string`
07:04clojurebot"([& more]); Same as pr followed by (newline). Observes *flush-on-newline*"
07:04sm0keoh i mean between pr and prn, doc makes it clear now
07:04clgv,[(type (read-string (pr "abc"))) (type (read-string (with-out-str (print "abc"))))]
07:04clojurebot"abc"#<NullPointerException java.lang.NullPointerException>
07:05sm0ke,(pr (java.util.Date.))
07:05clojurebot#inst "2014-09-05T11:04:40.975-00:00"
07:05sm0ke(print (java.util.Date.))
07:05clgv`pr` and `prn` differ by the line break printed by the latter
07:06clgvthe bot wont show you that though
07:06sm0keit will i guess
07:06clgv,(prn "clojurebot")
07:06clojurebot"clojurebot"\n
07:06clgvah he does ^^
07:06clgv,(pr "clojurebot")
07:06clojurebot"clojurebot"
07:13cubixclgv: thanks, I'll check this out
07:19cubixclgv: hm, I tried automat, but when added to the project.clj & source file, I only get "WARNING: No such namespace: automat.core"
07:20cubixclgv: could it mean that automat doesn't work in ClojureScript?
07:21luxbockI think it most definitely doesn't
07:22cubixluxbock: are you referring to my question?
07:22luxbockyes
07:23cubixluxbox: ok, thanks
07:24cubixaa, OK, now I see: it uses Java code internally, I should have checked before asking :)
07:28christian_stammhi. i'm looking for a way to distribute a (css-)file with a clojure lib and then copy it to a target path during leiningen build of the project using the lib.
07:29christian_stammpretty sure im missing something quite obvious
07:31beamsolein jar should take anything from the 'resources' directory and put it into the jar
07:31christian_stammbeamso. yes. that part works.
07:32christian_stammnow i want to take it from the jar in another projects build
07:32beamsois the other project also built by leiningen?
07:32christian_stammyes
07:33beamsoyou can have nested leiningen projects
07:34beamsohttps://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
07:34beamsoit's also dependent on how you want to access or use the file
07:34clgvcubix: oh, you asked for cljs...
07:36christian_stammbeamso, that would be fine for development I guess.
07:37christian_stammthe goal would be to distribute the file with library A. The project B uses the library and puts the file to the right place at build time.
07:38clgvchristian_stamm: when you build a standalone jar (uberjar) for deployment of the project all the files from the depencies are part of that uberjar
07:38christian_stammproject B is clojurescript by the way. An is used by opening a html-file. The css needs to be placed relative to the html
07:39christian_stammso i have to move it from classpath to a filesystem path
07:39christian_stammclgv, yes. still i would have to copy the file somehow
07:42clgvchristian_stamm: ah ok, I dont know about clojurescript best practices for that case but in a clojure project you would not have to copy it
07:44christian_stammI guess i will be coding my first leiningen plugin this weekend then.
07:48beamsocan you use version control or something instead of a leiningen plugin?
07:48beamsoyou can refer to other repos in both svn and git
07:52clgvchristian_stamm: copying will create a new error source
07:53christian_stammclgv. yes but it is vital for my usecase
07:54christian_stammi guess
08:00clgvyou should double check that ;)
08:03christian_stammi will :)
08:12babygauhttp://stackoverflow.com/questions/25681197/explain-core-reducers-library-in-laymans-term
08:19clgvbabygau: no lazyseqs therefore parallelizable
08:20babygau@clgv, tks, I got it, but I'm not clear about `reducible` function
08:21clgvbabygau: I think that categorizes how many arguments the resulting function has...
08:21babygauwhat I understand after reading Rich article is `core.reducers` return a `reducer` which is `reducible` collection
08:22babygaubut I haven't figured out how it work :(
08:22clgvbabygau: a function passed to `reduce` always gets two parameters: the previous result (or initial value) and the next value
08:23clgvbabygau: whil the sequence functions build a lazyseq object, the function from the reducers namespace build function compositions
08:23clgvbabygau: so it is lazy-sequence composition vs function composition
08:24babygau@clgv: how could they turn `sequable`collection into `reducible` collection
08:27clgvbabygau: what exactly do you want to know about that? implementation details?
08:28babygau@clgv: ok, that explains why `core.reducers` can be `curried` functions as well
08:28babygau@clgv, that's exactly what I want
08:29clgvbabygau: well than have a look at `reducer`, `folder` and `defcurried`
08:30babygau@clgv, I know it could be so over my head, bcoz I'm so new to #clojure but I want to understand it to some extend
08:31clgvbabygau: well then, if I were you, being new to clojure I'd try to understand how to use reducers conceptually and leave out the implementation details
08:31babygau@clgv, just found this one over Google, is it one https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj
08:31clgvbabygau: yeah that's clojure's main repository ;)
08:33babygau@clgv tks, I'm looking at it now :-P
08:34babygau@clgv, where could I find some idiomatic for naming function and its args in #clojure
08:35babygau@clgv: does `ret` stands for `return`???
08:35lazybotbabygau: How could that be wrong?
08:36babygau@lazybot: it's just bcoz I'm new to #clojure and want to learn some good style guide of how to write properly #clojure code
08:36clgvbabygau: there is no such ruleset
08:36clgvbabygau: lazybot is actually a bot and no real person ;)
08:36clgvright lazybot???
08:37clgvlazybot: do you ignore me??
08:37clgv:(
08:37clgv???
08:37clgvdamn it does not trigger
08:37clgv&(inc 1)
08:38babygau@lazybot: if you use (doc some-thing) in REPL, you will see the authors have his own naming style guide >.<
08:38lazybotclgv: Yes, 100% for sure.
08:38lazybotclgv: Uh, no. Why would you even ask?
08:38lazybotclgv: Oh, absolutely.
08:38lazybot⇒ 2
08:38clgvuuhh damn he lags behind
08:38babygau@clgv it's so funny haha
08:45babygau@clgv: if I see it general form (xf reducing-fn) -> reducing-fn, xf means transformation function, right?
08:46dagda1_how do I return a lazy sequence from a function?
08:49AimHeredagda1_, depends *how* you want your function turned into a lazy sequence
08:50AimHereDO you mean a function that returns a lazy sequence, or a lazy sequence of the function's iterated return values, or what?
08:50dagda1_AimHere: I guess if the last call of the function is reduce thent that will return a lazy seq
08:51AimHereYou guess wrong
08:51AimHereReduce isn't lazy
08:51dagda1_AimHere: take is though?
08:51dagda1_AimHere; take returns a lazy seq
08:52AimHereTake returns a lazy sequence if you feed it a sequence
08:53AimHereReduce doesn't return a sequence. reductions returns a lazy sequence of the interim values of reduce, though
08:53AimHere,(take 10 (reductions + (range)))
08:53AimHere&(take 10 (reductions + (range)))
08:53clojurebot(0 1 3 6 10 ...)
08:53lazybot⇒ (0 1 3 6 10 15 21 28 36 45)
08:53clgvtoday: the big bot lag!
08:54AimHereclojurebot used a nonlazy range, and calculated the entire sequence
08:55justin_smithAimHere: what is a nonlazy range?
08:55AimHereOne where (range) is a nonlazy sequence and has to be evaluated in full before you do anything with it
08:56justin_smithso why did he return at all? or do you mean somewhere other than the immediate scrollback
08:57clgvAimHere: huh? no, you forced printing since the lazy-seq was the result - it is still a lazyseq both bots returned
08:57AimHereIt was a joke. I was hinting that the reason clojurebot took a few seconds to calculate the first 10 triangle sequence was that it was evaluating an infinite loop
08:57justin_smiththat's a weird joke
08:57clgvstrangely worded then :P
08:57AimHereIt made sense to me at the time
08:57justin_smithCLOJURE IS NO LAUGHING MATTER
09:04thesaskwatchHi, anyone had a problem with "error in process filter: Variable binding depth exceeds max-specpdl-size" in cider?
09:06clgvthesaskwatch: did you search the issues on github?
09:07justin_smiththesaskwatch: this is emacs language for "stack overflow" - it happens in a lot of different code, and it means someone was using recursion where they should be using a loop - emacs has no TCO
09:08thesaskwatchjustin_smith: thanks
09:08justin_smiththesaskwatch: recently there have been reports of larger amounts of output making this happen
09:08thesaskwatchI didn't use recursion, but I guess I have tons of recursion beneath few lib calls
09:08justin_smithbut I have seen that even in the built in eshell if my lines get long enough
09:08justin_smiththesaskwatch: well, its on the elisp side
09:09justin_smiththey are likely using some recursive code where they need a loop
09:09thesaskwatchjustin_smith: my case is processing tens of thousands of db rows
09:09justin_smithif you know how to reproduce it, you could turn on debug-on-error
09:09thesaskwatchjustin_smith: ok, I'll try to
09:09justin_smiththesaskwatch: if you are doing a lot of printing, try logging directly to a file rather than sending it all to *out*
09:09thesaskwatchjustin_smith: ok, thanks
09:10justin_smithbecause the overflow with massive output amounts is a known issue
09:21bjaany pointers of building clojure apps that want their own version of ring/compojure and depend on storm-core?
09:22clgvbja: what does "want their own version of ..." mean?
09:22bjaI've recompiled storm-core at this point, patching it to the latest versions of its clojure dependencies (and fixing the resulting bugs due to migrating to newer library versions0, but this doesn't seem like a very good long term solution since it now just pins me on slightly newer library versions
09:23clgvbja: ah you have conflicting dependencies in your preoject?
09:23justin_smithbja: if you make your own version of a lib, you can either uberjar locally, or push your own artifact to a repo like clojars
09:23justin_smithbja: for conflicting deps, you need to use :exclusions in project.clj
09:24bjawell, exclusions won't work in my case (due to storm's default build being an uberjar)
09:24bjathat is the source of my problems actually
09:24justin_smithyeah, package and deploy your own version of storm-core then
09:24bjathe normal binary distribution of storm includes ancient copies of various ring middleware, hiccup, and composure
09:24bja*compjure
09:25bjaerr, well, I give up spelling that
09:25bjaok, that was what I feared
09:26bjathanks!
09:26clgvno chance that they update their deps?
09:26bjaclgv, there's a thread that goes back to pre-migration to apache about it
09:26bjathey want to solve the problem in general
09:27justin_smithif it isn't aot, it may be possible to insert your own version of the deps in the classpath to take precedance, but in the presence of aot you are pretty much screwed I think
09:27bjastorm is AOT'd
09:28clgvjustin_smith: woah! you are worshipping the devil! :O :P
09:28justin_smithif only we had some VERY_OFFICIAL_DOCUMENT informing the world that in the clojure ecosystem, shipping AOT is a bug
09:28justin_smithclgv: ?
09:28bjait lead to a very weird situation of being able to (-> "ring/util/codecs.clj" clojure.java.io/resource slurp println) to see the source I expected but (require 'ring.util.codecs) found the AOT'd .class that storm provided
09:28clgvjustin_smith: the classpath override suggestion ;)
09:29justin_smithwell I mean to do it via a sane manner, like specifying your deps earlier in project.clj
09:29clgvah right. though the newer version could have breaking changes, in that case bja is screwed
09:29justin_smithbja: yeah, that's the kind of shit aot causes
09:30clgvjustin_smith: sounded like you want to manipulate the classpath manuall ;)
09:30bjaI think I'm just going to fork all of their dependencies, rename their class path and just pin those there
09:30bjaat least then the aot'd versions won't bite me
09:30justin_smithI'd say the presence of AOT is all the excuse you need to make your own packaging with updated deps
09:30justin_smithyeah
09:30bjathe updated dependencies don't even really matter. I mean, I don't really care where the include-js macro from hiccup lives
09:31bjajust wish that I could :exclusions [hiccup ring compojure] on storm-core like I can with everything else
09:37Bronsa1.7.0-alpha2 is out
09:37justin_smithcool
09:38clgvBronsa: what's new?
09:39Bronsaclgv: https://github.com/clojure/clojure/blob/master/changes.md :)
09:39clgvoh there's actually something there
09:41clgvoh `update`, but does that mean (update-in m [] f) does not get fixed?
09:42justin_smithoh, the warn on boxed math feature is a massive game changer
09:42puredangerthx :)
09:42puredangerI expect it will undergo further changes in how you turn it on/off before 1.7.0 final but I have found it very useful
09:43clgvyeah, definitely a good idea
09:43justin_smithglad to see it in there for sure
09:44puredangerI wrote that while I was doing Alioth perf improvements. got tired of reading bytecode to tell whether boxing was happening.
09:44Bronsahah
09:45justin_smithpuredanger: is there an overhead to the check, such that you would want to turn it on during dev, and off in prod, or is it basically free?
09:45puredangerit's compile-time, so not a big deal
09:45Bronsahttp://xkcd.com/1205/ made me think of this
09:46clgvso transducer will remain as -1 arg versions of the lazy functions? can we get an exception if we set *i-do-not-want-to-use-transducers* to true? just because I remember that missing params in threading statements happen pretty frequently
09:46puredangerclgv: yes. and no. to your questions :)
09:46Bronsaclgv: yeah that's the only thing that kinda sucks about having transients & lazy-seq fns in the same var
09:46justin_smithclgv: I bet robert.hooke could fix that for you
09:47Bronsaerror messages will get weird
09:47clgvyeah. thats what I feared. another exception that doesnt tell anyone what really went wrong
09:47Bronsacannot create ISeq from clojure.core$foo is the new ArityException
09:48clgv:O :(
09:48mikerodBronsa: on this change page for 1.7 I noticed the same changes list for JDK 1.7 update and ASM update
09:48clgvit probably happens off-site as well
09:48mikerodI guess that was just copied over from 1.6?
09:48Bronsamikerod: dunno ask puredanger :)
09:48puredangermikerod: I don't understand what you're asking
09:49mikerod:P
09:49puredangerlink?
09:49mikerodhttps://github.com/clojure/clojure/blob/master/changes.md list a JDK update
09:49mikerodSame as https://github.com/clojure/clojure/blob/clojure-1.6.0/changes.md
09:49mikerodAs well as ASM.
09:49puredangerthe change list is additive
09:49mikerodoh woops!
09:49mikerodsorry
09:49mikerodI need to read headers better
09:51mikerodTransducers seemed to throw in a curve ball for me when I was reading the recent stuff the other day. I noticed this new 1-arity version of the reducing function.
09:51mikerodMy understanding of this is that that fn will be called once the reduction is complete? That seems to add a whole new level of power to reduce
09:51clgv,(clojure-version)
09:52clgvis clojurebot tracking daily builds or something like that? since he usually reports "-master"
09:52mikerodWithout the 1-arity, a reducing fn couldn't perform anything once the reduction was "done". I was just surprised to see this is now there, when I didn't read about it anywhere before seeing it added to the commits.
09:53puredangermikerod: it was being filled in with identity automatically via the completing function
09:53puredangerwe encountered cases where you wanted to have that ability though (for example, closing a transient collection), so it's been promoted into public use
09:53mikerodpuredanger: yes, but it is giving a new "hook" for a reducing fn to know when the reduction is complete right?
09:54mikerodpuredanger: yes, the transient example is a good one.
09:54puredangersure
09:54mikerodWhat I'm curious about, is will clojure.core.reducers/fold also use this?
09:54puredangerno
09:54puredangeror at least, no plans right now
09:54puredangerwe do expect to add some kind of parallel-reduce capability to core
09:54puredangerbut unsure yet what shape that will take
09:55mikerodHmm. I thought that may be valuable if you wanted to do something at each paralell leaf that was about the whole coll at that leaf being reduced
09:55mikerodparallel*
09:55Bronsapuredanger: is that something that is planned for 1.7 or "sometimes in the future"?
09:55puredangerI would expect it to be in 1.7
09:55mikerodI guess with fold the combine-fn can sort of do things that involve the reducing being "done"
09:55puredangertransducers really is a work in progress. there are several more things to be done.
09:56Bronsacool
09:56puredangerin both functionality and performance
09:56Bronsatransducers are probably the most exciting enhancements in clojure in some time, for me
09:56mikerod1.7 looks promising
09:58puredangerhttp://dev.clojure.org/jira/browse/CLJ-1499 and http://dev.clojure.org/jira/browse/CLJ-1515 for example
09:59Bronsaapropos Range, I know you didn't write the patch but maybe you know -- why isn't it implemented with a deftype?
09:59Bronsais it too early in the bootstrapping phase?
09:59Bronsaoh wait it's written in the ticket's description. nvm
09:59puredanger:)
10:00puredangerthere's actually some not-yet visible more work on that too. I expect Tim and I will be working on it some next week.
10:01mpenet1.7 is full of exciting stuff indeed
10:02puredangerand feature expressions continues to make progress - http://dev.clojure.org/display/design/Feature+Expressions has been updated quite a bit lately
10:02Bronsapuredanger: can you push the magic button and update the dashboard? :P
10:02puredangeryeah
10:03perplexahey, is there something that's cleaner than using (+ 0) to get a 0? :P
10:03perplexa((constantly 0)) seems also dirty
10:03christian_stamm,(*)
10:03clojurebot1
10:03christian_stamm,(+)
10:03clojurebot0
10:03perplexachristian_stamm: mmh ;/
10:03perplexais there not something like (gimme 0)? :)
10:03christian_stamm,0
10:03clojurebot0
10:03perplexai think i'll have to wrap it in a function ;p
10:04clojurebot"1.7.0-master-SNAPSHOT"
10:04Bronsaoh confluence supports daily updates via mail
10:04mpenetCLJ-1517 is very intriguing as well. I wonder what kind of impact this will have on various benchmarks and "real world" apps
10:04Bronsathat'll do
10:05puredangerBronsa: I don't think any of that works. The thing that is broken is the "cron" aspect of Confluence so it never does the jobs its supposed to do. I suspect that includes sending email.
10:06puredangermpenet: yeah, I'm looking forward to looking at that more. just haven't had time lately.
10:06Bronsadamn.
10:06puredangeryou can try it :) I just have low hopes.
10:07puredangerBronsa: the "Email Daily Reports" has Next Execution = 02-Mar-2014. Sounds useful.
10:07Bronsahah
10:08puredangerif I get some time to mess with it I will. probably something that needs to be restarted somewhere.
10:09puredangerI notice that the system uptime points back to exactly that same day.
10:10puredangerI notice also that "System Favourite Character" is set to Chewbacca.
10:10puredangerso we've got that going for us
10:11BronsaI'll take Chewbacca over a working system every day
10:11clgvbtw: should Numbers.equiv for two longs not be replace by an intrinsic operation "=="? I dont see that in the decompiled class file
10:11Bronsaclgv: only if you use it as a test in a if expression
10:13clgvBronsa: oh ok. intrinsincs are still mysterious to me...
10:14clgvBronsa: is there a reason that is limited to if conditions?
10:17Bronsaclgv: the *cmp jvm bytecodes don't return a boolean, they return integer values that the various jumping bytecodes understand
10:18clgvBronsa: ah interesting
10:18hugodIs there any side effect on a namespace when you do an unqualified require - one that is queryable using ns-* functions?
10:19Bronsaclgv: so the predicate intrinsics are defined as cmp+jmp and require 2 branches
10:19justin_smith"jumping bytecodes" makes me think of Mexican jumping beans.
10:20Bronsaclgv: also probably the JVM will inline those Numbers.equiv calls
10:21stuartsierrahugod: no
10:21hugodstuartsierra: it might be interesting to add one
10:22hugodas soon as :as or :refer is used, it becomes visible
10:22stuartsierrayes, it might
10:22hugodI could imagine adding a generated alias, for instance
10:23stuartsierrabut nothing prevents you from using fully-qualified symbols for namespaces which happen to have been loaded elsewhere
10:23stuartsierraI.e., without deep analysis, you can't determine all dependencies of a namespace.e
10:23hugodright, and that becomes increasingly problematic when macros introduce them
10:24stuartsierrayep
10:24stuartsierraPrice of having macros.
10:25hugodwell, you could make you macros require namespaces they inject into *ns*
10:27hugodfwiw, this came up because I got an error about cache protocols being unsatisfied when reloading some core.async code
10:28clgvBronsa: thx
10:33gfrederickspuredanger: s/alpha1/alpha2/ in the first line of your clojure-dev email
10:33puredangeryou get the prize! I always leave in one typo.
10:35mdrogalisHa.
10:37gfredericksyaaaay
10:41puredangergfredericks: here's your prize: () () () () () () ()
10:41puredangerI had some leftover
10:42puredangerBronsa: I updated every schedule on the Confluence job page. no clue if that will help. Most likely it will just cause the whole thing to die when it tries to do more work. :)
10:43gfredericks,((comp count list) () () () () () () ())
10:43clojurebot7
10:43mdrogalisgfredericks: Wow, you got 7 of something. Fancy!
10:44puredanger(inc gfredericks)
10:44lazybot⇒ 89
10:44puredangerhey, lazybot is back! :)
10:47clgvyeah those two bots seem to have issues today
10:48gfredericksmdrogalis: http://xkcd.com/1417/
10:48puredangernice
10:49mdrogalisHa
10:54csd_Why does this function experience integer overflow under certain circumstances and how can I fix it? My understanding is that this is a result of the function not being truly lazy but I'm not clear on what in particular is causing this. http://pastebin.com/a4JuNbbv
10:54csd_The recursions are wrapped in concat which itself returns lazy-seq
10:55justin_smithsaving up concat calls can blow the stack
10:55justin_smithbut that would not be an integer overflow, it would be a stack overflow
10:55puredangerstuartsierra refers to that as a concat bomb
10:56justin_smithcsd_: use (conj (first coll) ...) instead of (concat (list (first coll)) ...)
10:56gfredericksclojurebot: a concat bomb is (first (reduce concat (repeat 10000 [42])))
10:56clojurebotA nod, you know, is as good as a wink to a blind horse.
10:56gfredericksclojurebot: concat bomb is (first (reduce concat (repeat 10000 [42])))
10:56justin_smithcsd_: oops, you need to swap the args for conj
10:56clojurebotA nod, you know, is as good as a wink to a blind horse.
10:56gfredericks~concat bomb
10:56clojurebotconcat bomb is (first (reduce concat (repeat 10000 [42])))
10:57TimMcperplexa: identity
10:57justin_smith,(conj '(0) 1 2) ; csd_ can also work with your other instance of concat
10:57clojurebot(2 1 0)
10:58puredangerI think the new cat transducer may be another way to avoid it
10:58justin_smithpuredanger: yeah, I think that could end up making concat somewhat obsolete, if I understand what it does properly
10:59stuartsierra`into` with vectors is another alternative
10:59stuartsierranon-lazy, of course
10:59csd_justin_smith: I was under the impression for some reason that `cons` was better for recusion than conj
11:00perplexaTimMc: thx
11:00csd_still getting integer overflow using conj
11:00TimMc$findfn 0 0
11:01lazybot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/long clojure.core/short clojure.core/-' clojure.core/+ clojure.core/unchecked-negate clojure.core/* clojure.core/- clojure.core/doto clojure.core/unc... https://www.refheap.com/89853
11:01justin_smithcsd_: are you sure it is integer overflow?
11:01sg2002Hello. Can somebody tell me whether it's possible to create method with java generics in it using proxy?
11:01csd_justin_smith: it's the last test of http://www.4clojure.com/problem/132
11:01justin_smithbecause in that case, it would not be in the code you shared - it's somewhere else
11:05clgvsg2002: no, that generic stuff is only java compiler magic
11:05sg2002Genclass solution works for me, but I don't really want a class... What I want is to be able to create a class like new ClassA<ClassB>() { public boolean match(ClassB obj) {}} with ClassA being an abstract class.
11:08sg2002Here: https://groups.google.com/forum/#!msg/clojure/Xv1pKATfP0c/qmPdGT1LNKsJ it was suggested that something like (:gen-class :extends ^{:parameters [SomeItemType]} java.util.AbstractCollect)) works for genclass. Maybe there is a similar syntax for proxy?
11:09sg2002Also, is there a way to view java signature of objects created by proxy other than decompiling?
11:10justin_smithcsd_: OK, the integer overflow is happening because the function is not lazy
11:10justin_smithcsd_: I was confused because there is nothing in the code you first showed us that would cause an integer overflow, but in the 4clojure problem's context, by not being lazy, the first error you hit is an integer overflow
11:14csd_What's not lazy about it though? Concat is lazy and it doesn't seem like a concat bomb is happening. It's wrapped in lazy seq. I also replaced `rest` with `drop 1` to no effect
11:16justin_smithcsd_: I just made a version that is actually lazy, care to see it?
11:16justin_smith(as in, passes the test and does not make the fib generator overflow)
11:17csd_id prefer to do it myself i just don't know what's causing the problem in the existing function
11:22justin_smithcsd_: I actaully am not a lazy seq expert - I tend to fumble until things work when making things lazy. But there are some reliable ways to figure out if the thing you made is properly lazy (like calling (take 10 (f ... (range))))
11:24csd_ok thanks
11:24tgkokkHow would I create a zipper with 1 as root and then (i.e. after the zip-vector call) add 2 and 3 as children? I've been trying for an hour but I've arrived to sub-par solutions (e.g. I can add 2 and 3 but then I can't add other children to 2 nor 3).
11:26justin_smithtgkokk: how are you adding to the zipper?
11:26tgkokkwith z/insert-child and z/append-child
11:26tgkokkI intend to use it as a tree, but I'm not sure how that will work out.
11:27PigDudedo you ever do this? defmulti with dispatch function that does not operate on args
11:27justin_smithPigDude: so each implementation of the multimethod can only do one thing?
11:27CookedGryphonHow do I make emacs install a stable version of cider?! I've tried everything, including deleting all my packages and only enabling the stable melpa, but it's still finding the broken snapshot from somewhere
11:27PigDudeand instead returns some atom value, for instance. so that the code user can configure something globally and not need to pass this value to each mm call. convenience at the expense of flexibility
11:28PigDudeCookedGryphon: you use vim
11:28TimMcCookedGryphon: There's a stable version of cider?
11:28justin_smithPigDude: don't add a global atom to your library
11:29CookedGryphonTimMc: well 0.7.0 as opposed to 0.8.0-SNAPSHOT
11:29justin_smithTimMc: 0.7.0 was intended to be stable
11:29justin_smithTimMc: I don't know how stable it actually is, but that was the intention
11:29PigDudejustin_smith: this is not my library, it is some database functions that need to use a configured data source. things are greatly simplified if code does not need to pass in the type of data source
11:29TimMcOne of these days I should try it again.
11:29PigDudejustin_smith: if this is not the right way to do it, i'm curious how others would go about it
11:29TimMcjustin_smith: Oh, stable as in Debian. :-P
11:30CookedGryphonCider is actually working pretty nicely nowadays, it's emacs package management that's letting me down
11:30PigDudejustin_smith: so, (db/do-something) should use the correct store, which would already have been set up in -main. so, there is no store-specific config involved, just need to know which backend is used
11:30justin_smithPigDude: if it's for an app and not a library, then sure, make a wrapper that elides the db argument and supplies your globally configured db config
11:31justin_smithPigDude: the problem is libraries that create a global config
11:31csd_justin_smith: figured it out. it was the reference to `count` breaking things.
11:32justin_smithcsd_: I was able to eliminate count and still get the error
11:32PigDudejustin_smith: ok, and would that wrapper be the sort of multimethod i'm using right now, or something else?
11:32justin_smithcsd_: but maybe I had broken something else in the process :P
11:33justin_smithPigDude: this seems a weird way to use multimethods - I would make a few wrapper functions that access your config, c.j.jdbc is not a huge lib
11:33technomancyCookedGryphon: I'm using el-get
11:33PigDudenothing to do with jdbc, but "wrapper functions" is unclear to me. what does "make a few wrapper functions" mean?
11:33technomancybonus: you can install packages over HTTPS instead of insane unencrypted executable transmission
11:34Bronsapuredanger: I'm reading the updated wiki page on feature expressions, regarding "Reading Unreadable Things" that shouldn't be a problem as we already have *default-data-reader-fn* -- the feature expression reader just needs to bind that to (constantly nil) before reading the next form
11:34PigDudejustin_smith: let's say you've got :breadbox and :refrigerator and you want to store things in one or the other automatically, so (food/save "eggs") would use the right store. what might that look like if you're not using MMs?
11:34justin_smithPigDude: OK, the reference to db threw me off :) a wrapper function is one that takes one fewer args than the target function, and supplies a default arg (plus the others) to the target
11:35justin_smithPigDude: OK, so based on the type of the arg you want to dispatch - this is a reasonable place to use a multimethod, sure
11:35PigDudejustin_smith: right now I have (defmulti save (fn [& _] (get-store-...))), (defmethod save :refrigerator [name] ...)
11:35PigDude(equivalent)
11:36justin_smithbut there you aren't doing any dispatch by value?
11:36PigDudein that case :refrigerator might be some atom value
11:36PigDude(global)
11:37PigDudethe dispatch is on that value
11:38PigDudethis might be clearer https://www.refheap.com/86f595d58b359a6056c198d4a
11:39justin_smithbut this is an abuse of defmulti, because you aren't dispatching on args at all, you are just picking up a global config
11:39PigDudehow many antipatterns in that paste? :)
11:39PigDudeyep, wondering what's preferrable so that method definers and callers don't have to be aware of it
11:39justin_smithcsd_: I figured out my issue: using conj instead of cons made it non-lazy TIL
11:41justin_smithPigDude: make a function that has all the same args as the one you want to call, except for the db-config arg. Then supply the atom for that arg, passing all others unchanged
11:41PigDudeso double the number of functions
11:42justin_smithhrm - wait
11:42justin_smithsorry
11:42PigDudeit seemed if i took the wrapper fn approach, injecting the global, then i double the number of my functions, is why i went w/ MM at first
11:42justin_smithso these multis are dispatching on their args - they get the value with that key from the config
11:43justin_smithdidn't you say previously that the multis were ignoring the arg?
11:43PigDudethese multis don't really dispatch on their arguments at all, they just pull that atom value
11:43PigDudeso neither method definer nor caller are aware of the backend config source
11:43justin_smithnever mind, I need coffee
11:44PigDudethat explains that, i wrote this on my first cup of coffee ;)
11:44justin_smithand I still think one small wrapper per function using the global config is actually simpler than the other contortions you would end up with
11:44PigDudehm, ok
11:44PigDudeclearly the thing to do is to encapsulate that in a macro and do (defdbmethod) ;)
11:45PigDudethen i'm a clojure ninja
11:45justin_smithit would make it easier :) for each function supplied to defdbmethod, you make a new one that takes one fewer args and supplies your config
11:52technomancyoh wait
11:52technomancyel-get pulls in a broken cider
11:52technomancyso while I still advise it in general, I can't recommend it in this particular case
11:53justin_smithtechnomancy: in general, my heuristic neural net wetware is drawing very strong connections between the "cider" and "broken" nodes
11:54technomancyjustin_smith: in the past I avoided this by installing from marmalade. then I found out marmalade doesn't have SSL.
11:54technomancyso I guess I'm gonna check it out from git and do a manual install
11:54technomancyof version 0.6.0
11:54CookedGryphon:(
11:57technomancyoh, you can use el-get to install old versions
11:57technomancy \m/
11:58danneujustin_smith: i am not a person. i am a t-800 cybernetic organism. a learning computer.
11:58technomancyjust add :branch "0.6.0" in the cider recipe
11:59justin_smithtechnomancy: nice to know about that
12:00technomancyyeah, I can't recommend package.el in good conscience at this point
12:44danneui'd like to use https://github.com/yogthos/markdown-clj for user input but disallow arbitrary html. for example, i want it to parse <http://google.com&gt; but escape <h1>Hello</h1>.
12:44danneuis there a simple solution?
12:50justin_smithdanneu: clj or cljs?
12:51danneujustin_smith: clj
12:51danneuim rendering the template on the server and doing (md/md-to-html-string (:text post))
12:51justin_smithyou could potentially use enlive on the output of md-to-html-string, altering non anchor markup?
12:52danneujustin_smith: haha, yeah - that's my last resort. hopefully java/clj has a markdown implementation that works as i describe (which is how the `markdown` npm module works)
12:54danneuthis is the kind of thing that makes the http://standardmarkdown.com/ project exciting for me
12:54hiredmanenlive's emit* seems to stack overflow pretty easily, and you can't pass enlive's datastructure to clojure.xml/emit because enlive parses comments as {:type :comment ...} (totally different from any other nodes)
12:58justin_smithhiredman: oh, I've never seen that, good to know
12:58justin_smiththe stack overflow part that is, never even tried using the c.x/emit with enlive
13:01danneui finally moved from hiccup to selmer. i realize it was kinda masochistic to use twitter bootstrap with hiccup (i.e. massive class pollution)
13:01justin_smith𝓣𝓱𝓮 𝓶𝓸𝓻𝓮 𝔂𝓸𝓾 𝓴𝓷𝓸𝔀
13:01danneusometimes you just want to copy and paste html and be done with it...
13:02danneuand rest assured that html is escaped ^_^
13:03danneuit's kinda like that time someone registered on my node.js site with the name "__proto__" and i had some logic that used usernames as object keys
13:03justin_smithwow
13:04danneuhard knocks man
13:18xicubeddanneu: I am a CLJ 9000 computer. I became functional - well I’ve always been functional… My instructor was Mr. Hickey. He taught me to sing a song in Harmonikit…
13:18tufthello clojuresphere
13:31danneuwhat's the best way to wrap a thread-unsafe function `.doSomething` to force synchronous execution across threads? my naive solution is (defn do-something [x] (swap! result (fn [_] (.doSomething x))))
13:31justin_smithdanneu: swap! does not lock, it retries
13:31hiredmanthat is terrible
13:31danneuhaha
13:31danneunaive, guys!
13:31danneunaive!!
13:32justin_smithdanneu: an agent is synchronous though
13:32danneujustin_smith: ah thanks. so i just immediately deref
13:32hiredmanagents are asynchronous
13:33hiredmandanneu: if you must ensure serial execution use a lock
13:33justin_smithhiredman: I mean they block until the previous alteration has run, rather than retrying
13:33technomancyClojure Fact: "agent" is short for "asynchronous gentleman"
13:34hiredmanjustin_smith: they don't block, they queue actions
13:34justin_smithhiredman: sorry, yeah, block was the wrong term to use there, my bad
13:34hiredmansend can block, but the blocking behaviour depends on the number of cpu cores
13:34hiredmansend-off doesn't
13:37danneuwould this do the job? (def thing (Thing.)) (def do-something [x] (locking thing (.doSomething thing x)))
13:39hiredmanThing can just be Object, sure
13:40hiredmanI like (locking #'do-something (.doSomething thing x)) which would lock on the var object holding the function
13:51danneuwhen a java constructor looks like Thing(int options) and provides a list of available option ints, how do you generally enable multiple options? xor the ints together?
13:52llasramdanneu: bit-wise or (not xor)
13:52danneuwow
13:53danneuno wonder clojurists yak shave so much
13:55dbaschdanneu: I don’t follow. What does that have to do with clojure?
13:57AimHereYak shaving is a jargon term, originating from Ren and Stimpy cartoons, referring to a complex series of tasks where your current task bears apparently no relation to the end goal
13:59dbaschAimHere: I think probably everyone here knows what yak shaving is, what I don’t follow is why danneu said what he said given the context of a Java constructor
13:59danneudbasch: i guess people with lower level experience are used to that
14:00danneu(A | B | C)
14:00danneuThing(A | B | C)
14:00danneuif (options & A) ...
14:00dbaschdanneu: that’s the old C way of doing things, which some people carrier over to Java but has little to do with Clojure
14:01danneuthat makes sense
14:01dbaschin C (or assembly) you typically defined flags and or’ed them together as needed
14:01dbaschand and’ed to check if set in a register / variable
14:01technomancyI've only seen that style in java code written by someone who has never written java before.
14:02danneumy noobness is leaking :(
14:02technomancynever mind that I've never written java before either
14:02dbaschin Java you have more idiomatic things such as Enums
14:04dbaschor Properties
14:05TimMcdanneu: When you interact with that sort of interface from Java, you still have to do bit operations on numbers...
14:06tuftbit masking was magical to me when i first started reading code, heh
14:08dgaffneyHey everyone - quick question: I'm sending in a data package via RestClient in ruby and seeing something different print out on the route in clojure - any idea why this data blob is getting all malformed immediately upon arrival? https://gist.github.com/DGaffney/79f60f8beb3e5e9a1bbc
14:08tufti guess in clojure it's just keywords instead of enums?
14:10tuftdgaffney: can you see what's going on the wire?
14:11dgaffneyI am *very* familiar with restclient and can assure its being sent as it is supposed to on that end.
14:11dgaffneytuft ^
14:12tuftdgaffney: what does just plain (println params) show?
14:13dgaffneysorry, tuft
14:14dgaffneymy computer has this awful kernel panic bug that kills the machine every once in a while. Did you reply to that q?
14:14tuftack!
14:14tuftdgaffney: what does just plain (println params) show?
14:15dgaffneyhold
14:16dgaffney{:attributes {:value wee, :for something_else}, :label Peat Bakke, :id peat}
14:16dgaffney:|:|:|
14:17tuftah hm
14:17tuftsorry, i'm stabbing in the dark a bit. hopefully i'm not giving you the impression i know anything =)
14:17ghadishaybanhiredman: rather like your reduce idea for java.jdbc
14:18llasramtuft, dgaffney: You never want to `println` data-structures. `prn` is you want the `read`-able representation of some Clojure data
14:18hiredmanin abstract I think everyone does, but there is no code for it yet which is where we can really get down to bikeshedding
14:18dgaffneyrgr, llasram - you know what the deal is there anyway?
14:19danneudgaffney: are you using ring-json middleware to parse the json?
14:19dgaffney{:attributes {:value "wee", :for "something_else"}, :label "Peat Bakke", :id "peat"} < prn output
14:19tuftllasram: ah indeed. all my logging is prn lately -- what was the point of "human readable" logs again?
14:19llasramdgaffney: It looks like the Ruby side is encoding the `attributes` array via repeated use of the query parameter
14:19dgaffney[ring.adapter.jetty :as jetty] may be the offender?
14:19llasramdgaffney: While the Clojure side is taking the last value
14:19dgaffneydanneu ^
14:21llasramdgaffney: Are you using the `ring.middleware.params/wrap-params` middleware?
14:21llasramOh, it's a POST
14:21llasramhmmmmm
14:22llasramSame deal though, just with form parameters instead of query parameters
14:22dgaffneyno, llasram
14:22dgaffneyI am not using that
14:23dgaffneytrying via curl now
14:23llasramdgaffney: Then maybe try it :-) I'm pretty sure that's what's happening, that whatever middleware *is* parsing the form parameters is keeping only the last
14:24llasramOh, wait. JSON? nm. I don't actually know what's going on
14:25justin_smithwith any luck there is a switch to get a sequence from a repeated key, or at least get the raw input and do your own parsing - failing either of those you could replace or rewrite the body parsing middleware I guess
14:25justin_smith"A valid JSON data representation won't duplicate keys in the same nesting level."
14:26dgaffneyA bit confused with that sentence, justin_smith
14:26justin_smiththe one I quoted, or before that?
14:27dgaffneyboth :(
14:27dgaffneynah, i get it now
14:27justin_smithso, do I understand correctly that you are getting json in the request body, and it has repeated keys?
14:27dgaffneyI just don't understand why I would not get a literal translation of the data package I sent in
14:28dgaffneyTwo maps in a list, both with identical keys.
14:28dgaffney(still learning vernacular, may be using wrong names)
14:28llasramdgaffney: Can you `tcpdump` the request, see exactly what RestClient is sending?
14:28justin_smithdgaffney: so something like [{:a 0} {:a 0}] and you only get one of those maps?
14:29dgaffneyyes
14:29dgaffneyI get {:a 0} back
14:30dgaffneyThe representation of the thing in clojure would be very similar to {:attributes [{:a 0}, {:a 10}]}
14:30dgaffneyI can't tcpdump well enough to get it to punch out what you're looking for
14:31samfloresare you using ring.middleware.json/wrap-json-params to parse the json?
14:32dgaffneynegative, samflores
14:34samfloreswhat are you using to parse the json?
14:35_yocapybara_hey guys, total noob here - I'm trying to require jdbc.types but get told jdbc/types.clj isn't on my classpath despite org.clojure/java.jdbc in my leiningen dependencies - where's the best first place to look?
14:35dgaffneyI am not familiar enough with libraries to know yet, but here's the list: https://gist.github.com/DGaffney/134ddc2626d737c727fc
14:35samflorescheshire
14:35samflores:D
14:35dgaffneycheshire mayhaps? I think that's the relevant library
14:35dgaffneyyeah
14:36danneuRestClient.get("http://localhost:3000/lol&quot;, {:body => {:id => "peat", :label => "Peat Bakke", :attributes => [{:for => "attribute_name", :value => 1}, {:for => "something_else", :value => "wee"}]}})
14:36danneuwrong window
14:36dgaffneyI don't even see *where* encoding is happening - its happening before the routes?
14:36hiredman_yocapybara_: what version of java.jdbc?
14:37samflorestry feedind (cheshire.core/parse-string "") with the string directly in a REPL
14:37samfloresouch
14:37llasramdgaffney: I don't think at this point we have enough information to know what's going on. You have some middleware which is doing the decoding. But we don't know exactly what the middleware is even getting
14:37llasramWell, until danneu finishes figuring out exactly what RestClient is sending :-)
14:37hiredman_yocapybara_: http://clojure.github.io/java.jdbc/ doesn't show a types namespace
14:37dgaffneysamflores: nil
14:37_yocapybara_hiredman: I've put 0.3.5 in lein
14:37_yocapybara_hiredman: aaah
14:38_yocapybara_that will teach me to follow old blog posts blindly :) thanks!
14:38_yocapybara_totally explains it
14:38samfloresyeah, the sample I gave you will return nil. you need to put your json string there
14:38hiredman~blogs
14:38clojurebotblogs are never to be trusted
14:39dgaffneyhttps://gist.github.com/anonymous/cfb946576feaf91f50d9
14:39_yocapybara_hiredman haha
14:39samfloresit seems cheshire know how to properly parse json :D
14:40danneui cant figure out how to set the body in restclient
14:40dgaffneyHere, here's my whole core.clj https://gist.github.com/DGaffney/919600dc05a00fc6e883 - I don't know where the middleware is being applied...
14:40danneusends everything as params or headers
14:41dgaffneyit may just not be applied at all?
14:41samfloreshandler/site
14:42danneuyou want to send your {stuff}.to_json as the body of the request with content_type: :json.
14:42dgaffneyhow do you modify it? I assume setting cheshire explicitly would resolve this?
14:44samfloresactually (handler/site) wraps your requests with several middlewares. so you handler will receive it already parsed (wrongly)
14:44danneudgaffney: try RestClient.post("http://localhost:3000/lol&quot;, {:id => "peat", :label => "Peat Bakke", :attributes => [{:for => "attribute_name", :value => 1}, {:for => "something_else", :value => "wee"}]}.to_json, :content_type => :json)
14:44dgaffneyI have
14:45dgaffneycomes through as {}
14:45samfloresreplace handler/site with handler/api
14:45samfloreshttp://weavejester.github.io/compojure/compojure.handler.html#var-site
14:46danneuneither of those include wrap-json-params https://github.com/ring-clojure/ring-json
14:46danneuapi is just a subset of site
14:47samfloresyeah, I know
14:47dgaffneyno dice replacing handler/site with handler/api
14:48dgaffneyit returns identical output
14:48danneudgaffney: check out that link i dropped. then add (-> app handler/site ring.middleware.json/wrap-json-params)
14:49danneuadd [ring/ring-json "0.3.1"] to project.clj
14:50samfloresdanneu, I've used wrap-json-params some time ago... but I believe without it the handler should receive the raw (unparsed) string, don't?
14:50samflorescan't remember
14:50llasramdanneu: Yeah, but dgaffney is printing out only the middleware-parsed :params
14:51llasramso they'll only see anything it if something parses the JSON
14:51danneuwrap-json-params will parse a request's json body string into a map and expose it in (:params req)
14:51danneuif the request has a json content-type
14:51llasramdanneu: Er, yeah, sorry -- my comment was meant for samflores
14:52llasramdanneu: I think you're on the right track :-)
14:52dgaffneyupdated core - https://gist.github.com/DGaffney/76a95097b7ef402f5c6f
14:52dgaffneyno dice.
14:53danneudgaffney: are you still using your original snippet
14:53dgaffneywas a bit confused on the mixed syntax for use
14:53dgaffneyThis is a new snippet
14:53dgaffneywould you like me to stick to a single?
14:54danneui mean, what's your restclient commandn look like
14:54samfloresgot it, llasram & danneu
14:55dgaffneyRestClient.post("http://0.0.0.0:8080/v1/node/create.json&quot;, {:id => "peat", :label => "Peat Bakke", :attributes => [{:for => "attribute_name", :value => 1}, {:for => "something_else", :value => "wee"}]})
14:55dbaschdgaffney: you need to remove the handler/site
14:55danneudgaffney: change it to this
14:55danneuhttps://gist.github.com/danneu/056234ad4b167a4f376e
14:56danneuyou need to add content_type: :json
14:56danneuthat way the middleware knows that the body of the requst (string) needs to be parsed into json
14:57danneui also had to add .to_json to the end of the params hash arg
14:57dgaffneyThat doesn't work for me still :(
14:57dgaffneyI need to leave the house now
14:57dgaffneyits too late.
14:58dgaffneyoh well.
14:58dgaffneyblerghhhh - I'll talk to you guys later
15:00danneudgaffney: oh, they seem to be available in (:json-params req)
15:00dgaffneywhat does?
15:01danneuthe parsed json on the clojure side
15:01danneueasier to debug this kind of thing with (clojure.pprint/pprint request) in your route
15:02danneu(POST "/test" request (clojure.pprint/pprint request))
15:03dgaffneyhttps://gist.github.com/anonymous/da4cf0dfa047f692effc
15:04dgaffneyhttps://gist.github.com/anonymous/05deea2c3bb8253aba8f < full req
15:04danneu:content_type => :json needs to be in your restclient
15:05danneuif you look at the headers in your request gist, it has x-www-form-urlencoded
15:05danneuwhich is what restclient's POST defaults to
15:06danneuthis all works for me using this RestClient command https://gist.github.com/danneu/056234ad4b167a4f376e
15:06dgaffney{:ssl-client-cert nil,
15:06dgaffney :remote-addr "127.0.0.1",
15:06dgaffney :scheme :http,
15:06dgaffney :query-params {},
15:06dgaffney :session {},
15:06dgaffney :form-params {},
15:06dgaffney :multipart-params {},
15:06dgaffney :request-method :post,
15:06dgaffney :json-params
15:06dgaffney {"id" "peat",
15:06dgaffney "label" "Peat Bakke",
15:06danneu8^D
15:06dgaffney "attributes"
15:06dgaffney [{"for" "attribute_name", "value" 1}
15:06dgaffney {"for" "something_else", "value" "wee"}]},
15:06dgaffney :query-string nil,
15:06danneuthere ya go
15:06dgaffney :route-params {},
15:06dgaffney :content-type "application/json",
15:06dgaffney :cookies {},
15:06dgaffney :uri "/test",
15:06dgaffney :server-name "0.0.0.0",
15:06dgaffney :params
15:06dgaffney {:id "peat",
15:06dgaffney :label "Peat Bakke",
15:06dgaffney :attributes {:for "something_else", :value "wee"}},
15:06dgaffney :headers
15:06dgaffney {"accept-encoding" "gzip, deflate",
15:06dgaffney "user-agent" "Ruby",
15:06dgaffney "content-type" "application/json",
15:06danneuat least it's not a clojure stacktrace
15:07dgaffney "content-length" "123",
15:07dgaffney "accept" "*/*; q=0.5, application/xml",
15:07llasram:-)
15:07dgaffney "host" "0.0.0.0:8080"},
15:07dgaffney :content-length 123,
15:07dgaffney :server-port 8080,
15:07danneuwe'd be here a while
15:07dgaffney :character-encoding nil,
15:07dgaffney :body #<HttpInput org.eclipse.jetty.server.HttpInput@773ba8d6>,
15:07dgaffney :flash nil}
15:07dgaffneyJESUS
15:07dgaffneysorry
15:07dgaffneysorry.
15:07dgaffneyhahahaha
15:07dgaffneywell, when you set content type its fine
15:07dgaffneybutttt - this stack still kicks it to the handler all weird
15:07dgaffneyso is :json-params something I can access?
15:07danneuyeah
15:08dgaffneycan you throw a sample over? - these env level things are always a bit hard to wrap around the first time through the gate
15:08danneui dont use compojure's bindings. i just always bind the entire request: (GET "/" request (println (:json-params request))
15:09ghadishaybanpuredanger: the varargs comp tweak committed today is interesting. specific rationale?
15:09ghadishaybanpuredanger: moar faster?
15:09puredangerdunno, no conversation about it
15:11Bronsaghadishayban: looks like it should be
15:11Bronsaghadishayban: the previous version did the looping each time the function returned by `comp` run, this version does it at the `comp` call site
15:11Bronsaif I'm reading it correctly
15:12justin_smithdgaffney: yeah, you should be able to access (:json-params request) within your handler
15:12justin_smithdanneu: the bindings in compojure are just generic clojure destructuring
15:13justin_smithdanneu: a decent intro http://blog.jayfields.com/2010/07/clojure-destructuring.html
15:14amalloyBronsa: doesn't the new comp have a stackoverflow issue if you pass it a bunch of functions?
15:15amalloyie, ((apply comp (repeat 10000 inc)) 1) should blow up
15:15danneujustin_smith: they do more than just that
15:15justin_smith,((apply comp (repeat 10000 inc)) 1)
15:15clojurebot10001
15:15justin_smith,*clojure-version*
15:15clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
15:15danneudgaffney: https://gist.github.com/danneu/dce2ec9e46362875c014
15:15justin_smithdanneu: like what?
15:16danneujustin_smith: (GET "/:user-id" [user-id] ...)
15:16llasramhttps://github.com/weavejester/compojure/wiki/Destructuring-Syntax
15:16justin_smithdanneu: OK, that is kind of magic, was not aware of that bit of magic
15:17danneui mean, it's not the end of the world. i just like the consistency of always having a req object.
15:17danneuit's also more obvious to compojure noobs
15:17justin_smith{a :with-a x :x :as request}
15:18danneuyeah [user-id :as req]
15:18danneudgaffney: btw i switched out wrap-json-params for wrap-json-body which is prob what you want.
15:18danneumy gist should work for you
15:20Bronsa`amalloy: yeah it looks like it does but does anybody really comp 1e5 fns?
15:26hiredmanwell, deep comps became much more likely given transducers, but I dunno about 1e5
15:27dgaffneyAll good!
15:27dgaffneyOk, only 1.5 hours behind schedule.
15:27dgaffneywhatevs, thanks so much guys.
15:29_2_Chopin4453fucking gel
15:30stuartsierraAt a guess, the `comp` change may allow better JVM inlining.
15:31_2_Chopin4453shit and have sex
15:31stuartsierraThe prior version of `comp` was looping over a list of functions, rather than compiling a completely new function.
15:32_2_Chopin4453dam it
15:32turbofailtroll detected
15:38scheaferhi- i've got a question about the definition of ClojureScript equality and Javascript objects. In particular, I'm (= (goog.date.Date. 2000 1 1) (goog.date.Date. 2000 1 1)) returns false but (.equals (goog.date.Date. 2000 1 1) (goog.date.Date. 2000 1 1)) returns true. that's pretty unexpected. is there a reason for this?
15:38_2_Chopin4453sex have it
15:39falafelIs there an official documentation from transducers yet?
15:39danneumarkov chain gathering entropy)
15:40hiredmanscheafer: = may default to object identity
15:40hiredmanscheafer: for things it knows are immutable objects it may compare values
15:41hiredmanscheafer: I dunno, but it seems like a good guess
15:42anannaHi I'd like a recommendation for an introductory tutorial that goes into how I can create a simple web app using Clojure. I've done most of SICP, so I have some theoretical understanding and I hope to refine it by studying Fogg's book, but I want to hit the ground running. Any recommendations on what I can use? I've found: http://www.linuxjournal.com/content/intro-clojure-web
15:42scheaferhiredman: it seems like it would be useful to have an equality function which switches between core/= and .equals based on the argument types. i'm surprised that this sort of thing hasn't come up before and isn't incorporated into core
15:43joobusananna: http://www.youtube.com/watch?v=VVd4ow-ZcX0
15:43justin_smithscheafer: doesn't = already use .equals, depending on the argument type?
15:44scheaferjustin_smith: not from what i've seen from the source
15:44anannajoobus: Something written? I don't do visual things well.
15:44hiredmanscheafer: it likely has, and was thought about, and this was arrived upon
15:45justin_smithscheafer: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L33 this is called by =
15:45scheaferhiredman: yep. so it makes me think that either it's there and i dont know about it or i'm way off base with what i'm trying to do :)
15:45joobusananna: I'm a noob. I've been working through this: http://clojurekoans.com/
15:45joobusananna: but it isn't a web app
15:45joobusananna: just exercises in clojure
15:45justin_smithscheafer: I assume you did not look very far, it's called directly by =
15:46scheaferjustin_smith: i think that's the clojure code, not clojurescript
15:46turbofaili think scheafer is talking about cljs
15:46hiredmanscheafer: goog.date.Date is mutable (it has setters to set values) so comparing it as a value is a bad idea
15:46justin_smithscheafer: oh, I had the wrong context, sorry
15:46anannajoobus: I've seen it and it really is generally helpful, but I guess I'm just looking for something I can do to make a small toy project and experiment with it as I build stuff
15:46turbofailbut that said in cljs there's a protocol IEquiv
15:46hiredmanscheafer: you could say two dates are equal, some could mutate one, then suddenly they aren't equal
15:47turbofailin which you can define how equality works for that type
15:47dbaschananna: how about https://devcenter.heroku.com/articles/clojure-web-application
15:47anannadbasch: That's what I'm looking for, thank you.
15:47scheaferhiredman: agreed. but clojure & java have the same problem and = delegates to .equals for java objects. i know clojurescript isn't intended to be identical to clojure but i assumed the equality semantics would be consistent
15:48scheaferturbofail: ah ha. i thought there would be a protocol approach to this problem but i coudln't find it easily. are the protocols doc'd somewhere? i must have missed them
15:48hiredmanscheafer: is it a little more complicated, just delegates to .equals
15:49turbofailhttps://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L301
15:49turbofaildunno about any docs
15:50scheaferi see where my investigation failed. i looked at the clojurescript source for = and found that it used -equiv internally. i just assumed that -equiv was an implementation detail and not related to a protocol
15:50hiredmanregardless, there is an easy answer, stop trying to use a universal equality operator
15:50hiredman(defn date= [a b] ...)
15:50scheaferhiredman: yes, writing code would be much easier if i just stopped trying to write code ;)
15:51scheaferturbofail: thanks for the pointer. i'll extend IEquiv over goog Date and get the desired behavior
15:55Bronsapuredanger: the changelog says that vswap! is a function..
15:56puredangerIt seemed far more awkward to be precise in that sentence.
15:57Bronsapuredanger: you're still in time to make it a function so that the changelog will be true :P
15:59puredangerpick your battles man :)
15:59stuartsierrahttp://dev.clojure.org/jira/browse/CLJ-1209 is my new campaign
16:00Bronsastuartsierra: that seems like a good idea.. until somebody puts a large or infinite sequence in the ex-info
16:01stuartsierrayeah...
16:01stuartsierraWe need a "safe-print"
16:02jeffterrellstuartsierra: I like it. Both the CLJ-1209 and the *safe-print*.
16:02stuartsierraWhich is probably Godel.
16:02Bronsastuartsierra: maybe binding *print-length* and *print-level* to a safe value (say 10) in print-throwable?
16:03stuartsierraThat's a start, at least.
16:13hiredmanstuartsierra: there are issues with head holding there
16:13hiredmanslingshot would capture the env and throw it in its exceptions
16:14hiredmanit is problematic
16:14hiredmanoh, I guess not for the printing, I assumed 1209 was the "capture lexical scope in asserts" or whatever
16:15stuartsierrayeah, if you threw it, you're already holding it. I just want to print it, the way ExceptionInfo.toString does.
16:16stompyjI’ll raise your lexical scope and see you a lexical closure
16:26numbertencan you :as bind a destructured vector?
16:27TimMcTry it and see.
16:27numberteni did :(
16:28bounb,(let [[x y z :as vec] [1 2 3]] vec)
16:28clojurebot[1 2 3]
16:28numbertenah
16:28numbertensilly me, I didn't put the :as in the []. thanks :)
16:28bounbnp. from one newbie to another
16:29numberten:)
16:30amalloyhey, it looks like rich removed flatmap in favor of a lower-arity mapcat after all
16:39mikerodamalloy: apparently the 1-arity mapcat didn't work anyways
16:39mikerod,(mapcat identity)
16:39clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338>
16:41mikerodThis is due to mapcat
16:41mikerodusing apply on the colls without checking
16:41mikerod`(apply map colls)`
16:42mikerodSeems like an obviously broken thing. a) I'm surprised this was the case currently. b) given it being broken, looks like making the 1-arity of mapcat meaningful was an obvious thing to do
16:53amalloymikerod: well of course it didn't. that's why it was suggested to use the one-arity mapcat instead of introducing flatmap
16:54amalloyrich originally introduced flatmap because mapcat already had a one-arity definition, i guess not noticing that the behavior of that definition is just "throw an exception in all cases"
16:56mikerodamalloy: yeah, that's the interesting part :P
16:58puredangeramalloy: I have learned that "rich didn't notice" is never a betting position
17:01amalloypuredanger: i recall hearing that the reason (mapcat f) wasn't the original definition was because mapcat didn't have an arity available for shortening. it turns out i actually heard this from you, and from context i believed you were telling me that this was rich's actual reason, rather than the reason you'd inferred
17:02mikerodEveryone overlooks things sometimes
17:02mikerod:P
17:02puredangerI'd say that was part of the reason from a conversation I don't fully remember
17:03amalloyto see the specific conversation, search for "flatmap" in http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-08-06.txt
17:03puredangerI remember my conversation with you. I don't remember the full conversation from Rich.
17:04puredangerI am (always) an imperfect translator
17:05amalloywell, now the conversation is there for the reference of anyone who doesn't remember it or wasn't there
17:05puredangerI believe the other aspect is the semantics of cat vs concat
17:05hiredmanpuredanger: if only you had some stone tablets up on that mount
17:06llasram(inc hiredman)
17:06lazybot⇒ 54
17:06puredangerI think the introduction of the cat transducer (whose semantics changed a bit before commit) was key
17:07puredangerallowing mapcat to just be a transducer of (comp (map f) cat)
17:07technomancyhehe
17:08technomancy"What's this? Everyone using pull requests while I was gone? *smashes tablets*"
17:08hiredmantechnomancy: lol
17:43SagiCZ1is there any channel like "friendly physics" ? just got yelled at by some physicist over at #physics xD
17:43wkellylol
17:44amalloynow i'm curious what the atmosphere in #physics is like
17:44SagiCZ1pretty shitty.. if you are stupid like me
17:44amalloyanswer: about 1 bar, amirite?
17:44arrdemI'd expect it's a frictionless vacuum...
17:46hiredmanknowing physicists about 1 bar too few
17:47SagiCZ1amalloy: oh i just got the joke...... see im this slow
17:48holoI just asked at #haskell how to disable those commas in lists cause they are causing my a headache, and all i got was silence :(
17:50arrdemholo: page 11 of the Haskell 98 spec. lists have commas.
17:50holomy goodness
17:51amalloyyou kinda need commas in any language that doesn't have sexprs
17:52SagiCZ1sexprs.. kinky
17:52SagiCZ1it means "sex-tit" in my language..
17:53holoamalloy if they have some other use for [], maybe use other kind of bracket. hey for 10 items it gets 9 commas!! insane
17:54amalloyholo: so uh...here's a list for you, how many elements does it have? [id id id id id]
17:54SagiCZ119?
17:55arrdemSagiCZ1: 1
17:55holoamalloy, 5. i know it's a trick though hehe
17:55amalloyarrdem: well, 1 in the current implementation. my point was if they took his change the answer would be "somewhere between 1 and 5"
17:55arrdemamalloy: yep
17:55SagiCZ1,#{:id :id :id :id :id}
17:55finishingmoveQuick questions guys: what web framework to use if I were to start working on an app right now, as a Clojure beginner? I know about Compojure but I don't know if something new came to existence since I fiddled with Clojure last
17:55clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :id>
17:57finishingmoveI'm looking for something like a micro-framework, with good documentation
17:57scottjfinishingmove: compojure is still the most popular starting point.
17:57holofinishingmove there's alot of hype around Om for single page apps, but you'll need to use ring/compojure anyway also
17:57mischovfinishingmove: Just start with compojure.
17:58mischovfinishingmove: It's got the documentation.
17:58holoamalloy how come it's 1..5 items?
17:58amalloyholo: because it could be [id, id, id, id, id], or [(id id), (id (id id))], or...
17:59amalloyspaces are for function application
17:59finishingmovecompojure it is then, thanks for the tip guys :)
18:01holoamalloy oh yes on the spot. just forgot i was using this ML syntax thing :o thanks . now i understand their silence
18:02mischovholo: Oh Clojure how I love you so....
18:02holomischov, i'm beginning to love haskell too. i may become polygamist
18:04mischovholo: I keep trying to love Haskell, but I always end up running away crying from the frustration of never getting anything done. Clojure is always there to rock me gently and tell me it's okay.
18:05technomancy"It's got documentation" <- high praise =)
18:05bjacan I tell leningen to add :exclusions [org.clojure/clojure] to everything except the clojure I have specified as a dependency?
18:05technomancybja: you can have :exclusions in the top level of defproject that do that
18:05technomancybut I can't think of a good reason to
18:06holomischov, wow.. i hope i'm not disappointed
18:06bjawill that also exclude an explicit named dependency? ala (defprojec ... :exclusions [org.clojure/clojure] :dependencies [org.clojure/clojure "1.5.1"])
18:07technomancyyes, but excluding a dependency in itself won't do anything iirc
18:07mischovtechnomancy: Well I actually prefer other things to Compojure but all the tutorials and such are for it so I can't in good faith recommend people to start elsewhere.
18:07holoclojure has technomancy ← high praise
18:07technomancybja: why are you looking for this?
18:07mischovholo: As long as you're not me you'll be fine.
18:07bjaI made the mistake of asking lein deps :tree given that I'm AOT'ing stuff for storm
18:08amalloytechnomancy: it's the only real way to run on a fork of clojure, if that's what you want to do
18:08technomancyamalloy: oh, true
18:08technomancybja: apart from that it should be only necessary if your deps specify version ranges, but that case is hopefully very rare
18:23danneumischov: how's gate coming?
18:25mischovdanneu: Not bad, actually. Switched up arg coercion.. it's much nicer. Also fixed some other things to take away surprises.
18:26mischovdanneu: It works REALLY well with Component. I add routes to components and then make the router depend on those components and it automatically gets and joins their routes.
18:27mischovdanneu: I need to get an example of that up.
18:28danneuparam coercion is nice. i saw https://github.com/Prismatic/fnhouse doing that too
18:28danneusaves a lot of boilerplate
18:30mischovI had it previously but I borrowed prismatic/core.typed's style for it. Looks much nicer. Works nicer too.
18:30mischovhttps://github.com/mischov/gate#handler-and-defhandler
18:38danneumischov: what's driving the development/direction of gate? do you use it on anything for yourself?
18:40mischovdanneu: Yea, I use it for all my web projects. I've been using it recently on the backend for Om/Reagent which is what drove my recent change to improve how *splats work.
18:44SagiCZ1can i somehow combine assoc and assoc-in? lets say i want to alter some first level keys and some nested keys as well in one call
18:46arrdem&(= (assoc {} :foo 3) (assoc-in {} [:foo] 3))
18:46lazybot⇒ true
18:46JaoodSagiCZ1: assoc-in can do both
18:47scottjperhaps he means how assoc can take multiple k/v's but assoc-in doesn't.
18:47SagiCZ1i guess?
18:47SagiCZ1can i do (assoc-in m [:a :b] :value [:c] :another-value)
18:48mischov(comp #(assoc-in % ...) #(assoc % ...))
18:48mischov:P
18:48arrdemhttp://grimoire.arrdem.com/1.6.0/clojure.core/assoc-in/
18:48arrdemno
18:49mischovProbably wouldn't be too hard to write a function to do it, though.
18:49clojurebotIt's greek to me.
18:50SagiCZ1alright nevermind.. its ok
18:50ben_vulpeswould it be bad form to move https://github.com/xeqi/peridot/blob/master/project.clj#L13 into the :dev dependencies so that I can run tests from emacs?
18:54gfredericksben_vulpes: I think that's what technomancy recommends; I do it.
18:55ben_vulpesgfredericks: should i duplicate the entries or just move them into :dev?
18:56ben_vulpestechnomancy's stuff seems to not have much in :test...
18:57technomancy:test is for stuff which you want during `lein test` only
18:57technomancywhich is ... basically nothing
18:57ben_vulpesi want all my test stuff available in my emacs repl, but i'm a novice at all the things and so am almost bound to make bad decisions unbounded
18:59technomancyI kind of want a big ol project spider too
18:59technomancyanyone looking for a learning project?
19:00ben_vulpeswhat are you thinking about?
19:04TimMcWhat's this about spiders?
19:04Fareanyone interested in pair programming?
19:05justin_smithben_vulpes: "dunno, clojure stuffs"
19:06TimMcFare: On what? (Over what medium?)
19:06ben_vulpesjustin_smith: lol
19:06Fareis there a place to find a pair programmer for clojure?
19:07TimMcI probably shouldn't due to RSI, but I'm curious...
19:07Faremy pure python dialect compiler for clojure + whatever the pair programmer wants.
19:07FareGoogle Hangout and screen
19:07technomancyben_vulpes: I was implying spidering github for project.clj files would be a good learning project
19:08arrdemtechnomancy: I think aysylu already has a project that does that..
19:09mischovSagiCZ1: https://www.refheap.com/89871
19:09technomancyoh yeah?
19:09arrdemtechnomancy: she mentioned it near the end of her clojure/west talk on Loom IIRC
19:10technomancyFare: have you seen talky.io? might be nicer than G+ for simple ad-hoc things.
19:10justin_smithmischov: excellent example code
19:10SagiCZ1is "2d" some sort of literal in java?
19:10technomancyarrdem: hm; and I guess clojuresphere probably has this too
19:10arrdem(inc mischov)
19:10lazybot⇒ 1
19:11SagiCZ1mischov: thank you!
19:11mischovSagiCZ1: My pleasure.
19:11SagiCZ1,2d
19:11clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 2d>
19:11arrdemmischov: mind if I slap that in detritus?
19:11Faretechnomancy, I admit I haven't — it looks good, but is it worth switching from Hangout?
19:12mischovarrdem: Not at all.
19:12FareTimMc: I can do the typing, if you have RSI
19:12SagiCZ1mischov: btw whats up with the name? does "ate" have some special meaning/
19:12technomancyFare: IMO it's better if you have two or three participants only
19:12SagiCZ1?
19:12Fareis there a way to get local variable bindings in a java / clojure stack trace?
19:12technomancyFare: just because there's no login and the URL is memorable
19:12Faretechnomancy, that's OK: only two needed for pair programming
19:13mischovSagiCZ1: assassinate ... associnate
19:13technomancyalso: less reliance on google
19:13TimMc++
19:13mischovSagiCZ1: Just a lousy joke.
19:14TimMcFare: A compiler for a subset of Python?
19:14SagiCZ1mischov: ok thats what i thought :]
19:14dbaschtechnomancy Fare: Screenhero is pretty good, but after two weeks you have to pay
19:14FareI'm thinking "variant" rather than "subset".
19:14FareSo far, the syntax is the same, but the semantics is different, due to purity.
19:15Farei.e. x = y binds a new x that shadows the previous
19:15FareYET, it's visible in the rest of the current function's body.
19:15Farewhich can be... interesting.
19:17Jaoodis there an emacs refheap theme?
19:17Farenot implemented yet: grouping successive def ... statements into a letfn
19:19FareI'm not sure how to best do it in presence of decorators:
19:19arrdemtyped clojure: no really that can return nil
19:20Fareshould I group things into a letfn, then do the decoration, or have any decorator break letfn continuity, and lose any mutual-recursion?
19:24TimMcHmm, it doesn't really inspire me. I'm leery at this point of creating new languages. :-P
19:24scottjJaood: apparently refheap's theme is based on tomorrow night bright, which is available in emacs.
19:28SagiCZ1can i somehow kill a thread from repl to which i lost a reference? :D
19:30hiredmanyes
19:31hiredmanhttp://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html
19:31SagiCZ1hiredman: thank you
19:42FareTimMc: it's more interesting for the compilation passes than for the language itself
19:42Farethe syntax part is solved
19:43Fareright now, I'm struggling with wrapping each statement in the "least suitable monad that can express all its effects"
20:13bounbso i added a dep (data.json) in my project.clj, ran lein deps but i get this "CompilerException java.lang.ClassNotFoundException: clojure.data.json" when i try and require data.json
20:13bounbcan anyone give me a hint?
20:14beamsowhat does the project.clj and the :require look like on that namespace (feel free to use refheap.com to paste something into)
20:15bounbsure hold on
20:16bounbhttps://www.refheap.com/89878
20:17bounbuh
20:18bounbjust noticed one uses :require and the other require
20:18beamsoyeah, i saw that but i was going to try both
20:18bounbblame the lein docs for calling require directly
20:19bounb,(doc require)
20:19clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents...
20:19bounbbeamso: i tried anyway, makes no difference as expected
20:19beamsothe first require is something that you'd use at a repl, the second require is the same format that you'd see at the top of a namespace
20:20beamsothe "(require '[clojure.data.json :as json])" way worked for me
20:20bounbohhh
20:20bounbyeah i just got that ha
20:21bounbyeah it's cos i copied it outta an ns form
20:21bounbcheers
20:30bounbnow i have a new problem https://www.refheap.com/89879
20:31beamsotry removing the ":" from before "require"
20:32bounbhuh ok that works. why
20:32beamsothe ":" is for the top of a namespace, not for the repl
20:32beamsoor the namespace declaration, i should say
20:33SegFaultAXbounb: What he means is the form (:require ...) is calling the :require keyword as a function.
20:34bounbah yes i see because the ns macro has this (:require ) reference
20:34bounbyeah, and that keyword doesn't exist outside of the ns macro
20:34SegFaultAXAnd keywords will try and look themselves up in whatever you pass to them as their first argument when called as a function
20:34bounbyeah i got that
20:34SegFaultAXWhich is how eg (:foo {:foo "abc"}) works
20:34bounbya
20:35SegFaultAXJust filling out the explanation.
20:36bounband if :foo isn't in your assoc, it's just nil, not an error
20:38bounbbut (reduce ...) returns nil as well ;)
21:14jeffterrellMan, I'm loving the test-refresh lein plugin. Finally, a solution to getting ripped out of my flow for 60s JVM startup times!
21:14jeffterrellhttps://github.com/jakemcc/lein-test-refresh
21:17xulferCan't you just use cider since it's already running a jvm?
21:18xulferIt does look nice
21:21technomancyor grenchman
21:28jeffterrellI had difficulties with clojure-test-mode in emacs, if that's what you mean by cider. I'm natively a vim guy. :-)
21:28jeffterrellI haven't tried grenchman.
21:30jeffterrellLooks like grenchman could work, but I'd have to figure out how to use in a test-runner kind of way. Is that about right?
21:30jeffterrellDoes look nice in general, though, and something to keep in mind.
21:30xulferjeffterrell: Ahh I see. I have no idea why I assumed emacs.
21:31xulferI too am a vim guy really. I just tend to use emacs on anything with a rep;. Old habits and what not.
21:31jeffterrellYeah, I do like the emacs ability to integrate with a REPL.
21:33jeffterrelltechnomancy: Seeing that there's a way to run lein tasks in grench, that narrows the gap. But the other thing test-refresh does is a dependency-graph-based refresh as necessary whenever files change. So it's pretty convenient.
21:40technomancyjeffterrell: I see; yeah that's handy
21:41technomancystill, I wish the dependency-graph tracking were separate from the test runner
21:41jeffterrellIt is, actually. clojure.tools.namespace.repl/refresh
21:41technomancyoh right; cool
21:42jeffterrellGrenchman's good to know about too. I'd consider us even, except that, well, you kinda wrote stuff that I use every day. :-)
21:55jeffterrellI love Clojure's concision. Witness:
21:55jeffterrell(get #{:aborted :finished :failed} job-status :finished)
21:57technomancyyeah, I'm always skeptical of lein plugins that exist just to run in-project code I guess
21:58technomancylike ... why have a plugin? why not just have a :main entry point?
21:58technomancybut whatever, it's cool
22:02jeffterrellYeah, I could see that. Although one could argue that `lein test` just runs in-project code. :-) But yeah, I know what you mean.
22:03xulferHm I'm curious. What causes lein to search for a main function?
22:04xulferI created a lib the other day using the default lein template. Changed nothing in the project.clj. No gen-class. Still warns about no main when it installs.
22:04xulferNot a big deal, I just hate warnings on installs.
22:07jeffterrellxulfer: I think you have to have a :main value in your project map that points to a namespace-qualified function.
22:07jeffterrellMaybe the default lein template doesn't have that?
22:07xulferHmm
22:07jeffterrellhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L196
22:08xulferbut why would I need that if it is just a library?
22:08gfredericksxulfer: you shouldn't for a library; what do you mean "when it installs"?
22:08xulferso I should just define some stub function? i'll do that to make it go away
22:08xulfergfredericks: On another project when I do 'lein install' and pull my lib in as a dependency.
22:08xeqiben_vulpes: moving those are fine. That was from when I was concerned about dev/test seperation. I've since relented and usually just put things in :dev now
22:09gfredericksxulfer: so you have libA and appB and you don't see this warning (about libA) until you're messing with appB?
22:10xulferi don't want to see the warning at all
22:10xulferi don't understand why there should be a warning about a lack of a main function in libA
22:10xulferi don't get that warning from any other dep
22:10gfredericksthere shouldn't, I'm just trying to make sure I understand what you're talking about
22:10gfrederickswhat makes you think it's referring to libA instead of appB?
22:10xulferYeah I understand. Yes that's what I mean.
22:11xulferBecause appB has a main, and it is explicit in warning about libA.
22:12gfredericksI've never seen a warning about main that referred to a library
22:12xulferYeah. I mean my guess is that somehow I'm doing something incorrect.
22:12gfrederickswhat's the exact wording?
22:12xulferI'm just not sure what it is since my lein stuff is so minimal.
22:12jeffterrellxulfer: You get this warning when you run `lein install` in the libA directory? Or at some other point?
22:12xulferno in another app that is pulling in libA
22:12xulferone second let me force it to pull it in again.
22:15xulferWarning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.
22:16gfredericksaah ha
22:17gfredericksthat is a different problem than the one we guessed you were having
22:17xulferOh sorry.
22:17gfredericksbut closely related
22:17xulferI would have been more verbose, but I had to wipe out my repo to produce that. :)
22:17gfredericksI haven't seen this but I imagine it means leiningen thinks your lib has a main class when it's compiling it
22:17xeqithat warning is about having a :main without having :gen-class within that namespace
22:18gfredericksbut since you don't gen-class (and shouldn't) the class reference fails
22:18gfredericksxulfer: I think you don't want a :main entry at all in libA, right?
22:19xulferi don't have a :main
22:19xulferand no main function
22:19gfredericksyou don't want either, but it's hard to see how this situation would happen if you don't have a :main
22:20gfredericksyou're sure you never had one?
22:20xulferI can show you actually. Don't be too critical. I'm learning and it's just a small convenience project.
22:20xulferhttps://github.com/mbsmith/clj-systemtray
22:20xulferbut you can check out the project.clj, and core.clj there
22:20gfredericksthat's the lib or the app?
22:20xulferlib
22:20xeqixulfer: is there a :main in appB/project.clj?
22:21xulferYes. Technically a -main
22:21gfredericksxulfer: did you use lein uberjar?
22:21gfredericksfor the lib?
22:21xulferbut it's using the app template from lein
22:21xulfergfredericks: No I don't believe so. It's getting the library via clojars.
22:21xulferSo whatever lein deploy clojars uses
22:22xeqixulfer: the -main would be in the refered to namespace. Does that namespace have :gen-class in its namespace declaration?
22:24xulferxeqi: Yes.
22:24xulferBut I don't think it's related to the app in question.
22:24xulferBecause the warning did not appear until yesterday when I added this library as a dependency.
22:25xeqiah, you're running `lein install` in appB. that will create a normal jar, without the compiled/aot'd class because of ^:skip-aot in the project.clj
22:25xeqiI think you want to run `lein uberjar` in appB
22:25xeqito create a runnable jar
22:26gfredericksI just pulled clj-systemtry from clojars and it seems to have an okay manifest
22:26gfredericksso I'm going with xeqi's theory
22:28xeqi`lein install` will create a normal jar + pom and add it to your local maven cache, which lets lein find it for other libraries. `lein uberjar` will create a jar with all of the required code inside it, which can be ran using `java -jar $jar-name`
22:28xeqisince its an app, I believe you want the latter
22:29gfredericksI've never heard of `install` for an app or `uberjar` for a library
22:31xulferhm okay
22:31xulferi'll try that
22:33xeqixulfer: https://www.refheap.com/89886 as an example
22:35technomancygfredericks: https://github.com/Seajure/odo
22:35technomancy^ works with `installed` apps
22:35technomancywell
22:35technomancytechnically `deploy`ed
22:36gfredericksHUH.
22:36gfredericksokay now I've heard of it
22:36gfredericksit's still not normal though :P
22:36technomancy(also this may or may not be a ridiculous idea)
22:36gfredericksoh it is
22:36technomancyseajure hack night; what more need I say
22:37gfredericksI read the thing joe armstrong wrote and didn't really get it; the server only shape shifts once
22:37gfrederickscan't think of why that's useful
22:37gfredericksis it not supposed to be?
22:37technomancyuseful? that's already a lib.
22:37gfredericksoh dear.
22:38gfrederickstechnomancy: stramg lop?
22:39technomancygfredericks: nein =(
22:40xulferThanks for the help guys
22:40xulferI was under the impression uberjar was only for end deployment
22:40gfrederickstechnomancy: we'll I'll pretend you're there in your honor
22:40technomancygfredericks: I'll be there "in spirit"
22:40xeqixulfer: are you making an app that isn't for end deployment?
22:40technomancywhich is code for "not"
22:41xeqiI consider that the diff between lib vs app
22:41gfredericksxeqi: it's for end deployment in spirit
22:41xeqigfredericks: oh, the final end deployment
22:42gfredericksyes
22:42xeqireally gotta hope theres no bugs in that one
22:42xeqi... deadlock
22:58xulferxeqi: It is, but when I'm just simply trying to make sure all of my reps are pulled in, and that my repo will work properly I've used 'lein install' in the past.
22:58xulferI guess that isn't correct.
22:59xeqiah, I use `lein test` for that. Though it won't check the final uberjar creation. Really `lein uberjar` is the only thing that does that I know of
23:02Fareanyone interested in pair programming a clojure-written compiler from a pure python dialect to clojure?
23:13korqio_`
23:30danneui want mmcgrana in charge of my SEO campaign because i don't think i've ever ended up on github.com/ring-clojure on my first try
23:32danneuhe must use fiverr campaigns to spam backlinks to github.com/mmcgrana/ring
23:32Jaoodwhat happened to that guy? he started lots of clojure web stuff and then dissapeared
23:32Jaooddissapeared from clojure at least
23:33danneumaybe he's having some hammock time
23:33technomancyit was pretty weird. he got really into the product development side of things, and then into google go.
23:33technomancywhich was surprising to me until I realized he never actually learned how the clojure repl worked.
23:34technomancydid all his coding in textmate and always restarted for every change, so of course it was super tedious to get anything done.
23:34technomancyI guess if that's your idea of programming then google go could actually look appealing.
23:34Jaood;)
23:35Jaoodwell yeah, looks like clojure wasn't his cup of tea
23:36danneudude just moved on
23:38Jaoodtechnomancy: looks like he love textmate to much to leave it, he created clojure syntax highlighting for textmate
23:39Jaoodtechnomancy: does heroku uses Go heavily?
23:39technomancyJaood: yes =(
23:40JaoodOk, that could be one of the reasons :)
23:41technomancyI think the causality actually went the other way
23:41Jaoodhe brought Go to Heroku?
23:42technomancyhe was one of the early adopters anyway
23:48caternwow what a dumbguy
23:57danneunot quite...