#clojure logs

2013-01-14

00:05yedidoes prismatic use clojurescript?
01:21scottjyedi: I think it did at one time. I haven't heard that they switched.
01:22tomojhmm https://www.refheap.com/paste/7e814e3265c6fd0c5e4bfed8a
01:22tomojguess there are bugs for not-found
01:24tomojis there already something that serves up html for a browser repl?
01:25tomojI still have a static html file served by apache and a bit of cljs that looks at the url fragment for a repl port and clojure.browser.repl/connect's
01:49frozenlockIs there something like `bean', but that isn't read-only?
01:52bbloomfrozenlock: what would that look like? transients?
01:52bbloommaybe you should write 'frozenlock/bean! because i like the idea of a function named "bean!"
01:52bbloomsounds exciting
01:52technomancy:dependencies [[mister/bean "1.0.0"]]
01:53amalloyfrozenlock: if it's a mutable object with mutable fields, and not a clojure "value" (ie immutable), then it sounds like you just want...a java object
01:53bbloomtechnomancy: i can't tell if you're joking, or that's a project on github
01:54bbloomfrozenlock: yeah, what amalloy said
01:54amalloyso, i'd say this function is identity
01:54technomancybbloom: only in my dreams
01:54technomancypossibly clojure.reflect/reflect
01:55frozenlockamalloy: it is a java object. I would just like the ability to set the fields by a less tedious way than .setSomeFieldsMethod
01:55frozenlock(merge! (bean java-object) {:some-field value}) would be magic :)
01:56p_lwell, for java beans, making a macro would be easy
01:59amalloycareful. if you make it a macro, that would work, but (let [field :some-field] (merge! ... {field value})) wouldn't
01:59tomojwill closure optimize out keyword strings?
01:59tomojin a simple test, it seems not..
02:02p_lamalloy: dunno about how Clojure does with macros (I'm mainly lurking here, the chances to use clojure tend to die fast), but it's definitely doable in CL
02:02brainproxybbloom: been enjoying the silver searcher (and emacs integration for it) all day, thanks again for the tip last night!!
02:03tomojhttps://www.refheap.com/paste/a3345210b33f944c2b606fe0c
02:03tomojheh
02:04tomojhttps://www.refheap.com/paste/3f95ec12ac297e0dc6e1c0996
02:04amalloyp_l: baloney. you can't use macros to make that work in cl either, because merge! can't make compile-time use of the runtime value :some-field of the field binding
02:04bbloombrainproxy: np. enjoy!
02:04tomojwhoa
02:04tomojholy crap
02:04tomojwtf is that?
02:04p_lamalloy: oh, you can - by checking whether you have literal or variable, and generating apropriate code that would dispatch later
02:05tomojI guess closure said, "hey look, a bunch of strings, I'll combine them to save on quotation marks"
02:05tomoj(that's the advance compiled output of (def frob [:frob :frob :frob :frob ...])
02:05p_lamalloy: might require a compiler macro for the literal optimization, though
02:05bbloomtomoj: heh.
02:06bbloomtomoj: probably also saves on the string intern table at runtime
02:06amalloysure, if you're willing to have your macro behave like a function. but the presumption here was that the (.setFoo) operators were only possible at compile-time
02:06tomojbut in this case, there's obviously a better way :)
02:06bbloomtomoj: but seems like an overoptimization to me... sometimes i wonder about google closure
02:07bbloomtomoj: in my experience with "real" javascript apps, advanced compilation is practically useless when coupled with gzip. i guess it's only really useful when you have a *huge* stdlib that you want removed as dead code
02:07p_lbbloom: optimizing for JS is just like optimizing for computer, except the "cpu" is batshit insane ;)
02:07bbloomp_l: that resonates with me.
02:08ibdknoxbbloom: the inlining and such is nice
02:08bbloomibdknox: for sure. it was a *brilliant* move to build cljs on gclosure
02:08p_lI once heard some rumours of google V8 guys saying "we're getting to limits of how far you can compile and optimize JS while being useful"
02:09bbloomibdknox: however, it would be nice to eventually get all those optimizations into the compiler itself so they can 1) use clojure-specific knowledge and 2) be shared between host platforms
02:09bbloomibdknox: and 3) decouple from jvm
02:11ibdknoxbbloom: I would *love* for that to happen :)
02:11ibdknoxall of LT runs unoptimized
02:11tomojwould it make sense to 'intern' keywords in the cljs compiler?
02:11bbloomibdknox: i guess it must in order to support eval
02:11ibdknoxfor a number of reasons
02:11ibdknoxbbloom: yep
02:12bbloomibdknox: part of the problem is that the symbol mapping for minification lives in the jvm. it isn't shared with the browser
02:12ibdknoxbbloom: it's still wonderfully fast in v8 - such an amazing piece of technology
02:13bbloomibdknox: the guy who did his cljs-in-cljs is talking about it at clojure/west. hopefully we can push that stuff forward.
02:14ibdknoxbbloom: yeah, after seeing the list of talks, I'm regretting my decision not to go lol
02:14ibdknoxlooks like some really neat stuff
02:14ibdknoxI've been following that work pretty closely
02:15ibdknoxwaiting for the moment I can start using it :)
02:15bbloomibdknox: the closure compiler is ~90k lines of java... i've considered just for fun porting it one compiler pass at a time... i bet it would be significantly smaller in clj
02:15bbloomsadly, i have real work to do :-)
02:15ibdknoxhaha
02:15ibdknoxI bet you don't need most of it, to be honest
02:15bbloomibdknox: no you really don't
02:16bbloomand some of the stuff is just absurdly verbose
02:16bbloomthere are 3000+ line files that could probably be replaced by 5+ line macros
02:16bbloomin fact, i bet they were written by vim macros :-)
02:16ibdknoxlol
02:19bbloomibdknox: to be fair, it's pretty damn well written java
02:20ibdknoxas much as they get paid, I'd hope so ;)
02:21bbloomibdknox: so when is the next big "wow" release/video?
02:24ibdknoxbbloom: end of jan/beginning of feb :)
02:24bbloomibdknox: i'll keep an eye out for it
02:24ibdknoxlooots of goodness coming
02:25bbloomibdknox: recently read your article about component-entity-system. good stuff
02:26ibdknoxI need to write the follow up lol
02:26bbloommy ui stuff has a similar system that is tuned for trees rather than a flat set of game entities
02:28ibdknoxLT is just one big data structure, it's similarly flat though
02:28bbloomall in one giant atom? heh
02:28bbloomi have two atoms: model & view
02:30ibdknoxbbloom: I had it in one giant atom, but there were too many listeners and any one change caused immense amount of freshness checking. It's not an atom of atoms
02:31bbloomibdknox: so what is it now?
02:31ibdknoxerr it's *now* an atom of atoms
02:32bbloomah
02:32ibdknoxthat seems to be plenty fast enough at this point
02:32bbloomwhat's the branch factor on that? ie how many atoms?
02:32bbloomand what determines if something gets an atom?
02:32ibdknoxevery "object" in LT is an atom
02:32ibdknoxso it can be hundreds
02:33bbloomwhat is the granularity of an "object"? a window? a little floating bubble? a line of code? a character?
02:33ibdknoxan editor is the rough granularity
02:34ibdknoxeach tab is an object, the bar of tabs are objects
02:34bbloomand editors are those little bubbles arranged on a "table"?
02:34clj-newb-234is there a clojure builtin for checking if arg1 is a prefix of arg2, where arg1/arg2 are both lists
02:35ibdknoxbbloom: I moved away from that "table" stuff a bit in the latest LTs, but yeah that's correct
02:35bbloomclj-newb-234: maybe somebody can do better than this:
02:35bbloom,(every? (partial apply =) (map vector [1 2 3] [1 2]))
02:35clojurebottrue
02:36clj-newb-234bbloom: interesting use of every?
02:36clj-newb-234I was thinking of something like (defn prefix [a b] (= (take (count a) b) a))
02:36ibdknox(= arg1 (take (count arg1) arg2))
02:36bbloomclj-newb-234: heh, that's probably better
02:36bbloomin fact, that's definitely better
02:37bbloomi don't recall smoking anything....
02:37clj-newb-234why is it better? is there some weird case iinvolving laziness hwere one is more efficient than the other ?
02:37bbloom*scratches head*
02:37bbloomoh no, what ibdknox is saying isn't right
02:38clj-newb-234in fact, I think your approach is O(1) space, whereas mine is O(n) space
02:38bbloomyou'd need to know which list is longer
02:38ibdknoxah true
02:38clj-newb-234I need only check if the first is a prefix of the second
02:38bbloomi wasn't smoking anything, i just FORGOT why i decided to use map vector lol
02:38bbloomclj-newb-234: ah, in that case, go with ibdknox's
02:39bbloomhmmm but let me think about the space...
02:39bbloomi don't think that it will hold on to the heads of the sequences, so it shouldn't take more space
02:39amalloybbloom: nonsense
02:39amalloyit has to count one of them
02:40amalloyoh, i think i may not have understood the context
02:40bbloomamalloy: i was just answering a different question that i apparently made up myself
02:40bbloomamalloy: mine figures out if either seq is a prefix of the other
02:40bbloomwhich is different than testing if A is a prefix of B
02:40bbloomin summary: programming is hard
02:41ibdknoxI'm fairly certain mine is probably smaller
02:41ibdknoxspace-wise
02:41amalloyuseful has a prefix-of?, which is built on top of remove-prefix
02:41clj-newb-234is "take" lazy ?
02:41amalloyhttps://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L244
02:42bbloomibdknox: programming still hard: your approach would allocate less total memory, but both approaches use the same amount of space in terms of big-O
02:42clj-newb-234what is "useful" a library or a irc user?
02:42RaynesIt's a library IRC user.
02:42bbloomibdknox: that is, unless, = isn't smart and holds on to the prefix of the list... which it very well might do since equiv is a memberfunction
02:42ibdknoxbbloom: yeah
02:43devnclj-newb-234: take is lazy
02:43bbloomibdknox: so the answer really depends on whether or not the JVM is smart enough to let the garbage collector clean up the `this` object that equiv was called on
02:43devn,(class (take 4 (range 10)))
02:43clojurebotclojure.lang.LazySeq
02:43ibdknoxwell if you're doing this over something huge where any of this would matter, there's a better solution
02:43bbloomright, programming is hard, that's what i said :-)
02:43clj-newb-234nah, these lists come from string.splitting "/" of pathnames
02:43ibdknoxbbloom: hehe
02:44clj-newb-234list lenghts are expected to be < 10
02:44ibdknoxwhy not just check the string prefixes?
02:44bbloomhm wow, that thought had never occurred to me before: object oriented programming inhibits garbage collection
02:44clj-newb-234the gui code for the tree structure stores each level separately
02:45clj-newb-234(i.e. think those little + signs you click, and the next level of the tree expands out)
02:45bbloomi guess anything that makes extra references inhibits garbage collection... and `this` is the biggest implicit bag of extra references ever
02:45ibdknoxanything that hides state does
02:46devnlike atoms?
02:46clj-newb-234dumb question: is there a way to make #({ ... }) to somehow work? instead of having to write (fn [x] { ... } ) ?
02:46clj-newb-234i.e. I want an anonymous function that returns map
02:46clj-newb-234but I can't use #({ ... }) since that evals the map
02:46bbloomclj-newb-234: use ->
02:46bbloom,(-> #{1 2 3}
02:46bbloom,(-> #{1 2 3})
02:46clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
02:46clojurebot#{1 2 3}
02:46clj-newb-234wtf, isn't -> for threading
02:46ibdknoxlol
02:46bbloomclj-newb-234: yeah, but with only 1 argument, it has nothing to thread! :-)
02:46ibdknoxit's a golfing trick
02:47clj-newb-234(#(-> {1 2 3}))
02:47clj-newb-234,(#(-> {1 2 3}))
02:47clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
02:47clj-newb-234,(#(-> {1 2 3 5}))
02:47clojurebot{1 2, 3 5}
02:47bbloom,(map #(-> [:foo %]) (range 3))
02:47clojurebot([:foo 0] [:foo 1] [:foo 2])
02:47clj-newb-234this is disguisting, but I like it
02:47amalloydon't use -> for that, even if trying to golf
02:47devnlol
02:47amalloyjust use 'do, which is what it's for
02:47clj-newb-234amalloy: why not? it's cute
02:47devndisgusting is right
02:47amalloybecause it's cute is exactly why :P
02:48devn(inc amalloy)
02:48lazybot⇒ 40
02:48clj-newb-234well, I like it; and I hate future-self, so I'm going ot use it :-)
02:48ibdknox,(map #(do [:foo %]) [1 2 3 4])
02:48amalloyif it makes you go "lol i can't believe this works", don't write it
02:48clojurebot([:foo 1] [:foo 2] [:foo 3] [:foo 4])
02:48devnclj-newb-234: go forth and shoot thineself in thine foot
02:48bbloomamalloy: i actually like it because its nice to add trace statements.... just insert a dbg before or after
02:48bbloom#(-> %) becomes #(-> dbg % dbg)
02:49clj-newb-234bbloom: I like.
02:49devn(#(-> {1 2 3 4}))
02:49devn,(#(-> {1 2 3 4}))
02:49clj-newb-234#clojure <-- where you ask silly questions and get insightful answers.
02:49clojurebot{1 2, 3 4}
02:50devni just killed chat
02:50devngood night all!
02:50clj-newb-234I'm goign to spend the rest of the night thinking of all the evil uses of -> I can think of.
02:51bbloombut i'm a trace statement mad man.
02:53clj-newb-234for some weird reason; I find replacing "map" with "for" tends to make my code more readable
02:53bbloomclj-newb-234: i find that's only true when you have multiple levels of maps and mapcats
02:54clj-newb-234bbloom: actually, it's I tend to write (map (giant complicated expression) lst)
02:54clj-newb-234and (for [x lst] multi-line-expr) looks much better
02:54bbloomclj-newb-234: so the primary difference between 'for and (->> map mapcat ...
02:54bbloomclj-newb-234: is that 'for requires you have names
02:55clj-newb-234I like names too.
02:55bbloomclj-newb-234: where as map, filter, mapcat, etc would allow you to use functions without naming their arguments
02:55bbloomclj-newb-234: yeah, a lot of the time a name can make the code more clear
02:55bbloombut sometimes the name would just be silly like you have numbers, then numbers-without-fives, followed by numbers-without-fives-times-two
02:55bbloomso you either use short names like n
02:56bbloomor you write numbers* or numbers'
02:56bbloomor numbers''
02:56bbloomor numbers''''''''''
02:56bbloomalternatively, you can just avoid naming things that are intermediate values that wouldn't be beneficial to name
02:56clj-newb-234damn, I just realized that (-> x a b c d e f) looks infinitely better than (f (e (d (c (b (a x))))))
02:56ro_stor keep using the same name
02:56clj-newb-234even with colored parehntheises
02:57ro_stlet [a … a … a …]
02:57bbloomro_st: yeah, i hate that
02:57ro_sti use it when it's clear that it'd otherwise be as you described
02:58epitronclj-newb-234: what about x.a.b.c.d.e.f :)
03:02clj-newb-234epitron: a, b, c, d, e, f are functions, not java members :-)
03:03epitronclj-newb-234: sure.. i'm just sayin... OOP style is nicer
03:03clj-newb-234nah, I like forth style
03:03clj-newb-234-> reminds me of forth like things
03:03epitronload up that stack!
03:04clj-newb-234if someone merely ficgured out he perfect way to merge clojure, mathematica, apl, and forth, I'd be happy
03:06snowylikewhy would you want APL?
03:06clj-newb-234actually, I forgot one: I want: clojure + mathematica + apl + forth + perl
03:07clj-newb-234with such a system, I bet one can solve the halting problem in < 100 LOC
03:08bbloomclj-newb-234: you'd love https://github.com/brandonbloom/factjor
03:09clj-newb-234I like.
03:09ro_stbbloom: your talk got a '4' vote from me :-)
03:09bbloomro_st: nice. thanks :-)
03:09bbloomro_st: i'm going to try to release DomScript ahead of clojure/west
03:10clj-newb-234bbloom: is it just one core? src/factjor/core.clj ?
03:10clj-newb-234i like how that you've implemented the basic factor words
03:10clj-newb-234the only thing you'r emissing is hte factor ui :-)
03:12clj-newb-234I think the name can be better
03:12clj-newb-234factjor doesn't seem as naturalc as fajctor
03:13bbloomi kinda regret not calling factjure
03:13bbloombecause i keep spelling it that way
03:13tomojI think you'd have to convince lein to let you?
03:14Raynesbbloom: I'd really prefer to not put js in your names.
03:14RaynesHow would you feel if I started calling you Brajndon Bljoom?
03:15bbloomRaynes: heh, sorry. you got a better name? my goal was maximum confusion :-)
03:16bbloomRaynes: could have also gone wih Catjure
03:16bbloomor Clocat
03:16clj-newb-234for maximal confusion, you should call it "go"
03:16bbloomClotor ?
03:16tomojclo* bothers me more than *jure
03:16clj-newb-234I like clocat
03:16bbloomfactjor was the best that had when i was ready to type `lein new` and i was to lazy to change it
03:16bbloom:-)
03:17tomojI've been considering writing a shell script for attempting to rename a lein project
03:18bbloomtomoj: surely it should be `lein rename`
03:18tomojah, I suppose
03:18bbloomi'd install the shit out of that
03:20Raynestomoj, bbloom: I wrote a program to do something similar in Haskell.
03:20Raynestomoj, bbloom: Mine works for the specific case of adding a prefix to a namespace and setting up dirs and what not.
03:20Rayneshttps://github.com/Raynes/prefixify
03:21RaynesBask in the purely functional glory
03:22clj-newb-234isn't "lein rename" just "sed" ?
03:22clj-newb-234like "sed/factjor/clocat/g" **/*.clj
03:22tomojI used sed, but it doesn't rename files
03:23bbloomRaynes: yeah, tomoj's needs the package prefixing too
03:27tomojare there extant demos of crate's bindings?
03:28tomojhttps://github.com/fluentsoftware/cljs-binding/blob/master/examples/crate/src-cljs/sample.cljs I don't understand
03:30bbloomRaynes: your prefixify project is from ~2 months ago. do you still write a lot of haskell?
03:53scottjbbloom: just reading your clojure/west abstract, is domscript already released?
03:53bbloomscottj: not yet, i plan to release it ahead of clojure/west
03:53bbloomprobably in the next two weeks, but no promises because i'm kinda busy moving from seattle to nyc
03:53scottjbbloom: have you posted any pastes of example usage?
03:54bbloomscottj: here's an example: https://www.refheap.com/paste/8519
03:54scottjbbloom: thanks
03:54bbloomscottj: that might not actually be perfectly right since i never evaluated that particular bit of code
03:55bbloomin short, that little program creates some elements, clones one, attaches stuff to the dom, etc
03:55bbloomshould give you the feel of it
03:55bbloomit feels a lot like jquery, only with much much more powerful chaining
03:56echo-areaWhat package management change is leiningen waiting for?
04:03tomoj";;" looks awfully like "::" :D
04:12bbloomscottj: looking for something in particular?
04:15scottjbbloom: nope, just curious. looking forward to seeing the release and your talk.
04:15bbloomthx :-) me too, i'm excited
04:16Raynesbbloom: I've never written a 'lot' of Haskell.
04:16Raynesbbloom: If you look, I wrote like 23435234 Haskell things in like 3 weeks there.
04:16Raynesbbloom: I wrote at least 3 libraries while at the conj alone, and that was before I had to take my mother to the hospital!
04:17RaynesI was actually making jokes with people about how I was writing Haskell at a Clojure confernece.
04:17Raynesconference*
04:17bbloomRaynes: ah ok. just flirting with it for the sake of learning?
04:17RaynesSgeo: You're interested in anything that you can write programs in.
04:17bbloomSgeo: what exactly do you do? are you a student/researcher? you seem to jump around between languages a lot :-P
04:17SgeoIt's like Racket and Smalltalk are on opposite ends of a spectrum. Racket's a nice language with an environment that irks me, Smalltalk's a nice environment with a language that irks me
04:17Raynesbbloom: Well, Haskell was my first language. Back then I just never internalized monads, applicative functors, ect. I used it some more mostly for those things, but also because I like Haskell.
04:17Raynesbbloom: I'd use it more, but I don't often have a reason to.
04:17scottjSgeo: how come? (big fan of Smalltalk, used it quite a bit a decade ago)
04:18Sgeobbloom, just graduated from a sucky school
04:18bbloomRaynes: heh. odd. how did that come to be your first language?
04:18Raynesbbloom: Prefixify was actually an excuse to use Haskell at work, but I semi-annoyed my boss because I spent time on it. :p
04:18Sgeoscottj, no macros is a big one. Single-dispatch OO. A tendency to add methods to other people's classes, and no namespacing mechanisms for these added methods
04:18Raynesbbloom: http://codebassradio.net/2011/11/29/runtime-expectations-episode-13-hot-clojure-conj/ Listen to my interview here. Pretty sure I explained it there.
04:19RaynesI had such sexy hair at that conference.
04:19scottjSgeo: yeah definitely, my irc is lagging bad so my how come was actually to you being interested in it :)
04:19SgeoOh. The environment and IDE
04:19SgeoA fix-and continue, modify while it runs, that sort of thing is really interesting to me
04:19scottjSgeo: I like whisker browser, not sure if it loads in recent squeak
04:21bbloomRaynes: i'll listen to that in a little while if i remember
04:21RaynesDamn it.
04:22RaynesI lost my github commit streak.
04:22RaynesDidn't commit anything this weekend.
04:22RaynesShame.
04:22bbloomRaynes: i think it works via pushes
04:22bbloomRaynes: so just rebase some commits and change the dates
04:22scottjSgeo: mathmorphs and nebraska (kansas?) are really cool smalltalk things too
04:22bbloomgame the system
04:23scottjSgeo: blocky is a CL game programming environment that's partly inspired by morphic also, in case you didn't know
04:28SgeoHmm. But it's CL, which I also categorize as "good environment but not so nice language"
04:46echo-areaSgeo: Is Clojure in the same category?
04:46echo-areaIn your categorization
04:47SgeoActually, it leans much more towards better language, worse environment
04:48SgeoAlthough there are some nice things about the environment. Can always grab a Java library
04:48echo-areaHmm. How do you define "better" and "worse"? I'm not flaming here, I just want to know your point
04:48SgeoAnd it's popular enough to have a decent sized ecosystem
04:48SgeoWell, there are certain things I tend to look for. Resumable exceptions, first-class continuations, TCO
04:49SgeoEase of modifying a running program
04:49SgeoA nice IDE doesn't hurt, but Visual Studio for example feels too ... "large" to be considered nice
04:49Sgeo^^all that I classify as "environment"
04:50echo-areaOh. Is TCO really possible on JVM? And what's missing in CL?
04:51SgeoTCO is missing from CL, but my main problems with CL are language rather than environment
04:51SgeoAnd TCO is possible, but might hurt Java interop
04:51SgeoAny TCO code can be converted into code that doesn't use tail calls, I think
04:51tomojit's too bad 'descendant' means 'proper descendant' — 'non-ancestors' for 'improper descendant'? :(
04:52p_lTCO is quite common in CL, though
04:52p_land is possible in JVM for functions that call themselves (by replacing call with a branch)
04:53SgeoTCO has uses beyond self-recursion
04:57echo-areaWhat is a generated TCO?
04:58Sgeo?
04:59p_lSgeo: I *love* CL:DISASSEMBLE, btw :D
05:00Sgeop_l, wouldn't the usefulness of that be highly dependent on the implementation?
05:00p_lSgeo: so far it has been pretty useful to me - the only two cases with problems were ABCL and CCL
05:00p_ls/CCL/ECL/
05:01p_land it tends to show much better just what your optimization or changes do
05:14clgvwhere do I find the generated API for clojure's contrib lib? I think there was a github hosted site
05:15clgvah ok found what I was looking for
05:48augustlI'm building a clojure system where there's one http server that serves as the back-end of a web app, and another clojure system that is a central API that the web app (and others) will talk to
05:49augustlmy question is, should I use HTTP to talk to the central API, or are there any alternatives I should check out?
05:49augustlthe central API is completely internal, so some sort of JVM only library is OK
05:49cmdrdatsaugustl: why not use queues?
05:49augustlas you might have guessed, I'm new to the JVM ;)
05:50augustlcmdrdats: good question :)
05:50ejacksonaugustl, cmdrdats: yeah, I was gonna suggest the same. Rabbit or whatever.
05:50ro_st(inc rabbitmq)
05:50lazybot⇒ 1
05:51augustlcmdrdats: since the front-end HTTP stuff is written with ring/compojure/etc, does it make sense to have an async call to put something on a request queue, and then immediately block for a response from a response queue?
05:51augustlanyone, not just cmdrdats ;)
05:51ro_styou'd only queue work that doesn't have to happen in the same response
05:51ro_stotherwise you'd just do a normal blocking api call
05:51augustlthe request the front-end makes to the central API is stuff like "give me the data for the entity with this ID"
05:52ro_styeah that'd be blocking
05:52ro_ststuff required to render a page
05:52augustlyeah
05:52ro_stwe do outbound email and pdf gen with a queue though
05:53augustlI can't think of any call I'll make to the central API where I don't want a response back
05:53ro_stmay i ask why the separation?
05:53augustlso, does it make sense to use queues for RPC?
05:53cmdrdatsaugustl: yes, queues make sense for RPC
05:53ro_st(not saying it's bad, just curious about your particular case)
05:54cmdrdats:)
05:54augustlro_st: so that a multitude of systems can talk to the central API. The web front-end will have its own API, with user authentication etc. Then there'll be an admin app with full access to everything in the central API
05:54ro_sthow, cmdrdats?
05:54cmdrdatsone nice thing is that you can enforce a kind of SLA, so you can gracefully fail on timeouts
05:54augustlso the central API is essentially the database in the system
05:54ro_staugustl: ok, so it's a scalability and a separation of concerns thing
05:55augustlseparation of concerns for now :)
05:55augustlcmdrdats: yay :)
05:55cmdrdatsro_st: it also means that other components that could use the api's, even in different languages
05:55ro_styeah
05:56ro_stcmdrdats: how would async queues work with rpc, eg, fetching data for a page render?
05:56augustlso i guess the message I put in the request queue needs to have some kind of request ID, so I can consume only an item with that id from the response queue?
05:57augustlthis seems to be explained here http://www.rabbitmq.com/tutorials/tutorial-six-python.html
05:57cmdrdatsro_st, augustl: you register a temp queue, send the message off and wait for response to the temp queue
05:57xificurChi, if anyone has the nerves to answer stupid questions, here goes one: I just managed to get clojure and leiningen working on this laptop running win7. I downloaded a sample project from the compojure git, which uses a function named html5. It works just ok but of course I'd like to see what it does in the repl. So i start emacs, open the project.clj and do M-x nrepl-jack-in and copy the code, but it throws an exception. What am
05:57ro_stand you'd do this because you want the actual work on a separate machine?
05:58augustlcmdrdats, ro_st: this seems to be a lot of work, almost more than just doing HTTP
05:58cmdrdatshttps://github.com/Yuppiechef/simple-rabbit/blob/master/src/simple_rabbit/mq.clj#L106
05:58augustlI think what I'm after is some sort of generic RPC system where I don't have to manage the transport. If I use HTTP, I have to manually figure out connection pooling, etc
05:59cmdrdatsaugustl: it's not really that much work - queues are very cheap
06:00cmdrdatsaugustl: here's an example https://github.com/Yuppiechef/simple-rabbit/blob/master/src/simple_rabbit/example.clj
06:00cmdrdatsexcept that you'd want to use rpc-blocking instead of just rpc
06:00augustlchecking out both now, thanks
06:00cmdrdatsrpc runs a function upon receiving the result, rpc-blocking blocks the current thread until timeout or result and returns
06:01ro_stneat
06:01ro_ststorm-project provides distributed rpc
06:01ro_stintegrates like rpc, but uses the whole topology to compute
06:02cmdrdatsthat's just multiple machines listening on the same queue?
06:02ro_st"just", lol
06:02ro_sthttp://storm-project.net/
06:02cmdrdatswell, ye :P just fire up a bunch of machines configured to connect to the same server - done?
06:02augustlcmdrdats: so the rpc function will handle multiple requests for the same key properly, etc?
06:02ro_sthttp://www.infoq.com/presentations/Zolodeck
06:02cmdrdatsyes
06:02augustli.e. 5 concurrent requests to get a user by ID 5 or whatever
06:03cmdrdatsbecause each request sends a respond_to key to the server
06:03cmdrdatsso the server knows which temp queue to respond to for any given request
06:03augustlwhat's the benefit of doing this instead of using HTTP?
06:04ro_stretry semantics, presumably
06:04augustlthat's not important in my case, a timeout is more than good enough
06:05cmdrdatsone thing is that only rabbitmq has to be up for it to work
06:05cmdrdatsif your consumer is dying, another machine can transparently pick up the workload
06:05augustlgood point, that's nice
06:05augustland kinf of obvious.. You don't care where the work is done
06:05cmdrdatsye :)
06:06augustland presumably rabbit is up all the time, while the API goes down for restarts and whatever
06:06cmdrdatsyep
06:06cmdrdatsso you can spin up a failover machine, restart your main production machine safely
06:06augustland temp queues aren't expensive or anything?
06:06cmdrdatsno, they're quite efficient]
06:06Anderkent|awayqueues are cheap unless you're getting into millions
06:07augustlcmdrdats: and have multiple machines, just by, well, adding multiple machines :)
06:07cmdrdatsaugustl: heh, ye, exactly
06:07cmdrdatsAnderkant: thanks - I'm not sure where the falloff point was for using temp queues
06:07cmdrdatsAnderkent*
06:08augustlAnderkent: so in my case, that would be millions of concurrent requests?
06:08clojurebotNo entiendo
06:08Anderkentaugustl: i'd expect other stuff to give out first
06:08Anderkentconnections are more expensive than queues
06:08augustlI see
06:09Anderkentassuming empty queue of course, if you put megabytes of data into a queue and don't consume it you will have problems
06:09cmdrdatsaugustl: that's true - you can generally use a single connection for an app, and build multiple channels within the connection
06:09cmdrdatspretty darn efficient
06:09augustlthat's what I'm thinking
06:10augustlbuilt another system with a similar structure (central internal API), using HTTP. Haven't load tested a lot yet, but I have a feeling opening a TCP connection for every operation is gonna suck
06:12cmdrdatsaugustl: you should be able to provide a queueing layer over your other system too?
06:13cmdrdatsHTTP vs queuing isn't an exclusive choice :P
06:14p_ljust a honest plea: think whether you really need HTTP :P
06:14cmdrdatsI think HTTP would be applicable if you want to provide external services
06:15cmdrdatshaving 3rd party people jump onto your rabbitmq bus feels like a minefield
06:16p_lor if your API is "document" oriented (let's say, "noun oriented"), not "verb oriented" (actions etc)
06:19Raynesbbloom: That's cheating.
06:20p_la "verb" api ... doesn't fit HTTP
06:20p_l(unless you're "tunnelling" over it)
06:20augustlcmdrdats: the other system has a public API, so that's why it's HTTP
06:20augustlwhat you said ;)
06:21augustlit's also used internally though, could always provide queues for internal use
06:22augustlhopefully we'll need to do that soon, for some scaling reason or whatever :)
06:22augustlbeen wanting to decouple my bussiness logic from HTTP status codes anyway..
06:26augustlso, how do you choose an MQ? :)
06:26p_laugustl: depends what you need to do...
06:26p_lthat is, what kind of flows you need
06:27p_lyou might be satisified with just 0MQ doing a bit more than sockets :D
06:28augustlwell, right now my only requirement is that it's a small amount of work to do RPC through it in clojure
06:29cmdrdatsaugustl: just write your code against a handful of abstraction functions so that you can flip out the actual queue implementation at any time
06:29augustlprotocols
06:29augustlom nom :)
06:29cmdrdatsok, protocols if you like :P
06:35iamdrwdoes anybody know why library's code from :require is located below the code that'll be using it? in cljs
06:37iamdrwso I have goog.require('lib') before goof.provide('lib')
07:22RaynesHow do people get anything done at all with cracked.com existing?
07:24HodappRaynes: I totally read all about this on some article... I think it was "10 Ways the Internet is Fucking Up Your Ability to Get Anything Done"
07:25RaynesThat's a joke, isn't it?
07:25RaynesYeah, that's a joke.
07:25HodappDude, it's Cracked. Do you really think they DON'T have an article by almost that exact title?
08:05xificurCIf I have a project.clj open with listed dependecies, shouldnt the deps automatically load in nrepl when I do nrepl-jack-in?
08:06ro_styup
08:08xificurCro_st: I have hiccup "1.0.2" listed as a dependency, however when I try a simple (html foo) I get an exception
08:08ro_sthave you required it?
08:08iamdrwyou have to load them via (:use ..) or (:require ..) in the ns statement
08:08ro_st(use 'hiccup.core)
08:09iamdrwor (use 'hiccup.core)
08:10bprxificurC: the project.clj only ensures the dependencies are downloaded. To use them in code you have to require or use as ro_st and iamdrw have suggested
08:10xificurCthanks guys :)
08:11xificurCcan you also recommend something worth reading and up to date regarding compojure/hiccup?
08:11iamdrwu r welcome
08:11silasdavisI'm using monger and I'm getting at Clojure Compiler: java.lang.RuntimeException: No such var: cheshire.generate/add-encoder, compiling:(clojurewerkz/support/json.clj:79)
08:12silasdavismy project.clj has [cheshire "5.0.1"] dependency
08:13silasdavisI'm requiring monger.json in referenced module
08:13silasdavisThe referencing goes server > handler > routes.home > message > monger.json
08:14silasdaviswhere those named things are modules
08:14silasdavisbut it complains in server and handler
08:14silasdaviscould someone enlighten me on where I might need to require things?
08:16silasdavisthe docs don't say I have to do anything other than reference cheshire: http://clojuremongodb.info/articles/getting_started.html#cheshire_or_clojuredatajson
08:19silasdavisLooking at line 79 of https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj can anyone tell me why the var cheshire.generate/add-encoder would be undefined?
08:20silasdavisgiven that the require 'cheshire.generate above must have worked...
08:28ciphergothSo putting stars around my variable doesn't make it dynamic, but if I have ^:dynamic defined on it, should I put stars around it anyway to adhere to convention?
08:30babilenciphergoth: http://dev.clojure.org/display/design/Library+Coding+Standards → "Use *earmuffs* only for things intended for rebinding. Don't use a special notation for constants; everything is assumed a constant unless specified otherwise."
08:30ciphergothaces!"
08:31ciphergothwill read whole coding standards article - thank you!
08:31babilenciphergoth: yw :)
08:35ciphergothSo should a function that calls dosync use the bang! ?
08:41silasdavisDoes (catch Throwable t false) prevent further execution?
08:42silasdavisI should be more specific doesn (try (blah) (catch Throwable t false)) prevent later statements from being executed in a module
09:01labriahey
10:07juxovechow can I parse XML in clojure (must be lazy, file is approx 100 MB)
10:09algernonjuxovec: data.xml may be what you want
10:09Anderkentclojure.xml might be lazy ( I think it uses SAX on the backend ), try it
10:10juxovecthx
11:03xificurCif I wanted to write the simplest of the web pages containing only text and hyperlinks, no fancy design or scripts or login or shoutboxes, what do I need?
11:03yogthosxificurC: http://www.luminusweb.net/ is an easy way to get rolling
11:04yogthosxificurC: the base app is completely barebones and you can just add your pages in as needed
11:06xificurCyogthos: thanks, finally something that seems to have some documentation for starters as well (I hope) :) I will check it out, thanks
11:06yogthosxificurC: yeah I'm trying to keep it beginner friendly, if anything's missing give me a ping and I'll add it :)
11:07muhoosilasdavis: iirc, everything inside the try stops, and it's an implicit do
11:07muhoo,(doc try)
11:07clojurebotHuh?
11:07muhoofuuuuuu
11:07muhoo&&(doc try)
11:07lazybotjava.lang.RuntimeException: Unable to resolve symbol: & in this context
11:08muhoo&(doc try)
11:08lazybot⇒ ------------------------- try (try expr* catch-clause* finally-clause?) Special Form catch-clause => (catch classname name expr*) finally-clause => (finally expr*) Catches and handles Java exceptions. Please see http://clojure.org/special_forms#try nil
11:09xificurCthanks yogthos
11:10xificurCdont tell me to ping you because you might get a dozen of noob questions coming up tomorrow :p
11:10yogthosxificurC: haha, let's say some constructive feedback will be welcome :)
11:11xificurCyogthos: sounds much better :)
11:11yogthoshehe
11:11muhooibdknox: nm, you asked about catch. sorry
11:11muhoosilasdavis: sorry
11:12muhooibdknox: no, not you. gah, can't read or type today. sorry
11:34dnolenstuartsierra: any chance of adding Nada Amin to the Clojure org & core.logic repo to make collaboration easier? or is there someone else I should ping?
11:34stuartsierranot my call
11:34stuartsierraemail clojure-dev
11:34dnolenstuartsierra: ok, already did
11:35stuartsierraI'll ping Stu H., but nothing else I can do.
11:35dnolenstuartsierra: it's a bit annoying that project leads can't do this themselves.
11:35ohpauleezdnolen: That's mostly Andy now
11:35ohpauleezI can email him off list, if you like
11:35dnolenohpauleez: so Andy has access to the team memberships on GitHub?
11:35dnolenohpauleez: that would be sweet. I've already requested it twice.
11:36silasdavisyogthos: has luminus changed to not include a server.clj?
11:37yogthossilasdavis: yeah I moved to using ring instead
11:37yogthossilasdavis: I added repl.clj for running from a repl without using lein
11:38silasdaviscan I just copy that and delete server or are there any other changes?
11:38yogthossilasdavis: somebody was asking about the change on my blog, check the last comment I made there http://yogthos.net/blog/35
11:38silasdavista
11:38yogthossilasdavis: there's a couple of small changes
11:40yogthosweavejester: ping
11:40weavejesteryogthos: Yep?
11:40yogthosweavejester: what's your thoughts on something like this? https://www.refheap.com/paste/8616
11:41yogthosweavejester: or is there a part of ring I'm ignorant of as usual :P
11:41yogthosweavejester: err compojure :)
11:43weavejesteryogthos: Hm, I don't really like the syntax...
11:44weavejester(def foo (GET "/" [] …)) vs. (defroute foo GET "/" [] …)
11:44yogthosyeah essentially
11:44yogthosI one set of parens less :)
11:45michaelr525hello
11:45yogthoshi?
11:45weavejesterTBH I'm not even sure I like the "defroutes" form in Compojure currently...
11:45yogthosthe nice thing about it is that it groups the routes together in one spot
11:46yogthosso you can always trace where all the entry points are
11:49ohpauleezdnolen: done.
11:51yogthosweavejester: what were you thinking for defroutes alternativeS?
11:51weavejesteryogthos: Just (def foo (routes …))
11:52dnolenohpauleez: done as in done, or email sent? :)
11:52ohpauleezemail sent
11:52ohpauleezhaha
11:53yogthosweavejester: ah that might not be bad, but I do like it being explicit
11:53yogthosand afk
11:54dnolenohpauleez: thanks!
11:54weavejesteryogthos: Hm? That is more explicit...
11:54ohpauleeznp
11:54ohpauleeztotally welcome dnolen
11:57bprweavejester, yogthos|away: i had a use case where the (routes ...) form was necessary (as opposed to (defroutes ...) because I had to delay the definition of the routes until the rest of the system was available.
11:59weavejesterbpr: Why did you have to do that?
12:03bprI set it up so that the sub-components of the system were initialized based on the environment vars. Once that initialization was ready I invoked the function that defined the routes... basically dependency injection
12:03bprlol. i coulda said all that in 2 words :-p
12:11silasdaviscan anyone tell me why I get "CompilerException java.lang.RuntimeException: No such var: cheshire.generate/add-encoder, compiling:(clojurewerkz/support/json.clj:79) " when compiling this monger-requiring module: https://www.refheap.com/paste/8617?
12:12silasdavisI've moved the code from a different project structure and I think I'm missing something about how dependencies are handled
12:12hiredman.win 15
12:12silasdavisI have [cheshire "5.0.1"] in my project.clj
12:15dakronesilasdavis: does 5.0.1 show up in your deps when you do a `lein deps :tree`?
12:15silasdavisdakrone: yes
12:16dakronesilasdavis: hmm.. seems like something the clojurewerkz [sic] guys should look into
12:16dakronethe function is there in the cheshire code :)
12:16silasdavisoh really you think it's not me..
12:16silasdavisyes it is
12:16dakronesilasdavis: not sure without seeing all the code
12:17silasdavishere is the block:
12:17silasdavishttps://www.refheap.com/paste/8618
12:18silasdavisI'm assuming the way that works is that if the first try succeeds in requiring cheshire.generate then the second try runs the add-encoder bit
12:18silasdavisI've tried this in one of my own modules and it seems to work
12:19dakroneyea, sounds like something weird in their library
12:23technomancyweavejester: what do you think about future compojure handler/site or handler/api middlewares binding *read-eval* false?
12:24weavejestertechnomancy: Chas mentioned that as well. It might be a good idea to add some kind of middleware to do it, then add it to the standard set.
12:26technomancyany plans for a backwards-incompatible 2.0 yet? =)
12:27technomancythough I suppose you could make a pretty good case for this fixing a bug in clojure itself
12:29technomancyit's one thing to bind *read-eval* to true by default and one thing to have it be a secret undocumented feature, but doing both is absolutely nuts
12:31maehow does one apply varargs to a native java function, the correct way, i have tried (into-array) but i get null pointer exceptions
12:35matthaveneris there something written about *read-eval* in clojure documentation? i read some docs, but i don't understand why the reader would ever need to (eval ..) in the first place
12:35ska`Is anyone familiar with the impl of the new reducers? I'd like to understand why in line 110 "this" is used, whereas the other implementing definitions use "coll".
12:35jeremyheilermae, do you have a stack trace to show us?
12:35technomancymatthavener: it's a secret feature; IIRC the only documentation for it is the docstring on *read-eval* itself
12:36technomancymatthavener: it looks like clojuredocs.org has an example though
12:36technomancyhttp://clojuredocs.org/clojure_core/clojure.core/*read-eval*
12:36mae@jeremyheiler sure but its a bit complicated what i'm trying to do, i'm trying to generate classes for voltdb procedures
12:36dnolenska`: looks like a naming inconsistency, `this` doesn't mean anything special.
12:36mae@jeremyheiler give me some time, i was just wondering if anyone had any experience with native vararg functions and maybe alittle snippet example
12:37TimMctechnomancy: I have a patch on JIRA for documenting it in read and read-string, but...
12:38technomancyTimMc: keep up the good fight
12:38ska`@dnolen: ain't "this" the first argument when calling e.g. coll-reduce but using "coll" creates a closure in this case?
12:38matthavenerwhat is #= ? don't see it in the clojure cheatsheet
12:38TimMctechnomancy: It has been screened, so I guess that's progress.
12:39technomancymatthavener: <whisper>because it's secret</whisper>
12:39technomancyTimMc: is it? I can't tell any more.
12:39TimMcWell, it wasn't rejected, so it must be a *good* change, right?
12:40matthavenerthat's too bad
12:40dnolenska`: no, it `this` has no special meaning ever
12:40technomancymatthavener: it just means you can sneak arbitrary evals into calls to the reader
12:40jeremyheilermae, ok. you definitely should just be able to pass it in as an array.
12:40technomancyif that sounds crazy it's because it is =)
12:41matthaveneryeah, at least "EvalReader" is aptly named
12:41dnolenska`: it's just convention to write `this`, they could have (and probably should have) written `coll` instead - the code would do the same thing.
12:41matthavenersomeone should rename it "ReaderComplectedWithEval" :P
12:41nDuffmae: I do have experience, and it's always worked with into-array for me. Just a moment, and I'll find a snippet.
12:42mae@nDuff thanks i've done it before but i'm headdesking right now with trying to get voltdb to make these clojure-procedures work
12:42TimMcmatthavener: It also doesn't work quite the way you'd think:
12:42TimMcuser=> (read-string "#=(class (+ 1 2))") ;;= clojure.lang.PersistentList
12:42matthavenerTimMc: yeah I tried passing #= to my repl but i guess its a read-string only thing?
12:43nDuffmae: ...so, a typical use, in this case with an empty arg list: (.invoke getter instance (into-array Object []))
12:44clgv,(read-string "#=(System/exit 0)")
12:44clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
12:44clgvgood bot
12:44technomancy~botsnack
12:44clojurebotThanks, but I prefer chocolate
12:44clgv~chocolate
12:44clojurebotHuh?
12:44clgvlol
12:44technomancyingrate
12:45Anderkentclgv: but that would only give you ClassNotFoundException System :)
12:45TimMcWhy?
12:45clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
12:45clgvAnderkent: not really. try it in your own repl
12:45AnderkentI did
12:45Anderkentand thats what i got
12:45TimMc,(System/currentTimeMillis)
12:45clojurebot1358184667428
12:46clgvAnderkent: you have a strange repl then^^
12:46Anderkentbut with (read-string "#=(java.lang.System/exit 0)") it stopped responding and even ctrl-c doesnt work :D
12:46Anderkentlein repl
12:46mae@nDuff right on readingu p on .invoke, i was using .methodName before
12:46TimMcmatthavener: (+ 1 #=(+ 2 3)) ;;= 6
12:46nDuffmae: "invoke" is the name of the method I was calling.
12:46maeoh nm
12:46maelol
12:47maejust realized
12:47technomancymae: just a heads up that IRC isn't Twitter =)
12:47nDuffmae: Have a standalone reproducer for the issue you're seeing?
12:47S11001001technomancy: we should get lambdabot in here
12:47maetechnomancy: no problem, i have a habit of short messages, blame flowdock for that ; )
12:47TimMcS11001001: Does it yell at people for @ing?
12:47S11001001TimMc: it'll say "Unknown command, try @list"
12:47TimMchaha
12:47technomancynice
12:48S11001001you know, unless your nick happens to be "type" or "pl" or something
12:48TimMcbrb, setting up for a long troll
12:48maetechnomancy: were you referring to the @ tag? :)
12:49TimMcWell, "troll" isn't quite right. Meh.
12:49ska`@dnolen: I understand, that "this" has no special meaning, it just happens to be the name of the first argument in that function. However, "coll" is the name of the argument to #'reducer and thus, the difference here is, whether the first argument of the function of the protocol is used or the argument of the surrounding function. Or am I misunderstanding something?
12:52patchworkHey all, I am having an issue with clojure.data.json. I see the function names were updated, but this is suddenly breaking my app. How could a new version have been included in my project without me changing any dependencies?
12:52patchworkThis is madness!
12:52S11001001patchwork: how did you depend on it?
12:53technomancypatchwork: could be a transitive version range: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html
12:53S11001001patchwork: well, in general, you can spec deps in an unstable way, and if any of your deps do so, you inherit that instability
12:53patchworkI have no snapshots, if that's what you mean
12:53technomancybut yeah, it's madness. if you're depending on a project that specifies a version range you should report it as a bug.
12:53patchworkIn fact, it is not being included anywhere explicitly
12:54ska`@patchwork IIRC 0.2.0 introduced a breaking change, but 0.2.1 restored the old API
12:54patchworkWow, really?
12:54technomancyyeah, that was a real face-palm
12:54patchworkStill unsure how it could change out from under me
12:54patchworkCool, thanks guys
12:54technomancypatchwork: read the link I posted
12:55patchworkAh, not using ranged versions either
12:55technomancypatchwork: you're not directly using ranged versions, but you probably are indirectly
12:55Anderkentpatchwork: but if you depend on a library that does, that might break your build
12:55patchworkOh man!
12:55patchworkwow
12:56patchworkThat is terrible
12:56Anderkentyep, they're kinda evil
12:56technomancysomeone should write a bot that goes through all clojure projects on github and yells at people if they use version ranges
12:56technomancyanyone looking for a project?
12:56Anderkenthaha, sounds good, I'll add it to my todo list
12:57patchworkThat could actually be a good solution
12:57patchworkif people are not being informed in some other way
12:57AnderkentI suppose rather than crawling github I'd crawl clojars
12:57technomancyAnderkent: true
12:57technomancyyou should just steal that code from clojuresphere actually
13:01AnderkentI don't see a crawler there, on the first look. I think lein-outdated might be more help
13:01Anderkentanyway
13:02progoI'm translating some hrefs in HTML using enlive's at. I'm passing it a function but that function isn't within my dynamic binding scope. Should I write a closure instead? https://www.refheap.com/paste/8619
13:02technomancyAnderkent: actually I think it just tells you how to rsync over the entire pile of poms?
13:03Anderkentoh right, I didn't read the readme :)
13:03maenDuff: I am still trying to isolate the issue more, but here is the gist:
13:04maenDuff: https://www.refheap.com/paste/8620
13:07maesomething probably more to do with the way voltdb reflects on the procedure class
13:07maebeen climbing through their source code on github
13:08silasdavisdakrone: oh you are cheshire!
13:08dakronesilasdavis: yes
13:09silasdaviswell thanks... it seems that lib-noir pulls in cheshire 4.0.0
13:09silasdaviswhen you explicitly require 5.0.1 that disappears from lein deps :tree
13:09silasdavisbut could that be causing the issue with add-encoder?
13:09dakroneyea, that could be, sounds like it should explicitly require the 5.0.1 version
13:13silasdavisso even though I explicitly require 5.0.1 it will still get 4.0.0?
13:15Anderkent|awaytechnomancy: is it only open ended version ranges that should be nuked, or any? How about hard dependencies [1.0]?
13:15silasdavishm, not still doesn't work when I remove that
13:15technomancyAnderkent|away: IMO those are harmful too
13:15dakronesilasdavis: if you explicitly specify 5.0.1 it should be using that
13:16dakronesilasdavis: if it's not, something weird is going on with lein
13:25yogthossilasdavis: I could also update lib-noir to the latest cheshire
13:36maenDuff: the exception is originating from this line: https://github.com/VoltDB/voltdb/blob/voltdb-2.8.4.1/src/frontend/org/voltdb/ProcedureRunner.java#L1138
13:36maelol
13:36maeman i hate java, thanks be to clojure for making java not suck
13:38yogthosmae: indeed, all of a sudden jvm is a viable platform :P
13:39gfrederickswow; (->> coll (cycle) (drop n) (take (count coll))) is 3 times slower than (seq (into (vec (drop n coll)) (vec (take n coll))))
13:39maeyogthos: yeppers ; )
13:40nDuffmae: Am I missing something, then? I don't see anything that looks like an issue with varargs.
13:42maenDuff: nope i never claimed that there was a problem with varargs, was just one of the many possible culprits, thanks for your help
13:42silasdavisI'm trying to build a simple test case for my cheshire add-encoder problem
13:42silasdavishow can I get joda time in my class path so I can use (:import [org.joda.time DateTime DateTimeZone ReadableInstant])?
13:44yogthosdakrone: there's not breaking api changes in cheshire 5 from 4 right?
13:44dakroneyogthos: from 5 to 4 I think it would be breaking, from 4 to 5 it wouldn't be...
13:44dakroneie, if you were expecting 5.x, 4 wouldn't work, if you were expecting 4.x, 5 will work fine
13:45yogthosdakrone: yeah that's what I meant ;) I'm going to bump lib-noir to the latest
13:46dakroneyogthos: you can bump it, an NS is deprecated though, so it would be good to eventually move to the non-deprecated one
13:47yogthosdakrone: what's NS again?
13:47dakronenamespace
13:47dakroneyogthos: cheshire.custom is deprecated in 5.x
13:47yogthosah yeah I can update not to use it
13:47yogthosif we are :)
13:48yogthoswhat's the new one to use?
13:48yogthoscore?
13:48clojurebotcore is what you put in a namespace when you can't think of a better way to avoid single-segment namespaces.
13:48dakroneyogthos: if you are using add-encoder, use cheshire.generate now, otherwise everything should be in core
13:48technomancy~botsnack
13:48clojurebotThanks, but I prefer chocolate
13:48yogthosok cool
13:49dakroneyogthos: https://github.com/dakrone/cheshire#custom-encoders
13:49dakroneyogthos: and https://github.com/dakrone/cheshire#note-cheshirecustom-has-been-deprecated-in-version-500
13:49tomojclojurebot: api is what you put in a namespace when you can't think of a better way to avoid single-segment namespaces
13:49clojurebotOk.
13:49yogthoscool thanks, yeah only thing lib-noir does is encode json response with it
13:51dnolennice, http://clojurescript.net
13:52yogthosweavejester: still around?
13:52gfredericksdnolen: man someone asked at my talk about cljs-in-cljs and I was like "well I'd be surprised if there were anything in the next few months..."
13:52weavejesteryogthos: Yep
13:53yogthosweavejester: so about the whole route defining, I think there's some value in having syntax which indicates what's happening
13:54yogthosweavejester: like you can just use (def ...) for it, but then things don't jump out at you as easily when reading code
13:54weavejesteryogthos: But surely (def foo (bar …)) is more descriptive than (defbar foo …)
13:54technomancyweavejester: I agree; defroutes is the one thing about compojure that still feels iffy
13:54weavejesterThe former tells you exactly what it does
13:54weavejesterThe latter is very opaque
13:54yogthosthat's true
13:55technomancy(not that you have to use it)
13:55yogthosthe advantage is that you document the intent with the second one
13:55technomancyhuh?
13:55yogthoshmm how to explain :)
13:56technomancythe only advantage of defroutes is that it saves one level of nesting, so it makes it easier to fit things in 80 columns
13:56weavejesterI'm not sure I agree. (def foo (bar …)) is a better indicator of intent - that you want to define a new var
13:56weavejestertechnomancy: yogthos was actually proposing a "defroute"
13:56yogthoshmm I see the other side of it too though
13:56weavejestertechnomancy: i.e. (defroute foo GET "/" [] …) => (def foo (GET "/" [] …))
13:56muhoowait, isn't that a noir thing?
13:57yogthosif you keep to one standard syntax it's easier to tell exactly what it's doing
13:57technomancyweavejester: huh; I see
13:57technomancyI disagree; introducing new syntax obscures what's actually going on
13:58yogthostechnomancy: I agree with that
13:58jweissif 2 threads try to update the value of 2 different keys in a map in a ref, does that cause a collision and retry?
13:58weavejesterI'm generally not a huge fan of macros that define things
13:58technomancyunless it's something that can't be implemented in terms of a function obviously
13:59muhoothe way that noir did route definition via macros made them very difficult to compose and work with
13:59nDuffjweiss: The STM subsystem doesn't know that much about the datastructures behind it.
13:59technomancymuhoo: true, but wasn't that largely because it didn't use vars at all?
13:59technomancyIMO this is more a matter of taste than an actual technical problem
14:00nDuffjweiss: ...if the STM subsystem could DWIM, alter and commute wouldn't be two different things. :)
14:00jweissnDuff: so if i use one huge ref, even if my threads are not trying to update same place inside it at the same time, then it would potentially get a lot of conflicts?
14:00muhooah, it was defpage not defroute.
14:00yogthosweavejester: I definitely appreciate the transparency argument
14:01nDuffjweiss: Yes. That said, there will always be at least one thing succeeding, so it might be worth verifying that you actually have a problem before redesigning to work around it.
14:01jweissi am not really clear on what commute is supposed to be for. the docs for refs seems to assume i already know what it does.
14:02weavejesterjweiss: It's for applying functions where the order doesn't affect the result.
14:02muhootechnomancy: IIRC, defpage was a macro that wrapped around compojure's defroute. it made stuff like this necessary: https://github.com/kenrestivo/crudite/blob/master/src/crudite/core.clj
14:02weavejesterjweiss: e.g. if one thread adds 2 to a counter, and another thread adds 1 to a counter
14:02technomancymuhoo: yikes
14:02weavejesterjweiss: Whichever thread goes first, the same result occurs.
14:02muhoostill gotta rewrite that to use pure compojure. eventually.
14:03jweissweavejester: ah that helps, thanks. i think most of my transactions would be commute, then
14:03jweisssince they are updating different values in the same map, i don't care which one gets updated first.
14:04weavejesterjweiss: It effectively does the same thing as alter, but it's more efficient, because it doesn't have to coordinate order.
14:04weavejesterjweiss: So long as you're sure that two threads won't update the same value
14:05weavejesterBut usually it's for things like counters
14:05weavejester(commute counter inc)
14:05jweissin my case, it's a test harness where multiple threads are running different tests and updating a map of results. two threads won't be running the same test. so should be fine.
14:05weavejesterjweiss: Ah, I see. That should be okay, then.
14:06TimMcNice, that's a use of commute I hadn't considered.
14:06TimMcjweiss: Now go learn about ##(doc ensure)! :-D
14:06lazybot⇒ ------------------------- clojure.core/ensure ([ref]) Must be called in a transaction. Protects the ref from modification by other transactions. Returns the in-transaction-value of ref. Allows for more concurrency than (ref-set ref @ref) nil
14:10jweissTimMc: I'm not sure what that is for either, seems like i wouldn't need it for what i'm doing.
14:11TimMcYeah, I doubt you'd need it.
14:11nDuffjweiss: in that kind of use case, basically all your work will be inside the test itself.
14:11TimMcIt's actually pretty important to know about, though.
14:11nDuffjweiss: ...so, as long as the update at the end of the test is in its own transaction, it's not an issue if that gets retried.
14:12TimMcIf writing to ref B depends on the value of ref A, and you aren't writing to A, you need to call (ensure A).
14:12nDuffjweiss: ...it's if you tried to put the test itself in the transaction that things would be ugly.
14:12TimMcThat prevents some other transaction from sneakily changing A out from under you.
14:13jweissnDuff: right, the test results would be fine that way. i had also considered putting the trace in there too (which would be quite verbose and frequent updates), but i think that might be a bad idea. especially if i have watchers on the ref. i don't want the watcher just doing a no-op because a function got traced.
14:13silasdavisis there a way to clean a leiningen project?
14:13TimMcsilasdavis: lein clean
14:13silasdavisI'm getting errors that don't happen when I copy most of the code into a fresh project
14:14TimMclein 1 or 2?
14:14silasdavis... that's 2 hours I'm never getting back
14:15silasdavisTimMc: thanks
14:15silasdavis2 - it worked
14:17calis_are there any blogging systems written in clojure?
14:20zodiakcalis_, not that I am aware of.. but it sounds like a good learning project ;)
14:21dnolencalis_: there's a Jekyll like thing
14:21ohpauleezand I've seen some blog-like examples for Compojure and the now defunct Noir
14:21ohpauleezbut no formal project
14:22tuorI'm trying to get started with clojure and korma, but I'm getting a CannotAcquireResourceException (see https://www.refheap.com/paste/8622 ). Any ideas?
14:22calis_Yeah, I think there are static page generators, but no commenting systems
14:24thorwilcalis_: i'm *slowly* writing a blogging platform which will include a commenting system. not there, yet
14:27zodiaktuor, that's not a korma error, but rather a c3p0 error that korma relies on for resource pools
14:30tuorThanks zodiak. Where should I look to solve the c3p0 error?
14:31jcrossley3tuor: i might first try ruling out problems with the odbc driver. maybe try h2?
14:32zodiaktuor, sadly, the way I sorted that error when I had it was to jump down to an earlier c3p0 zip
14:32zodiakI think I tried 0.9.0. .. something or other (it was a pet project/sandbox/dev tinker)
14:33tuorjcrossley3, I don't understand reference to "h2". The odbc driver works with a straight connection, but might it not work with c3p0?
14:34tuorzodiak, I will try a different c3p0 version, then. Thanks!
14:34zodiakjcrossley3, long time no see ;)
14:34hiredmantuor: c3p0 can be kind of touchy, it may need tuning
14:35tuorhiredman, that's good to know. I just assumed korma would take care of setting up c3p0.
14:36technomancytuor: the fact that Korma thinks it can take care of setting up c3p0 is one of my biggest annoyances with it.
14:37jcrossley3technomancy: thankfully, i think alexbaranosky is addressing that
14:37technomancyjcrossley3: cool
14:37tuortechnomancy, is there something else you recommend? I am dealing with a legacy read-only database, and I like the idea of composable queries.
14:37technomancytuor: there is no good solution for SQL databases right now in Clojure to the best of my knowledge
14:38technomancyclojure.java.jdbc makes fewer mistakes merely by virtue of being lower-level
14:38technomancybut it's still misguided in a number of disappointing ways
14:38TimMctechnomancy: Hey, have you had occasion to figure out how to manage transactions explicitly in c.j.jdbc?
14:39TimMcspecifically for SQLite
14:39tuortechnomancy, ok. Well, I was using straight SQL before, so I can continue on that road.
14:39technomancyTimMc: no, I think SQLite on the JVM is a lost cause
14:39TimMcD-:
14:39technomancyI couldn't get it working anyway
14:40TimMcI have a project that uses SQLite. :-/
14:40technomancywe are in the process of moving clojars off SQL entirely
14:40TimMcOh right, you're using Lucene.
14:40brehautone of my friends has managed to get SQLite going with clojure + korma. it works, but it keeps running into horrific slowdowns for him
14:41technomancyTimMc: actually more of a mix of Lucene and in-memory atoms now
14:41amalloytechnomancy: you just unveiled some kind of github aws pair-programming thing, didn't you? what are the advantages over just tmuxing into a colleague's computer?
14:41technomancytuor: the most promising thing I've seen in this area is this https://github.com/jkk/honeysql but it's not ready yet
14:42technomancyamalloy: NAT, key management, and user creation/trust mostly.
14:42tuorThanks for the help, technomancy.
14:42technomancyplus you don't have to interrupt the pairing session if you (for instance) move your laptop to a different network or hibernate it
14:43technomancyamalloy: but if you already have a server set up for it and you typically collaborate with the same users then there's no much benefit
14:44technomancyamalloy: but also: the fact that you can implement it in ~400 LOC of clojure =D
14:46TimMctechnomancy: In my case, I mainly read all the data out of the DB, munge it in memory, then spit it back out into a different DB.
14:47technomancyTimMc: you might not hit the same problems I was hitting then. but I'd still never recommend sqlite when there are h2 and derby
14:48technomancynDuff: have you used the xerial JDBC adapter?
14:48nDuff(unclean shutdown / data loss issues, mostly)
14:48nDuff...no, that I haven't.
14:48technomancyok, that's specifically the part that is horrible
14:48technomancysqlite from not-the-JVM is fine
14:48nDuffAhh.
14:48nDuffThat I can believe.
14:49hiredmanderby is very nice
14:51SegFaultAXIs derby something like sqlite3?
14:51technomancyyeah, but it's a pure-java implementation
14:51SegFaultAXOh, that's kinda neat!
14:51SegFaultAXIs it reasonably stable?
14:51hiredmanI imagine derby predates sqlite? not sure
14:52hiredmanhttp://db.apache.org/derby/
14:52SegFaultAXhiredman: Looking at it now.
14:52jweissis it better to declare a record with just fields it will always have, or include even optional fields. or better to assoc in optional fields later?
14:53hiredmanthe in memory datomic transactor seems to embed h2, but I am not very familiar with that
14:58jcrossley3SegFaultAX: h2 is reasonably stable, but often you need to tweak its defaults, so your connection string ends up with a lot of config, e.g. MVCC=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE
14:59SegFaultAXjcrossley3: What is h2? Is that a derby distribution or something?
14:59maewhat does the @ prefix do/
15:00hiredmanI get a postgres vs. mysql vibe from h2 vs. derby
15:00amalloy,'@x
15:00clojurebot(clojure.core/deref x)
15:00jcrossley3SegFaultAX: different projects, similar goals (java rdbms)
15:01technomancyhiredman: which is which?
15:01hiredmantechnomancy: in order above
15:01hiredmanbut I have never used h2 for anything ever
15:02SegFaultAXSo h2 is significantly better in most respects?
15:02technomancyhiredman: but you said derby is actually nice
15:02hiredmansure
15:02hiredmanit is, and it works ok
15:02hiredmanI have no experience with h2
15:03hiredmanit is just sort of a general vibe
15:04maeanother question: with :state in gen-class, can i declare multiple fields?
15:04maei.e. multiple member fields
15:04ebaxtI'm struggling to add a defmethod without restarting the repl, is that not possible?
15:05pbostromfwiw, I worked on a pretty heavyweight Java app a few years ago that was configured to use derby by default, I always thought it worked pretty well
15:07hiredmanlove core.logic? all about list comprehensions? wonder if you should use a list monad? trying embedding a sql database today!
15:08ebaxtNever mind, I forgot to (var dispatch-fn)
15:10TylerEIs it possible to get the la clojure plugin for intellij to do "intelligent" code formating by default, e.g. aligning the test clauses in a cond
15:10TylerEI know that emacs+slime can do that sort of thing, but I'm pretty used to intellij these days
15:13SegFaultAXWhat does the , in ,'@x do? Is that a comment?
15:13maeSegFaultAX: dereferencing
15:13SegFaultAXmae: That's @
15:13maelol
15:13maenm then
15:24llasramSegFaultAX: Looks kind of like someone trying to CL-style unquoting
15:24SegFaultAXllasram: That's what I assumed.
15:27jonasencemerick: My first nrepl middleware: https://github.com/jonase/nrepl-transcript :)
15:27yogthoshiredman: technomancy: question for you guys :) I've got support for a whole bunch of dbs in luminus, would it be better to trim that to some recommended ones
15:28yogthosfor example, between sqlite, derby, and h2, is there one that's generally preferred and recommended over the others
15:28cemerickjonasen: Nice :-)
15:29cemerickjonasen: Did you find the architecture, APIs, etc reasonable to work with?
15:29jonasencemerick: Yes. It was pretty easy.
15:30hiredmanyogthos: I definitely think using sqlite from the jvm is silly
15:31yogthoshiredman: I always use postgres myself, so I have very passing familiarity with the embedded dbs
15:31jonasencemerick: but it's not a particularly complicated middleware either
15:31cemericksure
15:31yogthoshiredman: I'm leaning towards just including h2 or derby, but not really sure which one's better :)
15:32cemerickjonasen: you're capturing stuff off of the transport though, which is the significant departure from e.g. the ring model
15:32technomancyyogthos: maybe nDuff and jcrossley3 could share their experiences
15:33cemerickjcrossley3, tcrawley: BTW, pipes look pretty slick :-)
15:33nDuffNot sure I want to go into the details, but I've had plenty of issues with H2 stores being corrupted on unclean shutdown.
15:34tcrawleycemerick: thanks! I see it as a work-in-progress, but it has potential
15:34jonasencemerick: is that wrong?
15:34yogthosnDuff: that sounds like a bad thing :P
15:34nDuffI'd look into Derby pretty closely if I wanted a JVM-native embedded database right now.
15:34cemerickjonasen: insofar as you want to be capturing output as well as input, no
15:34yogthosnDuff: so sounds like derby would be the winner, and I should probably just cut h2 and sqlite from the list
15:34nDuffSQLite is my goto for that niche in the general case, but I haven't used it from the JVM, so warnings about the quality about the JDBC driver are apropos
15:35cemerickjonasen: If you only cared about e.g. :code, then you wouldn't have to touch the transport
15:35nDuffs/quality about the/quality of the/
15:35yogthosnDuff: I haven't found any issues using sqlite with jdbc, but there seems to be a negative cloud around it here :P
15:35cemericktcrawley: how is data going from stage to stage between nodes? pr/read, java serialization, or other?
15:35yogthosgranted I haven't done anything interesting with it beyond just seeing that it works
15:36tcrawleycemerick: it's using pr/read, yeah. in the docs there's a paragraph about making sure your data is serializable in that fashion
15:36jonasencemerick: ok
15:36UberNerdGirljamii: :P
15:36cemericktcrawley: sorry, I only got far enough to know where to file it mentally for later :-/
15:37tcrawleycemerick: no worries, I wasn't saying RTFM :)
15:37jcrossley3yogthos: i would never use sqlite for anything other than colocated, single-user access. i've not used derby, though i've heard good things about it. i like h2 because its in-memory store is xa-compatible which i need for testing. i probably wouldn't use any of the three in a production app. :)
15:37technomancyyogthos: feel free to peruse the clojars issue tracker if you want background on that particular trail of tears
15:37UberNerdGirljamii: hello stranger :P
15:37yogthostechnomancy: haha
15:37jonasencemerick: next, I'll make a datomic backend so you can query your repl history :)
15:38cemerickjonasen: you should talk to kovas; that's his bag w/ session
15:38yogthosjcrossley3: so sounds like cutting sqlite and leaving h2/derby is probably reasonable then?
15:39jcrossley3yogthos: yes
15:39jonasencemerick: I've worked with kovas on session lately.. that's where I got the idea from.
15:39cemerickah-ha, nm then :-D
15:47TimMcHmm, I should check how hard it would be to use Derby from Python. :-P
16:00CoverSlideisn't hsqldb kind of the new derby?
16:01CoverSlideor h2?
16:05jcrossley3CoverSlide: h2 was a rewrite of Hypersonic, which was renamed HSQLDB, and also has a version 2. hope that helps. :)
16:06CoverSlideyeah i know
16:06CoverSlideoh they mentioned h2
16:07CoverSlidesorry just reading the previous conversation
16:08Bronsahttp://i.imgur.com/GNLQ4.png is this expected behaviour?
16:09TimMcLooks a bug,
16:10amalloyposting a screenshot of text into irc? no, not expected behavior
16:10TimMcWhy'd you post it as a screenshot?
16:10TimMcheh
16:10Bronsabecause i don't want to flood
16:10Bronsaand I'm too lazy to use a nopaste.
16:10amalloyimgur looks like ten times as much work as gist or refheap
16:10amalloybut whatever
16:10TimMcYou have a special app for screenshots?
16:10Bronsai have a command line command, yes
16:11bbloomBronsa: but now we can't copy paste into our repl to verify
16:11Bronsafair enough
16:11TimMcamalloy: Luckily, I have an ascii-art image renderer in Lynx, and if I align it *just* right...
16:11TimMc(I wish.)
16:12Bronsahttp://sprunge.us/JYcB
16:12clojurebotdakrone maintains clj-http
16:13amalloyanyway, i imagine the ^:const causes the compiler to replace the bar symbol with a vector that has compile-time metadata, rather than runtime metadata
16:13amalloybut this is an area i always get wrong, so take that with a grain of salt
16:14Bronsano, it seems like metadata gets simply ignored
16:14Bronsahttps://github.com/Bronsa/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6784-L6785
16:14bbloomBronsa: only when :const ? what about if :dynamic ?
16:14Bronsait might as well be expected behaviour
16:15bbloomdoesn't seem like that should be expected
16:16amalloyBronsa: your link doesn't support your assertion at all as far as i can tell
16:19Bronsaamalloy: it goes through analyzeSeq that finds out the first element is QUOTE
16:19Bronsaparsing the expression as a ConstantExpr
16:19Bronsathat AFAIK ignores metadata
16:19amalloyso? (quote ^:foo []) can have metadata
16:20amalloy&(meta (quote ^:foo [1 2 3]))
16:20lazybot⇒ {:foo true}
16:20Bronsai see
16:33Bronsaoh wait
16:33Bronsathe metadata is there
16:33Bronsauser=> (meta (.getRawRoot #'foo))
16:33Bronsa{:foo true}
16:33TimMcwhaat
16:37Bronsaweird
16:37Bronsahttp://sprunge.us/SUFf
16:47iameduHi! sorry to bother... I am a programmer... who is very interested in functional programming, in particular clojure... I'm reading a book to learn, but I thing in order to truly learn I think I need a little guidance, and maybe a project.. so I'd like to know.. if there's anyone here that could give me a project and perhaps advice... Thank you very much!
16:47brehautiamedu: 4clojure.com
16:48brehautnot a project per se
16:48devniamedu: Use the REPL a lot. It's a fast feedback loop.
16:48brehautbut you'll learn heaps
16:49iameduInteresting I'll give it a try!
16:49nDuff...an environment which makes the REPL easy-to-use is worthwhile also.
16:50iamedunDuff: what do you recommend/
16:50iamedu?
16:50nDuffIf you're looking for a playground/sandbox beyond 4clojure, there's Light Table; if you're willing to invest in climbing a learning curve, emacs+nrepl.el is the gold standard.
16:50nDuff(Personally, I use Emacs Live)
16:51iameduThanks, I think I should learn emacs anyway
16:52amalloyi wouldn't recommend light table yet, really. last i heard about it was someone trying to learn clojure getting tripped by some bug in the current pre-alpha
16:52brehautiamedu: thats like learning to pilot a space shuttle to go get milk from the shop
16:52amalloyjust use any kind of repl. tryclojure is super-easy to use
16:52brehaut(iamedu the emacs bit)
16:53TimMcbrehaut: I wonder how the learning curves compare.
16:54brehauthaha
16:54maehi, to create a voltdb procedure i need to create a declared field which is non-private via gen-class, is this possible? here is the line of code responsible in voltdb for populating sql query information, basically i need some fields to show up in the java reflection api.
16:55maehttps://github.com/VoltDB/voltdb/blob/voltdb-2.8.4.1/src/frontend/org/voltdb/compiler/ProcedureCompiler.java#L81
16:55iameduok.. so small steps I think I'll start with tryclojure and 4clojure for now...
16:55TimMcmae: Wow, that looks like a complete pain.
16:56maeTimMc: yep, i'm like this | | close from patching voltdb for an 'alternate' way of providing the info
16:56TimMcOh god, it's even calling setAccessible.
16:57maei was hoping some gen-class wizard in here
16:57maecould provide me with some magic spells
16:57maeor in lisp-speak spels
16:57maehttp://www.lisperati.com/casting.html
16:57brehautpretty sure magic spells are a scheme thing
16:58TimMcgen-class is a big pile of undocumented features.
16:58maelol sorry forget the lisperati reference, lets focus on the gen-class
16:58mae@TimMc ahh ok so i should read the source for the eh?
16:58maelol
16:58TimMcmae: This may be one of those times.
16:58maekk
16:59llasrammae: I'm fairly certain you can't make non-private members with `gen-class`
16:59TimMcAt least while you wait and see if anyone in the channel happens to know.
16:59llasrammae: It's been a few months since I went spelunking through it to try to understand everything that could be done
16:59llasrammae: but I'm still pretty confident on that one
17:00maei knew there had to be a good reason no one has any examples of this on the net
17:00maeA NEW FRONTIER!
17:01llasramOh right, the `state` member will be public
17:01TimMcmae: As a fallback, you can write a .java file and put it on your project's java-source-path(s).
17:02maeindeed
17:02maei was thinking i could inherit from VoltProcedure in a .java
17:02maeand somehow create a shim
17:02maebut that seems like it might not work
17:03maellasram: i tried using state already, it still didn't seem to show up to the voltdb's compiler
17:04llasramAnd even if it did work, it would be a hideous, hideous hack
17:04yogthosmae: there's a good overview of gen-class on this guy's blog http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html
17:04maellasram: see https://www.refheap.com/paste/8632
17:06llasramOk, so wouldn't be all that hideous, if did work
17:09gfredericksI love how the README for clojure.core.cache says to look at the autogenerated API documentation for more details, and it's virtually blank
17:28gfredericksI'm having an awful time trying to figure out how to use core.cache to do something similar to memoize
17:29hiredmanimmutable caches are weird
17:30Apage43gfredericks: I just used core.memoize
17:30hiredmangfredericks: you make whatever and stick it in an atom
17:30Apage43https://github.com/clojure/core.memoize
17:30hiredmanI think sticking it in an atom is what core.memoize does
17:31gfredericksApage43: maybe my problem was not realizing that was a separate thing
17:31gfredericksApage43: hiredman: thanks :)
17:32Apage43also hiredman is correct about the atom-sticking https://github.com/clojure/core.memoize/blob/master/src/main/clojure/clojure/core/memoize.clj#L125
17:34arohnerI'm trying to used typed-clojure, and I'm getting exceptions in the analyzer
17:34tomojbbloom: what is dispatch-map for?
17:34arohnerfoo already refers to: #'the.ns/foo in namespace: user
17:34tomojoh, I didn't notice the blog post yet
17:34arohnerseems like the analyzer has a problem with (:require [foo :refer (bar)]). Is that a known issue?
17:35loganlinnThere isn't a Compojure equivalent of Rails' `rake routes`, is there?
17:35nDuffloganlinn: What does that do?
17:35loganlinnoutputs all registered routes
17:35loganlinnon command line
17:36brehautloganlinn: i dont think you could feasibly do that in compojure. routes just builds a handler function; they are opaque
17:36loganlinnnDuff: http://guides.rubyonrails.org/routing.html#inspecting-and-testing-routes
17:36weavejesterWe probably need something more restrictive, but also more transparent than Compojure.
17:36nDuffloganlinn: I ask principally to make the point that you were underspecifying.
17:36nDuffs/ask/asked.
17:37technomancyloganlinn: it's usually pretty easy to see all the routes just by hitting "navigate-to-source" on your app
17:37technomancyyou can jump around to all the nested definitions easily if your editor is set up for it
17:37nDuffloganlinn: ...many of us come from route-enabled web frameworks other than rails.
17:38loganlinnyeah, im not really a rails user anyway, I was just curious because I thought it was useful when building a rest api
17:38loganlinnespecially when things are nested within contexts
17:46technomancyweavejester: compojure.core/routes could certainly attach metadata to the handler function it generates
17:46technomancyproblem is you can't look deeper into nested handlers
17:46technomancywell you could with a macro that would walk the body, but that's sketchy
17:47hiredmansounds like you need executable maps
17:47weavejestertechnomancy: Yeah, those were my thoughts too. You might quickly come across instances where it doesn't work.
17:47hiredmanZING!
17:47technomancyhiredman: you mean like cljs source maps?
17:47weavejesterMy thought it to make a more restrictive library that routes off a data structure.
17:48weavejesterSometimes you might need to drop back down to Compojure
17:49weavejesterBut a lot of the time a static routing map would do
17:49yogthosmaking the common case easy is always good :)
17:50technomancyweavejester: I dunno; that sounds a bit like the situation with scheme macros where now you have to understand two separate systems because the simpler one isn't powerful enough.
17:50weavejestertechnomancy: Well, there is that...
17:50technomancymaybe there would be benefits to it, but just being able to programmatically list all routes doesn't seem compelling enough to introduce a new top-level concept
17:51weavejesterMaybe if you make your web apps small enough, it doesn't really matter.
17:51technomancys/benefits/more benefits/
17:51technomancyI'm a strong believer in the power of M-.
17:51brehauttechnomancy: the bigger benefit is that you'd be able to implement route reversal (ie, given a route name, and some args, produce the url to get there)
17:52technomancybrehaut: hm; maybe so
17:52technomancyby "a route name" you really mean a handler?
17:52brehautalthough im not sure that is a benefit yet. its certainly something that people with django experience expect
17:52technomancyor a defroutes var?
17:52brehauttechnomancy: yeah either a handler or a literal name
17:52loganlinnwhen routes are nested, maybe said metadata could be modified to include the new prefix? just an idea. but you're right, I don't think there's a strong enough use-case other than transparency/debugging
17:52weavejesterRoute reversal is really only useful if you want to change your URLs as far as I can see.
17:52hiredmanand according to the w3c, cool urls never change
17:53weavejesterloganlinn: The nested route would need to gather up the metadata of its children.
17:54technomancythe context macro might complicate it further too
17:54brehautweavejester: django users like it because it handles 'include'ing apps routes within a master route and not making the app hardcode the path
17:54technomancyI need to start using that
17:54yogthosI'm still of the opinion that dsl with good naming allows thinking in terms of the problem domain better :)
17:55brehautweavejester: however, the value of django's apps is marginal
17:55brehauti <3 'context
17:55yogthoseven in clojure core we see a lot of that, for example all defn is (fn [params* ] exprs*))
17:55yogthoserr (def name (fn [params* ] exprs*))
17:56yogthosit's a small difference, but important in my opinion
17:57weavejesterI think context could be faster in some cases...
17:57weavejesterCertainly in the case where there are zero parameters
17:58weavejesterAlthough I'd need to check hotspot doesn't already optimise it.
17:58technomancymeasure twice; cut once
17:58brehautyogthos: im weary of things that improve the easy case in exchange for making the hard case harder though
17:58yogthosbrehaut: it's always a balance :)
17:58tmciverweavejester: speaking of context, is one supposed to use hiccup.middleware/wrap-base-url when creating a war via 'lein ring uberwar'? I ran into this problem yesterday and using that middleware was the solution I found.
17:59weavejestertmciver: If you're using Hiccup then it's useful when deploying to a subdirectory.
18:02tmciverweavejester: isn't using context necessary if the app is not at the server root?
18:03weavejestertmciver: What do you mean? context the macro? :context the keyword?
18:05tmciverI'm not actually sure. :/ This is the first time I've deployed a clojure web app to an app server. The problem I had initially was that links on pages were with respect to localhost:8080 rather than localhost:8080/my-app
18:06tmciverUsign wrap-base-url solved the problem. Should I be doing something more sensible?
18:07weavejestertmciver: No, wrap-base-url is a good solution if you're using Hiccup and expect to deploy to a subpath. That's what it's for.
18:07weavejestertmciver: But if you're using some other system you need to use another solution; links don't automatically change.
18:07yogthosthis sort of thing is precisely the motivation for luminus :)
18:08tmciverweavejester: my feeling is that the behavior that wrap-base-url provides is the typical, desired behavior, no?
18:08tmciverDo most people deploy to the server root? I.e., it's the only app on the server?
18:10tmciverI expect to have several clojure web apps running within the same instance of tomcat, in which case they'll all need this behavior.
18:10weavejestertmciver: It depends how you're deploying it. Servlet containers like Tomcat or Jetty tend to have a URL scheme like example.com/app
18:11tmciverweavejester: Yes, where app is the name of the war, correct?
18:11weavejesterYep
18:11yogthostmciver: so each app will have a :context key in the request in that scenario
18:11weavejesterBut if you're say, deploying your app as a standalone app behind nginx, you might have your app running on app.example.com
18:12tmciverweavejester: Initially, I was able to navigate to the start page of my app but all the links did not include the 'app' part and so they failed.
18:12weavejesterCloud deployments, such as to Heroku and AWS beanstalk, also tend to take a app.example.com approach.
18:12yogthosthe real path to the app is :context + :uri
18:12weavejesteryogthos: No!
18:12weavejesteryogthos: The :uri is *always* the URI
18:13yogthosweavejester: well if you're on a standalone your context is null right
18:13weavejesteryogthos: (str (:context request) (:path-info request)) == (:uri request)
18:13yogthosweavejester: ah ok
18:14weavejestertmciver: Links don't automatically change to adhere to the context unless you use something to change them.
18:15tmciverweavejester: something like use wrap-base-url.
18:16tmciverI guess this is what I'm really trying to figure out. It seems to me that you would *always* need to use wrap-base-url.
18:16yogthosI guess wrap-base-url is hiccup specific right?
18:16yogthosso if you used something like enlive it would have to provide its own wrapper right?
18:17weavejesterYes, wrap-base-url is Hiccup specific, and useful if you're deploying to Tomcat or something that uses subpaths
18:17weavejesterThat way you don't have to write your own function to generate the right URLs.
18:17weavejesterBut you don't need it if you're deploying to a subdomain, for instance.
18:17tmciverweavejester: OK, true.
18:18yogthosoh yeah is there any cleaner way to handle context from ajax aside from hidden fields on the page?
18:18weavejesteryogthos: In what way? You can store the data as a variable in Javascript.
18:19yogthosweavejester: contexts really do introduce a lot of gotchas
18:19tmciverweavejester: so if one does not use hiccup and wishes to use tomcat (with subpaths), then they'd have to write their own wrap-base-url like middleware?
18:20weavejestertmciver: Right
18:20weavejestertmciver: For instance, you could write some middleware to add the context to a binding
18:21weavejester(defn wrap-context [handler] (fn [request] (binding [*context* (:context request)] (handler request)))
18:21weavejesterAnd then you could write your URLs as (str *context* "/normal/path")
18:21tmciverweavejester: I seem to recall reading yesterday that mmcgrana wanted to 'try out' the :context, :path-info stuff before putting it into ring-proper?
18:22weavejestertmciver: That was years ago, and it's been tried out in Compojure and lein-ring.
18:22weavejesterRing 1.2.0 will have :context and :path-info support. It seems a tried-and-tested idea by now. Mark agrees, btw.
18:23tmciverweavejester: then will a wrap-base-url middleware also be a part of ring 1.2.0? Seems it should be.
18:24weavejestertmciver: No, because that's Hiccup-specific.
18:24bbloomtomoj: dispatch-map is for when you want multimethod-like behavior, but don't want top level defmethod statements
18:24weavejesterIt might be an idea to add middleware to set a *context* binding, but I'm not certain that's necessary yet.
18:25bbloomtomoj: you can, for example, walk some data structure and compose a dispatch-map
18:26tmciverweavejester: it's hiccup-specific because of the use of *base-url* in hiccup.util/with-base-url?
18:26bbloomtomoj: so it's useful anytime you want pluggable dispatch in a dsl type environment
18:28sundbphi. i'm a bit confused about dynamic vars. example: (binding [*foo* [1 2 3]] (map (fn [x] (prn *foo*)) [1 2 3])) -> prints 1, 1, 1. How come the *foo* in the anonymous function does not inherit the *foo* binding it's defined within?
18:28weavejestertmciver: Yes. I mean, Ring could have some middleware that sets a *context* macro, but as far as I'm aware, no other templating system handles this.
18:28hiredman~map
18:28clojurebotmap is *LAZY*
18:28sundbpsorry, i started with: (def ^:dynamic *foo* 1)
18:28amalloyhah
18:29weavejesterI mean *context* binding (s/macro/binding/)
18:29dnolensundbp: laziness and binding don't really work well together.
18:29amalloysundbp: hiredman's point is that map instantly returns a lazyseq, without evaluating the function at all. then the binding pops, and then your repl realizes the seq in order to print it; at that time, there is no binding
18:29dnolensundbp: you want a (doall ...) around that map.
18:29sundbpdnolen: right - so i need to (doall) got it
18:29sundbpdnolen: ah - there you said it. thanks
18:30sundbpdnolen: works as expected - thanks!
18:30hiredmandnolen: didn't you have some example code using core.logic for parsing?
18:31tmciverweavejester: OK, I think I'm getting it. Seems like this is pretty yucky when deploying to an app server like tomcat (if you're not using hiccup).
18:31weavejestertmciver: Well, it's not as if it requires more than four or five lines of code to fix.
18:33weavejestertmciver: And all frameworks have the same problem. You need to wrap your URLs in something to get the right context path.
18:33tmciverweavejester: but as you said above, in the general case you'd have to have your own wrap-context handler and make sure you used that context when writing all your urls.
18:34weavejestertmciver: Yes, but that's no different to any other system. You need some way of determining whether to rewrite a URL or not. In Ruby on Rails, for instance, I believe you need to use the "url_for" function.
18:35weavejesterMVC.NET takes the approach of rewriting any URL that begins with a "~/", but that approach has its flaws.
18:35weavejesterHiccup rewrites any URI object to have the right prefix, but leaves raw strings alone.
18:36weavejesterAt some point you have to have something to denote that you want this URL to change depending on whether you're running from development or production
18:36weavejesterOr else make sure development and production have the same root.
18:37tmciverweavejester: yes, OK.
18:38tmciverweavejester: I guess you have to know way ahead of time if the app is going to be rooted at a sub-path; to change the app to be rooted at a sub-path after writing it assuming it wouldn't be would be a real pain.
18:39weavejesterI wouldn't say it was hugely difficult to change it
18:54arohneris analyze.core supposed to handle (:require '[foo.core :refer (bar])? It's failing hard for me
19:00arohnerTimMc: ha, thanks, but that's not my problem
19:01arohnerthe analyzer is breaking when seeing (bar) in the ns to be analyzed
19:01TimMcNo problem, paredit gives these to me for free.
19:01arohneras if it's not resolving in the correct ns
19:02amalloyarohner: that's not a valid ns clause
19:02amalloythe ' there makes the whole thing a mess
19:03arohnerfine. (:require [foo.core :refer (bar)])
19:03arohneranalyze still has a problem with that :-p
19:04arohnerlooks like Compiler$analyze calls resolve(), which calls resolveIn(currentNS()...)
19:05arohnerand I don't see a place where analyze.core binds *ns*
19:08hiredmanarohner: becuase it is hard to find an environment where it is not bound
19:08hiredmanall the repls bind it
19:09arohnerhiredman: yes, but the problem is that when trying to analyze 'the.ns, it's calling resolveIn('user) rather than resolveIn('the.ns)
19:09arohnerbecause currentNS wasn't rebound
19:09arohneror rather, *ns*
19:09hiredmanI doubt that
19:10arohnerfine. I have a working repro that disagrees with you
19:11wei_what's a good way to include scala classes compiled with sbt in clojure?
19:12amalloyhiredman: analzye is probably rolling its own compilation based on churning through files and read/eval each form. ie, there's probably no repl setting *ns*. but, i imagine it would have many more errors than just arohner's, if it had forgotten to set that itself
19:12technomancywei_: get it into a maven repo
19:12arohnerI will have a gist in a minute
19:15wei_technomancy: since it's a proprietary library, it should be a local rep. can you vouch for the localrepo plugin? https://github.com/kumarshantanu/lein-localrepo
19:16technomancywei_: yeah, that'd work fine. another alternative is an HTTPS repo or private S3 bucket
19:16technomancythose are better for teams but a bit more work
19:16wei_i see, thanks
19:16technomancyI strongly recommend just OSSing all your libraries; saves a lot of time =)
19:17wei_tell that to my contractee :)
19:17technomancysure; is he on IRC? =)
19:17wei_i would love that as well, since you guys would be able to review my code
19:18technomancynot the scala bits, sorry =P
19:19wei_i may invite him on shortly. i was hired to potentially introduce clojure to the team.. so wish me luck!
19:19technomancycool!
19:19technomancyyou can also significantly reduce your GitHub bill by OSSing all your libs
19:20arohnerhttps://gist.github.com/4534779
19:20wei_oh yeah, definitely
19:20technomancy(this has been protips with technomancy; tune in next time to hear technomancy telling you not to bother with a database and just stick with in-memory atoms)
19:21wei_no plug for datomic?
19:21technomancythat'd be a bit of a double standard, innit?
19:21technomancy"all your libs should be OSS, except the ones you pull in for this proprietary DB thingy"
19:25wei_for end-to-end testing purposes, I'd like to trigger javascript events using clojurescript and check for changes on the backend using clojure. is this possible?
19:31bbloomwei_: it's possible, but it probably isn't easy
19:35wei_seems possible to me as well, but I'm not sure where to start. cemerick: I heard you have done some work on this. is that online somewhere?
19:39bbloomcemerick: who are you talking to?
19:39bbloomoh he left
19:50frozenlockSomeone once gave me a link to a video explaining defmethod, deftype, defprotocol... The first examples were about smaps of shapes (triangle, square, circle). Unfortunately I formatted and lost the link. Anybody has it available? I would really appreciate :)
19:50bbloomfrozenlock: don't have a link, but have you tried the keyword phrase "solving the expression problem with clojure" ? i think that might have been it
19:53frozenlockHmm that gives me a talk by chouser. Not what I was looking for, but I'll gladly watch it, thanks :)
20:13hadronzooHow can one discover the protocols implemented by a given Clojure data type, like a PersistentList?
20:15TimMcOh, awesome! Clojars exposes an rsync daemon.
20:21brainproxytyyyyyyy6
20:22bbloomi forget how much it sucks working with java types that don't have sane string representations
20:43frozenlockI found the video I was searching, if anyone is interested :http://vimeo.com/53223938 (polymorphism in clojure)
20:46frozenlock#clojure really is quiet for a weekday. Is there a special holiday I should know about?
20:46technomancyI'm assuming everyone's busy testing the Leiningen release candidate
20:47frozenlocktechnomancy: Of course, silly me.
20:47cemerickwei_: yes, I've done some work in that direction, but nothing to publicize yet
20:47TimMcaka Leiningen Release Candidate Testing Day, a mandatory federal holiday
20:47TimMc(in all countries)
21:02djwonktechnomancy: I would be testing but I don't want to REPLicate what other people are doing
21:07mthvedtgiven a symbol 'bar and some namespace foo.core, is there a clojure function that yields 'foo.core/bar
21:11dmacmthvedt: the symbol function will do that
21:11amalloywell, sorta
21:11devn中国人的需求Clojure的书籍阅读。
21:12amalloyabsurdly, the two-arity body of symbol requires both arguments to be strings - it won't take symbols
21:13bbloomamalloy: that drives me nuts, especially considering ##(symbol 'foo) works fine
21:13lazybot⇒ foo
21:14mthvedtthanks
21:31therealadamso I wanted to play with algo.monads, but I can't figure out how one gets a repl with that library loaded
21:31therealadamis the easiest way to create a one-off lein project and add a dep?
21:31amalloyyes
21:32amalloyto do anything with clojure, step 1 is a lein project (step 0 being to identify what you want to do)
21:33frozenlockIsn't there something written by cemerick to load libraries on-the-fly? (In case one doesn't want to one-off lein project)
21:33amalloyyes, pomegranate does a reasonable job of it. but i really can't imagine having such an aversion to creating a few files on disk
21:34therealadamamalloy: cool. so how do I figure out the way to specify a contrib library as a dep?
21:34therealadamI cloned the algo.monad repo and....can't figure out how it builds
21:34amalloydon't build it
21:34amalloy(or clone it)
21:34therealadamyeah :)
21:35amalloy$latest org.clojure/algo.monads
21:35lazybotNo project by this name exists on clojars.
21:35amalloyugh
21:35technomancytherealadam: heya
21:35therealadamtechnomancy: eyah
21:35technomancyno one's written up some good tooling around doing that via pomegranate yet, so you should probably just do `lein new scratch`
21:36amalloytherealadam: your project.clj wants to include [org.clojure/algo.monads "0.1.2"] probably
21:36amalloyi'm off though, so if that doesn't work then bug someone else
21:37therealadamyeah, looks like maven can't find that dep
21:38therealadamthanks amalloy_!
21:38frozenlocktherealadam: Maven or Lein?
21:39frozenlockOnce you have added a dependency in your project file, you should save it and call 'lein deps' on the shell. This will download the jar.
21:40frozenlock(unless the new Leiningen does something magical)
21:40therealadamtop of stack race is a maven stack frame
21:42frozenlockorg.clojure/algo.monads doesn't show up in my clojars search... perhaps you could try [org.clojars.mccraigmccraig/algo.monads "0.1.3-SNAPSHOT"] ?
21:42frozenlockFirst time getting a REPL up and running is a bitch :)
21:43jgermanis there an option to leiningen to get it to give more verbose output? I saw a reference to a DEBUG env variable but not what it's supposed to be set to
21:44therealadamawesome, that worked
21:44therealadamthanks frozenlock
21:44frozenlocknp :)
21:44therealadamtechnomancy: also, thanks for leiningen. as you may be aware, it is orders of magnitude less rage-inducing than sbt.
21:44frozenlocktherealadam: btw, what are you using as a repl interface?
21:46frozenlockI would have rage quitted the first time I tried clojure weren't it for Leiningen.
21:46frozenlockWell I did, but I came back the next day :p
21:46therealadam`lein repl` or `lein vimclojure :repl true`
21:46frozenlockOh, Vim user...
21:49frozenlockYeah.. I'm not really honest with myself on this anyway, I've never tried Vim.
21:50therealadamit's a thing
21:52darrickwHey, I've run into an odd problem with Clojure initialization (I think) from a JRuby app, wondering if anyone here might be able to help.
21:55darrickwI googled it and someone said they solved it by " calling clojure.main once before using clojure.lang.Compiler.load(commands)." but that makes no sense to me...
21:55darrickwIt's at https://groups.google.com/forum/?fromgroups=#!topic/datomic/walERveqEuo
22:00bprwhat branch does nrepl.el want to receive pull-requests on?
22:01brehautdarrickw: i was under the impression that you want to use clojure.lang.RT (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java)
22:02brehautdarrickw: probably RT.var and RT.invoke
22:03technomancytherealadam: glad it's working for you =)
22:03darrickwbrehaut: I'm doing the following 2 lines:
22:03darrickw String str = "(ns g (:require mcfly.graph))";
22:03darrickw Compiler.load(new StringReader(str));
22:04brehautdarrickw: you are trying to muck about with the compiler directly, rather than using the runtime
22:04technomancytherealadam: if you haven't sunk much time into vimclojure yet I'd recommend taking a look at the foreplay lib
22:04technomancysupposedly a lot more solid repl interaction for vim
22:05therealadamI've heard good things. Right now vimclojure is fine for tinkering, but I'm going to try foreplay if I find the need to tear that part of my config down.
22:05brehautdarrickw: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L331-L333
22:06brehautdarrickw: there are (turns out) functions on RT for loading scripts etc
22:06brehautdarrickw: and to compile files
22:07darrickwI am using RT.var everywhere, but how do I get it to 'require my namespace?
22:09hiredmanRT.var("clojure.core", "require").invoke(Symbol.intern(null, "my.ns")); or something
22:09brehaut(.invoke (clojure.lang.RT/var "clojure.core" "require") (.invoke (clojure.lang.RT/var "clojure.core" "symbol") "clojure.set"))
22:09brehautoh. hiredman has a smarter way to get a symbol
22:09darrickwoh yeah, that *does* make sense... :)
22:09hiredmanmeh
22:09hiredmanI like brehaut's
22:10hiredmanhaving a symbol creating method in RT would be nice
22:10brehautdarrickw: you can obviously grab hold of symbol and require as class statics
22:10darrickwI'm going to give this a try right now...
22:11brehautthere was a nice mini presentation somewhere by rhickey that showed how they do this with the datomic API
22:11brehautif only datomic were OSS
22:11eggheadya brehaut
22:11eggheadhttp://skillsmatter.com/podcast/scala/impromptu-rich-hickey-lightning-talk
22:11brehautthats the one, thanks egghead
22:11darrickwThat's what I was going off of, but I don't recall him going into great detail...
22:13darrickwOk, thanks, that worked!
22:15darrickwoh, interesting, he's doing "private static final Var EVERYTHING = RT.var(...)"
22:22frozenlockIs it possible to have multiple client connected to the same repl?
23:07tomojif a paper says "requires rank 2 polymorphism" or "requires rank 3 polymorphism", should one pretty much give up hope porting the ideas to clojure? :(
23:09echo-areaIs `iterate' supposed to turn an iteration with side-effect into a side-effect free one?
23:10echo-areaTo turn an imperative iteration into a functional one, I mean
23:11TimMcfrozenlock: I believe nrepl is designed to support that...
23:11TimMcMore commonly, you run a REPL under screen or tmux. :-)
23:14TimMcecho-area: Not exactly, no.
23:16TimMcecho-area: That's one way you can use it, though.
23:17TimMcI usually think of imperative loops as having multiple state variables, and iterate isn't quite as convenient under those circumstances.
23:18echo-areaWhat do you do in such circumstances?
23:21TimMcloop/recur
23:23TimMcRecall that iterate gives you a series of intermediate values -- it doesn't have any notion of when to stop.
23:23TimMcIf you know that you're going to iterate a set numbre of times, that's al well and good. Otherwise, you'll need take-while or whatever it's called.
23:32DigitalJackI just realized there is going to be a clojure conference where I live! (clojure/west) That is awesome!
23:38echo-areaTimMc: Writing in this context functionally makes the function itself longer and harder to understand
23:39echo-areaSo maybe I should not commit to functional style everywhere
23:39echo-areaAlways choose the one simpler is the idea.
23:39TimMcIf you have multiple state variables, loop/recur is pretty nice.
23:39TimMcIt's imperative style, but you can embed it in a functional context.
23:41echo-areaYeah. Restricting to functional style here only makes it a bit complex