#clojure logs

2013-12-05

00:00sm0keit seems i have to convert it to (foo ClassName. (into-array Object ["aa" "bb"]))
00:00murtaza52I have multiple keys on my system now, which gpg key does it use ?
00:01sm0kewtf! how do people write interop!!
00:01arrdemsm0ke: yeah the 2nd one is fine, what of it?
00:01sm0keoh i meant .foo
00:01sm0kearrdem: why do i have to call it like that?
00:02arrdemsm0ke: because your java function is vardic, which really means that Java internally builds an array for one "real" argument.
00:03sm0kehmm this has come down to compiler internals i see
00:04arrdemsm0ke: ... yeah you're trying to do interop. that's gonna happen.
00:04arrdemsorry there isn't much we can do to clean it up :/
00:05sm0kehmm its weird that clojure allown (doseq) on primitive arrays oob
00:05technomancymurtaza52: yes, your password is wrong.
00:05sm0kebut refuses to support varargs synactic suagr
00:05technomancywhich key is chosen is up to gpg; `lein help gpg` might explain that, but it's not causing this failure
00:06arrdemsm0ke: see compier internals. raw arrays are ISeq, that totally works. Java built your method to a silly signature, not our fault.
00:07arrdemor rather you gave your method a silly signature and javac did as it was bid
00:09sm0keraw arrays are ISeq
00:09sm0kewhat else i Iseq
00:09sm0keis Collection ISeq too?
00:09sm0keWhat i Iseq anyway
00:10amalloyraw arrays are not ISeq. that would be impossible
00:10sm0keWhat!
00:10sm0keyou ust said they were
00:10amalloythey're seqable, but the compiler can't add new interfaces to them
00:10arrdemamalloy: thanks for the correction.
00:10sm0keoh similar names
00:10arrdemamalloy: I was just thinking that would be pretty similar
00:10arrdem*silly
00:11amalloywell, it would be great, it's just impossible
00:11murtaza52technomancy: which password my gpg or clojars ?
00:11sm0kei guess ISeq must be something which supports cons
00:13sm0keWouldnt it had make sense if we had [
00:13sm0kesorry
00:13sm0ke[String & Object] as valid def in gen-class
00:14murtaza52technomancy: I am signing in clojars using the same user/pass and it is working. I am also able to successfully enter my passphrase for both my ssh and gpg. So which one could be wrong ?
00:16murtaza52I created a new gpg key, updated it on clojars, and specified it in my profiles.clj. Its using it, but still failing.
00:16sm0keor may be we can have simply 'varargs' aliased to "[Ljava.lang.Object;"
00:16sm0kewe do have 'void'
00:16murtaza52How can I debug which password is causing the problem ?
00:18murtaza52technomancy: when I enter a wrong password for clojars I get this error - ReasonPhrase: Unauthorized.
00:19murtaza52The one I am getting right now is ReasonPhrase: Forbidden.
00:19sm0keanyhow, i see its unecessary, if i am trying to support java methods with varargs i can write a java class with varargs in my clojure project and have varargs convert to Collections
00:20logic_progI'm using clojurescript repl. Web server is localhost:3000, clojurescript brepl server is localhost:3002. Is there anyway to tell chrome "dude, allow localhost:3002's iframe to access localhost:3000's page" ?
00:20sm0kefking synactic sugar for imperative langs are nothing but nuisance
00:21logic_progsm0ke: except for APL, where the syntax is the language
00:21sm0kelogic_prog: access-control-allow-origin: * ?
00:21logic_progsm0ke: interesting, reading http://stackoverflow.com/questions/5008944/how-to-add-an-access-control-allow-origin-header now
00:22SegFaultAXDon't use *
00:22SegFaultAXBe explicit about what hosts you care to respond to.
00:22sm0keyep you can use comma seperate domains
00:36logic_prog :headers {"Content-Type" "text/html; charset=utf-8" "Access-Control-Allow-Origin" "http://localhost:3002/"}
00:36logic_progis that basically what I want in my compojure/ring response?
00:37sm0kelogic_prog: well you can try
00:38sm0kelogic_prog: did you say you were trying open 3002 as iframe in 3000?
00:38logic_progsm0ke: trying
00:38sm0kehmm actually, you dont need cross origing for iframe :P
00:38sm0keif i am not wrong
00:38sm0kewhat error were you getting
00:39sm0kecan you hit ctrl-shift-j to inspect?
00:41logic_progi'm using chrome, not firefox
00:41logic_progat the moment, I can't even (js/alert ...) anymore, so I must have broken something
00:41sm0kectrl-shift-j works in chrome too
00:42logic_progalright
00:42logic_progI have the developer console
00:43logic_progelements / resources / network / sources / timeline / profiles / audits/ console
00:43logic_progwhere do I check for the http headers?
00:44sm0keon network
00:44sm0keclick the request for which you want to see headers
00:44sm0kewth.. can you first tell what the error is under console?
00:45logic_progAccess-Control-Allow-Origin:http://localhost:3002 <-- I see this in one of the two
00:45logic_progsure
00:45logic_proglet me restart few things, many things just broke
00:46danenaniais there an idiomatic way to take a sequence of symbols like (symbol1 symbol2 symbol3) and turn it into a hash-map like {:symbol1 symbol1 :symbol2 symbol2 :symbol3 symbol3}
00:46danenaniawithout writing out the keys?
00:46logic_prog(into {} (map #(vector (keyword %) %) ... )) ?
00:47rasmustoare they quoted symbols?
00:47arrdem,(into {} ((juxt (comp name keyword) identity) ['x 'y 'z]))
00:47clojurebot#<NullPointerException java.lang.NullPointerException>
00:48danenaniaok, will have to define my own i think
00:48rasmustoarrdem: missing a map?
00:48arrdemwe should have a clojurebot shootout night... who can quickdraw the most map/filter/juxt/into solutions :P
00:49arrdemrasmusto: lil bit
00:49arrdemI'd loose but it'd be fun
00:49sm0ke,(into {} (map #(vector (keyword %) %) '(a b c)))
00:49clojurebot{:a a, :b b, :c c}
00:49sm0kelogic_prog: well done
00:49rasmusto,(into {} (map (juxt keyword identity) ['x 'y 'z]))
00:49clojurebot{:x x, :y y, :z z}
00:49danenanianope, not quoted
00:49danenaniajust find myself assembling hash-maps like that alot for keyword argument passing
00:49logic_progsm0ke: if only cljs was as easy, lol
00:50rasmustodanenania: I build up maps like that manaually for the most part
00:50arrdemdanenania: there's (let [{:keys [foo bar baz]} ...] ... )
00:50rasmustoand I save space by destructuring them afterwards using {:keys [a b c]}
00:50sm0keguys i dont seem to be able to call https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging.clj#L70 like (log "namespace" :info "something")
00:51sm0kewhat does the logger-ns accepts?
00:51danenaniarasumusto: yeah that's what i've been doing as well... just getting greedy and trying to save a few more keystrokes :)
00:51sm0kei mean what is logger-ns , it surely is not a string
00:52rasmustodanenania: actually, I think I tried to write a macro or something to do it and it got really confusing. You should avoid quoted symbols IMO
00:54danenaniayeah probably not worth it
00:58logic_progsm0ke: cljs.user> js/parent "Error evaluating:" js/parent :as "" #<SecurityError: Blocked a frame with origin "http://localhost:3002&quot; from accessing a cross-origin frame.> Error: Blocked a frame with origin "http://localhost:3002&quot; from accessing a cross-origin frame.
00:58logic_proghttps://gist.github.com/anonymous/7800751
01:01sm0kelogic_prog: can you try plain * for header
01:01sm0kespecific domain can be reworked later
01:04danenaniahere's what i ended up with:
01:04danenania(defn identity-map [syms] (into {} (map #(vector (keyword %) (eval %)) syms)))
01:04logic_progsm0ke let me try
01:06rasmustodanenania: looks good, the only thing now is you have to manage a collection of quoted symbols :)
01:07danenaniarasmusto: well assuming they're in context, i can just do (identity-map '(a b c))
01:07danenanianot too bad
01:08rasmustodanenania: but that quote!
01:08danenaniahaha, can't have everything i suppose
01:09arrdemrasmusto: he could use a macro...
01:09rasmustoyeah, I guess the macro would let you drop the quote
01:11glosoliRunning into some weird problems with Enlive https://www.refheap.com/0788fd13a47504aa9f7593bed it does not seem to be able to select :script element by my custom :data-defer attribute, though if I rename that attr to class and check for some class name it works
01:11glosoliAny ideas ?
01:16sm0kewtf, https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/impl.clj#L161 logger-ns has to be a string
01:16sm0keugh, clojure stack trace fail again
01:16sm0kei get this for an error => (log/log "ns" :info "ddddddd")
01:16sm0keIllegalArgumentException ns clojure.tools.logging/eval130/fn--131 (misc.clj:6)
01:19logic_progsm0ke: hmm, still same error, even with Access-Control-Allow-Origin: *
01:23sm0kelogic_prog: can you try some other browsers too?
01:43kristofAre common lisp channels mutable data structures?
01:44kristofAnd are the reading and writing operations on them destructive?
01:49andyfkristof: Do you mean the Common Lisp library called ChanL? I wasn't aware that the Common Lisp standard had something called channels.
01:51bitemyappandyf: https://github.com/sykopomp/chanl
01:51bitemyappoh, yes, sorry
01:51bitemyappwell now eother people can look at it.
01:51kristofandyf: I'm sorry, I actually meant Clojure channels in core.async
01:52kristofandyf: I'm secretly planning to port some of that juicy stuff over to CL but if I declare anything now it should be considered vaporware.
01:53andyfkristof: I am no authority on the matter, but I have a hard time imagining a sense in which a core.async channel could be considered an immutable data structure.
01:54kristofSeems sort of counter to Clojure philosophy to have something that can be bashed upon so easily
01:54nopromptwent to update npm with npm update -g npm. it failed and now i don't have npm anymore.
01:54nopromptthe javascript life story right there.
01:54kristofandyf: But I was reading some of swannodette's (sp?) blog posts and it was pure magic.
01:54andyfkristof: Clojure is not Haskell
01:54kristofOh, I'm certainly aware
01:55kristofBut Clojure still tries to make bashing atomic and guaranteed, with STM
01:55andyfMutability is embraced, when needed, or just plain old useful
01:55kristofat least when it's a shared resource
01:55kristofand atoms and actors are not meant to be shared resources so they do not count
01:55andyfHow are atoms not meant to be shared resources?
01:56kristofNot meant to be modified by a lot of different things, I suppose
01:56nopromptkristof: the clojure focus is power, simplicity, and focus; how do channels/atoms and their usage conflict with that philosophy?
01:57noprompt*the clojure philosophy
01:58kristofnoprompt: Atoms *don't*, channels seem to. Atoms are not meant to be coordinated with...
01:58kristofwell, I suppose data in channels don't, either, do they?
01:58nopromptkristof: nope. :)
01:58kristofnoprompt: See, I was looking at channels like an unsafe kind of ref
01:59nopromptkristof: how are they unsafe?
01:59kristofunsafe in the sense that stuff can pop things off of the queue and put them on whenever, however
01:59nopromptthat's the whole point.
02:00kristofOf course! I understood that, but it felt kind of weird because I was thinking of stm too much
02:00kristofBut there's no coordination in channel usage, unlike in stm usage; in fact, THAT'S the whole point
02:00kristof"just do whatever, whenever"
02:00nopromptand it's not if i'm my code is suddenly going to start putting dog food on my channels.
02:00kristofright
02:01kristofI'm still slightly bedazzled by core.async, especially after having used javascript and thinking in terms of block block block
02:01noprompton the client side i have no beef with core.async. i'll take dog food on channel over callbacks any day of the week.
02:02nopromptkristof: yes core.async is *very* nice client side.
02:04kristofnoprompt: And what about futures? They've enamored some people.
02:04kristofBut not swannodette.
02:04nopromptkristof: futures are cool server side. i made heavy use of them with a huge database migration i had to do earlier this year.
02:05nopromptkristof: nowadays i'd probably use core.async.
02:07nopromptso far 2 out of the 3 node based cli apps have had some sort of wacky design flaw.
02:08kristofnoprompt: What's the disadvantage of using a future over a go block?
02:09nopromptkristof: i don't know.
02:09kristofHm. Alright.
02:09kristofnoprompt: Eventually I'm going to need to find out how the different coroutines are multiplexed onto one thread. That might be... fun? :/
02:10nopromptkristof: you don't have to add a dependency on core.asyn in your project.clj i guess? i'm sure there's a better answer.
02:10nopromptkristof: sounds like it might be. i'm pretty much hands off in that area.
02:10nopromptkristof: i'm one of the "stayed for the data structures" guys.
02:11kristofCan't remember who said that
02:11kristofMaybe it was in a hickey talk?
02:11nopromptwell that and having to put up with a minimum amount of bullshit from a programming language.
02:11noprompti've used clojure for a year solid now and still the only thing that bugs me is stack traces.
02:11noprompteverything else is pretty nice.
02:18nopromptgetting sick is stupid.
02:19nopromptwho came up with that idea?
02:19arohnerbitemyapp: sorry, I missed what you said
02:19arohnerthe irc client popped something up, but I disconnected & reconnected, or something
02:25bitemyapparohner: oh I've wanted to do the same thing you wanted, I called it "draining" channels. Anyway, just wanted to know if the "repeatedly" solution guns recommended worked for you.
02:26bitemyapparohner: you wanted to get multiple items from a channel.
02:26arohnerright. what did you suggest w/ repeatedly?
02:26bitemyappa discrete number perhaps.
02:27bitemyapp15:48 < gfredericks> would also be easy given a (defn ch->seq [ch] (->> (repeatedly #(async/<!! ch)) (take-while (complement nil?)))
02:27bitemyappblocking take looks like.
02:27arohnercool, I'll try that
02:27arohnerty
02:29bitemyapparohner: guns provided an initial naive solution, gfredericks refined it.
02:31jph-newbie question - how do i select-keys on a list of maps?
02:32jph-i see filter, and select-keys, but how would i use them together?
02:32rasmustojph-: make a function that uses select-keys
02:32jph-what args would it take?
02:33jph-the function
02:33rasmusto(map #(select-keys % [:a :b :c]) my-list-of-maps)
02:33rasmustojph-: just one, the map that you're pulling keys out of
02:33jph-lemme try that on for size
02:33rasmustojph-: check the argument order, I can't remember if the map or the keyseq comes first
02:34jph-that works
02:34jph-how would i filter based on key val?
02:34jph-ie (= val something)
02:34bitemyapparohner: you really need a persistent IRC session that you can rejoin
02:35arohnermeh. http://clojure-log.n01se.net/ is usually good enough
02:35arohnerfor some reason the logs cut off today though
02:35bitemyappfair.
02:35rasmustoyou can just use (filter #(= (:a %) val) coll)
02:35Rayneslogs.lazybot.org
02:35arohnerI really don't have the time to mess with irc sessions these days
02:36rasmustojph-: you don't necessarily need the select-keys in this case, or you could do if after if you really want to cut the other ones out
02:36jph-rasmusto: you're my hero
02:36jph-cheers
02:36jph-im just learning all the ways to use these functions together
02:36arohnerRaynes: cool!
02:36jph-rasmusto: thank you for help
02:36RaynesThis log viewer is built-in to lazybot courtesy of aphyr (Kyle Kingsbury of Jepsen fame).
02:37rasmustojph-: destructuring would be cool too: (filter (fn [{:keys [a b]}] (= [a b] [vala valb])) coll)
02:37noprompt(inc bbloom)
02:37lazybot⇒ 19
02:37jph-rasmusto: i'll write that down and see what it does
02:37jph-is that to filter out
02:37jph-?
02:37jph-or just another approach to filtering based on val?
02:38rasmustodestructuring can be applied anywhere you take a collection as a function argument or let binding, it works in this case becasue you are filtering a collection of maps
02:41jph-is there a repl trick to automatically (use) something on repl start?
02:41jph-in my lein config maybe?
02:42jph-nm i think ive found it
02:44dbusnenkoyes
02:45dbusnenkodid you read "Worflow reloaded" by Sierra?
02:45dbusnenkohe describes that
02:46nopromptjph-: you can create are user.clj file in something like a ./dev folder and add that to your [:profiles :dev :source-paths]
02:46jph-i just want to avoid having to (use) on repl startup
02:46jph-for some common libs i load
02:46jph-i can put deps in ~/.lein/profiles.clj
03:05logic_prog_is there a linux tool that can merge the outputs of two stdouts? for example, I'd like a single window to contain the output of "lein cljsbuild auto" and "lein run main" -- both of them dump output messages, and I want both stdouts/stderrs to be in the same window (rather than take up two separte windows)
03:09amalloylogic_prog: cat
03:09amalloyor tail, i suppose, if you want them interleaved
03:09logic_prog_doesn't cat only handle files?
03:09amalloyeverything is a file
03:10amalloy$ tail -f <(lein foo) <(lein bar)
03:10amalloy$ tail -f <(lein foo 2>&1) <(lein bar 2>&1) ## since you want stderr as well
03:10logic_prog_no fucking way
03:10logic_prog_this is balck magic
03:11amalloylogic_prog_: worked?
03:12logic_prog_not in zsh
03:12logic_prog_trying bash
03:12RaynesBut the prompts!
03:15amalloytail -fq, if you want to suppress the fairly-useless headers
03:16logic_prog_this is weird
03:16logic_prog_tail -f (ls 2>&1) works
03:16sm0kewtf i ahve :aot on a ns and also :gen-class in the definition still no class is getting generated on lein compile
03:16logic_prog_but tail -f (lein cljsbuild once 2>&1) just hangs
03:16amalloyyou forgot the <
03:17logic_prog_amalloy: you are right
03:19sm0kewtf in lein :pre-tasks has to be [["compile"] "javac"] instead of ["compile" "javac"]
03:45hitekihi there
03:48ucbhey hiteki
04:50bitemyapphttp://alexott.net/en/fp/books/
04:53ucbbitemyapp: !
04:53bitemyappucb: about to sleep, anything before I go?
04:54bitemyappucb: http://russiancircles.bandcamp.com/album/memorial
04:54ucbbitemyapp: nothing, just hi and good night :)
04:54bitemyappucb: hi, good night. Let me know how you like the new Russian Circles album
04:54ucbwill do
04:54bitemyappucb: check out those FP books, it's a fantastic list.
04:54bitemyappone of the best I've found.
04:54ucbyeah, reading
04:56jarodzz,(+ 1 1)
04:56clojurebot2
05:19xificurCI just installed cider on emacs via el-get and when I try to run it I get `cannot open load file: nrepl/cider', any ideas whats wrong?
05:20xificurCI see the folder ~/.emacs.d/el-get/nrepl/ and I have cider.el as well as cider.elc
05:22logic_prog_with optimizations: none, how do I get goog.base installed?
05:22logic_prog_in cljs, when building with optimiations: advanced or optimizations: whitespace, the necessary goog closure files are compiled in
05:23logic_prog_with optimiations: none, I appear to need to somehow provide the goog.closure libraries
05:23logic_prog_where do I get those libraries?
05:41bozhidarbrainproxy: btw, I'm prelude's author. Glad to hear you like it :-)
05:45bozhidarI got a bit late to participate in the smartparens/paredit discussion, though. Maybe next time...
06:02FenderA new day, a new question. Today:
06:02Fender, (hash #"asd")
06:02clojurebot30128182
06:02Fender(hash #"asd")
06:02Fender, (hash #"asd")
06:02clojurebot12613946
06:02amalloyregexes don't have meaningful hashes or equality comparisons
06:02Fender:(
06:02amalloyyeah, bummer, i know
06:03amalloyblame java
06:03Fenderhehe
06:03Fenderso to use regex in hashmaps, I'd ahve to instantiate exactly one regex and always refer to it indirectly
06:04amalloyor use its string representation as the key instead
06:04hyPiRionblame java on regex equality? Wat.
06:04Fenderhmmm, is there a way to obtain the string from a regex?
06:05Fenderor do I have to re-pattern every string?
06:05amalloy&(str #"foo")
06:05lazybot⇒ "foo"
06:05amalloy&(str #"foo\*")
06:05lazybot⇒ "foo\\*"
06:05hyPiRion,(.toString #"foo\*")
06:05clojurebot"foo\\*"
06:05amalloy.toString? heretic!
06:06hyPiRion(heretic! hyPiRion true) ; ?
06:06Fenderstr!!! stupid me
06:09Fenderactually, I gotta admit, I also tried .toString first -.-
06:09Fenderwell, thanks for the help
06:26sm0ke why doesnt this work? ##((symbol "inc") 0)
06:26lazybot⇒ nil
06:26hyPiRionbecause that's a symbol, not a function
06:27hyPiRion,((-> "inc" symbol resolve) 0)
06:27clojurebot1
06:27sm0ke,inc
06:27clojurebot#<core$inc clojure.core$inc@822930>
06:28sm0kehmm shouldnt a symbol resolve by itself?
06:28sm0ke,(resolve 'inc)
06:28clojurebot#'clojure.core/inc
06:29sm0kenot i guess
06:30hyPiRionif it did, it would be hard to make macros and programs writing programs
06:30hyPiRion,`(~inc 0)
06:30clojurebot(#<core$inc clojure.core$inc@822930> 0)
06:30hyPiRion^ not possible to read back in
06:30sm0ke,(eval `(~inc 0))
06:30clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
06:31sm0kei see the point
06:31hyPiRionsm0ke: as in, write to file and read back
06:31hyPiRion,(read-string (str `(~inc 0)))
06:31clojurebot#<RuntimeException java.lang.RuntimeException: Unreadable form>
06:32sm0ke,`(inc 0)
06:32clojurebot(clojure.core/inc 0)
06:32sm0kewould you really need a ~ there?
06:33hyPiRionno, but that would've happened if the symbol resolved to a function
06:33hyPiRionby default
06:34sm0kealso what is *ns*?
06:34sm0keif i have a namespace ns1 which call a functon in ns2 which does (prn *ns*) what namespace would that be?
06:36ucb"And after a while we began to take their complaints seriously. We began to feel as if we really were responsible And disciples saith (below free (if (< n d) n (remainder (- n d) d))) We can thus make a factorial subroutine that returns to the entry point" -- http://kingjamesprogramming.tumblr.com/
06:36sm0kethats a stupid question i suppose
06:36ucbsorry, couldn't resist.
06:36hyPiRion,(:meta #'*ns*)
06:36clojurebotnil
06:36hyPiRionwhops
06:36hyPiRion,(meta #'*ns*)
06:36clojurebot{:ns #<Namespace clojure.core>, :name *ns*, :added "1.0", :doc "A clojure.lang.Namespace object representing the current namespace.", :tag clojure.lang.Namespace}
06:36hyPiRion,(:dynamic (meta #'*ns*))
06:36clojurebotnil
06:40Apage43sm0ke: oh, your symbol thing earler
06:40Apage43symbols act like fns, but not the way you're thinking
06:40Apage43they act like keywords ##((symbol "foo") {'foo :bar})
06:40lazybot⇒ :bar
06:42sm0ke,('foo {'foo :bar})
06:42clojurebot:bar
06:42hyPiRionyeah, implements ifn
06:42sm0keyep i see your point
06:43Apage43whereas vars call their referenced thing
06:43Apage43,(#'inc 1)
06:43clojurebot2
06:43Apage43when used as a fn
06:43sm0kewhat is #'inc what is that?
06:44Apage43#'inc is shorthand for (resolve 'inc)
06:44sm0keaha
06:44Apage43which returns a var
06:44Apage43,(type #'inc)
06:44clojurebotclojure.lang.Var
06:44sm0keso coming to original form ##(#(symbol "inc") 0) ; should work
06:44lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox5671$eval40180$fn
06:44Apage43# is pretty weird
06:45Apage43#' is (resolve 'foo)
06:45Apage43but #(foo) is (fn [] (foo))
06:45sm0keoh yes
06:45Apage43and #"" is shorthand for regexes =P
06:45Apage43,(type #"foo")
06:45clojurebotjava.util.regex.Pattern
06:46sm0kethat is correct too
06:46sm0ke#
06:46sm0kelol
06:46Apage43it's magic that lives in the reader, not something that exists in the thing that has been read
06:47Apage43,(read-string "#'inc")
06:47clojurebot(var inc)
06:47Apage43,(read-string "#(foo)")
06:47clojurebot(fn* [] (foo))
06:47Apage43,(read-string "#\"wat\"")
06:47clojurebot#"wat"
06:49sm0keshouldnt the reader figure out #'(symbol "inc")
06:49sm0kei mean #(symbol "inc")
06:50Apage43,(read-string "#'(symbol \"inc\")")
06:50clojurebot(var (symbol "inc"))
06:50sm0kehmm i see thats a valid function too
06:50Apage43#' is actually shorthand for var, as you can see
06:50Apage43and var is macro-y
06:50sm0kei havent see anyone using var in a code
06:50clojurebotPardon?
06:50Apage43it's not a function
06:51Apage43sm0ke: most people don't, because #' is shorthand for it =P
06:51Apage43because it's not a fn you can't pass stuff to it at run time, it's evaluated at compile time
06:52sm0keok so this should work ##((var 'inc) 0)
06:52lazybotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
06:52Apage43,((var inc) 0)
06:52sm0kewth
06:52clojurebot1
06:52sm0ke,(var inc)
06:52clojurebot#'clojure.core/inc
06:53hyPiRionvar is a macro
06:53Apage43rightr
06:53hyPiRion$source var
06:53lazybotSource not found.
06:53hyPiRionyeah, it's not even a macro I guess, it's a special form
06:53Apage43yeah
06:53Apage43Why I said "macro-y"
06:54sm0kenot its not http://clojure.org/special_forms
06:54hyPiRionaha
06:54sm0kecant find var
06:54sm0keoh yes there is
06:54Apage43so forms like (var foo) are specially recognized by the compiler
06:55sm0kei honestly havent see a #' in a code too
06:55sm0kehttps://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging.clj this is full of macros
06:55sm0keno #'
06:55Apage43sm0ke: using #' often happens when someone is doing livecoding type stuff
06:55Apage43because if you do something like
06:56hyPiRionor in tests through alter-var-root and friends
06:56Apage43(def my-composed-thing (comp foo bar baz)) to compose the functions foo, bar, baz
06:56Apage43if you then in a live coding session redefine foo bar or baz, my-composed-thing doesn't react
06:57Apage43you can (comp #'foo #'bar #'baz)
06:57Apage43and now that thing has indirection in it
06:57Apage43and when those are called they look up what the var *currently* points to
06:57sm0keApage43: doesnt reloading foo bar baz would work?
06:58Apage43sm0ke: not if you don't reaload my-composed-thing as well
06:58Apage43since it captured the *value* of the var at the time that code was evaluated
06:58sm0kehmm i dont think thats necessary
06:58sm0keah ok you are right
06:58sm0kecomp is a macro
06:58hyPiRiongenerally not needed, you can usually reload the whole namespace
06:59hyPiRionbut for livecoding, that's usually iffy
06:59sm0ke$source comp
06:59Apage43where it comes in handy, for me, is when I'm messing with a web app
06:59lazybotcomp is http://is.gd/jgSVls
06:59sm0kehmm comp seems to be a function
06:59Apage43and I've run something like (start-http-server (-> my-handler wrap-some-middleware wrap-more-middleware))
07:00Apage43so the http server has the *value* of my handler fn
07:00Apage43if I replace that with #'my-handler I can redef it and not have to stop and start the http server
07:03Apage43example: https://www.refheap.com/21522
07:04sm0kewhat does juxt do?
07:05sm0ke,(doc juxt)
07:05clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
07:05Apage43,((juxt inc dec odd? even? pos? neg?) 12)
07:05clojurebot[13 11 false true true ...]
07:05sm0keawesome sauce
07:05jballanc,((juxt :foo :bar :baz) {:foo 1 :bar 2 :baz 3})
07:05clojurebot[1 2 3]
07:05sm0ke,((juxt inc dec odd? even? pos? neg?) 12 13 14)
07:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$inc>
07:06sm0ke,((juxt inc dec odd? even? pos? neg?) [12 13 14])
07:06clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
07:06sm0kewth
07:06philandstuff,(map (juxt inc dec odd? even? pos? neg?) [12 13 14])
07:06clojurebot([13 11 false true true ...] [14 12 true false true ...] [15 13 false true true ...])
07:06Apage43((juxt f g h) a b c) == [(f a b c) (g a b c) (h a b c)]
07:07Apage43,((juxt count first last) [1 2 3])
07:07clojurebot[3 1 3]
07:07Apage43,((juxt + - /) 1 2)
07:07clojurebot[3 -1 1/2]
07:07sm0kei dont understand shit
07:07Apage43((juxt + - /) 1 2) == [(+ 1 2) (- 1 2) (/ 1 2)]
07:08sm0keok i get it
07:23ProfpatschI’m going crazy here: https://github.com/Profpatsch/cljs-canvas-test
07:23ProfpatschCan someone tell me why my namepaces are not accessible when I do lein repl?
07:23ProfpatschIt _should_ work in theory, since my source-paths are set to the right folders.
07:25sm0kehad a similar problem today, i had pre-tasks defined incorrectly
07:26ProfpatschLook at the project.clj, I can’t make it more minimal.
07:26ProfpatschMaybe a typing error somewhere? oO
07:26sm0kehttps://github.com/Profpatsch/cljs-canvas-test/blob/master/src/clj/canvas/core.clj#L15
07:26sm0kewhat is that?
07:26ProfpatschIt’s src/clj/canvas/core.clj
07:27ProfpatschThat’s the server.
07:27sm0keyou have wrong parenthesis
07:27sm0keu instead of (
07:27ProfpatschUuuuugh.
07:27ProfpatschWHY DOESN’T LEIN TELL ME THAT?
07:27sm0kelein is evil
07:27ProfpatschThat’s plain stupid.
07:28ProfpatschIt should Warning the hell out of me.
07:28sm0kehmm i am surprised
07:28amalloyi mean, isn't that what lein repl and then (require 'canvas.core) *does* tell you?
07:28amalloyunable to resolve symbol udefroutes, i would imagine
07:29ProfpatschNo, nothing.
07:30Profpatschhttps://www.refheap.com/21523
07:30Profpatschafk for a bit.
07:30amalloyProfpatsch: yeah, you didn't attempt to compile it at all
07:30amalloythat's why i said require, not in-ns
07:30amalloyyou could type random chinese garbage into any file and get that behavior - in-ns is for moving into already-compiled namespaces, not for compiling them
07:36sm0kewell i think to avoid this one can have :dev profile with :aot :all
07:36sm0kehmm not sure though
07:44buddywilliamsGood morning, anyone awake?
07:49buddywilliamsSo, I was hoping someone could point me in the right direction. I am trying to build a simple Chess program in Clojure as a means to learn Clojure. Currently, I have constructed a Vector but I find myself continuing to stare at it because I have a few questions that I can't make sense of. If I have one Vector which will track the state of the chess pieces and board, does that then mean I have build mapping functionality into
07:49buddywilliamsmost functions as I pass this data structure to? Do I have to replace the whole Vector each time I want to make a chance? How does destructuring help me?
07:50buddywilliams(def chess-board (atom
07:50buddywilliams [2, 3, 4, 5, 6, 4, 3, 2,
07:51buddywilliams 1, 1, 1, 1, 1, 1, 1, 1,
07:51buddywilliams 0, 0, 0, 0, 0, 0, 0, 0,
07:51buddywilliams 0, 0, 0, 0, 0, 0, 0, 0,
07:51buddywilliams 0, 0, 0, 0, 0, 0, 0, 0,
07:51buddywilliams 0, 0, 0, 0, 0, 0, 0, 0,
07:51buddywilliams 1, 1, 1, 1, 1, 1, 1, 1,
07:51buddywilliams 2, 3, 4, 5, 6, 4, 3, 2]))
07:53sm0kei think for the second question the answer would be yes
07:53sm0kebut it doesnt imply inefficiency, as there is sharing between new and stable data structures
07:54sm0kestale*
07:54Profpatschamalloy_: I think I get the namespace stuff now. Still, lein repl should blow up in your face.
07:55buddywilliamsso under the hood the language is seeing the fact that we are replacing and doing some kind-of compare update?
07:55buddywilliamsin order words, it only going to add/remove the parts which changed.
07:55sm0kebuddywilliams: yes absolutely
07:56sm0kenot in the sense of C/C++ arrays updates
07:56buddywilliamsright
07:57sm0kemost data structures are internally trees.. so its a structural sharing between trees
07:58buddywilliamsSo, in my chess example, if I want to move a piece up, then I have to create a whole new vector.
07:58buddywilliamsI am sure there is some convenient way to operate on these structures but it's a little confusing.
07:58buddywilliamsto me at least
07:59buddywilliamsI think I am more concerned with how to solve the problem then I am the solution to this given problem.
07:59sm0kebuddywilliams: well creating is not as clumsy as it sound
07:59sm0kebuddywilliams: for eg ##(assoc [0 1 2 3] 0 -1)
07:59lazybot⇒ [-1 1 2 3]
08:00sm0kethis just created a new vector with 0th index replaced
08:00ProfpatschIt only does the immutable stuff internally.
08:00buddywilliamsThat makes sense.
08:00ProfpatschBut because it didn’t mutate the old object you can still use it without worrying someone changes stuff under your ass.
08:00buddywilliamsSomeone else has already done the hard work of looping, find the right index, making a new array, etc.
08:01ProfpatschThis is a great help for me: http://clojure.org/cheatsheet
08:01sm0keyep that would be rich hickey
08:01buddywilliamsBasically, it's all about learning the functions which give you quick access to some nested structure.
08:02ProfpatschUnder Vector it lists all the stuff you can use to “modify” the data structure.
08:02buddywilliamsI saw the chest sheet yesterday for the first time, I'll comb it today.
08:02ProfpatschDo not try to understand every function in one go.
08:02ProfpatschThat’s way to many to learn at once.
08:02sm0kebuddywilliams: you just have to think about what you want to do
08:02ProfpatschAnd then look in the right section of the cheat sheet.
08:03sm0keheh
08:03buddywilliamsI am playing something of the dummy, because well I feel like one, I have watched hours upon hours of talks, read tons of articles, trying to get my mind to a place where I can think functionality.
08:04sm0kehmm yep functional programming coming form an imperative or oo background looks awful
08:04buddywilliamsIn the assoc example, would I then use swap! one I call that function?
08:04buddywilliamsSo far, I love the ideas and I'm convinced it has a lot to offer me, but getting started in a bear because everything is so easy to understand until I try to do something non-trivial.
08:05buddywilliamsis a bear*
08:05ProfpatschI guess it’s the working on the datastructures, working /with/ the datastructures part that’s hardest to grasp.
08:05sm0kebuddywilliams: yes for atoms you use swap!
08:06ProfpatschAnd all the meta-stuff, like multimethods.
08:06buddywilliamsRight. I have basic questions like, should my whole app just use one nested map?
08:06buddywilliamsQuestions that keep me confused about where to begin.
08:06sm0kemaps with keywords as keys are good for data abstraction
08:07buddywilliamsImagining the data structure is easy, but thinking about how to build an application, I am lost.
08:07ProfpatschBut when writing e.g. I noticed that my code consists basically only out of list comprehensions, so I figured: Why not use a functional language from the get-go?
08:07buddywilliamsOkay smoke.
08:08buddywilliamsI am sold profpatsch.
08:08ProfpatschYeah, and realizing that maps are The Best Think That Can Happen To You.
08:08Profpatsch*Thing
08:08buddywilliamstired of beating my head against the whole and not making progress
08:08buddywilliamsAre you saying, it's worth the pain?
08:08buddywilliams:)
08:08ProfpatschI guess so.
08:09buddywilliamsI am so much a big picture thinker than it's hard to go on parts.
08:09ProfpatschThe other part of is that we are all just experimenting. There ar e not many best practices for functional programming yet.
08:09buddywilliamsSo for my chess application, do you guys think it's okay to use one data structure?
08:09Profpatschof course.
08:10buddywilliamsThat makes me happy, at least I am not totally of base.
08:10ProfpatschSince you only have 64 fields, it should work splendidly.
08:10ProfpatschBut I’m not sure if a vector is your best bet here.
08:10buddywilliamsI will never forget the joy I had from reading Paul Graham's article and spent the whole weekend trying to understand a one page list that at the end I could say, yeah I got it.
08:11ProfpatschHah, same here.
08:11sm0kehmm i agree i would rather go with a map
08:11buddywilliamsReally, a map?
08:11buddywilliamsI built one of those too, but only as a way to reference the positions.
08:11sm0keyes why not, its easy to look up a position
08:11buddywilliams(def chess-board-map {:a8 0, :b8 1, :c8 2, :d8 3, :e8 4, :f8 5, :g8 6, :h8 7,
08:11buddywilliams :a7 8, :b7 9, :c7 10, :d7 11, :e7 12, :f7 13, :g7 14, :h7 15,
08:11buddywilliams :a6 16, :b6 17, :c6 18, :d6 19, :e6 20, :f6 21, :g6 22, :h6 23,
08:11buddywilliams :a5 24, :b5 25, :c5 26, :d5 27, :e5 28, :f5 29, :g5 30, :h5 31,
08:11buddywilliams :a4 32, :b4 33, :c4 34, :d4 35, :e4 36, :f4 37, :g4 38, :h4 39,
08:11buddywilliams :a3 40, :b3 41, :c3 42, :d3 43, :e3 44, :f3 45, :g3 46, :h3 47,
08:11buddywilliams :a2 48, :b2 49, :c2 50, :d2 51, :e2 52, :f2 53, :g2 54, :h2 55,
08:11buddywilliams :a1 56, :b1 57, :c1 58, :d1 59, :e1 60, :f1 61, :g1 62, :h1 63})
08:12buddywilliamsThat's true.
08:12buddywilliamsbut I thought the logic of move here would mean I would have to figure out a way to get the movements to think in terms of chess board rather than indexs.
08:14buddywilliamsWell, I'll go and do the hard work of more reading and experimenting.
08:15sm0kebuddywilliams: you can map each poition to a tuple too like :a1 -> [0 0]
08:15buddywilliamsokay.
08:16buddywilliamsI am tuple a vector?
08:16buddywilliamsIs a*
08:16buddywilliamsone for each player, is that why I would use a tuple?
08:18sm0kebuddywilliams: yes a vector of length 2, i meant it to be like [x,y] coordinated on board
08:19buddywilliamshow would you store the location of the peice?
08:19echo-areaNeat, in clojure-mode where indentation doesn't work, M-x fill-paragraph (M-q) auto indents correctly
08:19buddywilliams[x,y,peice]?
08:20buddywilliamsokay I see, with x,y I can give the meaning to :a1 for example
08:21sm0kebuddywilliams: thats can to be a map of {:piece [x,y]}
08:21buddywilliamsInteresting.
08:21VFeyeah, like {:a1 [x, y, piece]}, or like smoke said depending on how you want to organize the data
08:21buddywilliamsmakes sense though
08:22buddywilliamsI guess that's part of the confusion, does it really matter? Hard to tell in the beginning.
08:22modulusSo guys, if i have a defrecord on a namespace and i use it from anotehr file, i don't seem to get the constructors for the records but i get the functions. is this how it's meant to be?
08:23sm0kewell i depends a lot on what exactly makes its easy for you to write algorithm on it
08:23buddywilliamsyeah, I can see that.
08:23buddywilliamswrite some, refactor, write some more, etc.
08:24sm0kea 8*8 size is really small data, for keeping track of current positions etc
08:24moduluslike (ns bla) (defrecord Foo) then from another file (ns other [:use [bla :as that])) and i can't do (that/Foo.)
08:24VFeYeah, it's more about how you want to model the data so that it's easy for *you* to use it(or whoever)
08:29buddywilliamsmodulus, I don't know the answer to your question.
08:31sm0kewell its not really trivial once it comes to algorithms though
08:31sm0kewell then it would come to knowledge of gametheory i guess
08:32sm0kebuddywilliams: chess is partial game right?
08:33modulushmm ok
08:34buddywilliams?
08:34buddywilliamspartial, what do you mean?
08:34sm0keanyhow people seem to have written chess in clojure may be you wanna have a look https://github.com/clojure-dus/chess
08:35sm0kebuddywilliams: have you written chess in some other language before?
08:35buddywilliamscool, I haven't seen this one. I looked at a couple of others but the authors didn't finish then.
08:35buddywilliamsno, I have not.
08:36buddywilliamsThe only game I have written was tetris
08:36sm0keok, i was asking about how to decide on the next move
08:36buddywilliamsAI?
08:37sm0keyep
08:37sm0kepartial impartial games?
08:37sm0kepartizan if you prefer
08:37sm0kegrundy theorem
08:37sm0kehehe game theory scares me
08:38buddywilliamsreading about it on wikipedia now...
08:38buddywilliamsyeah, I agree
08:39buddywilliamsI will be happy to see a piece move on screen :)
08:40sm0keok later
09:17marutkshas anyone tried to invoke overloaded methods on a hessian proxy? I couldn't get it working, type hints didnt help.
09:42konrIs there some sort of linked-hash-map in clojure, in which I can keep inserting new key-val pairs and it'll be ordered by insertion order?
09:43nightflyjust do a list of lists or something
09:46mdrogaliskonr: TreeMap from Java?
09:47arrdemkonr: https://github.com/flatland/ordered
09:48ProfpatschCan someone explain this: https://www.refheap.com/21525 ?
09:49mdrogalisProfpatsch: ns's can partially load.
09:50BAMbandaWhat IDE do you guys recommend for linux?
09:50BAMbandais there anything like SLIME for clojure
09:50arrdem$google nrepl emacs
09:50lazybot[clojure-emacs/cider · GitHub] https://github.com/clojure-emacs/cider
09:50hyPiRion~nrepl
09:50clojurebotnrepl is a network REPL implementation: http://github.com/clojure/tools.nrepl
09:50arrdemhyPiRion: jinx
09:50mdrogalisarrdem: I did not know lazybot did that :P
09:51BAMbandathanks
09:51arrdemmdrogalis: my bot-foo is very hit or miss but that one is handy
09:52arrdemBAMbanda: emacs + (nrepl.el | cider) is the reccomended setup around here.
09:52BAMbandaarrdem, alright, i was looking for something with emacs, this is good thanks
10:01Profpatschmdrogalis: Does the second require try to reload the namespace? Or will it do nothing?
10:01mdrogalisProfpatsch: I'm not sure to be honest.
10:02mdrogalisYou could drop a print in there and find out.
10:19sm0keguys
10:19sm0keis there an easy peasy way to defined getters and setters for gen-class/
10:19sm0ke?*
10:24sm0kei can define methods getP setP but thats too much work
10:24sm0kethere must be an easy way
10:25danlamanna^what are peoples takes on web frameworks for clojure? in terms of python i would be looking for something closer to django than flask
10:25BobSchacksm0ke: :exposes {protected-field-name {:get name :set name}, ...}
10:25BobSchackSince the implementations of the methods of the generated class
10:25BobSchackoccur in Clojure functions, they have no access to the inherited
10:25BobSchackprotected fields of the superclass. This parameter can be used to
10:25BobSchackgenerate public getter/setter methods exposing the protected field(s)
10:25BobSchackfor use in the implementation.
10:25BobSchackfrom http://clojuredocs.org/clojure_core/clojure.core/gen-class
10:26TimMcI think I would have preferred just the link. :-P
10:26TimMcor fewer linebreaks
10:26`cbpdanlamanna^: libraries over frameworks is kinda the motto around here
10:26BobSchackyeah sorry about that :(
10:27`cbpdanlamanna^: you won't find much in the way of django or rails around here unfortunately
10:27`cbpor fortunately
10:27vijaykirandanlamanna^: there isn't anything closer to Django - may be try http://let-caribou.in
10:27brainproxybozhidar: prelude is awesome and thanks for merging my patch the other day for def-...
10:30sm0keoh let me try
10:30sm0kei really dont understanf
10:31sm0kewhats the protected-field-name?
10:33`cbpthe field for which youre generating setters and getters
10:34sm0ke`cbp: then why is :get :set needed?
10:34wei__what's the minimum Clojure version to use core.reducers? I'm using 1.5.1 and get 'clojure.core.reducers' not found when trying to require
10:35sm0kei get field not defined in class, or ancestor
10:37stuartsierrawei__: Reducers is part of 1.5.1. Check your `require` syntax, maybe?
10:37sm0keas far as i know you can only define one field using gen class
10:37wei__(require '[clojure.core.reducers :as r])
10:37llasramwei__: You may get an exception if using Java 6 and not including a ForkJoin lib
10:37wei__(using the repl.) could it be because I'm running java 6?
10:38wei__should probably upgrade to java 7 then. but the exception is "Exception namespace 'clojure.core.reducers' not found clojure.core/load-lib (core.clj:5380)", not a forkjoin lib error
10:39llasramAre you sure you're using 1.5.1?
10:39llasram,*clojure-version*
10:39clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
10:43wei__{:major 1, :minor 5, :incremental 1, :qualifier nil}
10:46sm0kei was basically writing a log4j appender
10:46sm0kewanted to have some custom properties
10:47sm0kei guess id have to write get/set as :methods mutating atom in :state
10:49gfredericksso exceptions thrown in a go block
10:50llasramwei__: Beats me then. You do need to add jsr166y for it to work w/ java 6 though. Try adding that to your deps and trying again
10:50gfredericksthey will totally crash the process and there's no generic mechanism for catching them?
10:51jonasenBronsa: ping
10:51Bronsajonasen: pong
10:52jonasenShould :static-field have a :validated? true?
10:53gfredericksit's also weird that map< returns a "channel" that can throw exceptions on take
10:53jonasen(analyze 'String/CASE_INSENSITIVE_ORDER (empty-env)) does not have a :validated? key
10:53Bronsajonasen: no, if it's a static-field there's no need for :validated?
10:53jonasenBronsa: ok
10:54jonasenthanks
10:54Bronsajonasen: same goes for :instance-field
10:55gfredericksI guess you can't generally assume that <!! is a safe operation
10:55Bronsajonasen: basically reflection happens on :static-call/:instance-call with no :validated? and on :host-interop, all the other cases are validated
10:56jonasenConstructors also must be validated, right?
10:57Bronsayeah
10:59Bronsajonasen: probably adding :runtime-reflection? would be a good idea to make it easier to understand, I'll probably add that
11:06bozhidarbrainproxy: you're welcome
11:11brainproxyis there something like *warn-on-reflection* for clojurescript
11:11brainproxyah see it here: https://github.com/clojure/clojurescript/blob/master/devnotes/corelib.org
11:11brainproxybut what's the correct usage?
11:12eLobatoquestion, is there any clojure library that uses 'libgit2' to offer an interface to git? Or clj-jgit is the only thing that has been developed?
11:40seangrovebrainproxy: What would it do in cljs?
12:00brainproxyseangrove: wasn't sure, something I've never come fully to terms with in any case
12:00brainproxybut I saw it listed, wondered
12:01brainproxyI'm starting to see garbage in my compiled js files if I edit a macro file during an auto build
12:01brainproxyit doesn't always happen
12:01clojurebotHuh?
12:01brainproxybut when it does, I have to do a cljsbuild clean and reckick the auto build
12:02hiredmanbrainproxy: I've had that recently when I had a cljsbuild auto that didn't die when I closed the terminal it was in, so I ended up with two running
12:03brainproxyhiredman: thanks! I had 3 running...
12:04hiredmanpaying it forward (dnolen suggested it to me after I had opened an issue for cljsbuild about it)
12:05jcidahois anyone using clamq or an alternative? Clamq seems a bit dead
12:10egosumIs there a reason Clojure's compiler isn't two pass, with the first pass just declaring all the vars, so that forward declaration aren't necessary?
12:11seangroveegosum: Interesting question. Not sure though.
12:11technomancyegosum: that would make it fail to catch typos
12:11seangroveI believe the cljs compiler has passes now, but they're not used for forward declarations
12:11egosumtechnomancy: I'm not sure I follow?
12:12dnolenegosum: it means making the compiler more complicated for little perceived value
12:12egosumCouldn't it just declare top level defs, essentially?
12:12dnolenegosum: Clojure is fundamentally an expression level compiler
12:12technomancyegosum: (defn x [] (thingy 1)) (defn thing [n] ...) ; <- obviously a mistake, but with auto-forward-declare it succeeds
12:12dnolenegosum: sure but it's never going to happen
12:13egosumtechnomancy: that would still fail; `thingy` would never have been declared
12:13technomancyegosum: oh I see; you're proposing something else. never mind.
12:13egosumtechnomancy: Ah, sorry for being unclear
12:14technomancyegosum: no, it's just that most people who complain about foward declarations want to solve it a different way =)
12:14technomancyanyway, I appreciate the fact that the compiler is just (doseq [f forms] (eval f))
12:14technomancymuch easier to understand
12:16egosumdnolen technomancy: It is more simple, it seems, from a structural perspective to be able to write code in logical order e.g. line 1-n (defn most-abstract-form-written-using-fns-i-haven't-defined-but-have-imagined) lines n—EOF defs filling in the blanks. Otherwise, you need to re-order your code.
12:16dnolenegosum: declare solves this problem
12:16egosumdnolen: declare is boilerplate
12:16dnolenw/o complicating the compiler
12:17technomancyegosum: it's certainly easier to not have to think about how you order your code before writing it
12:17dnolenegosum: in your opinion, anyways your points are going to fall on deaf ears
12:17technomancyhowever, I question whether "thinking less about order" is a good goal to have
12:17egosumdnolen technomancy: but I can appreciate the compiler simplicity
12:17brainproxy(inc hiredman)
12:17lazybot⇒ 29
12:18technomancyforcing you to think about order forces you to think about the relationship between different parts of your code
12:18egosumdnolen: I hope I haven't come across as hostile; I'm fine with using declare, I just am wondering about the reasons behind the design decision. I'm always interested in what smarter people than I think about
12:19egosumtechnomancy: I buy that, yeah
12:19dnolenegosum: it makes the compiler really simple to implement that's the main reason, and in practice it's not really a big deal
12:19dnolenegosum: in the 7500 lines of the CLJS standard library we have ~30 declare expressions
12:19brainproxydnolen: is there a straightforward way to go from (cljs/analyze-symbol ...) to getting a form to pass back through the reader during compile time?
12:19dnolennot exactly a pain point
12:20technomancyegosum: it also helps when reading; you know that as you progress from top-to-bottom, you don't have to think about any functions you haven't seen yet.
12:20egosumdnolen: makes sense
12:20dnolenbrainproxy: the ast preserve the original form under :form
12:21brainproxydnolen: ok!
12:21brainproxyI can gen an ast using a func in cljs.compiler right?
12:22dnolenbrainproxy: cljs.analyzer/analyze
12:22brainproxyoh duh, I see what you mean
12:22brainproxyI was making it too complicated :/
12:22egosumdnolen finally got around to using core.async since seeing you speak at 2sigma—had a great time using it, thank you for that into (though I ended up not using it with cljs)
12:22brainproxybut good times reading through the source in any case :)
12:23egosumtechnomancy: right, that is nice. It also acts as a sort of todo-list when writing code, which is how i tend to think about it
12:23egosumrather than relying on the compiler to tell me which var i've forgotten to define
12:23dnolenegosum: nice!
12:23technomancyclojurebot: use a map is https://twitter.com/krisajenkins/status/408625918362791936/photo/1
12:23clojurebotc'est bon!
12:25egosumare people using defn- these days, or ^{:private true}?
12:25brainproxyclojurebot: shared mutable state is http://image.slidesharecdn.com/concurrencygotchas-100408105435-phpapp01/95/slide-7-728.jpg?cb=1270742095
12:25clojurebotc'est bon!
12:25technomancyegosum: defn- absolutely
12:26technomancyanything that gets more people to be explicit about what part of their lib is an implementation detail is a wonderful thing
12:26egosumtechnomancy: k…that's what i thought. I'd recently come across a few examples with the meta tag instead, was wondering if the style had changed
12:26technomancysome people like the consistency with def since there's no def- but IMO that's silly
12:28bbloomtechnomancy: i do find it mildly annoying that there is no def-, defmacro-, etc. and then whenever you create any kind of def-ing macro you need to take care to copy the metadata across
12:29bbloomtechnomancy: i do use defn-, but i think i prefer the ^:private syntax across the board b/c otherwise some part of my brain has to resist the urge to define my own defwhatever-
12:29coventryYou have to be careful to copy the metadata across anyway, no?
12:30bbloomyeah
12:30bbloomi have a love/hate relationship w/ metadata
12:30bbloomi love that it's there when i need it
12:30bbloomi hate that it's there when i forget to think about or look at it :-P
12:30mikerodIsn't :private anything really just a bad thing? Functions should be generic and reusable. :)
12:30technomancybbloom: yeah, the arguments against adding def- are baffling to me
12:31technomancymikerod: you should strive to communicate to your consumers what parts of the library are subject to change in minor bumps and where you're committing to compatibility
12:31technomancymikerod: if someone is okay with breakage, they can go ahead and use private vars. it's just two more characters to do so
12:31technomancybut then when it breaks it's their fault
12:32technomancybbloom: the rules about what preserves metadata and what doesn't seem really arbitrary
12:32bbloomtechnomancy: the argument is pretty simple to me: then what about defmacro- ? and what about defprotocol- or whatever? we already have a consistent syntax for arbitrary annotations that is much more future proof. i'd rather deprecate defn- :-)
12:32mikerodtechnomancy: True, so you use private to relay this information to consumers of a lib. I can see that argument. Sometimes I wonder if it should just be a "private" namespace of functions.
12:32bbloomtechnomancy: yeah, it's b/c each data structure needs to deal w/ metadata on their own
12:33coventryHow about a def-private-def* macro macro? :-)
12:33bbloomcoventry: i have on several occasions wanted a defdefmacro macro
12:33technomancymikerod: if you have enough, sure
12:33technomancyenough vars, I mean
12:34bbloomcoventry: i'd say like 30% of my macros are trivial wrappers around some (def f (comp whatever (fn ...)))
12:35bbloomtechnomancy: that's an interesting point. mikerod suggests making another namespace, which is a nice idea but suffers from the fact that the small amount of friction stops ppl from doing things like that
12:35bbloompg wrote some thing about the "weight" of function names
12:35bbloomhow smaller function names encourage more use subconciously
12:35bbloomhe took it to an absurd extreme w/ arc, but he's right in many respects
12:35technomancybbloom: which is why I heard defn-
12:35technomancy*heart
12:36bbloomif you want people to do stuff, you need to make it 1) the default or 2) absurdly easy to accomplish
12:36mikerodhmm, yeah I can see the weight of a namespace making it not happen in practice I suppose
12:36mikerodI just don't know that I'm a fan of seeing how carried away people get with defn-
12:36bbloommikerod: it's entertaining to me how many dumb ideas have shown up in programming b/c people don't like to type a little bit
12:37technomancybbloom: REGISTER_GLOBAL_VARS or whatever
12:37bbloommikerod: it affected me for a long time. and it's poisonous in some communities
12:37bbloomtechnomancy: i'm thinking more of Ruby's const_missing
12:37technomancyoh heavens
12:37mikerodI like to question why something is private, and ask does it need to be or could it easily be generalized. I get that some things are just subject-to-change implementation details though obviously.
12:38bbloomwhen you try to evaluate `User`, you get const_missing('User') which basically winds up calling require("models/#{'User'.camelize}")
12:38bbloomweeeeeeee
12:38bbloomhorrifying.
12:38mikerodbbloom: the fear of typing is real indeed.
12:39bbloomi much prefer the clojure way of just sticking lots of stuff in a namespace, but then you wind up with what mikerod mentioned about people getting crazy with defn-
12:39bbloomand you have the problem of private things being really *internal* things
12:40bbloomand you wind up having to refactor in to namespaces later anyway and delete all the ^:private metadata
12:40technomancymikerod: what I really hate is having to make a change on a function that I should have declared as private and wondering "is this safe to change? I bet nobody's *actually* using this. I'll just go ahead and see what happens I guess?"
12:40technomancyreducing your surface area decreases your responsibility
12:41technomancyif someone wants to use it, they can deref the var and ask you to commit to maintaining it in future versions
12:41mikerodyeah, that's a valid downside it indeed
12:41tommo__can someone explain when i would use reduce/apply as opposed to the other?
12:42coventrytommo__: Have a look at the clojuredocs examples. If it's not clear from that, feel free to ask again.
12:42tommo__already did, thats why i resorted to here coventry :p
12:43technomancytommo__: they're totally different. apply results in a single call; reduce results in one call per coll item.
12:43teslanickapply is something you do to a function, reduce is something you do to a seq.
12:43teslanickThat's simplifying, but that's how I tend to think about them.
12:43tommo__so apply is basically (+ 1 2 3), and reduce would be (+ (+ 1 2) 3)?
12:43coventryOh, I see why you're confused.
12:44coventry,(reduce #(do (pr [%1 %2]) (+ %1 %2)) [1 2 3 4 5])
12:44clojurebot[1 2][3 3][6 4][10 5]15
12:44coventry,(apply #(do (pr [%1 %2]) (+ %1 %2)) [1 2 3 4 5])
12:44clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (5) passed to: sandbox$eval63$fn>
12:44coventry,(apply #(do (pr [%1 %2 %3 %4 %5]) (+ %1 %2)) [1 2 3 4 5])
12:44clojurebot[1 2 3 4 5]3
12:45tommo__ahh i see
12:45tommo__thanks alot
12:46coventryThe initial clojuredocs examples are confusing here, because they work roughly the same in those cases. (reduce + [1 2 3 4 5]) vs (apply + [1 2 3 4 5])
12:46coventry
12:46coventry
12:46tommo__thats what confused me
12:47raek_tommo__: 'apply' is useful when you want to pass a sequence of arguments from your function to another one. 'reduce' is useful when you want to combine all values in a sequence using a function that takes two arguments
12:47tommo__similar to what teslanick said
12:48tommo__ty
12:49teslanickI map the two functions to their javascript counterparts, because I'm far more familiar with JS. That introduces a degree of conceptual blindness about when to use them. So maybe it's not a helpful way to think about the two in all cases.
12:55jonasenBronsa: https://www.refheap.com/21533
12:56jonasenBronsa: ^ similar issue as yesterday?
12:57Bronsajonasen: no, the method name needs to be munged, looks like I forgot to do it
12:58TimMcbitemyapp: I know you <3 tracing -- any tips on dealing with gigantic argument and return values?
12:58TimMcI'd love some kind of interactive trace analyzer where I can expand and collapse nodes.
12:59justin_smithTimMc: yeah, imho there should be a tracer that ouputs emacs org files
12:59justin_smithso you can expand for detail as you wish
12:59justin_smithI've thought of hacking that up myself
13:01ohcibiis there a function like map that gives me the last return value? so like a mix of reduce and map 8-)
13:02coventry,((comp last map) identity (range 5))
13:02clojurebot4
13:02S11001001which is the same as just taking the last thing and calling the function on it
13:03ndp,((comp identity last) (range 5))
13:03clojurebot4
13:03`cbpwhen is joy of clojure coming out? :P
13:03coventryS11001001: Only if the function is pure. :-)
13:03S11001001coventry: I'm just going to assume that :)
13:03Bronsajonasen: pushed a fix
13:04`cbpohcibi: for side effects?
13:04jonasenBronsa: Awesome!
13:04`cbpor just (f (last coll))
13:04ohcibi`cbp: no side effects
13:04`cbpthen just (f (last coll))
13:07justin_smithif coll is a vector (f (peek vec)) is much faster (linear rather than O(n) time), btw
13:07justin_smithjust in general, probably does not apply here
13:08justin_smith* make that ~O(1) instead of O(n)
13:09coventryYou mean constant rather than linear.
13:09justin_smithright
13:09jonasenBronsa: That took care of one NoSuchMethodException. I've got another (on another piece of code): java.lang.NoSuchMethodException: clojure.lang.RT.get(java.lang.Object, clojure.lang.Keyword)
13:09jonasenI'll try to find a minimum failing test
13:10jonasen(might also be a bug in my code)
13:12ohcibi`cbp: I meant in (map f coll) that for each call of f I can pass something to the next call of f... what I want to do is iterate over a vector of vectors and select one element based on the index of the element that was taken from the last vector... where the first vector hast only one element..
13:12Bronsajonasen: don't bother with finding a minimal case, just give me the piece of code that fails, I have a feeling I know what's going on
13:12danneuI keep clicking the "Mute" button on Github thinking I'm unmuting it. This icon fools my brain: https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/p-zlrg7x.png
13:15jonasenhttps://github.com/jonase/eastwood/blob/master/src/eastwood/analyze_ns.clj
13:15jonasen^ when I analyze that namespace
13:16jonasenI have a pass that reflects on :instance-call, :static-call, :static-field, :instance-field and :new
13:16jonasenI think it fails on a :static-call
13:16jonasenBronsa: is that enough?
13:17Bronsagah. this should trigger that (loop [a 1] (if true (get {} :foo) (recur ""))
13:17coventryohcibi: You can do that with reduce. The return value of the fn you pass to reduce can be whatever you want.
13:18Bronsaindeed
13:18coventryohcibi: Unless you also want the sequence of results to be returned like with map, I guess.
13:18ohcibicoventry: I want it to return a sequential
13:19Bronsajonasen: thanks, I'll try to fix this, might take me a while though
13:19ohcibicoventry: i will reduce afterwards, but I need the single values first 8-)
13:19jonasenBronsa: the code you pasted does trigger the same exception
13:19jonasenBronsa: no hurry.
13:20Bronsajonasen: yeah, the cause is similar to why (for [a nil]) was failing yesterday
13:20coventryohcibi: reductions.
13:20Bronsaand it's terribily hard to debug validate-loop-locals
13:21jonasenBronsa: the java reflection api is not smart enough to know that a java.lang.Keyword is a java.lang.Object?
13:21ohcibicoventry: perfect... thanks
13:21Bronsajonasen: no, I'm tagging the method args with the wrong type :)
13:28Bronsajonasen: ok that was easier than I thought, should be fixed now
14:20rurumateis there a canonical way to write hadoop jobs in clojure? I've been using clojure-hadoop so far, am I missing anything?
14:21technomancyrurumate: llasram has some stuff for that
14:21rurumateI see
14:25llasramrurumate: Oh yeah, my new stuff: https://github.com/damballa/parkour/ and the incumbent: https://github.com/nathanmarz/cascalog
14:30mdrogalisrurumate: It really depends on what you're trying to do on Hadoop.
14:30mdrogalisI've used about 5 different Java/Clojure frameworks. There's big trade-offs with each.
14:34llasrammdrogalis: Nah. I'm pretty sure Parkour is the right tool for all jobs :-D
14:34seangroveHah
14:34mdrogalisllasram: Hah.
14:35technomancycascalog seems like a lot more than just "write hadoop jobs in clojure"
14:35technomancyI mean it looks neat, but it's a very different paradigm
14:35mdrogalisIt's pretty great since it brings a logic programming abstraction, but a few things from Cascading, the library underneath seep through.
14:35mdrogalisSo it's not quite as intuitive as Datomic's datalog.
14:37llasramMy current rule of thumb is that if I need more than 1 non-replicated join in sequence of jobs, I still reach for Cascalog
14:37llasramIt's pretty killer at that
14:37mdrogalisJoins are pretty darn slow with Map-Reduce though. :/
14:37seangrovellasram: No storm?
14:38llasrammdrogalis: Oh yeah. Which is why I've managed to switch 90%ish of Damballa's jobs Parkour
14:38llasramseangrove: In what sense?
14:38seangrovellasram: Guess I'm not totally clear on the hadoop/storm divide, other than hadoop seems more batch oriented vs storm's continuous processing
14:39seangroveIt seemed from a vague, far-off distance that storm would be nicer to work with overall
14:39mdrogalisThat's pretty much it, seangrove.
14:39llasramseangrove: That's my understanding as well. Storm looks pretty slick, but I just haven't personally had an occasion yet to use it
14:39mdrogalisSome jobs truly need to be batch oriented, so Storm just don't fit.
14:39seangrovemdrogalis: Maybe hadoop's raw crunching ability/throughput is better though?
14:39technomancystorm doesn't have any analog to HDFS afaict, which is kind of the whole point of using hadoop
14:40llasram(inc technomancy)
14:40lazybot⇒ 87
14:40llasramPretty much
14:40seangrovetechnomancy: The idea there being to keep the data close to the computation?
14:40technomancyseangrove: exactly
14:40mdrogalisMeh, it's a dated concern.
14:40mdrogalisNetwork speeds have caught up.
14:40mdrogalisNetflix uses Map-Reduce and keeps their data on S3.
14:41llasramWe used to do that. Maybe it's gotten better in the... 2 years? since we invested in our own cluster, but my experience is on the order of a 100x speed-up
14:42seangrovellasram: That's pretty considerable.
14:42noncomwhat is the most idiomatic way to access and/or update a value in an arbitrary comples clojure datastucture? for example, I want to read or write or update an integer in a [] which is in a {} which is in a {} which is in a [] which is in a #{} which is in a [] which is in a {}, well you get the idea...
14:42mdrogalisllasram: Yeah, I mean, you need something like SSDs and infiniband to get equal performance, but you can get close otherwise now.
14:42seangrovenoncom: assoc/update-in ?
14:43hiredmanllasram: cluster for storage or for compute
14:43hiredmanllasram: because I bet the slow down there would be ec2 compute, not s3 storage
14:43llasramIt probably also depends on your data and your access patterns. If you have relatively small amounts of data that you preform heavy computation on, S3 is probably perfectly reasonable
14:43seangrove,(update-in [1 1 {:a [0 0 {:c 20}] :b 9} 3 3] [2 :a 2 :c] inc)
14:43clojurebot[1 1 {:a [0 0 {:c 21}], :b 9} 3 3]
14:44mdrogalisI mean, it's kind of the same reasoning for Datomic running queries right on the peer.
14:44seangrove,(assoc-in [1 1 {:a [0 0 {:c 20}] :b 9} 3 3] [2 :a 2 :c] 88)
14:44clojurebot[1 1 {:a [0 0 {:c 88}], :b 9} 3 3]
14:44llasramhiredman: You think so? Hmm. I was totally going in the other direction
14:44mdrogalisS3 is pretty slow to read off of.
14:44seangrovenoncomm ^
14:44llasramYou can always throw more money at EC2 for more compute on your nodes, but you can't make Amazon bounce our data to and from S3 any faster
14:45llasrams,our,your,
14:45slpsysamen
14:45technomancyit's not uncommon for me to see archives that download from S3 in less time than they take to untar
14:45noncomseangrove: cool! i just teted it in the repl, it works for {} and [], although, doesn't punch through #{} :/
14:46brainproxydnolen: I just tried what you suggested earlier; :form only gives me the symbol
14:46dnolenbrainproxy: what were you expecting?
14:46llasramThis looks like it call for some empirical evaluation! Volunteers?
14:46seangrovenoncom: Interesting, not sure how to approach that, since sets don't have guaranteed ordering
14:47brainproxywell, what I really want is to be able to get to the s-expr that the symbol points to on the cljs side
14:47mdrogalisllasram: Maaaybe another time :P
14:47llasrammdrogalis: Awesome. Let me know what you find!
14:48mdrogalis*Uploads a 500 GB file under company's AWS account*
14:48mdrogalis*Innocent whistle*
14:48noncomseangrove: hmmmm very true... i think i can't formulate what behavior i expect from sets here..
14:48brainproxydnolen: I also tried using resolve-var from cljs.analyzer, and it finds the var, but there's no source/form associated with that, but there are :line :and column numbers
14:48brainproxythat's what I was alluding to originally when I asked about an easy way to extract...
14:49dnolenbrainproxy: I don't know what you asking - the s-expr the symbol points to?
14:49noncomseangrove: although definitely there must be something as they (sets) are not terminals of the datastructure. only bnon-collection types are terminals
14:49brainproxysorry, wasn't accurate with terminology
14:49brainproxyon cljs side I have (def xyz [...])
14:50noncomor maybe we have to treat a set as a terminal
14:50noncomand break the path in pieces if there are sets
14:50brainproxyand on clj side I have (defmacro resme [sym] (cljs.analyzer/... ...))
14:51brainproxywhat I want is to be able to invoke resme with xyz from the cljs side, but resolve the [...] source on the clj side
14:51noncomthe next piece is only valid if a value is present in the set
14:51noncomdoes it sound like nonsense?
14:51seangrovenoncom: Yeah, I believe that will work...
14:51noncomok, i'll try
14:51seangrovenoncom: But then you need to have the data structure you're looking up in the set anyway
14:52seangroveBut depending on your use case, it could work
14:54noncomseangrove: see, i am displaying the datastruct as a tree. and the user can visually type in a new value for any leaf. thus, if the leafs are separated by at least one #{} from the root of the tree, there is this problem. probably just have to treat sets as roots, update them separately and then update the whole set as a single atomic data type for the previous collection..
15:03seangrovenoncom: In that case, you can probably just use assoc-in, since you can generate the path to the leaf you want to update
15:16dnolenbrainproxy: yeah I have no idea what you are trying to do
15:17dnolenbrainproxy: if you're trying to determine the form that xyz was assigned to via the analyzer this is not possible nor will it be
15:18dnolenbrainproxy: at least out of the box, you could add a pass to do this yourself though but it's going to be expensive since you'll be saving the AST of all tops levels - you could only do this for special cases via metadata or something
15:19justin_smithis there a way to have my protocol default to noop / identity methods if they are not defined? I tried implementing it on object or record so that the superclass resolution would take care of it but I get an error about the class being closed
15:20hiredmanjustin_smith: that doesn't sound right
15:21justin_smithcould be pebkac, I will double check and try this again
15:21hiredmanthe jvm doesn't even have the concept of a class being closed, since they are all "closed" to begin with
15:22hiredmanso getting an error about classes being closed makes no sense
15:22justin_smithlet me get that exact message again
15:26justin_smithhiredman: the problem is that if I define some subset of the protocol (to my new record type for example) and leave any of the methods unspecified, it is not inheriting from java.lang.Object, but instead just not finding a method
15:26justin_smiththe previous was my misunderstanding/misremembering the problem
15:27llasramjustin_smith: That's the way protocols work: all-or-nothing far a given implementation
15:27justin_smithllasram: OK, so I have no option for "specialize these two methods, and leave the other 9 at the default"
15:27llasramjustin_smith: You can, just have to do it differently
15:27justin_smithdo tell
15:28llasramYou can use `extend` to pass in a map of implementations. The map is a plan map of protocol-function keyword to Clojure function. You can define a base implementation map, then `assoc` in specific implementations
15:28hiredmanit is an a la cart thing, separating inheretence hierarchy from implmentation sharing
15:28llasramjustin_smith: Check out clojure.java.io for a pretty good example
15:28hiredmanif you want to share implementation you can create a custom macro for templating
15:29justin_smithcool, thanks guys
15:29justin_smithI guess I just expected it to act like implicit subclass inheritance
15:32seangrovetechnomancy: Is this still the way to add local jars?
15:32seangrovehttps://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/
15:35bobajettis "cond" different in clojure from elisp in that only one expression is allowed in clojure for a conditional?
15:37hyPiRionno, multiple expressions are allowed
15:37coventrybobajett: The syntax is different in that in elisp each pair is wrapped in an extra set of parens. Otherwise, it's the same.
15:38hyPiRion,(let [n 10] (cond (zero? n) :zero, (neg? n) :neg, (pos? n) :pos))
15:38clojurebot:pos
15:41bobajett,(let [n 1] (cond (< n 0) :neg, :else (print "hello") (print "goodbye")))
15:41clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: cond requires an even number of forms>
15:41bobajetthyPiRion: *I think* in elisp you can have multiple expressions follow a test?
15:42justin_smithbobajett: oh yeah, likely, because of the extra set of parens you could have an implicit do there
15:42coventrybobajett: Oh, yes, that's true.
15:42hyPiRionbobajett: yeah, that's true. You can do that in Clojure with the `do` macro
15:42justin_smithwith clojure you can do that with do
15:43hyPiRionspecial form, rather
15:43bobajettah awesome! you guys just cleared up my confusion! I need "do" to acheive the sme thing! thanks!
15:45OscarZif i have a function x returning a vector with 3 values like [1 2 3] and i want to use that vector as parameters for some other function y so that it would called just like (y 1 2 3) .. can i do that ?
15:45OscarZi know i can pass a vector and destructure it
15:45dnolenReact is pretty incredible, lazy tree construction, faster diffing w/ immutable values - https://gist.github.com/swannodette/7813518
15:45hyPiRionOscarZ: use apply: `(apply y [1 2 3])`
15:45dnolenthis boilerplate-y but it can made more awesome
15:46hyPiRion,(apply + [1 2 3 4 5]) ; == (+ 1 2 3 4 5)
15:46clojurebot15
15:46OscarZhyPiRion: nice, i didnt realize that :) thanks
15:48hyPiRionnp
15:49dnoleneric_normand: not sure how you are using React, but I have a basic approach that I think could be taken further ^
15:49nopromptdnolen: regarding the discussion in the gist, i'm a bit confused. am i to understand the direct use of renderComponent is less performant than the use of createClass + renderComponent?
15:50eric_normanddnolen: more than the gist you posted a few days ago?
15:50coventrydnolen: A few comments in these gists would hugely broaden their reach.
15:50coventrydnolen: For instance, I have no idea what (pure) does, and I've watched Pete Hunt's talk.
15:50eric_normanddnolen: I'm just using renderComponent with DOM
15:51eric_normanddnolen: trying to finish the app before I start refactoring
15:51eric_normanddnolen: though I would love hiccup style (at runtime, not a macro)
15:51noprompteric_normand: if you're willing to accept the performance tradeoffs that should be fairly easy to do.
15:52dnolenone second
15:53noprompteric_normand: it's fairly easy to build the hiccup style parser/compiler with extend-protocol.
15:53dnolennoprompt: coventry: eric_normand: gist updated with supporting code
15:53nopromptthanks.
15:53eric_normanddnolen: thanks
15:54coventrythanks x 3
15:55eric_normandnoprompt: where is performance tradeoff?
15:56dnoleneric_normand: noprompt: in my gist I use createClass to just make a wrapper component
15:57noprompteric_normand: i'm not sure if there is one, that's why i'm asking. i was confused by some of the comments.
15:57eric_normanddnolen: does that help in some way?
15:57eric_normanddnolen: that is, why keep the state in the component?
15:57dnoleneric_normand: I don't think you can write faster Rect code than what I've done
15:57dnolenin fact it should blow away what people are doing in JS w/ React
15:57nopromptdoes (enable-console-print!) do what it says on the tin?
15:57dnolenout of the water
15:57dnolennoprompt: it does
15:58dnolenpure create a node for diffing
15:58dnolensince we're in CLJS we're using immutable values
15:58eric_normanddnolen: because of the state dirtiness check?
15:58dnolenbut that means we can use *identity* checks
15:58dnolennone of this horrible JS object traversal crap
15:59eric_normanddnolen: that makes sense, but is it faster than not having state?
15:59eric_normanddnolen: and traversing the virtual dom?
15:59dnoleneric_normand: what state?
16:00eric_normanddnolen: the value in (defmacro pure [value children]
16:00dnoleneric_normand: that's not really state
16:00dnolenit's just an immutable value used for diffing
16:01eric_normanddnolen: if I understand correctly, you are saying "re-render all children if this value is different from last time"
16:01dnoleneric_normand: yes, this everything that React does for JS, but faster and in a functional non-oopy style
16:02eric_normanddnolen: "but if it is the same, don't re-render"?
16:02dnoleneric_normand: yep
16:02dnolenso you can have a massive graph of UI
16:02dnolenupdate one tiny piece of it
16:02dnolenand this will BLAZE
16:03eric_normanddnolen: yeah, makes sense
16:03eric_normanddnolen: you just have to select your value carefully
16:03dnoleneric_normand: no, it's just the value that represent the value of the component
16:04eric_normanddnolen: right. but it means that if your children were depending on a global atom or something, you need to put the derefed atom into the value
16:06dnoleneric_normand: right, or you could just propagate that value into their "state", which is probably what you should do 95% of the time.
16:06eric_normanddnolen: and if that atom had a map with a bunch of irrelevant stuff, now I need to get rid of the irrelevant stuff
16:07eric_normanddnolen: that kind of invalidates the way I just designed this program
16:08eric_normanddnolen: global state in an atom
16:08eric_normanddnolen: and render the current value of the atom functionally
16:08dnolenthis is still just a sketch, but I think it could be cleaned up a taken much further - this is going to rock :)
16:09seangroveOh, god damn Java inner classes
16:09eric_normanddnolen: but having the comparison value as you do in the gist is awesome
16:09eric_normanddnolen: so I'm going to play with it and see where it goes
16:09dnoleneric_normand: cool
16:10eric_normanddnolen: I'm not sure if this happens generally, but in my case, the dom tree corresponds pretty closely to the state tree
16:10eric_normanddnolen: which would benefit a lot from this
16:10eric_normanddnolen: I am very excited about React right now
16:11eric_normanddnolen: the first "framework" that actually does some of the dom work for you :)
16:11dnoleneric_normand: yes this should always be true. We can represent UI as ... maps & vectors!
16:11dnolenand update it efficiently
16:11dnolenmore efficiently than you ever could with popular JS patterns
16:14egosumIs there a preferred way to run tests (faster than lein test)?
16:15llasramegosum: From the REPL
16:16eric_normandegosum: for fast testing, I use clojure-test-mode in emacs
16:16bitemyappTimMc: that's pretty rough, I usually make a trace-filterer and customize the tracing behavior to change the way the args get printed (elision, summarization, etc)
16:16egosumeric_normand llasram: that seems introduces all sorts of incidental bugs—reordering/renaming vars and the old vars persist in the running JVM. Or am I doing something wrong?
16:17SegFaultAXegosum: Reload the namespace(s) before running.
16:17eric_normanddnolen: clojurescript is paying its own way :)
16:17TimMcbitemyapp: In this case it's ring middleware, so I should probably use some ring-specific tracer, but... ugh.
16:17eric_normanddnolen: does react use google closure compatible requires/provides?
16:17eric_normanddnolen: can it be closure optimized?
16:17dnoleneric_normand: :) something like React is honestly the last piece of the puzzle for the CLJS story
16:18egosumSegFaultAX: does clojure-test-mode handle that for you?
16:18eric_normanddnolen: Last? that's optimistic
16:18dnoleneric_normand: React is ~27K gzipped, this is acceptable for what it provides a "view" story
16:18dnoleneric_normand: heh, well last for me - we know have the pieces to compete with JS MVC approaches
16:19dnolens/know/now
16:19eric_normanddnolen: but core.async to get local event loops and React for a functional dom:
16:19SegFaultAXegosum: Dunno, not an emacs user.
16:19SegFaultAXegosum: Somehow I doubt it though.
16:19eric_normanddnolen: I have to say it: it also competes with pedestal
16:19eric_normanddnolen: (and wins in my book)
16:19SegFaultAXeric_normand: What does?
16:20technomancyegosum: it does
16:20egosumtechnomancy: thanks—just started reading the source
16:20dnoleneric_normand: yes but pedestal can't win against React for this specific use case since it wants to do more - React focuses on specific thing.
16:20dnolens/on/one
16:20llasramtechnomancy: Oh, it does? I must have an old version. I don't rename tests frequently, but never noticed it wiping and reloading the NS before
16:20eric_normanddnolen: true, pedestal has a lot of developer tools, etc
16:20bitemyappTimMc: yeah probably. are your requests really fat or something?
16:20egosumtechnomancy: i'm guessing you're using clojure-test-mode, then?
16:21bitemyappTimMc: or the responses, I guess, would be?
16:21egosum(aside from you know, just writing it)
16:21technomancyegosum: not really
16:21egosumin addition to*
16:21bitemyappTimMc: you can just summarize the "body" of the response if it's spamming you.
16:21egosumtechnomancy: what are you using these days?
16:21eric_normanddnolen: but it kind of punts on the UI, which I think is still the hardest part of web frontend
16:21bitemyappI wouldn't recommend summarizing the request unless something strange is going on.
16:21dnoleneric_normand: but I also don't see really see them as incompatible. I think Pedestal could scale bake and integrate with how React works
16:21dnoleneric_normand: the other cool bit is that the server can render the right HTML for a particular UI state
16:22dnoleneric_normand: and the client will know exactly what's going on
16:22dnolen"scale bake" "scale back"
16:22technomancyllasram: it just reloads, not wipe+reload
16:22eric_normanddnolen: agreed re: scaling back
16:23eric_normanddnolen: the new branch of pedestal with core.async is way more understandable
16:23eric_normanddnolen: something similar with a virtual dom for the view would be great
16:23technomancyegosum: I'm working on replacing clojure-test-mode with something that's not hard-coded to emacs
16:23technomancyegosum: but also I'm not really writing any tests
16:23llasramtechnomancy: That's what I thought. I believe the specific issue under discussion is the way deleted/renamed test vars hang around
16:23eric_normanddnolen: about rendering on the server, do you mean running React in node.js?
16:24dnoleneric_normand: no you don't need the whole React infrastructure server side
16:24bitemyappegosum: (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (require '[clojure.pprint :refer [pprint]]) (require '[clojure.data :refer [diff]]) (require '[clojure.repl :refer :all])
16:24dnoleneric_normand: just something that generates DOM w/ checksum attributes that's it
16:24egosumtechnomancy: Fair enough. I'm writing them as additional documentation, mostly. clojure-test-mode will work for me (thanks)
16:24bitemyappthat's my standard "test loop" macro in Emacs.
16:24eric_normanddnolen: I see. the client builds the virtual dom from the real dom?
16:25eric_normanddnolen: that's pretty cool.
16:25dnoleneric_normand: it doesn't need to build anything :) unless the user clicks something
16:25dnoleneric_normand: and boom, React knows what to change!
16:25eric_normanddnolen: that's a compelling story.
16:25dnolenfuck yeah it is
16:25hyPiRionbitemyapp: heard of Stuart Sierra's development loop? That one's kind of nifty for stuff
16:26coventryegosum, technomancy, llasram: I'v been meaning to experiment with putting something like (remove-ns 'ns-symbol) before the ns form to prevent the confusion from stale vars. Anyone tried something like that?
16:26bitemyapphyPiRion: that's sort-of what I do.
16:26bitemyapphyPiRion: except I don't go full architecture astronaut like him.
16:26eric_normanddnolen: and if you're sharing hiccup between the two, no big maintenance cost
16:26technomancycoventry: in slime you could do C-c C-l to wipe a namespace before loading it
16:26hyPiRionbitemyapp: hehe
16:26dnoleneric_normand: yep
16:26technomancycoventry: I don't think it's been ported yet
16:26llasramcoventry: I think that would cause doom as vars in other NSs find the NS they used to refer to is gone
16:26bitemyapphyPiRion: I do avoid def'ing bare vars with side effects in namespaces though.
16:27bitemyappbecause it's fucking stupid.
16:27bitemyappand it's bad for growing your code.
16:27hyPiRionor vars with mutable/global state in it
16:27hyPiRionoh, the pain
16:27eric_normandclojure: better than Java and use the java ecosystem
16:27technomancybitemyapp: ugh we got a bunch of slamdhound bug reports from people who just loooove doing that
16:27eric_normandclojurescript: better than Javascript, and use the js ecosystem!
16:27bitemyappbare vars pointing to values can't "grow" as well as functions that return data things are dependent on.
16:28eric_normandlet those other guys code up a good library, we wrap it, and it's better!
16:28eric_normanddoes clojure clean up everything it touches? :)
16:28hyPiRiondoes Clojure clean up anything at all? :p
16:29bitemyapptechnomancy: http://i.imgur.com/GwSrBuw.jpg
16:29bitemyapperic_normand: no
16:29eric_normandbitemyapp: example?
16:30bitemyapperic_normand: no types
16:30coventrytechnomancy: Thanks, will take a look.
16:31eric_normandbitemyapp: can you give me an example of something that clojure has wrapped that is not better than the original? Not saying it doesn't exist.
16:32bitemyapperic_normand: oh, wrapped? then no.
16:32eric_normandbitemyapp: that's what I meant :)
16:32bitemyapperic_normand: I mean, I could cherry-pick libraries, but at the language level, no.
16:32bitemyapperic_normand: there are many terrible libraries though.
16:32bitemyappterrible, terrible libraries.
16:32eric_normandbitemyapp: yeah, agreed
16:32bitemyapplike Korma and it's relationship with c.j.j
16:33eric_normandbitemyapp: I don't like korma either. Did too much
16:33bitemyapperic_normand: I'm a maintainer on Korma, I think the basic design and idea is solid, but it needs to be reworked.
16:33hyPiRionWell actually, when thinking about it, Clojure has wrapped regexes nicely
16:33bitemyapphyPiRion: what?
16:34hyPiRionlike, Java regexes
16:34bitemyapphyPiRion: what?
16:34bitemyappwhat was wrapped?
16:34tommoregex's are not specific to java
16:35bitemyapptommo: I'm sure everybody here knows that. He's probably talking about the API.
16:35technomancy"Everything's a function in Clojure; it's great!" / "Oh cool. Even regexes?" / "No, not regexes."
16:35eric_normandbitemyapp: the classes Pattern, Match, etc
16:35technomancy=(
16:35eric_normandtechnomancy: I cried when I heard that, too
16:35bitemyappwouldn't that have effectively turned strings into functions?
16:35eric_normandjust string literals with # in front
16:36eric_normandbut I don't know how it should work
16:36technomancybitemyapp: strings are final
16:36hyPiRionbitemyapp: more like actually writing them, like #"\\" vs "\\\\" (as an example)
16:36eric_normandshould it be like re-match, re-find, re-seq?
16:36technomancy(regexes are final too, but no one in the history of clojure has ever used regexes for interop, so it doesn't matter)
16:36osa1hello everone. I'm currently playing with LightTable, is there a way to use it's browser and editor for ClojureScript currently?
16:37eric_normandbtw, I'm not saying clojure makes things perfect
16:37bitemyapphyPiRion: oh, yeah, that's an improvement.
16:37bitemyapperic_normand: have you used a language with a nice type system?
16:37technomancythat is the official story anyway. ("and that's final.")
16:37technomancybitemyapp: haha; I asked him that like just last week
16:38eric_normandbitemyapp: never. Only used Java, C, and Haskell.
16:38coventryBwahaha
16:39bitemyappcoventry: arg/resp elision.
16:39coventrybitemyapp: Sorry, I don't follow.
16:40eric_normandHaskell's type system has some benefits.
16:41eric_normandAnd maybe it's not the type system's fault, maybe it's just the language itself.
16:41eric_normand(it's hard to say when the type system is so integral to the language)
16:43eric_normandI can say this: I miss types at times.
16:45eric_normandI think row types may have solved a lot of what I don't like about Haskell, but I'm not sure, since I never used row types
16:46coventryWhere can I read about row types?
16:46coventrygoogle(haskell row types) returns a thicket.
16:46brehauti think puffnfresh might have an introduction to them on his blog
16:47brehauthttp://brianmckenna.org/blog/row_polymorphism_isnt_subtyping perhaps?
16:47coventryThanks, brehaut
16:47brehautnope its not really an intro. ignore me
16:48brehautmaybe it'll help anyway
16:48coventryYeah, I can understand that.
16:49eric_normandcoventry: this *may* be useful: http://cufp.org/sites/all/files/slides/2013/kmett.pdf
16:53eric_normandcoventry: the answers to this question look decent: http://www.reddit.com/r/haskell/comments/1qol5n/ermine_presentation/
16:54eric_normandcoventry: the main reason I was thinking row types was because of how we use maps in clojure: just look at the keys you care about, ignore the rest
16:54S11001001eric_normand: now that core.typed has heterogenous map types perhaps you'd like to try it? :)
16:54eric_normandcoventry: this reduces coupling between modules
16:55eric_normandS11001001: core.typed is on my list of things to try
16:55coventryeric_normand: Thanks, those slides are pretty challenging, but I'll take a look.
16:56eric_normandcoventry: it's basically saying "this function accepts any type that has field 'a' of type 'Int', regardless of other fields and their types"
16:56eric_normandcoventry: which is a great form of polymorphism that supports a lot of reuse
16:56coventryOh, cool. That is a great idea.
16:57bitemyappcoventry: he's using the wrong terminology, you want "row polymorphism"
16:58bitemyappcoventry: lenses + row polymorphism is how the cool kids write Haskell.
16:59bitemyapprow polymorphism is built on nested pairs (tuples)
16:59bitemyappyou can write your code as if you were writing in a dynamically typed concatenative language if you wanted (in Haskell)
16:59bitemyappnot sure why you would, but you could.
16:59eric_normandbut that's how it goes with types: you always want more :)
16:59bitemyapperic_normand: row polymorphism is less, not more.
17:00bitemyapppeople that want more are hacking Agda and Idris, not fucking with tuples.
17:00coventryIt's a broader domain for your function, so in that sense it's more. :-)
17:00bitemyappwe're talking about types.
17:00bitemyappand how to leverage them. it's not more.
17:02eric_normandbitemyapp: but then you want more expressive types
17:02bitemyappI need scotch for this conversation to continue and I have none.
17:02bitemyapperic_normand: it's a multi-faceted, multi-dimensional subject.
17:03bitemyappand not one you're doing a very good job of talking about in a meaningful capacity, so lets drop it before dnolen has a hairy canary.
17:03eric_normandbitemyapp: agreed. I would love to be schooled, but not now.
17:03bitemyappI don't want to school anybody, I want people to stop strawmanning type systems.
17:04eric_normandbitemyapp: ok, let's stop talking about it.
17:04bitemyapplet's supposed to be a contraction of "let us"?
17:04bitemyappis let's*
17:05bitemyappserious question.
17:05eric_normandyes
17:05coventry$google let's let-us
17:05lazybot[let's - Wiktionary] http://en.wiktionary.org/wiki/let's
17:05bitemyappgood to make certain.
17:06eric_normandbitemyapp: good change of subject :)
17:06bitemyapperic_normand: there's no intent here, I was more interested in verifying that than entertaining a strawman.
17:07noncomas far as i understand, every anonymous (fn) creates a new class, so it can ruin permgen, right?
17:07eric_normandbitemyapp: bad change! you went back!
17:07noncomif anused too much i mean
17:07noncoms/anused/abused :)
17:07bitemyappnoncom: write a test, find out.
17:07eric_normandnoncom: I might be wrong, but I believe that was fixed
17:08eric_normandnoncom: but a test would do the trick!
17:08coventrynoncom: This was discussed on IRC recently. I believe the conclusion was that it's not a problem.
17:08hyPiRionhm
17:08bitemyappI'll never understand programmer hesitation to employ empiricism.
17:10noncom,(let [a (repeatedly 999999999 (fn [] (fn [x] (+ 1 x))))] a)
17:10clojurebot(#<sandbox$eval29$fn__30$fn__31 sandbox$eval29$fn__30$fn__31@1a9759d> #<sandbox$eval29$fn__30$fn__31 sandbox$eval29$fn__30$fn__31@68a394> #<sandbox$eval29$fn__30$fn__31 sandbox$eval29$fn__30$fn__31@1cb6ca2> #<sandbox$eval29$fn__30$fn__31 sandbox$eval29$fn__30$fn__31@491938> #<sandbox$eval29$fn__30$fn__31 sandbox$eval29$fn__30$fn__31@116bd1d> ...)
17:10hyPiRionnah, won't evaluate all
17:10hyPiRion,(last (repeatedly 1e7 #(fn [a b] (a (b a)))))
17:10clojurebot#<sandbox$eval61$fn__62$fn__63 sandbox$eval61$fn__62$fn__63@139bfb>
17:10noncomhmmmm
17:12coventryGood to know. I didn't realize clojure's print functions are smart enough to only evaluate the displayed parts of a lazy function.
17:12coventrys/function/structure/
17:12TimMcbitemyapp: But I only have 500 lives left! Every compiler error consumes one.
17:14eric_normand(loop [] (fn []) (recur)) runs at 140% CPU and 200MB memory
17:14TimMcnoncom: Every place you write fn in the code corresponds to a class; every time that part of the code is executed, a new *instance* of that class is created.
17:15coventrySo I guess you could hose the permgen by (eval)ing a lot of fn.
17:15TimMcTo ruin permgen, you'd need something like (loop [] (eval '(fn [])) (recur))
17:15noncomno guys, don't worry, i'm just stupid
17:16noncomoh, that's what.. i'd never guess
17:16bbloom_the more js/rb i write, the more i <3 clojure. ::group hug::
17:16noncomso evaling an (fn) actually creates a class
17:16TimMcCompiling it, yes.
17:17noncomstill ain't really used to that part of lisp
17:17bitemyappbbloom_: you made a serious mistake following me on Twitter.
17:17bbloom_bitemyapp: ok fine. you're unfollowed
17:17bitemyappbbloom_: good, you're not invited to the salad.
17:18coventryHow does a set of eval'd fn's not get a corresponding set of classes?
17:18bitemyappbbloom_: you couldn't handle it anyway.
17:18TimMcnoncom: You can see in your example above that your inner fn's class is sandbox$eval29$fn__30$fn__31 and you keep having new instances of it.
17:18seangroveI have an announcement: I will be attending the meteor.js devshop/meetup tonight instead of the clojure meetup.
17:19bitemyappseangrove: I'm disowning you.
17:20noncomso that fn does not really get evaled?
17:20dnolenseangrove: shameful
17:20bitemyappseangrove: there are many things that are suitable excuses for not coming to the Clojure meetup, but tonight is the lightning talk one!
17:20noncomoh well..
17:20seangroveS'alright, I'm going to feel the crowd out a bit.
17:20bbloom_seangrove: you're going to discredit meteor, right? :-P
17:20`cbp(dec seangrove)
17:20lazybot⇒ -3
17:20bitemyapp(dec seangrove)
17:20lazybot⇒ -4
17:20seangroveJesus christ, I must have the lowest karma in here now
17:20technomancywow, harsh
17:20bbloom_aw c'mon
17:20bitemyappseangrove: leave your badge and lambdas on the desk.
17:20bbloom_(inc seangrove)
17:20lazybot⇒ -3
17:20llasram(inc seangrove)
17:20lazybot⇒ -2
17:20bbloom_i think he deserves 0 karma at worst
17:20bitemyapp$karma bitemyapp
17:20lazybotbitemyapp has karma 15.
17:20bitemyapphow am I higher karma than seangrove?
17:20dnolenseangrove: I recently read the scaling Meteor.js post that was on HN, I'm really surprised people use it
17:20bbloom_(dec bitemyapp)
17:20lazybot⇒ 14
17:20bitemyappkarma isn't karmic :(
17:21seangrovebitemyapp: Sacha Greif is staying with me and presenting at the meetup, so that's the reason I'm going
17:21dnolen(inc seangrove)
17:21lazybot⇒ -1
17:21bbloom_seangrove: you're at -1
17:21technomancyI would inc him, but I am a bit wary of the ecological implicaitons of http://finalfantasy.wikia.com/wiki/Meteor_(Final_Fantasy_VII)
17:21bitemyapp(inc seangrove)
17:21lazybot⇒ 0
17:21bitemyappseangrove: forgiven.
17:21seangrove I tried to convince myself that there's some overlap with meteor.js and cljs, but just can't really find any.
17:21bbloom_seangrove: that's a sentinel value for "unbounded"
17:21bitemyappSG is a good reason.
17:21technomancybitemyapp: maybe because he used to go by seangrov` all the time
17:21bitemyapp$karma seangrov`
17:21lazybotseangrov` has karma 0.
17:21technomancy(identity seangrov`)
17:21lazybotseangrov` has karma 0.
17:21technomancyhm
17:21bitemyappnope.
17:21bitemyapphe came by the negative karma honestly :)
17:22seangroveHaha
17:22seangroveMore or less
17:22hyPiRion(inc seangrove)
17:22lazybot⇒ 1
17:22seangroveI am curious to talk to some of the meteor guys about react though
17:22seangroveThey're all pretty impressive distributed systems people
17:22bitemyappwhat?
17:22clojurebotwhat is cells
17:22bbloom_seangrove: meteor is much more about the model layer
17:22bbloom_react doesn't provide any model layer stuff
17:22bitemyappseangrove: I don't think you mean distributed systems.
17:22seangroveCurious to hear what they're doing around simplifying ui programming
17:23seangrovebitemyapp: They're mostly very impressive MIT people who were working on distributed systems before
17:23bbloom_also react is all about taking out the stupid 2-way data binding from your views... why would you want to add 2-way databinding to your models too?
17:23seangroveWell, I don't know "mostly" anymore... about a year ago anyway
17:23bbloom_"you know, my database is pretty nice to work with. i'd really like to make it more like my annoying UI code"
17:23bbloom_booo.
17:23bitemyappthere's something perverse here.
17:24seangrovebbloom_: Yeah, so I'm not sure I see a huge win with meteor beyond a cool use of ddp
17:24seangroveBut smart people are interesting to talk to, and often have surprising insight
17:24bbloom_http://www.meteor.com/blog/2012/03/21/introducing-ddp says:
17:24bbloom_"DDP is a standard way to solve the biggest problem facing client-side JavaScript developers: querying a server-side database, sending the results down to the client, and then pushing changes to the client whenever anything changes in the database."
17:24bbloom_that is *far* from the biggest problem in any javascript client app i've ever used
17:25bitemyappMeteor is as far from how Clojure people usually like to design things as I can possibly imagine.
17:25bitemyappit also solves a solved non-problem in the worst way possible using semantics that don't even really make sense at scale.
17:25bitemyapp(declarative, idempotent expression of intent > stateful bit smashing) for talking to the backend.
17:26bbloom_when dnolen and i talked to petehunt the other day he mentioned https://github.com/petehunt/react-graph
17:26bbloom_david & i suggested he study datomic :-P
17:26alandipertbbloom_: DDP looks sane, and afaict the rest of meteor is par-for-blub while being very nicely documented
17:26bbloom_but his readme shows he's on the right track :-)
17:26seangrovebbloom_: Yeah, but I'm working on some UI stuff, so curious at least to see how they're approaching it over the next year or so
17:27seangroveI'm really blown away at how bad writing ui's in js/cljs is right now, amazingly bad
17:27bitemyappbbloom_: that react-graph repo is something I've wanted for awhile.
17:27bitemyapphistorical client-state.
17:27bitemyapptoss in pluggable asynchronous synching to a backend and you're in business.
17:28bbloom_bitemyapp: i dunno if pete has been in here yet, but the next time he's on irc, i'll make sure he starts idling in here
17:28dnolenseangrove: you should look more closely at React, bbloom was dead on
17:28bitemyappbbloom_: plzdo.
17:28dnolenseangrove: I was afraid it was good tech but couldn't be used in a functional way from CLJS - happy to know I'm wrong
17:28bbloom_(inc reactjs)
17:28lazybot⇒ 1
17:29alandipert(+ reactjs 0.2)
17:29dnolenbbloom_: so I have a basic approach to reactjs that should be faster than what React can offer JS devs based on petehunt's suggestions
17:29alandipertoh
17:29bbloom_dnolen: nice. gist?
17:29dnolenbbloom_: https://gist.github.com/swannodette/7813518
17:29bbloom_alandipert: i can't comment on the impl of DDP w/o digging in to more details
17:29seangrovednolen: I'm working on combining react in a pluggable way with hiccup-syntax that can compile out to various implementations, bootstrap/foundation/closure ui, etc.
17:30dnolenbbloom_: as suspected we can use =, and we can instantiate the tree only when we need it
17:30bbloom_dnolen: fast equality checks are like the best thing to ever happen to anything ever
17:30dnolenbbloom_: we can rerender from the root and it will be fast, and we don't need to adopt any goofy OO stuff
17:30bbloom_dnolen: told you :-P
17:31dnolenbbloom_: ;)
17:31alandipertbbloom_: i've only read https://github.com/meteor/meteor/blob/master/packages/livedata/DDP.md
17:31bitemyappI really wish Clojure had docstrings.
17:31bbloom_dnolen: i think this is like the 3rd time you ignored me for 6 months until you realized i was right. you should start "give it 5 minutes" to more random shit i say :-)
17:32dnolenbbloom_: haha noted
17:32ivanbitemyapp: do you mean triple-quoted strings?
17:32bbloom_alandipert: i'll try to look in a bit
17:33nopromptreact is nuts.
17:33nopromptand by nuts, i mean awesome.
17:33alandipertbbloom_: oh, not recommending, so no worries :-)
17:34bitemyappivan: yes.
17:34bitemyappI am tired of escaping "
17:34eric_normandsource maps in cljs are rocking my world!
17:34OscarZwhats react about? some new web framework? :)
17:34bbloom_alandipert: tab closed. :-P
17:35ivanOscarZ: https://www.youtube.com/watch?v=x7cQ3mrcKaY
17:35bbloom_dnolen: looking at your gist. yeah the single "value" key is the trick i was suggesting
17:35bbloom_so their internal shallow copy doesn't cause us issues
17:36bitemyappOscarZ: frontend stuff.
17:37OscarZok.. are there some new revolutionary ideas ?
17:37nopromptOscarZ: i supposed that would be your call.
17:37bitemyappOscarZ: revolutionary? no, but people are starting to move beyond callbacks (the goto of async).
17:38bitemyappThere are no revolutions in computer science because blub programmers exist.
17:38noprompt:(
17:38bitemyapponly incremental dragging of intransigent lazy-bones into the future.
17:38noprompt;_;
17:38dnolenbbloom_: yeah, React is pretty rocking. I'm curious to see if we can beat Backbone on the TodoMVC benchmark w/ this
17:38dnolenbbloom_: if we can you can expect a blogpost :)
17:38bitemyappnoprompt: be happy.
17:39noprompt:)
17:39nopromptXD
17:39bitemyappnoprompt: http://i.imgur.com/GwSrBuw.jpg
17:40nopromptugh, i picked up a cold over the holidays and getting information in to my brain is like trying to give a dog medicine that isn't wrapped in bologna.
17:40OscarZyeah i havent done much front end but enough to know what the callback mess... i saw some tutorial on pedestal, it uses some kind of queue to make things sequential
17:40bitemyappnoprompt: My insomnia flared up and I started eating less. I'm living on coffee, tea, and hatred these days.
17:41astevenoprompt: so I have to trick you into thinking it's food and then throw it at your face so you catch it?
17:41bitemyappOscarZ: it's closer to a core.async DAG of channels, but yeah, close enough.
17:41bbloom_OscarZ: apparently the pedestal stuff has changed quite a bit recently. i have no idea what it's like now
17:41bitemyappnoprompt: also stop reminding me how I don't have a dog :(
17:41bitemyappbbloom_: there are some core.async agitators in the ranks.
17:42nopromptdnolen: this is a great hack.
17:42OscarZi wanted to do things like.. "wait these 3 callbacks to do their thing and then do this"
17:42OscarZtheres deferred in jQuery for that.. but thats all i used..
17:42bitemyappOscarZ: core.async is good for that.
17:42OscarZi guess these frameworks are for sorting this kind of thing?
17:43dnolennoprompt: heh, I wouldn't call it a hack :) I came to that solution after picking petehunt and balpert's brain in #reactjs
17:43OscarZcool.. i should look into core.async
17:43OscarZcan core.async be used on client side as well ?
17:43dnolennoprompt: but you maybe you just meant it's cool code, then I agree w/ that
17:43bitemyappOscarZ: only because of CLJS, but yes.
17:44bitemyappOscarZ: being used in CLJS was a design goal for core.async.
17:44seangrovebbloom_: It looks like pedestal and react independently converged on quite a few ideas
17:44bitemyapp~reactjs
17:44clojurebotreactjs is a poorly implemented comonad
17:44bbloom_no, no it isn't
17:44bbloom_clojurebot: forget reactjs
17:44clojurebotTitim gan éirí ort.
17:44bitemyappclojurebot: forget bbloom
17:44TimMcHmm, eval'ing '(fn []) in a tight loop is generating 1000 classes per second, but they're getting cleaned up.
17:44clojurebotHuh?
17:44nopromptdnolen: i'm of the mind that everything is pretty much a hack client side. haha! but yes, it's definitely cool.
17:44bitemyapp~bbloom is afraid of comonads
17:44clojurebotIn Ordnung
17:45OscarZbitemyapp: cool.. thought its more for server side processing queues etc..
17:45OscarZprolly can be used for that too of cos
17:45noprompt:(
17:45bitemyappOscarZ: it's good for anything async. Really.
17:45bitemyappOscarZ: I use it to clean up callback bullshit all the time.
17:45bitemyappserver and client-side.
17:45OscarZcool
17:45bitemyappcultureshipname: GCU: Only Free Men Can Negotiate
17:47TimMchttp://i.imgur.com/7WliQqW.png
17:48nopromptdnolen: this plus core.async. i wanna fall out my chair. but i have hard wood floors.
17:50nopromptdnolen: so i guess my next question would be, how much stuff do you put in a component? i mean how big should these things be?
17:51bbloom_noprompt: as small as possible but no smaller
17:51bbloom_also worth asking in #reactjs
17:51nopromptbbloom_: good point.
17:52nopromptbbloom_: i was more or less thinking of nesting components.
17:53noprompti think it's time to go get some pho.
17:55dnolennoprompt: I suspect they can be very large for us
17:55dnolennoprompt: at some point I'd like to do some benchmarks
18:01bitemyappTimMc: looks like the GC is keeping up with the stuff that fell out of scope. Seems fine to me.
18:03TimMcbitemyapp: Yeah, but it shows that I was wrong about it messing up permgen.
18:04TimMcThat also means I can't knock over clojurebot with this:
18:04TimMc,(let [evil ((symbol "eval") (ns-publics 'clojure.core))] (dotimes [_ 500000000000] (evil '(fn []))))
18:04bitemyappTimMc: it's churning the PermGen.
18:05clojurebotExecution Timed Out
18:05bitemyappTimMc: you weren't wrong about that, you were just wrong about how smart it is about scoping.
18:05bitemyappTimMc: there's still possibly a way to smash the PermGen with this.
18:05TimMcOh, heh.
18:05bitemyappspawn threads + long sleep.
18:05bitemyappshouldn't be able to harvest then. I would think.
18:06bitemyappnew anonymous fn in each executable thread before it sleeps.
18:06OscarZafter long time lurking i've been starting to actually code Clojure lately.. doing project euler exercises.. learning basic stuff about map, filter, sequences etc..
18:06bitemyappI don't think Euler is a good way to learn Clojure.
18:06bitemyapp4Clojure is better for learning the API.
18:07bbloom_(inc 4clojure)
18:07lazybot⇒ 2
18:07OscarZyeah was going to ask what you guys think would be a good next step.. what APIs or concepts to learn
18:07seangroveI'd agree that 4Clojure is probably a reasonably good approach to start with
18:09bitemyappOscarZ: 4Clojure and clojure book are my usual recommendations.
18:09bitemyapp~clojurebook
18:09clojurebotExcuse me?
18:09bitemyapp~clojurebook is http://clojurebook.com
18:09clojurebotIk begrijp
18:10bitemyappOscarZ: ^^
18:10OscarZwas impressed how easy it is to "compose" stuff from smaller building blocks
18:11OscarZbitemyapp: ok.. ill check it out.. i have a clojure book on kindle that ive been reading when ive had time.. Programming Clojure i think
18:11tommoim working through that too, its really good
18:15OscarZyeah its a nice book.. ive had it for some time, have read a chapter or two once in a while.. should have started actually coding earlier :)
18:16sritchiemagnars: would it make sense to add gzip support?
18:17sritchiefor static resources?
18:18bitemyappsritchie: to what?
18:18sritchieto optimus
18:18sritchiethough, from looking at the discussion,
18:18bitemyappsritchie: you shouldn't be serving static assets from something like that.
18:18sritchiewhat do you mean
18:18sritchiesomething like optimus?
18:19OscarZ4clojure looks nice.. i think ive tried it a bit long time ago
18:19bitemyappsritchie: if you care enough about performance to worry about gzipping, you should be statically compiling assets and deploying to an nginx server or a CDN.
18:19sritchieit looks like you get more wins from adding gzip as a middleware and compressing any response, dynamic html included
18:19sritchiebitemyapp: I'm using a CDN for static assets
18:19sritchiecloudfront, which refreshes from optimus
18:19bitemyappif you're fronting with cloudfront then why are you worried about gzipping in optimus?
18:20sritchieI didn't realize cloudfront gzipped
18:20bbloom_bitemyapp: cloudfront doesn't do it's own gzipping
18:20bitemyappbbloom_: wow.
18:20sritchiewell, there we go
18:20bitemyappso my conclusion at that point would be to not use a CDN that doesn't gzip, of all things.
18:20bbloom_bitemyapp: cloudfront serves whatever you give it
18:20bbloom_what level of gzip should it use?
18:20bbloom_what resource types should it gzip for?
18:20bitemyappshouldn't the headers decide this?
18:21bbloom_gzip slows performance for some file types
18:21bbloom_cloudfront has two modes
18:21bbloom_basically read-through caching or write-through caching
18:21bbloom_in the write-through mode, you can literally just give it a .http file
18:21bbloom_w/ a raw response & it will inject a header or two & that's that
18:22bbloom_but that requires you add stuff to your deployment process
18:22bbloom_the read-through approach is way easier, but it serves whatever you serve
18:22sritchiebbloom_: so sounds like gzipping ANY text response, + html, is the right way to go
18:22sritchievia middleware
18:23sritchie(for hosts that accept gzip)
18:23sritchiewhich means that cloudfront will get the benefits
18:23bbloom_yes
18:28sritchiebbloom_: do you know if cloudfront keeps separately cached items for gzip vs not?
18:28bbloom_sritchie: yeah, per-encoding header, i believe
18:28sritchiebbloom_: meaning, if it gets a file once with gzip, then a client asks that doesn't support gzip, does it refresh
18:28sritchieokay
18:28sritchienice
18:29sritchiebbloom_: but with huge expires headers, the first time you fail to return a gzip version when cloudfront asks for gzip,
18:29sritchieyou're hosed until you change the file
18:29sritchiewhich is fine
18:29bbloom_this is all relatively well documented on the amazon site
18:30akurilinHey folks. I'm trying to find the most maintenance-free way of dumping error logs from both our various frontends and backend. I could just make a new ring app with a db on the existing PG instance, but I'd rather not. I'm thinking of something like Parse or Dynamo as this hassle-free log dump. Any thoughts?
18:30OscarZbitemyapp: why you think project euler is a bad way to learn clojure?
18:33bitemyappproject euler has more to do with math than programming.
18:33bitemyappand not even the interesting math.
18:34technomancyand everyone knows you need a type system to do math
18:34OscarZinteresting.. would it be better to use something like Haskell for that?
18:34bitemyappno.
18:35bitemyappeuler is boring no matter what language you use.
18:35bitemyappHaskell isn't necessarily any more well suited for mathy things than anything else.
18:35technomancyOscarZ: I'm just messing with bytemyapp
18:35hiredmanit's true, otherwise you'll try and add two different kinds of numbers together
18:35technomancybite
18:35bitemyappouch dude.
18:35OscarZ:)
18:36bitemyapphiredman: it's better than the 31-bit Ints in OCaml.
18:37jwieringaInteresting, I was just using euler to learn more about Clojure and spent more on Wikipedia reading about Mathematical functions :)
18:38brainproxydnolen: yes, you understood what I was trying to do
18:38OscarZjwieringa: its wrong. now you have to get drunk and erase it all :)
18:38bitemyappjwieringa: that's kinda the point.
18:38brainproxyfound a difference mechanism that works better in the first place, so it's fine
18:39brainproxydnolen: I had thought maybe there would be an easy way to tease the info out of the analyzer, gave it a naive go
18:39brainproxys/difference/different
18:40jwieringabitemyapp: Yeah, the timing of the conversation was good :)
18:41dnolenbrainproxy: we don't store AST information, only the usual metadata on top levels + function info for optimization
18:42brainproxydnolen: right, well I'm learning, today was the first I spent some serious time in the analyzer/compiler/etc codebase poking around, fun stuff
18:45eric_normandhow did it get to be quarter to six?
18:45eric_normandI've got to stop logging into irc :(
18:45bitemyapperic_normand: it didn't - because it's actually 1545
18:45technomancytime travel
18:45eric_normandbitemyapp: off by two error!
18:47bitemyapperic_normand: you middle-country people don't exist.
18:47devneric_normand: some of my best and worst moments have been captured on IRC
18:47bitemyappdevn: you're nothing but a lazy sequence of moments, with the universe itself (take ...)'ing from you.
18:48bbloom_is there any good paper/explaination/details about the transient implementations? reading their code is only a little enlightening
18:49bitemyappbbloom_: that's one slightly annoying thing about stuff I find in Clojure, there's often less published work backing the implementation.
18:50bbloom_*shrug* for the most part the impl is absurdly simple
18:50bitemyappI'm not speaking only about impl.
18:50bbloom_the data structures are pretty much the only interesting part of the implementation
18:50bitemyappnot talking only about Clojure's implementation...
18:50bbloom_oh ok then
18:51hyPiRionre transient impl: I'll possibly write something about them in January
18:51bitemyapphyPiRion: preemptive thank you
18:51bbloom_hyPiRion: cool
18:51bbloom_hyPiRion: does that mean you can give me a 5 sentence explaination now? in particularly PHM. PV makes much more sense to me
18:51eric_normanddevn: I have never really been much to chat online. I'm liking it and glad I'm a little hooked. Otherwise, I would never do it.
18:52bitemyapperic_normand: I grew up on IRC and cll, thus why I'm a terrible person.
18:53eric_normandbitemyapp: that explains it! I was on cll, once. ONCE!
18:53eric_normandbut I kid
18:53eric_normandthere are some really great posts on cll
18:54hyPiRionbbloom_: Wish I could, but I want to be really sure I understand them properly
18:54bbloom_heh
18:54bbloom_ok then
18:54bitemyappI'm pretty sure I spent the first 60% of my programming life believing evil correlated with intelligence because of cll and IRC.
18:54arrdembitemyapp: that explains so much...
18:54arrdemcll not even once.... irc all day erry day
18:54bitemyappwell, time to stop relinquishing my secrets and go back to plotting the demise of my enemies.
18:55hyPiRionI usually end up understanding something halfway through my own explanation, and have to rewrite because I haven't taken that stuff into account
18:55bbloom_hyPiRion: always good for your understanding tho
18:56bbloom_i have dozens of blogposts that i started to write but stopped b/c i learned something
18:56bbloom_:-P
18:56hyPiRionbbloom_: yeah, it's wonderful, but I don't want to explain something I'm not sure I completely understand myself :p
18:56bitemyappSpeaking of cll, I want conditions and restarts.
18:56hyPiRionre those 5 sentences
18:57arrdembitemyapp: we don't have a jvm bytecode goto. not gonna happen.
18:58bitemyapparrdem: could fake it.
18:58bitemyappnot the goto, the state preservation.
18:59arrdemthe state preservation sure... restarting in place no way... restarting from the top sure.
19:00arrdembut then you just have a try with a loop around it :P
19:00bitemyapparrdem: that's not state-preserving.
19:00bitemyapparrdem: I could think of multiple ways to do it in a language not Clojure that shall go unnamed.
19:03bitemyapparrdem: https://en.wikipedia.org/wiki/Java_bytecode_instruction_listings I see a goto.
19:03bitemyapparrdem: I think you meant that Java doesn't have goto, the JVM certainly does.
19:03bitemyappprobably needed it for implementing exceptions sanely.
19:04bitemyapptoo bad they did exceptions the wrong way.
19:05arrdemso given that we have a goto... why don't we have TCO? is it that we do class generation rather than bytecode emission?
19:05amalloythe jvm's bytecode goto is restricted to staying within the same method
19:05bitemyapparrdem: we use methods.
19:06amalloyand also rich wanted clojure function calls to be java method calls, otherwise interop looks pretty bad
19:06bitemyapparrdem: look at Frege to see the other evolutionary branch.
19:07arrdemamalloy: okay yeah that's what I thought.
19:08arrdemstill... you have jumps to word aligned addresses... with that you could splat out several entire
19:08arrdem"methods" into a single function and then just provide a wrapper to make it look sane
19:09bitemyapparrdem: have you looked at Frege? It's a really cool language for thinking about how to target the JVM.
19:09arrdembitemyapp: I only just learned about it :P
19:11bitemyapparrdem: excellent opportunity to learn!
19:12arrdembitemyapp: first I need to beat deft into submission and start a clojure.RT and JVM pre CinC reading list then add that...
19:17bitemyapparrdem: props for making SimpleVM a register machine btw.
19:18arrdembitemyapp: why are you looking at that shitheap
19:18arrdemthanks tho :P
19:20arrdemreally it's more of a heap machine than a register machine... it provides an infinite register set which really means that all its ops are memory->memory
19:22nopromptomg. <3 pho.
19:23bitemyappnoprompt: $10 bowl of broth.
19:23nopromptbitemyapp: nah they hook it up out here.
19:24bitemyapp$10 bowl of broth and poorly prepared, nearly flavorless noodles/meat.
19:24nopromptbitemyapp: :| that sir is not the case.
19:24rasmustohahahahaaha, I remember this conversation
19:24bitemyappnoprompt: pho is a waste of money.
19:24rasmustoramen supremacy
19:24arrdembbq is king
19:24nopromptbitemyapp: startups are a waste of money, pho is not.
19:25bitemyappnoprompt: except for the one I work at, sure.
19:25nopromptbitemyapp: i can't speak for pho in the bay but here in fresno i'm pleased to say the pho scene is good.
19:26bitemyapphttp://www.cpptips.com/term_except
19:26bitemyappnoprompt: I've had pho in most corners of the country. It was all a waste of time and money.
19:27nopromptbitemyapp: you need to take of those lollerskates buddy.
19:27noprompt*off
19:27bitemyappnoprompt: come to SF, I'll show you real food.
19:28nopromptbitemyapp: pretty sure i just ate "real" food.
19:28bitemyapphttp://www.reddit.com/r/haskell/comments/1s6wb6/a_modified_approach_to_comonadic_cellular/
19:28bitemyappnoprompt: you ate peasant broth at first world prices.
19:28nopromptbitemyapp: i'm pretty sure there was blood in it which is what i want.
19:29arrdemclojurebot: offtopic |is| #clojure-offtopic is #emacs
19:29clojurebotOk.
19:29bitemyappnoprompt: goulash and borscht are superior alternatives.
19:29nopromptbitemyapp: i'm sure they are.
19:29nopromptand i will eat them too.
19:29bitemyappnoprompt: also, kapusniak.
19:30bitemyappnow I want kapusniak. dammit.
19:30rasmustohad some of this the other day: http://en.wikipedia.org/wiki/Dinuguan
19:30nopromptrasmusto: now that's what i'm talking about.
19:31nopromptrasmusto: anytime there's blood and organs in a bowl of stew i'll be the first at the table.
19:31rasmustonoprompt: <3 (and ears/tail/snout/liver...)
19:31akurilinnow you made me hungry
19:31nopromptrasmusto: my ex was philipino but her mom never made that dish. :( i feel cheated.
19:32nopromptrasmusto: she did make ox tail soups a lot though. that was pretty good.
19:32rasmustosounds rich
19:33nopromptbitemyapp: you take me to get blood soup.
19:34bitemyappnoprompt: no
19:34nopromptbitemyapp: fine. organ meat then.
19:40arrdemamalloy / bitemyapp: any hints for starting reading the Clojure core, or do I just need to spend a week with coffee?
19:41bitemyapparrdem: avoid coffee, drink tea if you want caffeine.
19:41rasmustodrink blood tea
19:41arrdemrasmusto: BLOOD FOR THE BLOOD GOD
19:44brehauthttp://amultiverse.com/tag/corn-god/
19:45scottjarrdem: clojure or java parts?
19:45bitemyappis the core.clj bootstrap that interesting?
19:46bitemyapprealistically the more interesting bits are going to be in Java.
19:49arrdemscottj: I've read some of the clojure bootstrap and I've written lisp bootstraps before. It's the java bits that I'm curious about.
20:35dpetrovicsanyone know if there is an analog of jquery's wrap-all in Enlive?
20:35dpetrovicsIm looking to wrap a div around all elements in the set of matches from an Enlive selector
20:38dpetrovicsnever mind-- looks like wrap actually does that-- I assumed it would wrap each match
20:41amalloydpetrovics: fwiw, it's a useful rule of thumb that not many clojure functions "do x to each y". it's more flexible to just "do x to y", and then use map if you want it on multiple things
20:42coventryGoing back to the earlier question about permgen and fn creation, the only ill effects of (last (repeatedly 1e8 #(eval '(fn [] "foo")))) seems to be that it runs forever (three hours on my system.)
20:43dpetrovicsamalloy: here's what I mean-- looks like the at form actually does apply the transformation to each match
20:43dpetrovics(at [{:tag :p :content ["foo"]} {:tag :p :content ["bar"]}] [:p] (wrap :div {:class "outer"}))
20:44dpetrovicsthat will actually wrap each
20:44dpetrovicsp element
21:01bbloom_dnolen: finally got brenton to look at react too :-)
21:07bitemyappnoprompt: you should've come to the Clojure meetup and given a talk.
21:08nopromptbitemyapp: man, that would have been awesome. i really want my life to get back to normal.
21:09nopromptbitemyapp: i'm going to be talking about clojure two days a week for six weeks starting january.
21:32ddellacostaI want to do a union of two vectors of hash-maps, but based only on the value of a specific key/value pair (id). What is the most efficient way to do this?
21:34ddellacostasorry, I meant intersection, not union
21:34amalloyddellacosta: that's too vague a request for me to really understand, but "most efficient" has got to be the wrong question
21:35amalloylearn how to do it at all, and then if it really really matters you can worry about what's efficient
21:38hyPiRion(into {} (for [[k v :as entry] m1 :when (= entry (find m2 k))] entry)) is probably okay-ish
21:40ddellacostaamalloy: ouch
21:40ddellacostalet me restate the question
21:40sritchieshot in the dark - anyone played with infinite scroll in cljs?
21:40amalloyhyPiRion: vector of maps
21:40ddellacostaSay I have [{:a 1 :b 2}{:a 2 :b 3}] and [{:a 1 :b 2}{:a 3 :b 6}] --I want to get [{:a 1 :b 2}] in the end
21:41hyPiRionoh, eh.
21:42ddellacostaoh, but I should qualify that further-- even if the value for :b is different in the second vector, I want to get (one of the vectors values for) the map with :a that has value 1
21:43amalloyi mean, that sounds like just doing (group-by :a ms) on each vector, and then working with them as maps
21:47bitemyappddellacosta: group-by + merge
21:48bitemyappddellacosta: map reduce (group-by :id ....)
21:48bitemyappmap reduce merge (group-by :id ...)
21:48ddellacostaamalloy, bitemyapp: thanks, will try these. Messing about with clojure.set now
21:49sritchietechnomancy, I can't track it down - what was your rec about how to inject :aot :all AFTER the prep tasks?
22:10ddellacostafeel like I could do this better: https://www.refheap.com/21549
22:11bitemyapp"Clojure is basically lazy by default" yeah. uh huh.
22:11ddellacostabitemyapp, amalloy: I tried with group-by, but wasn't sure how it helped me get the answer I wanted...probably wasn't thinking about it correctly though.
22:11bitemyappddellacosta: merge each group
22:11ddellacostabitemyapp: that gave me a union though, and I wanted an intersection
22:12bitemyappddellacosta: oh sorry, set/intersect + select-keys
22:20deadghostwhat's #'
22:20deadghostgoogle doesn't like stuff like that
22:20bitemyappdeadghost: var
22:20deadghostk
22:20bitemyappdeadghost: where did you see it?
22:20coventrydeadghost: http://clojure.org/reader
22:21arrdem,((require 'clojure.pprint)(#'clojure.pprint/pprint {:foo :bar :baz {:many-key :so-nested} :wow true}))
22:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: clojure.pprint/pprint in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:21deadghostafter a ran a function for scraping
22:21deadghostit's a little confusing because I spent the last money in CL
22:21deadghost*month
22:43arrdemdevn: as long as you promote regexes to IFn while you're at it, I'l all for it.
22:45arrdemdeadghost: I'm curious... can you offer any compelling reason to really master CL/Guile? I tried to use CL a few times and the lack of packages or propper module structure really rubbed me the wrong way.
22:46deadghostarrdem, why do you think I'm on clojure
22:46technomancyguile is pretty great for interop inside a larger system
22:46deadghostI couldn't string enough packages together to write a simple scraper
22:55arrdemdeadghost: oh ok. I was hoping that you had sucessfully used CL for something serious. And yeah. The library infrastructure, clojars and leiningen are totally killer features for Clojure over the other Lisps I've played with.
22:56deadghostclojure definitely left a better first impression
22:56deadghostnope, tried and failed
22:58Qarrydeadghost, everyone hates me. =(
22:58QarryEven Chousuke
23:00deadghostalthough leinin is mad at me
23:00Qarrydeadghost, Vladimir Lenin?
23:00deadghostbut I figure that's because marmalade is borked and I got it off melpa
23:01mikerodhow can I get lein test to show output from println or similar functions
23:01mikerodi.e. show me stdout stream stuff
23:01mikerod`lein test`
23:02QarryChousuke, sä etkään oli täällä katsoksesi suomeani parentua
23:03deadghostarrdem, how was your CL experience?
23:04deadghostwhat did you try writing?
23:04arrdemdeadghost: I looked at CL before clj, used CL for one class assignment and then despite my prof's warnings about not having any clj sample code I threw out his CL codebase and went it solo for the term. worked out great, thanks in no small part to #clojure
23:05arrdemdeadghost: the project was a toy pascal compiler
23:12echo-areaTrue or false: If I'm adding an extra argument to many functions and the purpose of this argument is all the same, I can make it a dynamic var
23:12echo-areaWill it look like weird?
23:13arrdemdynamic vars seem to be considered an anti-pattern... but I'd be OK with it
23:14echo-areaI have concerns on if it's idiomatic rather than pattern, and I'm okay with it too, but I still want suggestions
23:14echo-areaIs there any drawback on this?
23:15echo-areaI personally haven't seen any
23:15echo-area(Although I have to use binding-fn, but that's a price to pay)
23:15arrdemthe main question (or issue) is that dynamic vars play badly with threads and lazyness
23:17echo-areaI'll get a non-lazy result at the end of the "scope" I set the dynamic var up.
23:19echo-areaBut I think it would be easier to address the problem if I intentionally leave the root value of the var to be unbound
23:19echo-areas/the problem/problems
23:19coventryecho-area: Sounds OK for a quick hack prototype, but it will complicate your life over the long haul if you keep it that way.
23:23echo-areacoventry: The most clean way, as I can see, is to pass the arg on every function call.
23:23coventryYeah, that's a sane approach.
23:24echo-areaHmm, maybe dynamic scope is only for temporarily altering behavior of some part of the program
23:24echo-areaOnly for this scenario can it be clean
23:25technomancyecho-area: if you invoke dynamic binding, you must also take responsibility to ensure nothing lazy escapes its scope
23:25technomancysometimes that's easy and sometimes that's impossible
23:27echo-areaI have to figure out a sane way
23:27echo-areaThanks for the suggestions
23:35echo-areaIs it weird that I create some functions in let's lexcial binding?
23:37arrdemas long as you aren't emitting defs from there you're fine
23:37arrdemin theory at least
23:38echo-areaNo I'm not. But I may have to use letfn. To me this sounds like a compromise between dynamic scope and adding args to many more functions
23:39echo-areaIt does make testing a bit hard, so hmm
23:40echo-areaI'd better fall back to use an extra arg for those functions
23:48brainproxyecho-area: what's the extra arg for?
23:48echo-areabrainproxy: More like for the usage of state, context, or configuration
23:49brainproxyecho-area: have you explored the State monad pattern, it's pretty nice for that
23:49echo-areabrainproxy: No, I hear about this for the first time. I'm search for it. Thank you!
23:50brainproxyecho-area: here's a clojure based tutorial to give the idea
23:50brainproxyhttp://www.clojure.net/2012/02/10/State/
23:50brainproxythere are now several libraries that implement State and other monad apis
23:50brainproxyprotocol-monads, algo.monads
23:51brainproxyfluokitten
23:53technomancywithout the compiler's help it's arguable as to whether that results in simpler code
23:54brainproxytechnomancy: depends on how much power you pack into the macros/sugar around monads
23:54brainproxywith a good implementation of `do` i find it helps me, but i could be weird or misguided
23:57brainproxyin any case, it's really just a patter; programmers can "taste and see", and use it appropriately if they find it useful
23:57brainproxy*pattern
23:58technomancyyeah, give it a try
23:59technomancyI have seen some very messy monadic code in clojure but I don't want to rule out the possibility that it can be done well
23:59brainproxyI'm doing a sizable project with them currently; my biggest complaint is that the code density gets extremely high
23:59brainproxybasically just lots and lots of symbols