#clojure logs

2012-10-12

00:00JvJmaybe I'll just compile from source
00:02SgeoUh
00:02SgeoI can't seem to get documentation for .. on clojuredocs.org
00:03AtKaaZSgeo, it's 404?
00:03JvJSego, get docs from the repl.
00:03SgeoNot 404, but directs to the clojuredocs.org core docs
00:03clojurebotreply is the new high-powered repl that powers lein2's repl task https://github.com/trptcolin/reply
00:03AtKaaZSgeo, for . works though, http://clojuredocs.org/clojure_core/clojure.core/_dot
00:04AtKaaZSgeo, it's 404 for me, if you come from cheatsheet: http://clojuredocs.org/clojure_core/clojure.core/_dot_dot
00:04Sgeoo.O there's a -?>
00:05SgeoThat's it, I'm making a m-> for use with arbitrary monads.
00:05SgeoOr maybe a macro that takes macros and ... does stuff
00:06pandeiro,(= (keys {:a 1 :b 1 :c 1}) (keys {:a 1 :b 1 :c 1})) ; is not converting these to (set ...) a bug?
00:06clojurebottrue
00:06AtKaaZSgeo, where did you see the -?> I can't find it
00:06Sgeohttp://clojuredocs.org/clojure_contrib/clojure.contrib.core/-_q%3E
00:07AtKaaZin contrib? how do I access that in repl/
00:09JvJaren't the contrib libraries being refactored?
00:15JvJnow that contrib has been mentioned, I'm trying to access it in leiningen... I'm having some problems
00:21JvJnever mind, solved. clojure.contrib.core is now clojure.core.incubator
00:23AtKaaZJvJ, I was able to run mandelbrot.clj example from penumbra
00:23JvJAtKaaZ, was there an issue loading the PenumbraSystem class or something like that?
00:24AtKaaZJvJ, it was when trying in a new project, but not when trying inside penumbra not that example at least
00:26JvJAtKaaZ, what kind of problem did you get?
00:26AtKaaZJvJ, I already posted it on mailing list, after your reply
00:27JvJAtKaaZ...oh i misread your post. I thought you said you were NOT able. sorry
00:30AtKaaZJvJ I think the error is because PenumbraSystem is java code and maybe not included in output penumbra.jar ? will check
00:30JvJThanks AtKaaZ
00:43AtKaaZJvJ, I don't know why they aren't included but if you compile manually (lein uberjar) they are
00:44AtKaaZI mean, I don't know what you'd have to type to lein so that you'd get the .jar without those .class files
00:45AtKaaZonly .clj files are in it
00:45AtKaaZhere: http://clojars.org/repo/penumbra/penumbra/0.6.0/
00:45JvJi have manually compiled the uberjar. do you know how to include that in my lein project? For some reason lein isn't generating or using a lib directory
00:46AtKaaZI don't know, but I want to
00:46SgeoSince I want to make new syntax for working with monads, I should try to make my syntax not dependent on the particular monad library used
00:47SgeoDoes that make sense?
00:47SgeoA compatibility layer allowing my syntax to be used with either algo.monads or protocol monads
00:47JvJAtKaaZ, there's some nonsense about using maven here.... but I don;t like it http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/
00:48antares_JvJ: calm down, it's not nonesense
00:48antares_and it is 2 lines
00:48AtKaaZlol
00:48JvJNonsense is just a word I use to mean "stuff" sometimes
00:48AtKaaZseems old post, surely must be better ways file:// maybe?
00:48antares_Leiningen reuses JVM infrastructure, this means that local repos are just Maven repos
00:49antares_this saved Leiningen maintainers a lot of owrk
00:49antares_lein also can install a jar to the local repo
00:49antares_of your project, though, not an arbitrary one
00:49JvJright. I want to use an arbitrary jar and access it in my project
00:50antares_JvJ: I'd do mvn install:install-file -Dfile=jaad-0.8.3.jar -DartifactId=jaad -Dversion=0.8.3 -DgroupId=jaad -Dpackaging=jar (note that I do not specify a custom repo location)
00:50antares_lein2 uses ~/.m2 (the standard local repo location)
00:50AtKaaZJvJ, this doesn't seem too bad: https://gist.github.com/3062743
00:50antares_so you don't need to mess with :repositories
00:52JvJok, looks like I'll have to get maven
00:53antares_JvJ: you can create a directory and copy the jar there but putting together a metadata file is probably harder than installing maven
00:53antares_on recent Ubuntu and debians, sudo apt-get install maven
00:53AtKaaZwasn't there something like lein pom ?
00:53antares_on OS X, brew install maven
00:53JvJi'm on windows atm
00:53antares_AtKaaZ: he needs .pom for an arbitrary jar
00:53JvJjarbitrary...
00:54AtKaaZantares_: he has the project.clj in this case, for penumbra
00:54AtKaaZantares_: would it work?
00:54antares_JvJ: so you need to install the jar for a project managed by lein?
00:54AtKaaZyep
00:54antares_AtKaaZ: yes, in that case, just lein install in the repo
00:54AtKaaZoh that simple
00:55antares_assuming that project does not have unspecified dependencies, lein will do everything for you
00:55JvJok, so let me get that striahgt.... copy the jar somewhere in ~/.m2 and... use lein install?
00:55JvJOH WAIT
00:55JvJnever mind
00:55JvJi gotcha ;)
00:55antares_JvJ: if you have a lein project you need to install locally, cd into that directory and lein install
00:55antares_should be all you need
00:55JvJI'll lein install from penumbra and then I'll have it in my directory
00:55JvJOK! Let me try it
00:56antares_JvJ: you will have it in the local maven repo. But that's where leiningen will look for it.
00:56antares_JvJ: just for the record, do you use lein2?
00:57antares_(lein install works the same way with 1 and 2 but I'd probably recommend lein2 at this point)
00:57AtKaaZantares_: totally works you are a god! :)
00:57antares_AtKaaZ: I am a Leiningen contributor
00:57JvJis lein2 different? lein version gives me 2.0
00:58antares_JvJ: that's what I meant, you are all set
00:58AtKaaZantares_: ok then demigod? :))
00:58antares_AtKaaZ: something like that :)
00:58AtKaaZwell this is cool
00:59JvJah, the exciting world of dependency management
00:59AtKaaZI'll totally be needing this knowledge in the future
01:00gh0stzI've been starting to mess around with clojure now a couple weeks but really have just been reading a lot, getting a working environment and writing a few little basic things to test new things I've read about. Anyone recommend any good tutorials or whatever to kind of walk through a true functional example. just to get a good feel for it
01:00antares_gh0stz: http://clojure-doc.org/articles/content.html. It is a week old but already has some decent content in one place.
01:01gh0stzok great…thanks
01:01JvJgh0stz: http://4clojure.org if you're looking for a challenge. there are a lot of exercises from the beginner to expert level that you can try
01:02gh0stzthanks…i'll definitely give both of those a look
01:02gh0stzthis is my first experience with a functional language. also, I've been fighting with emacs after being a long time vim user
01:03antares_gh0stz: why not use VimClojure?
01:03gh0stzI know vim has support and I also use Intelli J at work and know they have a plugin, but I just felt like I should take this opportunity to learn emacs as well
01:03gh0stzI am going to go back and try VimClojure, but I just thought this was a great time to do a learning exercise in both clojure and emacs
01:04antares_gh0stz: in that case, check out https://leanpub.com/fp-oo
01:04AtKaaZ,(declare ghost)
01:04clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
01:04antares_,(inc AtKaaZ)
01:04clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: AtKaaZ in this context, compiling:(NO_SOURCE_PATH:0)>
01:05gh0stzI don't think emacs is bad at all, just not as quick with stuff as I'd like yet. also thought about giving evil a try in emacs
01:05antares_hm, inc is a lazybot thing :)
01:05AtKaaZI'm like a ghost :))
01:05gh0stz:)
01:05antares_&(inc AtKaaZ)
01:05lazybotjava.lang.RuntimeException: Unable to resolve symbol: AtKaaZ in this context
01:05gh0stzso what all can the bot do?
01:05antares_god dammit
01:05SgeoHow often do people come in here to declare that identity is useless and shouldn't exist?
01:06AtKaaZlike doing ##(inc inexistent)
01:06lazybotjava.lang.RuntimeException: Unable to resolve symbol: inexistent in this context
01:06AtKaaZlol
01:06SgeoBecause that would be amusing to see
01:06antares_gh0stz: most people use bots for the REPL
01:06antares_,(+ 1 2 3)
01:06clojurebot6
01:06antares_&(+ 1 2 3)
01:06lazybot⇒ 6
01:06antares_but also for lulz
01:06antares_~maven
01:06clojurebotHelp, I'm trapped in an XmlFactoryFactory!
01:06gh0stznice…that's what I was wondering. I didn't know if the bot would give you a repl or not
01:06antares_,(doc iterate)
01:06clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
01:06Sgeo,(map (juxt dec identity inc) (range 5))
01:06clojurebot([-1 0 1] [0 1 2] [1 2 3] [2 3 4] [3 4 5])
01:07Sgeojuxt is awesome
01:07gh0stzi'm not familiar with juxt
01:07Sgeo,(doc juxt)
01:07clojurebot"([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)]"
01:08gh0stzlol…yea I am slow tonight I had just realized that I should probably do that
01:10gh0stzbtw, gotta give you all credit. one thing I can definitely say is since the first day I decided to play with clojure, everyone I have asked anything has been fucking super helpful. best community I've ever encountered around a language
01:10gh0stzso thanks to you all
01:13AtKaaZantares_: ##'(inc AtKaaZ)
01:13lazybot⇒ (inc AtKaaZ)
01:13AtKaaZlol I failed=)
01:13AtKaaZI see now that the "##" was carefully chosen
01:15AtKaaZ,(println (str "##" '(inc AtKaaZ)))
01:15clojurebot##(inc AtKaaZ)
01:15lazybotjava.lang.RuntimeException: Unable to resolve symbol: AtKaaZ in this context
01:15AtKaaZ,(println (str "##" ''(inc AtKaaZ)))
01:15clojurebot##(quote (inc AtKaaZ))
01:15lazybot⇒ (inc AtKaaZ)
01:15AtKaaZnevermind, I fail
01:16AtKaaZ,'(inc AtKaaZ)
01:16clojurebot(inc AtKaaZ)
01:16lazybot⇒ 1
01:16AtKaaZ(dec AtKaaZ)
01:16lazybotYou can't adjust your own karma.
01:17AtKaaZ,'(dec AtKaaZ)
01:17clojurebot(dec AtKaaZ)
01:17lazybot⇒ 0
01:17AtKaaZ##'(inc AtKaaZ)
01:17lazybot⇒ (inc AtKaaZ)
01:19AtKaaZcan't make the other bot do it
01:19AtKaaZcan't me one bot make the other bot do it*
01:24gh0stzso what's the deal with karma and the bots?
01:32antares_gh0stz: that's another internal joke, kind of
01:34antares_gh0stz: real karma in the Clojure community is gained by contributing real code, e.g. clojurewekz.org or flatland.org or clojuresphere.com, no need to worry :)
01:35AtKaaZwww.clojurewerkz.org
01:36antares_yes, clojurewerkz.org
01:39SgeoHmm
01:40SgeoI'm looking at the source for ->, and I don't understand the behavior of (-> 10 [1 2 3])
01:40Sgeo,(seq? [1 2 3])
01:40clojurebotfalse
01:40Sgeoo.O
01:41SgeoWell, that explains it, for some weird definition of "explain" where for some bizarre reason vectors aren't seqs
01:41cemerickvectors aren't seqs
01:42cemericknot bizarre, tho :-)
01:47AtKaaZ$findfn inc inc 1 2 3 [2 3 4]
01:47lazybot[]
01:47AtKaaZ$findfn inc inc 1 2 3 '(2 3 4)
01:47lazybot[]
01:48SgeoYou know, I think the whole vararg thing can be annoying
01:49SgeoNeeding to pass around (partial apply concat), instead of having concat just take a sequence like (concat [[1 2 3] [4 5 6]])
01:51AtKaaZ$findfn inc 1 2 3 '(2 3 4)
01:52lazybot[]
01:52SgeoAtKaaZ, what exactly is your example?
01:52Sgeo,(map inc [1 2 3])
01:52clojurebot(2 3 4)
01:52AtKaaZSgeo, it's good but I wanted to not have them in a seq
01:53AtKaaZeach as a param, instead
01:53Sgeo,(#(map inc %&) 1 2 3)
01:53clojurebot(2 3 4)
01:53AtKaaZlol tricky
01:54AtKaaZlet me remember what I wanted in the first place, since I got lost
01:54Sgeo,((fn [& rest] map inc rest) 1 2 3) ; easier to read?
01:54clojurebot(1 2 3)
01:54Sgeo...o.O
01:57wingyhow do i set defaults to destructuing keys?
01:57AtKaaZSgeo, you're right, that is the way, I don't know why I was hoping for something else
01:57wingyin case it cannot find a key with that name in the vector
01:58Sgeo,(let [{:keys [a b c] :or [1 2 3]} {:a 5 :b 6}] [a b c])
01:58clojurebot[5 6 nil]
01:58Sgeo,(let [{:keys [a b c] :or {:a 1 :b 2 :c 3}} {:a 5 :b 6}] [a b c])
01:58clojurebot[5 6 nil]
01:58Sgeohmm
01:59Sgeo,(let [{:keys [a b c] :or {a 1 b 2 c 3}} {:a 5 :b 6}] [a b c])
01:59clojurebot[5 6 3]
02:00wingySgeo: thx!
02:01Sgeowingy, yw
02:04Sgeo,(macroexpand '(#(map inc %&) 1 2 3))
02:04clojurebot((fn* [& rest__27#] (map inc rest__27#)) 1 2 3)
02:04SgeoHmm
02:04SgeoSo what did I do wrong
02:05AtKaaZ,(macroexpand '(->> x class print))
02:05clojurebot(print (clojure.core/->> x class))
02:05Sgeo,((fn [& restfoo] map inc restfoo) 1 2 3) ; easier to read?
02:05clojurebot(1 2 3)
02:05AtKaaZwhy isn't the inner ->> expanding too?
02:05SgeoHmm
02:05SgeoAtKaaZ, because macroexpand doesn't macroexpand all macros
02:05Sgeo,(doc macroexpand)
02:05clojurebot"([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms."
02:06AtKaaZok the last line I guess
02:06SgeoJust expands until the head of the form is no longer a macro.
02:06SgeoYeah
02:06AtKaaZi got stuck on repeatedly calls... assuming it will all
02:06Sgeo,(require clojure.walk :as w)
02:06clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0)>
02:07Sgeohttp://clojuredocs.org/clojure_core/clojure.walk/macroexpand-all
02:08AtKaaZI don't see how I can use it though, no ideas
02:08AtKaaZon how to import it
02:09AtKaaZweird, I had it hmm
02:09AtKaaZthanks:)
02:09AtKaaZ,(clojure.walk/macroexpand-all '(->> x class print))
02:09clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk>
02:10AtKaaZI had it from :dependencies [org.clojure/clojure-contrib "1.2.0"]
02:21AtKaaZ,(#(do (map (fn [x] (->> x class println)) %&) nil) '() [] #{})
02:21clojurebotnil
02:22AtKaaZno idea what I'm missing, println not showing
02:23AtKaaZ,(do (println 1) nil)
02:23clojurebot1
02:23AtKaaZoh oops got it
02:26AtKaaZ,(map println '(1 2 3))
02:26clojurebot(1
02:26clojurebot2
02:26clojurebotnil 3
02:26clojurebotnil nil)
02:27AtKaaZragequit lol
02:36Sgeo(defmacro let-threaded [val varname & body] `(let [~varname ~val] ~@body))
03:08AtKaaZok so what's the deal here
03:08AtKaaZ,(map println '(1))
03:08clojurebot(1
03:08clojurebotnil)
03:08AtKaaZ,(vec (map println '(1)))
03:08clojurebot1
03:08clojurebot[nil]
03:08AtKaaZ,(do (map println '(1)) 2)
03:08clojurebot2
03:09AtKaaZ,(do (println 2) (map println '(1)) )
03:09clojurebot2
03:09clojurebot(1
03:09clojurebotnil)
03:09antares_aka: map is lazy
03:09antares_AtKaaZ: ^^^
03:10antares_and should not generally be used for side effects
03:10antares_,(dorun (map println [1 2 3 4 5]))
03:10clojurebot1
03:10clojurebot2
03:10clojurebot3
03:10clojurebot4
03:10clojurebot5
03:10antares_,(map println [1 2 3 4 5])
03:10clojurebot(1
03:10clojurebot2
03:10clojurebot3
03:10clojurebot4
03:10clojurebot5
03:10clojurebotnil nil nil nil nil)
03:10AtKaaZat first I was afraid that it includes the *out* in the seq but it doesn't
03:11antares_dorun forces evaluation. In the REPL, printing out results also forces evaluation but it's not generally the case.
03:12AtKaaZ(inc antares_)
03:12lazybot⇒ 1
03:13callen,(def blah 1)
03:13clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
03:13callensanbox? what the hell is a sanbox?
03:14callenwho do I complain to about the bot?
03:14callen,(println "woot")
03:14clojurebotwoot
03:15antares_callen: you cannot execute arbitrary code
03:15callenantares_: I understand exactly how the bot works, I was bitching about the typo.
03:15antares_callen: because, you know, kids will run (System/exit 0) and stuff
03:16callenantares_: I use clojail too.
03:16antares_callen: I think it's https://github.com/hiredman/clojurebot
03:16antares_callen: ok, sorry
03:22rbxbxHey peeps.
03:22rbxbxdoes anyone know if there's any way in a noir pre-route to grab the handler that would have handled the request had you not intercepted it?
03:22rbxbxother than doing some craziness reconstructing it based off the request :uri
03:23callenvijaykiran: so a few pointers on your tutorial series. 1: the use of lobos is questionable.
03:24callenvijaykiran: 2: abstracting away from the persistence side might help with focusing on Clojure. This could potentially mean using something simpler like redis and leaving SQL for a separate tutorial.
03:43vijaykirancallen: Is there something comparable to lobos - the basic reason to use lobos was to show the point that if someone wants to build webapp with Rails/Playframework mindset comparable tools exist in clojure-land
03:43wingyso weird .. datomic seems to generate the same id all the time
03:44wingyif i put {:db/id #db/id[:db.part/user -1000001] in my transaction data it generates the same id
03:44vijaykirancallen: I agree that persistence might be delegated to a different post - but I wanted to keep things simple - the code is very primitive and not "production ready" :)
04:54bosietrying to get a hang of midje
04:56bosiehttps://gist.github.com/3878152
04:56bosiewhy would this happen?
05:25clgvbosie: thats not midje related. you have not deleted the auto-generated test in core_test.clj
05:25clgvbosie: leiningen generates that one and it's a failing test
05:25bosieclgv: hmm, you are right. and for some reason my test file isn't being executed
05:26clgvbosie: do you have it in the test folder?
05:26bosieyes
05:26clgvand you run "lein test"?
05:26bosieclgv: yes
05:28clgvbosie: ah there is a separate lein-midje plugin
05:29clgvhttps://github.com/marick/lein-midje
05:38bosieclgv: thanks works now
06:12goraciohey can anyone explain how to use "on" event from jayq ? (on ($ ".element") :click [handler ])?
06:19goracionoone use jayq ?
06:20aperiodicit's a low-traffic time for the channel
06:20aperiodicmiddle of the night/early morning for the continental US
06:21aperiodicin a few hours the east coast will be waking up; you might have better luck then
06:22goracioок
06:27clgvgoracio: did you find no docs or tutorial on jayq?
06:27goracionothing at github
06:27goraciowill look at google ...
06:40goracioalmost nothing - no examples
06:42andrewmcveighgoracio: I think it should be (on ($ :.element) :click handler-fn) - from memory
06:47goracioandrewmcveigh: this doesn't work
06:51goracio(on elem event & [selector data handler]) - selector just string i guess "document" for example
06:52goracioif on invokes on document then (on ($ "document") :click ["#id" handler-func])
06:53clgvgoracio: yoi misinterpret the argument list. remove the vector brackets
06:54clgv*you
06:54goraciook will try
06:56goracio(on ($ "document") :click "#reply-but" get-replies)
06:57goracioalso doesn't work
06:57andrewmcveighgoracio: this works: (on ($ :body) :click (fn [e] (.log js/console (pr-str e))))
06:58goraciowell i need to attach this event to an element
06:58goraciobutton click
06:58goraciolike live() but on() is modern replacment
06:59andrewmcveighgoracio: well, the selector is the ($ :.element)
07:00andrewmcveighgoracio: so (on ($ :.class1) :click (fn [e] ...)) *should* bind to all .class1 s
07:00goracio($ :.element) element not selector
07:00goraciook will try
07:02andrewmcveighwhere you would write $('.class1').on('click', handler-fn) - you should write (on ($ :.class1) :click handler-fn)
07:04goracioon attaches to document
07:05goracioso i load a document then add some code to it and there i have #reply-but
07:05goracioso i need something like live()
07:05goracioinstead of bind
07:06goraciothis is on()
07:08andrewmcveighgoracio: I'm just looking at the jQuery docs, I've not really used .on() before. The examples give things like: $("button").on("click", notify);
07:08goraciono no
07:09andrewmcveighgoracio: do you know how it should look in js/jQuery
07:09goraciothere is lot more then this :)
07:10goracioon attached to document because document is there always and doesn't change
07:10goracioor to body
07:10goracioso propagation things work there
07:10goraciothat's why it's almost like live()
07:11goracioso i need fire an event on element that doesn't exist
07:11goraciothat will exist some time later
07:12andrewmcveighgoracio: so you're trying to do: $('document').on('click', '.class1', handler) ?
07:13goraciosomething like this
07:14andrewmcveighgoracio: that would be: (on ($ :document) :click :.class1 handler) in cljs
07:17goracio(on ($ :document) :click :#reply-but get-replies)
07:18goraciodoesn't work
07:24andrewmcveigh(on ($ :body) :click :#step-2 (fn [e] (.log js/console e))) - is working for me
07:24andrewmcveighit's not working with :document for some reason
07:37goracioyep on body works
07:37goraciook will try this then :)
07:37goraciowill work with body :)
07:42holohi
08:53Kototamahow can I convert a JavaScript object into a clojurescript map?
09:08erwagasoreI would love to know how to use clojurec with lein?
09:10Kototamawhy is clojurescript complaining that I redefine get-in since i do that in a different namespace than the core?
09:12chouserKototama: because a pointer to core's get-in is brought into your namespace ("referred") when you say (ns ...) at the top of your file
09:13chouserand then you overwrite that refer with your own var and definition, and it's just warning you about that. You can still get to clojure.core/get-in
09:13chouserif you want to get rid of the warning, add to your ns a clause like (ns foo (:refer-clojure :exclude [get-in]))
09:14Kototamaah yep, sounds logic in fact
09:14Kototamathank you
09:15wingyerwagasore: wow .. clojurec = speed
09:15Kototamanext question: why doesn't clojurescript impleemnt ISeq for JS objects :-) ?
09:17chouserKototama: I believe there's a function to return a seq for a js object.
09:19chouserKototama: There is array-seq
09:19Kototamaah
09:20erwagasorewingy: Faster faster. Everyone like speed right!
09:20Kototamai also found js->cljs
09:20Kototamain the core.cljs
09:20wingyerwagasore: good for scripting :)
09:20Kototamabut (seq obj) does not seem to work
09:20chouserah, nice.
09:21wingyhttps://github.com/schani/clojurec/tree/master/run/android
09:21wingywill cljc be able to run on android?
09:21wingyhttps://github.com/schani/clojurec/tree/master/run/ios
09:21wingyand ios?
09:22wingyclojurec could surely boost up clojure's popularity even more
09:30erwagasoreSure.
09:42jcromartiewhat's the rationale for ClojureC
09:44jcromartiesay, over ClojureScript running on an embedded JS VM
09:45jcromartielooks cool, though
09:52jweissi am using a trace lib similar to clojure.contrib.trace. One thorn in my side is accidentally tracing fn's that return infinite seq's, they try to consume the whole seq and obviously blow the heap. Is there a technique I could use to avoid this (other than manually rooting out these functions from being traced)?
09:54jweissmaybe something like dispatching on the type of returned value, if it's a lazy seq, don't consume it?
09:54jweiss(in the trace lib i mean)
10:04wingywhy aint i getting any email updated on new posts on google groups :/
10:18TimMcSgeo: Reading a ref doesn't change anything about what other transactions are allowed to do with it, since your transaction is reading from a snapshot of the ref world.
10:21DrNautilust##"I worship his shadow"
10:41chouserjweiss: in recent versions of Clojure there is "realized?" which can be used to avoid forcing any step of a lazy seq
10:42jweisshm.
10:42jweiss,(realized? (iterate inc 0))
10:42clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPending>
10:42jweissi'm not sure how Cons's fit in
10:45jweiss,(doc iterate)
10:45clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
10:48zerokarmaleft,(let [xs (lazy-seq (iterate inc 0)) pre (realized? xs) x (first xs) post (realized? xs)] [pre post])
10:48clojurebot[false true]
10:51jweisszerokarmaleft: do you know how to check the lazy seq returned by iterate without wrapping it?
10:54zerokarmaleftjweiss: no...internally iterate conses onto a lazy-seq, so i'm a bit confused on the types returned there
11:05duck1123,(realized? (rest (iterate inc 0)))
11:05clojurebotfalse
11:07zerokarmaleft,[(type (rest (iterate inc 0))) (type (seq (rest (iterate inc 0))))]
11:07clojurebot[clojure.lang.LazySeq clojure.lang.Cons]
11:07zerokarmalefthuh? clearly i need to study the source
11:08zerokarmaleftdoesn't rest implicity call seq?
11:11jkkramer_(doc next)
11:11clojurebot"([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
11:12chouserif its argument is already an ISeq, rest does *not* call seq, so as to preserve laziness
11:12chouserbecause calling seq on something that's already a seq forces one step so that it can return nil if the seq is empty.
11:14zerokarmaleftah
11:25pordan30Most installation guides for clojure assume emacs24 for package support. If I generally use emacs23 for compatibility with Coq/Agda, is but manually install clojure-mode and so forth, will there be any compatibility issues?
11:28jsabeaudrypordan30, I'm using emacs23 and have not had any problems
11:29jsabeaudrypordan30, Only a few extra steps like installing emacs package manager
11:40pordan30jsabeaudry: thanks
11:40jcromartiewhat is this all about
11:40jcromartieCan't call public method of non-public class: public javax.sound.midi.Instrument[] com.sun.media.sound.AbstractPlayer.getAvailableInstruments()
11:41jcromartieis it a reflection thing?
11:41jcromartiehm, yeah
11:41nDuffjconnolly: Is this happening during a bean invocation? I have a patch for it.
11:42jcromartie(defn channels [^javax.sound.midi.Synthesizer synth] (.getChannels synth))
11:42nDuffs/jconnolly/jcromartie/
11:42jcromartiecan I avoid making a fn for each method I want to call?
11:42jcromartiejconnolly: no, just trying to do (.getChannels synth) or whatever
11:42jcromartieor .getAvailableInstruments
11:43jcromartieyeah I can give a type hint in a def or let, I guess
11:43nDuffCan't hint on the call itself?
11:44mpenetSomeone made a refheap fork using datomic, interesting
11:44jcromartienDuff: yeah looks like I can
11:44jcromartieI can put hints all over the place :) so I'd better come up something
11:44jcromartieor else I will have hints everywhere
12:36technomancy"Notably, when you use regular expressions, you MUST ALWAYS put in a comment (usually a two-semicolon comment on the previous line) explaining, at least basically, what the regular expression does" haha geez
12:37technomancy(google's CL style guide)
12:37fractaloopThat is awesome
12:37fractaloopWe have this one regex in production that is wider than your screen.
12:39technomancyso many things in that guide that you just don't have to care about in clojure
12:40technomancy(setf vs setq, yuck)
12:40Iceland_jackI love CL but hate it at the same time
12:40technomancyalso: predicates ending in -p can't help but make me think of the 80s
12:41Iceland_jackCL's use of "-p" was also very inconsistent
12:41thorbjornDXdoes clojure let you split regex onto multiple lines?
12:42technomancywhy not?
12:42technomancynewline is just another piece of whitespace
12:43thorbjornDXok :)
12:43S11001001thorbjornDX: with the x option you can even have regex comments, which can lead to some interesting looking clojure (as the comments are shell-style)
12:43antares_is there a common name for [java.util.concurrent TimeUnit Executors] — :import lists like this?
12:44thorbjornDXS11001001: interesting, I'll check it out
12:44S11001001I have actually written this
12:44S11001001#"(?x) someregex... # about this part
12:44S11001001somemoreregex..." ;about this part
12:45thorbjornDXI see why you were saying it looks interesting now
12:51jsabeaudrytechnomancy, cool that google has a CL style guide, will use it to convince people of lisp's credibility
12:51technomancyjsabeaudry: they only have it because google bought ITA
12:52jsabeaudryThat, I don't have to tell :}
12:52technomancyat one time they were using clojure for their internal code indexing
12:52technomancybut that was before yegge threw a fit
13:01nDuffIs there a built-in equivalent to -> which short-circuits on getting a nil, or a simple way to get that effect?
13:01jkkramer_nDuff: -?> from https://github.com/clojure/core.incubator
13:02nDuffjkkramer_: graci; thanks!
13:20MordusHi, can anyone point me to a working app which uses friend? Preferably just for authentication (no special stuff, no roles, no openid) just a most basic example of how to use it for authentication?
13:23jcromartietechnomancy: did Yegge throw a fit over Clojure?
13:23scriptora while back
13:23HodappYegge?
13:23clojurebotHaha! The survey mentioned in the comments to Yegge's last post has a "favorite language" question, but Clojure is not an option.
13:23chouserYeah, turns out he's liberal and Clojure's conservative. Who knew.
13:24jcromartieI thought Yegge liked Clojure
13:25jcromartieoh I see
13:25jcromartieit's because the community has strong ideals
13:26jcromartiee.g. "don't use macros without a good reason" counts as "staunch conservatism"
13:36goraciohi clojurescript problem - i use fetch and remote for client-side communication- i need to send data to the server and get results only after that but i cann't use remote in remote what better use then ? jayq ajax ? or maybe there is some way to do this with remote ?
13:41lynaghkping: dnolen
13:43emezeskegoracio: From your description, it sounds like a single remote call would do. Maybe paste a snippet of code that demonstrates what you would like to do, but doesn't work?
13:43goraciook 1 min
13:48goraciohttps://gist.github.com/3880460
13:49goraciothis doesn't work
13:50emezeskeWhat happens?
13:51emezeskenDuff: I asked him to post the paste
13:51nDuffAhh. :)
13:52goraciounreadable form
13:52goracioerror in console log
13:53emezeskegoracio: I don't see any immediate reason why what you're trying to do shouldn't work
13:53emezeskegoracio: I am 99% sure I have done that exact thing before
13:53CheironHi. I have about eight small functions used by a function. I created them as closure functions inside the function . no other function use them . should extract them to private functions?
13:54nDuffCheiron: Usually, I'd say yes.
13:54tomojhuh, does fetch have a flat global namespace?
13:54nDuffCheiron: ...extracting them will make them easier to test, and will make your larger function shorter, and thus easier to read.
13:54emezeskegoracio: Are you certain that fetch-messages works when it's called outside of the first remote?
13:54tomojthat's nuts
13:55emezesketomoj: Uh.. it doesn't?
13:55CheironnDuff: those eight functions are going to be created every time the parent function is called?
13:55goracioemezeske: will check but it should work
13:55emezeskegoracio: It sounds to me like your server-side code for the remote is returning a Clojure object that the ClojureScript reader can't handle
13:55tomojemezeske: (add-remote ~(keyword (name remote)) ~remote)
13:55CubicCheiron: If they are closures, probably yes. But I don't know very much about how the Clojure compiler works.
13:55tomoj(defn add-remote [remote func] (swap! remotes assoc remote func))
13:56tomojlooks like it to me?
13:56CheironCubic: assuming those are created every time the parent function is called, is it a problem?
13:56emezesketomoj: The term "namespace" has a generally more commonly used meaning in Clojure
13:57CubicCheiron: Depends on what you're actually doing with that function. You probably shouldn't worry too much unless you actually run into a problem
13:57tomojemezeske: yes, it would be nice if they were used here instead of a flat global namespace
13:57emezesketomoj: I'm saying it's really confusing of you to call it a namespace
13:58emezesketomoj: At least say "fetch-namespace" or something
13:58Cheironclojurebot: I, Robot
13:58clojurebothistorical ninja robots are so 1999...
13:58nDuffCheiron: No, they aren't recreated on invocation in any event
13:58nDuffCheiron: ...compilation happens once, at compilation time, unless you're using eval.
13:59CheironnDuff: Oh, amazing to know that!
13:59CubicnDuff: How do closures work? Just function objects like in C++?
13:59nDuffCubic: I don't know the implementation details.
13:59goracioemezeske: fetch-messages works fine
13:59CheironnDuff: so they will be created the very first time the father function is called? and then they live in the memory? (no re-creation is ignited if the father function is called again)
14:00nDuffCheiron: No, they're called when the namespace the parent function is in is compiled, well before the invocation.
14:02CheironnDuff: still a little bit unsure. the namespace is compiled. those eight closure lives inside a function (created inside let form) . how they aren't created every time the parent function is called?
14:02nDuffCheiron: Because no compilation happens except at compile time, period.
14:03SgeoI think Cheiron might not be asking about implementation details?
14:03nDuffCheiron: ...otherwise you couldn't use those forms in ClojureScript, which has no compiler available without a JVM.
14:03emezeskegoracio: Hmm, and get-replies works when the (fetch-messages) call is removed from it's body?
14:04Sgeo,((fn [a] (fn [b] (+ a b))) 5)
14:04clojurebot#<sandbox$eval27$fn__28$fn__29 sandbox$eval27$fn__28$fn__29@377cf9e5>
14:04Sgeo,(((fn [a] (fn [b] (+ a b))) 5) 6)
14:04clojurebot11
14:04gfredericks,(let [{:keys [foo jam]} '(:foo 12 :bar 17)] [foo jam])
14:04clojurebot[12 nil]
14:05SgeoCheiron, are you thinking of closures as functions that semantically get created at runtime?
14:05gfredericks,(let [{:keys [foo jam]} [:foo 12 :bar 17]] [foo jam])
14:05clojurebot[nil nil]
14:05SgeoBecause that's how I think of them too, but implementation may be different
14:05CheironSgeo: yes exactly
14:06gfredericksSgeo: every fn form is a class, and each time "a function gets created at runtime" the class is instantiated
14:06gfredericksI think the object mainly holds information about the bindings
14:07Cheironwhat I mean : a function creating eight closure functions inside it using let form. every time the parent function is called, the eight closures are going to be created?
14:07SgeoThat might not be what's going on in the implementation, but semantically that sounds about right
14:07gfredericksthe 8 classes will be instantiated
14:07goracioemezeske: looks like get-replies doesn't work :)
14:09SgeoYou can simulate closures in environments without closures, with some difficulty
14:09emezeskegoracio: Good deal. I would look at the forms that you're trying to send back from the server -- I expect that you're trying to send some Clojure object that ClojureScript can't read.
14:10goraciook
14:14CubicnDuff: JavaScript has closures though, so technically the functions could still be recreated all the time
14:15nDuffCubic: Indeed, I assumed a fairly specific value of "created". That's a different, valid interpretation.
14:18CubicHas anyone here tried using Light Table?
14:20technomancy~anyone
14:20clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
14:23CubicOh sorry, I didn't know you couldn't have subjective discussions here. Guess that's to be expected to avoid clutter
14:23lynaghkdnolen: not sure how we could do "not-has-keyo" within the partial map's record protocol implementations.
14:24dnolenlynaghk: you wouldn't do it there, would just be normal goal.
14:24dnolenlynaghk: keys always have to be ground anyway.
14:24lynaghkdnolen: okay. Let me rip that stuff out and get you a new patch (assuming the rest of the current one looks okay)
14:25dnolenlynaghk: you can build your sugar on top of that.
14:25nDuffCubic: It's not so much about subjectivity, more about respecting peoples' time. You're asking a large crowd of people to volunteer without specifying what you want to talk about in enough detail for any of them to know if they're _really_ the right person to answer. "Does anyone use foo" sounds pretty similar to "does anyone know enough about foo to volunteer to answer some arbitrary, unstated question" on IRC.
14:25dnolenlynaghk: I'm assuming the syntax you were showing were additions to the simple unifier correct?
14:25lynaghkdnolen: the !_ syntax is just a symbol in the partial map's IUNifyWithMap routine.
14:26CubicThat's what I meant. I didn't really intend to ask a technical question. I don't want to be a bother, so sorry about that.
14:26dnolenlynaghk: yeah, partial map should do anything would symbols at all.
14:26dnolenlynaghk: shouldn't
14:26lynaghkdnolen: shouldn't?
14:27lynaghkah.
14:27dnolenlynaghk: the patch should be absolutely minimal. partial map unification, that's it
14:27lynaghkdnolen: okay, coming right up.
14:27dnolenlynaghk: but I'm all for sugar, but these enhancements should be separate discussions tickets.
14:28@rhickeyis anyone currently using a macro/function called cond-> ?
14:28dnolenlynaghk: my philosophy is that you should be able to do this stuff with only the miniKanren primitives + some new fns.
14:28lynaghkdnolen: is the use of "load" okay with you? I wasn't sure how to put it in a separate namespace without getting into circular dependency mess, since you wanted the constructor in core.logic
14:30CubicHow do you `lein compile` with *warn-on-reflection*?
14:31dnolenlynaghk: hmm right ... yeah that's fine for now will address that later.
14:31emezeskeCubic: Add :warn-on-reflection true to your project.clj
14:32lynaghkdnolen: also, there's an issue where you can't automatically prep PMaps since walk doesn't know how to make an empty version of it. I think that's a separate ticket though
14:33CubicIs that lein 1 or lein 2? I'm using lein2 and I don't get any warnings, although I know I should get some
14:33emezeskeCubic: Both.
14:34dnolenlynaghk: yeah - perhaps worth providing our own extensible version of clojure.walk
14:34dnolenlynaghk: btw looking forward to this patch! :)
14:35dnolenlynaghk: I'm really curious to see what you're going to do w/ it
14:35lynaghkdnolen: yeah, I'm jazzed to be finally using core.logic for something serious. =P
14:38Cubicemezeske: That's funny, I'm not getting anything from lein compile with or without :warn-on-reflection true, but when I call (compile my-module) from a repl with *warn-on-reflection* set I do get several
14:38dnolenrhickey: I saw that in codeq, looks neat
14:38technomancyCubic: `lein compile` will only compile if there are changes; you can do a clean to force it to trigger.
14:39Cubictechnomancy: Ah thanks, it works now.
14:41@rhickeydnolen: I'm tired of it not being in core
14:41@rhickeykills the repeated let pattern
14:43goracioemezeske: well i just converted response object to str on the server side and it works now :)
14:43emezeskegoracio: Great!
14:43hiredmanwhat is the repeated let pattern?
14:44dnolenlynaghk: I'm a bit confused w/ your PMap implementation, you construct it but it doesn't have any fields - it needs to take the map right?
14:44@rhickeyhiredman: (let [x something x (if y (mod x) x) ...] ...)
14:44hiredmanI see
14:44lynaghkdnolen: I'm just merging the map into it using the provided map->PMap constructor
14:45lynaghkdnolen: the record is for protocol dispatch only
14:45scottjrhickey: is there a reason deftype and defrecord use `(let [] ...) instea dof `(do ...)?
14:45@rhickey(cond-> x y? (conj 42) z? (conj another))
14:45chouserhah! This would have been a component of my (rejected) conj talk!
14:45dnolenlynaghk: ah right sorry I missed that I never use the record ctor fns.
14:45@rhickeychouser: I was waiting for you to chime in!
14:46hiredmanwell, uh, I went to go see waht cond-> and the first use of it in codeq.core still is a repeated let, so I am not sure I follow
14:46@rhickeyis yours called cond-> ?
14:46@rhickeyhiredman: would have been many more repeats
14:46dnolenlynaghk: ok this looks good.
14:47hiredmanrhickey: well, it's your clojure.core :)
14:48@rhickeyhiredman: that's why I'm here seeing if it would conflict for anyone
14:48dnolenlynaghk: I couldn't apply the patch with git am - could you fix that?
14:48lynaghkdnolen: rad. I'll kick around a nice way to do the no-has-keyo thing. There are some other goals I'll want in this matching process too, so I think you're right about that being a more general approach.
14:48chouserrhickey: ours all start with ->, so that one is ->cond
14:49jkkramer_I've been using that pattern a lot lately to build up hash maps. I tried using an assoc-if fn but cond-> looks nicer
14:49@rhickeychouser: do you have any you use more than that one? I guess people love the nil-safe ones
14:49lynaghkdnolen: I just grabbed the diff from the github url. Branch is agaist e4587 master---are you on something else?
14:50dnolenlynaghk: yeah can you produce a patch w/ git?
14:50dnolenlynaghk: a bunch of things missing from that patch - attribution, commit message etc.
14:51lynaghkdnolen: ohh, I think I uploaded the diff. let me grab the patch. my bad.
14:51chouserrhickey: none of ours are nil-safe. ->when is probably our most often used.
14:51@rhickeychouser: how does ->when differ?
14:51@rhickeyjust nil returning?
14:52lynaghkdnolen: added.
14:53chouserHuh, I guess I hadn't thought about it but I guess ->when is just a degenerate case of ->cond
14:53@rhickeyif so, it doesn't seem to correspond with 'when'
14:54chousersorry, I haven't looked at these in a while. let me check
14:54hiredmanchouser: really? I am note sure you could express ->when with ->cond in a ->
14:54@rhickeycond-> is (cond-> something test mod test mod ...)
14:55chouserah, right. vs. (->when test mod)
14:55chouserno
14:55chousersorry
14:55@rhickeychouser: where does the thing go?
14:56chouser(->when something test mod), returning something if test fails otherwise (-> something mod)
14:56@rhickey(->when maybe-nil mod) ?
14:56@rhickeychouser: that seem a real mismatch with when
14:57Hodappwhoa, rhickey actually comes in this channel?
14:57hiredmanwill we get cond->>?
14:58@rhickeyhiredman: probably, although for some reason I almost never need that
14:58dnolenlynaghk: applied! and merged cleanly into the branch for the next version of core.logic
14:58chouserso this isn't our code -- we discovered pallett already had a think like our ->when: https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj#L40
14:58lynaghkdnolen: thanks!
14:59hyPiRionSo is putting everything into a pipeline the new thing nowadays?
14:59hiredmanI'd hardly call it new, and it isn't everything
14:59hiredman->> is just great
15:00@rhickeychouser: so is special case of cond->
15:00chouserIt's nice for like (-> q (conj :foo) (->when need-bar (conj :bar)) pop)
15:01chouserrhickey: yes, I think so. I hadn't noticed that before as we kept wanting ->when and then got a bit silly writing other ->*
15:01@rhickeyyes, same use case as cond->
15:01hiredmanhttps://gist.github.com/184831 pre ->> sequence processing
15:02@rhickeyanyone opposed-to/confused-by cond-> cond->> ?
15:02jkkramer_fwiw, at first I expected cond-> to only follow one branch, like cond
15:02chouserwhen, when-not, if, cond, let, assoc, first, second, nth, last, and ->> versions of all, plus some other's we're even less sure are good ideas.
15:03jkkramer_but once you know what it does, it's fine. I'd use it extensively
15:03hiredmanjkkramer_: pretty sure it does?
15:03@rhickeyjkkramer_: yes, that is different depending upon how you think about it
15:03gfredericksjkkramer_: I assumed it did until you said that
15:03chouserohhh. Our cond only follows one.
15:03@rhickeyno, keeps going, each thread is guarded
15:03jkkramer_guarded-> ?
15:04nDuff...okay, I'm forgetting something basic here. How do I get a var, rather than its value?
15:04chouserI see from the codeq impl that cond-> does not stop checking
15:04CubicWhat does cond-> actually do?
15:04hiredmaninteresting
15:04chouserCubic: https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj#L27
15:04ddeaguiar,(var)
15:04clojurebot#<CompilerException java.lang.NullPointerException, compiling:(NO_SOURCE_PATH:0)>
15:05uvtcnDuff: #'my-symbol ?
15:05nDuffAhh.
15:05@rhickeyjkkramer_: guard does mean anything in Clojure at present
15:05nDuffgraci.
15:06jkkramer_just wondering if something other than "cond" would communicate its semantics better. seems everyone expected it to follow one branch
15:06@rhickeyI don't see much use in the branching logic
15:06@rhickeybut yes, don't want people confused
15:06jkkramer_not suggesting it should branch. right
15:07chouserrhickey: So now I'm uncertain about the multiple matches in a thing called cond->, compared to clojure.core/cond. But I have no complaint about the semantics.
15:07ddeaguiarnDuff: or (var my-symbol)
15:07jkkramer_I'll be adding it to my util lib regardless
15:07@rhickeychouser: agreed. so we play the name game
15:07@rhickeytest->
15:07hiredmanthe repeated let thing makes more sense
15:07zerokarmaleftlet->
15:07zerokarmaleft?
15:08@rhickeyzerokarmaleft: I'd expect a binding form (let-> [x init] test mod test mod ...)
15:08Bronsalet->fix
15:08@rhickeyand being able to use x in expressions
15:08chouserI love the name game! But I have to run. Good luck!
15:08@rhickeyI have one of those, but it is less composable
15:09hyPiRionSo you apply mods until one predicate fails.
15:10@rhickeyno, you just don't do that mod if that one fails
15:10hyPiRionoh, okay.
15:10@rhickeyit flows all the way through
15:10hiredmantest-> seems to communicate what it does
15:10@rhickeybuild-. was another name
15:10@rhickeybuild->
15:11gfredericksmaybe->
15:11@rhickeyguard also works, but those are often branching too
15:11TimMcfix-> matches amalloy's useful/fix
15:11hugodpallet-thread's when-> returns it's first argument when test fails so the threaded value just falls through to the next expression - I don't see that as incongruous with when
15:11gfredericksor perhaps-> so as not to evoke monads :)
15:11@rhickeygfredericks: I like maybe for maybe someone will give me something, not maybe I will do something
15:12hyPiRionSo you apply mod if pred is true.
15:12hyPiRion"apply"
15:12@rhickeythere's no need to rename the -> notion
15:12jkkramer_I kinda like build->, since that's what I'd use it for. but test-> is ok too
15:12@rhickeythe enhancement to -> is that each step is conditional
15:13gfredericksI definitely already have the word 'fix' in my head for this functionality due to flatland/useful as mentioned by TimMc
15:15zerokarmaleftbuild-> seems to evoke the use case intent, test-> seems to evoke the mechanism
15:15hyPiRionI think of each step as optional/depending on the predicates. So my name-shot would be opt-> or optional->.
15:15@rhickeyhugod: when examines the truthiness of its first arg, not call a test
15:16hyPiRionBut I don't think it's evident from its name.
15:16Hodapptruthiness?
15:16@rhickeyhugod: I'd expect anything named (whenblah x ...) to test the truth of x
15:16@rhickeygfredericks: link?
15:16andrewmcveighhence->
15:16gfredericksHodapp: truthiness meaning the behavior of clojure.core/boolean
15:16andrewmcveigh?
15:17gfredericksrhickey: https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L30
15:17pandeirofor composability i'd like to be able to dynamically resolve method names on a javascript object and call those methods - can i do that in clojurescript?
15:17TimMc->p
15:17@rhickeyandrewmcveigh: not really a consequence
15:17hugodrhickey: when used with -> it looks like that (-> 1 (when-> true (+ 1))) => 2
15:17gfredericksrhickey: I don't think any of these are exactly the same functionality, but I think they all have the conditional-modification flavor
15:17lancepantzfwiw, we use fix all the time in our codebase
15:18amalloyrhickey: i think cond-> is the same as https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L66, but i'm not 100% sure
15:18@rhickeyhugod: but not without
15:18amalloywe use it the same way, for stuff like (-> foo (given even? (+ 10)))
15:19tomojisn't it pretty obvious that cond-> doesn't follow only one branch, given that it's ->-shaped?
15:19@rhickeyamalloy: no, that tests the subject, these predicates have nothing to do with it
15:20hugodrhickey: sure, but the only reason to use when-> is within ->
15:20TimMcamalloy: Is given short-circuiting?
15:20amalloyTimMc: just catching up now. where's the fix-> you mentioned?
15:20pandeiroiow, can someone show me this in cljs: function doClassOp(op, el, arg) { el.classList[op](arg); }
15:20gfrederickstomoj: the -> suggests that but the word 'cond' suggests the opposite; so depends which one you notice first
15:20@rhickeytomoj: I think so, bit I see the other side too
15:20TimMcamalloy: Elsewhere, and it's called cond-> so far.
15:20amalloyyes. matches one clause and then stops
15:20@rhickeyhugod: I don't buy it
15:20TimMchttps://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj#L27
15:23wallhello. i have questions about antlr+clojure. in blog http://briancarper.net/blog/554/ describe about it, but then i run "java -cp 'lib/*' org.antlr.Tool src/antlr_example/Expr.g" i'll get Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/Tool
15:23wallCaused by: java.lang.ClassNotFoundException: org.antlr.Tool
15:23wall at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
15:23wall at java.security.AccessController.doPrivileged(Native Method)
15:23wall at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
15:23wall at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
15:23wall at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
15:23wall at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
15:23wallCould not find the main class: org.antlr.Tool. Program will exit.
15:23wallhow i can solve this problem?
15:23amalloyrhickey: given actually works either way: if a clause is a non-ifn value, then it's tested as a value instead of used as a predicate on the subject
15:24TimMcwall: Please use a pastebin such as refheap.com next time.
15:24@rhickeyamalloy: that's just too tricky
15:24wall<TimMc> - sorry.
15:24amalloyheh, i agree; that feature was added against my will. but it does make it line up with your cond-> more closely
15:25hugodrhickey: maybe ->when would have been a better name. pallet-thread's macros are all for use within -> expressions, whereas cond-> is something different.
15:25@rhickeyhugod: I don't see why things need to be made for with ->, if they are good they will work there and elsewhere
15:25gfredericks?->
15:25uvtcpossible naming consideration: I tend to think "to" when I see "->".
15:26tomojgfredericks: yeah I guess I noticed the -> first..
15:26@rhickeygfredericks: yes, will get perl snickers
15:26gfredericksperl snickers sounds like a tasty candy
15:26scottjpred->
15:26Hodappperl... snickers?
15:26@rhickeyscottj: not really a pred in that not a fn called on the subject
15:27@rhickeyjust tested values
15:27TimMcBut it's threading with a bunch of predicates...
15:27@rhickeya pred is a function of something
15:27gfredericksoh hmm
15:27TimMcoh wait, y? and z? aren't predicates?
15:27@rhickeyTimMc: no
15:27@rhickeynot in the sense of filter etc
15:28TimMcSuddenly I'm a lot less interested in this macro.
15:28scottjexample usage https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj#L375
15:28@rhickeyscottj: thanks
15:28gfredericksTimMc: you really think most of the time you'd want to pass the subject in to a function
15:28gfredericks?
15:28@rhickeythe repeated let this replaces is a very common pattern
15:29dnolenrhickey: and annoying ;)
15:29ninjuddrhickey: the decision to support both subject predicates and test clauses was a compromise between amalloy and myself. if you have to choose one, it would certainly have to be the latter, but supporting predicates on the subject does make for some supremely readable code
15:29@rhickeyone of the biggest tripups for people trying to build things non-imperatively
15:29TimMcI can't think of a single time I've done repeated let'ting on a binding that just checks against a value.
15:29@rhickeyninjudd: no need to cram into one construct
15:29@rhickeyTimMc: not for you then
15:30dnolenrhickey: yep, (let [x ... x ...] ...) will burn you eventually.
15:30TimMcYeah. I'd like something that does that, though.
15:30scottjI like that build-> doesn't autocomplete match anythign in core with bui. granted not a sufficient reason to choose it :)
15:30@rhickeyclojure.core is full of it
15:30gfredericksTimMc: you can do it with (fix-> subject (funky? subject) trsform ...)
15:31ninjuddrhickey: i think you're right. i tend to make that mistake
15:31@rhickeyscottj: the problem with build is that cond-> is also good inside of (-> ...)
15:31TimMcgfredericks: Not past the first pair.
15:31gfredericksTimMc: sure, but it doesn't sound very likely to me that you would have to test the most recent value of subject
15:31hyPiRionQuestion: Do you use the same function over and over with cond-> ? I see conj/assocs only.
15:32lancepantzi like the usefulness of cond-> but having "cond" in it when each clause is evaluated after a match is very confusing
15:32TimMcOh, I see -- this is for when you have a lot of parameters that control how you munge a value.
15:32@rhickeyTimMc: see earlier, let-> let's you test the value being built as it is named
15:32SgeoAny use for a let-> (defmacro let-> [val varname & body] `(let [~varname ~val] ~@body))
15:32Sgeo?
15:32SgeoOr is that different from what's being discussed?
15:32TimMcSo you want to turn various sub-munging steps on and off.
15:32gfredericksSgeo: that's just different but not really shorter syntax, so merely confusing
15:33wallanybody can help me with antlr?
15:33SgeoWhat's being discussed?
15:33@rhickeyTimMc: the linked example shows a typical use
15:33gfredericksSgeo: any answer to that would probably just be repeating something from above
15:33SgeoAh, sorry
15:34TimMcSgeo: Naming for https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj#L27
15:34zerokarmaleftSgeo: as used in https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj#L375
15:35TimMcwall: The room's pretty busy right now on a different topic -- you probably want to wait until conversation dies down a little and pose your question again.
15:36hiredmanwall: that error means that antlr class org.antlr.Tool is not on the classpath
15:36@rhickeynot loving anything more than cond-> yet, reservations aside
15:37@rhickeyread it as conditional thread
15:37Sgeogfredericks, but it could be useful inside a -> ?
15:37SgeoAlthough off-topic I gues
15:37Sgeos
15:37hiredmanwall: you might be missing the class because you don't have the jar that cintains the class, or you have a different version of the library with the class named something different
15:37uvtc"conditional thread-first"?
15:37@rhickeyright
15:37@rhickeyand cond->>
15:37gfredericksSgeo: ah right; does the swiss-arrows' diamond-wand cover your use cases?
15:38lancepantzbut it always evaluates all of the clauses?
15:38@rhickeyyes
15:38@rhickeyelse there's not much threading going on
15:38SgeoActually, I think the diamond-wand is a bit broken. There's no way to put the diamond as part of a result of an if clause, is there?
15:39lancepantzi love the functionality, but it's confusing to have that in the api with cond
15:39gfredericksSgeo: like (-<> (if foo <> bar))?
15:39abrooksIs 'chain too overloaded?
15:39wall<hiredman> but after lein deps in folder /home/wall/.m2/repository/org/antlr/Tool/3.2 no files. and no folder lib in my project folder. how fix it?
15:39lancepantzaccumulate-> ?
15:39lancepantzacc-> ?
15:39Sgeogfredericks, oh, hmm. What about if I wanted to do (-<> (if foo (inc <>) (dec <>)))
15:40@rhickeylancepantz: that's just redundant on the -> part of the semantics
15:40lancepantzi want to say apply-> but that has the same problem as cond
15:40Iceland_jack-<> would be fantastic to Google
15:41hiredmanwall: if you are using lein2 it doesn't create a lib folder
15:41hiredmanwall: it uses jars right out of the ~/.m2 cache
15:41@rhickeyabrooks: chain also just redescribes ->
15:41ninjuddscottj: here is your example from above written using given https://gist.github.com/3881046
15:41hiredmanwall: did you specify the antlr jar as a dependency in your project.clj?
15:41gfredericksIceland_jack: http://symbolhound.com/?q=-%3C%3E
15:41@rhickeywe need to describe the conditional aspect
15:42gfredericksSgeo: ah I see; so you mean it can only be used once
15:42amalloyIceland_jack: symbolhound, except it apparently doesn't index github
15:42gfredericksSgeo: though I don't see why it has to be that way
15:42lancepantzninjudd: i like that given-> does read better
15:42Sgeogfredericks, not that, but I mean that it can't be used in subforms if I understand -<> properly
15:42hugodthe guarded-> suggestion sounds the nearest to what it does, to me
15:42gfredericksSgeo: I think it can
15:42amalloyguarded is a neat word for it
15:43wallhiredman: yes. lein version return Leiningen 2.0.0-preview10 on Java 1.6.0_24 OpenJDK 64-Bit Server VM. But how correct project.clj to compile?
15:43uvtc~guarded
15:43clojurebotTitim gan éirí ort.
15:43Sgeo"the <> hole form is not recursive, it only works at the top level."
15:43hiredmanwall: project.clj is not something you compile
15:44gfredericksSgeo: wat. that is lamez.
15:44ninjuddin the example, given is a lower-level construct that can be used with -> if you don't want short-circuiting
15:44Sgeohttps://github.com/rplevy/swiss-arrows/blob/master/src/swiss_arrows/core.clj#L3
15:44hiredmanwall: have you read the lein readme? https://github.com/technomancy/leiningen
15:44amalloygfredericks: not surprising, right? so is swiss-arrows
15:44@rhickeyguards are like cond in other langs - one branch taken
15:44wallhiredman: yes. in project.clj exists [org.antlr/antlr "3.2"]
15:44hyPiRionIs there any fn which works the same way-ish?
15:44gfredericksamalloy: not that I knew
15:44SgeoIt does allow for nested -<> forms
15:44hyPiRionI keep on thinking about filter or keep, but I don't know if those are near enough.
15:44hyPiRionkeep-> ?
15:44Sgeoamalloy, I do think <<- is nice
15:45hiredmanwall: so that will never work, because you are using lein2, there is no lib dir full of libs
15:45hyPiRionit's not really describing it correctly.
15:45zerokarmalefti thought guards in haskell fell through to subsequent guards?
15:45@rhickeyzerokarmaleft: until a match
15:45zerokarmaleftoh right
15:45@rhickeyone match, like cond
15:45hiredmanwall: `lein classpath` should spit out a classpath you can use
15:46wall hiredman: and how correct for lein2?
15:46ninjuddyou only need one match though. if you want multiple, use multiple gaurds and thread through them
15:46hiredmanwall: I don't follow
15:46antares_wall: have you posted your project.clj? If not, it's time to do so.
15:47amalloyninjudd makes a good point: if you have something that matches a single clause and then stops (like flatland's given), it's easy to build something like cond-> by combining multiple givens; with cond->, you can't easily derive given
15:48hiredmanantares_: his problem is he is trying to run a command line that expacts his jars to ./lib but lein2 doesn't create a ./lib
15:48TimMcwall: Leiningen has a classpath command.
15:48TimMc-cp `lein classpath` might do what you want.
15:49antares_hiredman: ah, ok
15:49wallantares_:http://pastebin.com/F2UC9SUA
15:49pandeirowhy does (. object (method ...)) take the first element if method is a string?
15:49antares_wall: it looks OK except for the :dev-dependencies part
15:50pandeiroi have to do this to dynamically resolve a method name in cljs: (. object (["methodName"] ...))
15:50chouseris the name game done?
15:51hyPiRionchouser: Nope, you're still in for the party.
15:51@rhickeynope
15:51chouserrepeated uses of when-> ?
15:52@rhickeychouser: ?
15:52pandeirowouldn't (. object ("method" ...)) make more sense if it resolved "method" to 'method, rather than to \m ?
15:52hyPiRion(c-> init test1 mod1 test2 mod12 == (w-> (w-> init test1 mod1) test2 mod2)
15:53chouser(-> foo (cond-> t1 m1 t2 m2 t3 m3)) written instead as (-> foo (when-> t1 m1) (when-> t2 m2) (when-> t3 m3))
15:54@rhickeyick
15:54@rhickeywhy hve cond when you can have nested ifs?
15:54dnolenpandeiro: that would require changing Clojure. you can also use aget, (aget o "methodName")
15:54chouserthese aren't nested (visually)
15:54@rhickeythe repeated when->s take away from seeing the work
15:55dnolenpandeiro: I'm assuming this for interop
15:55@rhickeyand when-> is still a bad name for that
15:55chouserwhy?
15:55clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
15:55hyPiRion(when-> init test mod1 mod2 mod3) sounds reasonable.
15:55@rhickeybecause when implies a truthiness test of first arg
15:55pandeirodnolen: yeah but on natives it borks
15:56@rhickeyhugod made an argument for it just being for insie -> but I don't buy it
15:56chouserah, which only holds (to the extent that it does) in a ->
15:56pandeiroeg el.classList.[add|contains|remove]
15:56@rhickeychouser: exactly
15:56dnolenpandeiro: why do you need to a dynamic lookup on natives?
15:56pandeirodnolen: wrapping a bunch of html5 apis for a chrome extension
15:57pandeirodnolen: is that hack i came up with reliable moving forward, you think?
15:57pandeiro(. object (["methodName"] ...)
15:58jamiirhickey: you mentioned using QSQR to evaluate datalog - do you have a good reference for that? I found some papers explaining how to apply it to Horn knowledge bases, just wondering if there is a simpler version for datalog
15:58@rhickeywhence->
15:58dnolenpandeiro: I would not rely on it.
15:58chouserheh
15:59dnolenpandeiro: I assume you're doing this for feature detection?
15:59@rhickeyjamii: http://www.amazon.com/Foundations-Databases-The-Logical-Level/dp/0201537710
15:59pandeirodnolen: yes and building higher order functions with partial etc
15:59dnolenpandeiro: if you are I don't understand why you can just use the normal property syntax.
15:59chouseractually, that's not bad
16:00jamiirhickey: awesome, thanks
16:00pandeirodnolen: some APIs have 10-20 methods and it adds a lot of code to have to cond for each method rather than resolve dynamically
16:00dnolenpandeiro: (if (.-propertyName j/SomeNative ...) ...)
16:01pandeirodnolen: yeah feature=testing is fine
16:01chouserresolved->
16:01chouserin the debate topic sense
16:01@rhickeyif we get that long we can use guarded->
16:01pandeiroi wanted document['createElement']('div')...
16:02pandeiro...in cljs
16:02dnolenpandeiro: ((aget js/document "createElement") "div") should work just fine.
16:02chouserwhere->
16:02pandeirodnolen: it doesn't b/c of .call
16:02hyPiRionchouser: That sounds pretty close to something working.
16:02ninjuddi like where->
16:02amalloyi like where-> best so far
16:03pandeirodnolen: i am testing with himera at the moment but i assume this is not different in r1450
16:03aperiodicoh my god, i was just wishing that cond-> existed yesterday
16:03dnolenpandeiro: it is different
16:03pandeirodnolen: eesh sorry
16:03hugodon->
16:04@rhickeychouser: setting aside Clojure's use of when, when-> is better than where->
16:04dnolenpandeiro: oops, actually perhaps not ...
16:04dnolenpandeiro: but testing against Himera is not recommended very out of date now.
16:04ninjuddi think i like given-> better, but where-> is a close second
16:04wallTimMc: Thanks. i solve all problem
16:04@rhickeyand cond, and case
16:04dnolenpandeiro: in anycase that's the real problem.
16:05ninjuddwhat about -?>
16:05pandeirodnolen: yeah i am with very broken code so firing up cljs.repl is a pain but... is there a fix for this or is it just outside the purview?
16:05pandeiroall cljs fns get called with .call, right?
16:06dnolenpandeiro: depends
16:06@rhickeythen->
16:06dnolenpandeiro: if the function is js/foo never, under advanced optimizations we try to eliminate call as much as possible since it's slow.
16:07pandeirodnolen: yeah but the nested natives are a different beast yeah?
16:07TimMcninjudd: -?> is a nil-short-circuiting version of ->
16:07TimMcand I wish *that* were in core
16:07@rhickeycond-> is the right name, how to stave off the confusion
16:07ninjuddTimMc: yeah. just saw https://github.com/clojure/core.incubator
16:08TimMcOh, it's in incubator? Sweet.
16:08@rhickeycont-> (for contingent
16:08@rhickey)
16:08lancepantzthat's better
16:08dnolenpandeiro: they are ... is this problem everywhere or just in some browsers?
16:08hyPiRionDoesn't sound obvious for me.
16:09TimMcrhickey: Sometimes a block of clauses with (mild) repetetive structure makes code *easier* to read.
16:09TimMcThe (when-> ...) (when-> ...) ... example someone posted earlier didn't look so bad to me.
16:09lancepantzto->
16:10@rhickeywhen-> is broken IMO
16:10@rhickeya thing that only makes sense in a certain context
16:10@rhickeybleh
16:10@rhickeyClojure is not Ruby
16:11TimMcI have no opinion on when-> itself.
16:12@rhickeyTimMc: people's confusion aside, cond-> looks great, so I;m not interested in anything other than a good name for it
16:12abalonehello :) paredit approximation exists now for codemirror. https://github.com/achengs/subpar
16:12ssalcrhickey: how about sub-> (from subordinate, def 2. here: http://www.thefreedictionary.com/subordinate)
16:12abalonethe github repo has a demo page
16:13lancepantzwhat about then-> ?
16:13@rhickeygated->
16:13abalone(also in the market for a job)
16:14@rhickeyssalc: sub is the prefix for too many things
16:14lancepantzthen is nice because there isn't somehting to conflict with it already
16:15chousercond*->
16:15@rhickeychouser: yeah, but it's not let*
16:16tomojabalone: sweet
16:16chouserno, it's not.
16:16ninjuddgranted->
16:17@rhickeywe use when repeatedly in for
16:17ninjuddbecause->
16:18@rhickeythe loop dominating
16:18chouserbleh, you're right. And in 'for', :when is anded. Here it's closer to being 'ored
16:18lancepantzbuild-> ?
16:18chousercont-> was a cute idea. no worse than juxt. :-)
16:19pandeirodnolen: problem on [x] chrome [x] firefox [x] opera [x] android-webkit
16:19@rhickeychouser: bad pronunciation risks
16:19ninjuddi like cont-> if it isn't going to short circuit
16:19lancepantzrhickey: you should have heard the jokes in the office at that suggestion
16:19@rhickeynot going to happen
16:19chouseroh, sigh.
16:20Rayneslancepantz: I heard them all the way from Alabama.
16:20ninjuddconds->
16:20lancepantzhehe
16:20chouserconds-> isn't bad
16:21lancepantzthat's a good point
16:21hyPiRionifs-> may be just as good.
16:21lancepantzthe s implies more than one
16:21@rhickeywhens-> == whence->
16:21chouserconds-> is just enough different to raise an appropriate question in the minds of the unfamiliar
16:21TimMcopt-> is my "vote" at this point
16:21chouserwhence means "from where" doesn't it?
16:21clojurebotExcuse me?
16:22@rhickeychouser: here it's the 'resulting' meaning
16:22abrooksYes, when I see 'whence I think locational.
16:22TimMc"From whence-> doth this name come?"
16:23ninjuddergo->
16:23lancepantzi like build-> and conds->
16:23technomancyit seems like a pretty clear mash-up of cond and ->
16:23hugodfor me, any form of cond implies the first argument is used in the predicates
16:24@rhickeyall of those are somewhat too precious, the meaning we want is conditional->
16:24abrooksI think 'conds-> or 'whens-> ake the most sense to me.
16:24scottjI don't like conds->, 1) for newbie, "is it plural?" 2) it might only have one clause
16:24lancepantzthat's the point, it is a plural cond
16:25technomancycontinuing beyond one condition is already implied by ->
16:25lancepantzif it has one clause there's no point in it
16:25hyPiRionlancepantz: That's scottj's point. It may be only one condition.
16:25hyPiRionoh, well, maybe.
16:25lancepantzumm, isn't that if?
16:25lancepantz*when
16:25chouserI disagree that when-> is incorrect. The -> overrides the usual meaning in all cases, indicating a threaded arg comes first. True in the case of cond-> as well.
16:25amalloytechnomancy: no it isn't; you could easily write cond-> to thread into a the value of the first matching clause
16:26technomancyamalloy: why would you bother to write that as a macro though? it doesn't offer much value.
16:26@rhickeychouser: the test moves in when-> and doesn't in cond->
16:27chouserthe test gets shifted to the right by both
16:27@rhickeyyou expect pairs in cond
16:27amalloytechnomancy: i disagree with that assertion, but i don't think it's relevant to the question of whether cond-> instantly implies to the reader that all clauses will be tried
16:27ninjuddcond-> is actually starting to grow on me, with a good docstring to make sure people understand how it is different
16:28technomancy"does what it says on the tin"
16:28hyPiRionninjudd: I'm afraid it will be another case of "contains?".
16:28technomancy->cond might express the threadiness of it better, but it reads horribly
16:28jkkramer_i think it's sufficiently abstract to not be a problem for newbies
16:28dnolenpandeiro: hmm document.createElement.call exists in Chrome / Safari, but I guess this doesn't apply to all APIs?
16:28@rhickeyso, not everyone presumes single branch. I agree -> implies threading
16:29@rhickeytechnomancy et al are with me
16:29ninjuddhyPiRion: contains? took me a while, but now i wouldn't have it any other way
16:29lancepantzi think slapping an s on the end solves the cond confustion
16:29chousertechnomancy: if you didn't see it mentioned earlier, a friend and I wrote several ->foo macros, including ->cond. We actually liked the extent to which the leading -> stands out
16:29@rhickeyconds is gross
16:29ninjuddconfust->
16:29pandeirodnolen: interesting but i can't figure out how to invoke it
16:29technomancychouser: hm; maybe it'd grow on me with time?
16:30@rhickeychouser: ->when works better than when->
16:30chouseranyway, our ->cond expanded to actual cond, taking only one branch
16:30technomancythe other thing cond makes me think is "I should probably rewrite this as a pattern match" but that's a whole different can of worms. =)
16:30dnolenpandeiro: document.createElement.call(document, "div")
16:30ddeaguiarprefers cond-> over ->cond
16:30jkkramer_->cond could be confused with ->SomeRecord
16:30Bronsajkkramer_: +1
16:30pandeirodnolen: cool, let me give that a spin
16:31@rhickeyI don't like ->blah, just saying it reads thread-when
16:31technomancymaybe I'd be more comfortable with an arrow at the front if I actually used records
16:31lancepantz>>. done.
16:31@rhickeychouser: did you use that much: ->cond ?
16:31jkkramer_I don't mind cond->, even though I presumed single branch at first
16:31lancepantzeveryone is going to presume a single branch at first
16:32@rhickeylancepantz: several people have chimed in here otherwise
16:32chouserbut I must say, I don't know that we ever used ->cond. ->when we used frequently, ->if occasionally, also the occasional ->first and ->assoc
16:32dnolenpandeiro: though that doesn't solve you're problem since we'd need to set the context in CLJS ...
16:33lancepantzi admit i have a penchant for overusing the words everyone and everywhere
16:33@rhickeyNot thrilled with anything else, but let do a poll, one preference each
16:33@rhickeycond->
16:33lancepantzconds->
16:33pandeiroyeah it doesn't
16:33chouserconds->
16:33dnolencond->
16:33ninjuddcond->
16:34hugodguarded->
16:34ddeaguiarcond->
16:34aperiodicconds->
16:34amalloyconds->
16:34technomancycond->
16:34dakronecond->
16:35andrewmcveighcond->
16:35hyPiRioncond->
16:35chouserNo fair voting for cond-> just because it'll give you more karma from newbs answering simple questions!
16:35scottjgated-> (am I throwing my vote away?)
16:35lancepantzscottj: you voted for nader!
16:35amalloychouser: srsly. ninjudd said he loves contains?, but he doesn't hang out in #clojure or on stackoverflow :P
16:36@rhickeyanyone else - 2 minute warning
16:36hyPiRionhasn't clojurebot some timing stuff?
16:36cemericklancepantz: so cynical! ;-)
16:37amalloy$say #clojure do bots get a vote?
16:37lazybotdo bots get a vote?
16:37scottjI might have missed this, but couldn't you write a cond-> like thing that would follow only one clause? For that construct, what would be the perfect name for it? cond->?
16:37amalloyscottj: yeah, brought up three times or so and rejected
16:37jkkramer_cond-> is good enough
16:37zerokarmaleftcond->
16:37amalloythe version ninjudd and i have is called given; chouser likes when->
16:38lancepantzlooks like the the cond->'s have it
16:39pandeirodnolen: just going to write everything with the dot since after advanced compilation it probably wouldn't make much difference, just more painful to type. maybe there is not a huge use case for this
16:39@rhickeyok everyone, thanks for your input, it was fun. coming soon, under some name, to a lang near you
16:40lancepantzrhickey: its a good function, i'm glad you're adding it
16:40chouser:-)
16:40hyPiRionlancepantz: macro :o
16:40lancepantzofcourse i'll have to rewrite all of our givens
16:40lancepantz* macro :) re hyPiRion
16:41dnolenpandeiro: yeah I've got no answers yet for your issue - I will say I don't find this kind of approach very nice even in JS. While it's not evidence - it's also not something I've heard many people complain about.
16:41CheironHi, i created a function with two arities. first has the signature ([& {:keys .....}]) and the second arity is [obj1 obj2] but it looks it is not allowed
16:42Cheironam i missing something?
16:42amalloyCheiron: (foo :a :b). what body would be invoked?
16:42Cheironhmm, true
16:42lancepantzamalloy: with the socratic method
16:43Cheironamalloy: I asked earlier. a function declaring 8 closure functions inside its body with let form. every time the parent function is called , the eight closures will be created?
16:46amalloysince i've been pegged as socrates: what do you think? would it make sense for them not to be created? if so, how does it work?
16:47Cheironi think they will be created every time the parent function is called
16:47lancepantzyou are correct
16:48Cheironi created those 8 functions as closures because no other function is using them
16:48lancepantzwell, they probably get jit'ed away or something
16:48lancepantzbut i don't know
16:48ddeaguiarwould defining them as (fn foo [..]) instead make a difference?
16:49emezeskeCheiron: Have you profiled your application and found the nested functions to be a performance bottleneck?
16:49amalloywhat about in (defn foo [x] (let [f #(+ x %)] (if (even? x) (let [g #(dec %)] (g x)) (f 10))))?
16:49Cheironemezeske: no not yet but planning to
16:49amalloyemezeske: trick question: nobody in the history of the universe has ever found that to be the bottleneck
16:50emezeskeCheiron: My advice, then, is to stop caring about them
16:50emezeskeamalloy: >:)
16:50Cheironamalloy: what us that code ? :D
16:50Cheiron*is
16:51amalloyi disagree with the advice, though. it's good to know what's going on under the hood; Cheiron hasn't said a word about caring about the performance
16:52emezeskeamalloy: Oh, I didn't scroll up enough. I assumed this was an argument about performance.
16:52Cheironperformance issues? I'm not sure how 8 closures will differ from 8 defns in performance
16:53emezeskeamalloy: I agree that knowing what's going on is a good thing.
16:53amalloyemezeske: if you scroll wayyyyyy up, there's some talk where maybe people care about performance, but that doesn't seem like the issue being discussed; at the moment he's just asking how closures work
16:54Cheironbut i guess calling a function that makes use of 8 internal closures will consume more memory that a function calling 8 other defns defined at the same level
16:54emezeskeCheiron: Keep caring about things! :)
16:54TimMcI missed the voting!
16:54TimMcServes me right for having a job.
16:54amalloyTimMc: good news: no vote you could have cast would have an impact
16:56amalloyjust like living in california
16:57emezeskes/california/the US
16:57aperiodiche might've taken us inside the recall margin, though
16:57aperiodics/recall/recount
16:58gfredericksobligatory comment about the characteristics of the voting mechanism used contrasted with others
16:59cemerickapathy begets regression
16:59cemerickmuhoo: Well done. :-D
17:00gfredericks(inc democracy)
17:00lazybot⇒ 1
17:00muhoocemerick: thanks. i hear new hampshire might need some volunteers too.
17:01cemerickmuhoo: Been there every four years since 2000. There's actually a close-ish race here in MA, so I actually get to work local. :-)
17:06antares_cemerick, lpetit: http://clojure-doc.org/articles/tutorials/eclipse.html. Needs a lot of editing but already not bad.
17:07hyPiRionOh, right. Is there anyone here who has had a "introduction to Clojure" workshop/presentation?
17:09hyPiRionI'm coming from Common Lisp, so I'm not 100% sure what normal Java/C++-people would have issues with when learning it.
17:09lpetitantares_: you wrote it?
17:09antares_lpetit: no, someone contributed it, I just did some very small edits so far
17:10antares_lpetit: https://github.com/clojuredocs/cds/pull/12
17:12cemerickHrm. lpetit and I both have access to the "starting with eclipse" page on dev.clojure.org. Another documentation site to maintain doesn't sound too fun.
17:12cemerick(Not that I've done much of any work on ccw docs. Preferred to do screencasts in that neighborhood in general.)
17:13antares_cemerick: dev.clojure.org is a closed party
17:13antares_cemerick: I cannot contribute to it
17:13antares_and everybody can contribute to https://github.com/clojuredocs/cds/
17:14cemerickantares_: Yeah, I understand the motivation, etc. It's just an odd patch — more for lpetit than me — since this now makes three distinct documentation sources.
17:14cemerickEch, four if you count the in-IDE docs. :-|
17:15lpetitantares_: Oh, you're Michael, I hadn't understood by the nickname :)
17:16antares_cemerick: we will try to unify them, maybe even move it to CCW site and link there, but there is value in having content for various levels of expertise
17:16ystaelanyone know offhand how to troubleshoot a com.sun.tools.attach.AgentInitializationException when trying to attach a djpowell/liverepl to a running clojuer process?
17:16lpetitantares_: you'll just have to remember that CCW is a moving target :)
17:17antares_lpetit: you can always notify us about what we need to update or update it yourself
17:17cemerickMaybe this will be the impetus that convinces lpetit to get ccw off of Google Code… ;-)
17:17antares_it is not a problem, I merged that PR 4 minutes after it was submitted
17:17SgeohyPiRion, may I ask why you choose Clojure over CL?
17:17antares_eeeek
17:18lpetitcemerick: you never lose your grips on a bone, do you? :-D
17:18antares_lpetit: is there life on google code? :P
17:18lpetitantares_: do you believe in parallel worlds? Multiverses? ;)
17:19antares_lpetit: no, absolutely not :)
17:24lpetitantares_: what is the license of the documentation for clojure-doc, again? (please)
17:25lpetitgot it
17:25antares_lpetit: Creative Commons BY 3.0
17:25lpetitis there a tl;dr about this license somewhere? :)
17:25antares_http://creativecommons.org/licenses/by/3.0/
17:26antares_it's BSD of content licenses, more or less
17:28cemericklpetit: Come now, I haven't mentioned it in months. :-P
17:28cemerickBut, GC is quite shite. Bitbucket, github, nearly anything is preferable.
17:29lpetitantares_: looks like a good start. The structure seems a little bit strange, tho. I mean, there's Installing Eclipse, and Installing Counterclockwise is not there. It does not indicate what version of Counterclockwise it covers, etc.
17:29antares_lpetit: that's why I am saying that it needs a lot of editing
17:30lpetitantares_: being able to start discussions on a page via e.g. integration of disqus comments would be a plus?
17:30antares_some day
17:31lpetitantares_: like right now: it's 23:25 here, I'll quit in mnutes, and while not being able to edit right now, having left notes via disqus on the page would have prevented them to get lost in #irc :)
17:31lpetitcemerick: I've noticed everyone moved to github :-p
17:32antares_but that's what I *don't* want comments to be
17:32antares_comment on the pull request or other GH issues
17:32antares_comments are necessary for people to be able to point out issues
17:32antares_but right now we know what sucks
17:33antares_it's obvious in most places
17:33antares_we are trying to add content in large chunks without much polishing right now
17:33antares_err, sorry, I wanted to say "we are agile"
17:34dignatiHey, after reading this: https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L42 I was wondering where `fn*` is defined?
17:34hiredmandignati: in the compiler
17:35dignatihiredman: Uhm, where could I find this?
17:36hiredmandignati: Compiler.java
17:36dignatihiredman: Great, thanks! :)
17:38dignatiOh god, this is going to be fun
17:38lpetitcemerick & al: do you think it's time to switch the editing mode to strict/paredit by default? Pondering this possibility right now...
17:39technomancylpetit: wow, you have some guts =)
17:39antares_lpetit: that's probably too hardcore for newcomers
17:39technomancynDuff: meh; I use maybe 20% of paredit on a good day
17:41lpetitnever mind, I think I can only do that when there's a clear visual component guiding the user to escape from the strict mode. Maybe some AI understanding that when he/she hits ")" 10 times then maybe he really wants to insert that damn ")" :)
17:41nDufftechnomancy: It's like MS Word: Nobody uses all the features, but everyone uses a different 5%.
17:41technomancylpetit: yeah, the #1 usability challenge is making it clear how to step outside its boundaries when things get messed up
17:42jkkramer_just use a paredit clippy
17:42nDufftechnomancy: ...I use a very different 5% from lpetit, which drives me batty trying to use ccw (and leads to feature requests for which the answer is "why are you doing it that way? Just do it this other way...")
17:42jkkramer_"so you'd like to slurp some sexps? ..."
17:43hiredmanI see you are trying to insert a bracket, would you like your brackets balanced?
17:43lpetittechnomancy: currently, there's no visual, but it's already there: hit alt+D to quit the mode entirely for this editor "session", hit Esc key to disable strict mode for the next key press, and/or go to the preferences to change default mode when entering a new editor.
17:44lpetithiredman: he, with a cute dog face to ask the question :-D
17:45TimMckibit + clippy
17:45TimMcAnd with that, I'm heading home.
17:45hiredmanit looks like you are smasking keys randomly, would you like me ti disable paredit?
17:45lpetitnDuff: I see Tom Hickey has a slurpage / barrage etc. in his paredit.clj fork.Don't know whether it's finished yet, or not.
17:45lpetit:)
17:47lpetitWhat's the status of kibit these days?
17:52hyPiRionSgeo: Sorry for late reply. I like it more, for unknown reasons.
17:52hyPiRionMost likely because it's more focused towards immutability.
17:52hyPiRion/s/towards/on/
17:55SgeoI like that, and the libraries I think. But I don't like the necessity of being oriented around projects
17:55SgeoOne-file things would be nice
17:57ivanhttp://www.4clojure.com/problem/49 <- the shortest solution to this makes me happy
18:03hyPiRionSgeo: yeah, that's a bit impractical at times. But it keeps the simplicity down when you scale projects though.
18:03hyPiRionup*
18:04hyPiRionivan: (juxt take drop) ?
18:04ivanyep
18:05hyPiRionit's elegant.
18:08technomancyit's juxt! what's not to like
18:10Sgeo,(apply concat {:a 1 :b 2})
18:10clojurebot(:a 1 :b 2)
18:10SgeoHrm
18:10Sgeo,(apply identity {:a 1 :b 2})
18:10clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity>
18:10Sgeo,(apply identity {:a 1})
18:10clojurebot[:a 1]
18:10Bronsa,(mapcat identity {:a 1 :b 2})
18:10clojurebot(:a 1 :b 2)
18:12Sgeo,((fn [& {:keys [a b]}] [":a" a ":b" b]) {:a 1 :b 2})
18:12clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {:a 1, :b 2}>
18:12Sgeo,((fn [& {:keys [a b]}] [":a" a ":b" b]) :a 1 :b 2)
18:12clojurebot[":a" 1 ":b" 2]
18:12Sgeo,(apply (fn [& {:keys [a b]}] [":a" a ":b" b]) {:a 1 :b 2})
18:12clojurebot[":a" nil ":b" nil]
18:13Sgeo,(apply (fn [& {:keys [a b]}] [":a" a ":b" b]) (apply concat {:a 1 :b 2}))
18:13clojurebot[":a" 1 ":b" 2]
18:14SgeoWhat's the proper way to do that?
18:14gfredericksto do what?
18:14SgeoPass a map to a function expecting keyword arguments
18:14gfrederickshaha
18:14gfredericksmapply
18:14gfrederickswhich doesn't exist
18:14gfredericksI laugh because TimMc has been complaining about keyword arguments for that exact reason for a while
18:16KaOSoFtHello there. I’m just learning about Clojure, and I’m curious. When I check `(source +)`, I see a `reduce1` function, but `(source reduce1)` throws nothing. What is this magical `reduce1` I see?
18:17amalloyi prefer to just not define keyword-arg functions at all. it makes everything easier
18:17gfredericksKaOSoFt: it's private in clojure.core
18:17KaOSoFtIt’s different from `reduce`?
18:17gfredericksKaOSoFt: you can (source clojure.core/reduce1)
18:17gfredericksKaOSoFt: I'd never heard of it;
18:17Sgeoamalloy, would that be similar to accepting a single vector rather than var args?
18:18hyPiRionamalloy: Or explicitly sending maps.
18:18hyPiRionThat's easier, I think.
18:18SgeoIf concat were used (concat [[:a :b :c] [1 2 3]]) instead of (concat [:a :b :c] [1 2 3])?
18:18gfredericksSgeo: I think he's talking specifically about implicit-map varargs rather than general varargs
18:18amalloyreduce1 is just an artifact of the bootstrapping process; it disappears once we can do a real, performant reduce
18:19KaOSoFtgfredericks, indeed, there it is. Weird naming.
18:19gfredericksthat rhickey is a real goofball
18:19KaOSoFtgfredericks, thanks. :)
18:22ivan~mapply
18:22clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
18:37cemericklpetit: That's fine by me, as long as you're going to answer all the emails ;-)
18:37lpetithe
19:28dnolenemezeske: I'm assuming a new lein-cljsbuild not too far off?
19:29emezeskednolen: Yeah, I've been meaning to cut a release for a week or so now, got derailed by getting married :)
19:29dnolenemezeske: whoa, congrats!
19:29emezeskednolen: thanks!
19:30emezeskednolen: I saw a note on the ML about a new cljs release
19:30emezeskednolen: I wonder if that will be soon? If so, I might wait for it
19:30dnolenemezeske: already out
19:30emezeskednolen: oh, sweet
19:31emezeskednolen: I should be able to do a release this evening then
19:40danielglauserDoes anyone know of a detailed compojure/friend sample app that I could look at?
19:41emezeskedanielglauser: Not a sample app, but does use friend: https://github.com/ato/clojars-web/blob/master/src/clojars/web.clj
19:42danielglauseremezeske: Excellent, that should do it. Thanks!
19:44danielglauseremezeske: can you shed some light on, "Work around friend#20 and ring-anti-forgery#10"
19:44emezeskedanielglauser: I'm guessing those are github issues: https://github.com/cemerick/friend/issues/20
19:45emezeskedanielglauser: Looks like friend#20 has been fixed, maybe those workarounds are no longer needed?
19:46danielglauseremezeske: that makes sense
19:46weavejesterYeah, they were problems with setting the session.
19:47weavejesterI'll fix the anti-forgery one tonight. I keep forgetting about it.
19:47TimMc /ba
20:24AtKaaZam I correct in assuming a delay cannot be cancelled? or maybe interrupted?
20:28AtKaaZ,(delay (throw (Exception. "a")) 100)
20:28clojurebot#<Delay@601ef748: :pending>
20:28AtKaaZ,@(delay (throw (Exception. "a")) 100)
20:28clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.Exception: a>
20:30amalloy&(deref (delay (Thread/sleep 10000)) 1000)
20:30lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$deref
20:31amalloy&(deref (delay (Thread/sleep 10000)) 1000 :timed-out)
20:31lazybotjava.lang.ClassCastException: clojure.lang.Delay cannot be cast to clojure.lang.IBlockingDeref
20:31amalloyoh, sure. no, you can't
20:35AtKaaZ,(let [d (delay (throw (Exception. "a")) 100)] (vec (map pprint (list d (try (@d) (catch Exception ex (str "caught exception: " (.getMessage ex)))) d))))
20:35clojurebotAtKaaZ: Cool story bro.
20:35amalloy(inc clojurebot)
20:35lazybot⇒ 14
20:35AtKaaZlol what didn't he like? thanks btw for reply
20:37AtKaaZsome inconsistency: ##(let [d (delay (throw (Exception. "a")) 100)] (pprint a) a)
20:37lazybotjava.lang.RuntimeException: Unable to resolve symbol: pprint in this context
20:37AtKaaZ,(let [d (delay (throw (Exception. "a")) 100)] (pprint a) a)
20:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0)>
20:37AtKaaZ,(require 'clojure.pprint)
20:37clojurebotnil
20:37AtKaaZ,(let [d (delay (throw (Exception. "a")) 100)] (pprint a) a)
20:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0)>
20:38AtKaaZ,(let [d (delay (throw (Exception. "a")) 100)] (clojure.pprint/pprint a) a)
20:38clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0)>
20:38AtKaaZ,(let [d (delay (throw (Exception. "a")) 100)] (clojure.pprint/pprint d) d)
20:38clojurebot#<Delay@520ed4: :not-delivered>
20:38clojurebot#<Delay@520ed4: :pending>
20:38AtKaaZ,(let [d (delay (throw (Exception. "a")) 100)] (print d) d)
20:38clojurebot#<Delay@5eff06be: :pending>
20:39clojurebot#<Delay@5eff06be: :pending>
20:39AtKaaZthis is consistent
20:47AtKaaZdispatch.clj has :not-delivered and core_print.clj has that :pending the ones relevant to above
20:48AtKaaZand it's the same two places where something like "#<core$future_call$reify__3499@7c9391d9: :cancelled>" can be implemented
20:50AtKaaZ,(require 'clojure.pprint) (let [p (promise)] (print p) (clojure.pprint/pprint p) p)
20:50clojurebotnil
20:50AtKaaZ,(let [p (promise)] (print p) (clojure.pprint/pprint p) p)
20:50clojurebot#<core$promise$reify__3678@4899aebd: :pending>#<Promise@4899aebd: :not-delivered>
20:50clojurebot#<core$promise$reify__3678@4899aebd: :pending>
20:53AtKaaZif I wanted to use the same :key in more than 1 place within the code, would you recommend holding it in a (global?) def instead? what is the equivalent of a java static final constant in clojure?
20:58hyPiRionAtKaaZ: Not if you're working with keywords. There's no point in a (def foo :bar)
20:59AtKaaZI guess you can always change the variable if even only temporarily, but the key itself is a static final if used like :key
20:59AtKaaZhyPiRion, maybe to avoid forgetting that you have to change code in more than one place
20:59hyPiRionA java "static final" is the same as def.
20:59AtKaaZbut I can def it again later, I kinda wanted to prevent even that
20:59hyPiRionHm
21:00emezeskeAtKaaZ: For something where you just need a constant to identify something, not for a specific value (e.g. 42), just use a naked keyword
21:03AtKaaZI guess that makes half sense:) I only say it because in clojure code I found the same code in two places and it shows two different keywords (I figure someone changed one of them but forgot to change the other) - it's in those tests above
21:03AtKaaZ(and (instance? clojure.lang.IPending o) (not (.isRealized o)) :not-delivered
21:03AtKaaZ(and (instance? clojure.lang.IPending o) (not (.isRealized o)) :pending
22:00dnolenmacros are grand - http://gist.github.com/3882891
22:04SgeoAlthough taking the concept and implementing a Lisp based on it would likely be better than actually using Tcl
22:08_tcawachamacallits?
22:11wingylol http://en.wikipedia.org/wiki/Brainfuck
22:15pandeiroi have :source-path "src/clj" in my lein project but lein cp is only showing src/ and i'm getting a ClassNotFound exception when i try to run main with lein run
22:16emezeskeSgeo: Have you used Tcl much?
22:17Sgeoemezeske, it was my preferred language for a few months
22:17SgeoWrote an IRC bot in it
22:17emezeskeSgeo: It is a god-awful mess to maintain code that does macro-type stuff
22:17SgeoI think it was actually the ecosystem that drove me away partially
22:17SgeoI needed to use tclkit, and couldn't find a good xml library that worked well on it
22:18SgeoYes, it's possible to make portable stuff with Tclkit, but don't expect to be able to port scripts that use ActiveTcl libraries :(
22:18frozenlockWhen I run a webserver from a repl, what's the typical way to send stuff to the repl, print?
22:18emezeskeI guess I just wanted to mention that I strongly disagree with any notion that Tcl code-writing-code is remotely better than macros
22:19Sgeoemezeske, how much of that comes from stringiness and no quasiquoting, and how much comes from the concept of a command's call site determining what the command sees
22:20emezeskeSgeo: Mostly the former.
22:21l4mb4Unless I'm doing it wrong, it seems as if the Lein REPL doesn't support Java escape characters in string literals; anyone know what's up with that?
22:21emezeskeSgeo: Okay, I won't call you completely insane, then :)
22:22AtKaaZwingy: https://gist.github.com/1495970
22:22wingyAtKaaZ: :)
22:22Sgeowingy, check out esolangs.org
22:23wingyglad im doing clj
22:32ivanl4mbd4: what escape doesn't work?
22:32pandeirois :source-path still supposed to work in lein2-preview10?
22:33AtKaaZ:source-paths ["src/clojure"]
22:33SgeoSuppose I want to implement a lazy non-seq structure. Is it acceptable to just use some mutation, or are there higher-level libraries for defining lazy structures?
22:35l4mbd4ivan: They're all fine now. Something strange was going on in my REPL, but killing it and starting a new one worked.
22:35AtKaaZpandeiro, according to PLUGINS.md file: "Another key change is that `:source-path`, "..."have changed to
22:35AtKaaZ`:sources-paths`", so the answer is probably no
22:35pandeiroAtKaaZ: you da man thanks
22:36pandeiroswear i was looking at the sample.project.clj and seeing :source-path a second ago
22:36AtKaaZI still wonder if it works as backward compatibility
22:37pandeiroAtKaaZ: it isn't for me
22:37ivan"\v" seems to mess up lein repl forever
22:38AtKaaZpandeiro, searching thru code, and also in sample.project.clj it doesn't seem to be any backward compat, :source-paths only
22:39amalloyivan: just type the closing " again
22:39ivanamalloy: man that's a weird thing to have to do. thanks.
22:39l4mbd4(println "\v") just seems to throw a RuntimeException on my end
22:40ivannow hit enter twice
22:40amalloyi dunno. when a repl for any language siezes up and pretends i'm not typing anymore, "'))))]]]]}}}} is the first thing i try
22:40l4mbd4Ah yeah
22:41ivanguess I'll be using JavaScript for my vertical tab needs
22:42emezeskeANN: lein-cljsbuild 0.2.8 released.
22:47frozenlo`\o/
22:50AtKaaZ,(symbol "\\o/")
22:50clojurebot\o/
22:51AtKaaZ,(symbol "\o/")
22:51clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o>
22:51jorgeugerard0, vos acá? jajaja
22:53AtKaaZdoes anyone know why I am seeing the SLASH message(in my repl): http://cljbin.com/paste/5078d649e4b05027595811b8
22:53AtKaaZit's a return
22:55AtKaaZ,"\o(println "test")"
22:55clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o>
22:55AtKaaZthat shows "test" when in repl :)
22:55jorgeuAtKaaZ, I don't think \o is supposed to be used between " "
22:56AtKaaZ,\o(println "test")
22:56clojurebot\o
22:56jorgeu,(str "this is the o char:" \o)
22:56clojurebot"this is the o char:o"
22:56jorgeuwell, and in fact it is a symbol
22:56jorgeu,(symbol \o)
22:56clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String>
22:57AtKaaZ,\o1
22:57clojurebot\
22:57AtKaaZ,(str \o1)
22:57clojurebot""
22:57AtKaaZmy implied question was, how come the println gets executed: ##"\o(println "test")"
22:58AtKaaZ&"\o(println "test")"
22:58lazybotjava.lang.RuntimeException: Unsupported escape character: \o
22:58AtKaaZonly in ccw repl tho
22:59AtKaaZwhich is nrepl, works with lein repl too
22:59AtKaaZ,"\o(println 'test)"
22:59clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o>
22:59AtKaaZi guess the bots stop automatically on first exception
23:02AtKaaZit's probably a nrepl bug: http://pastebin.com/yPqPX8fK
23:04AtKaaZthis one is actually how that didn't throw the second time: http://pastebin.com/XhiQzHtJ
23:04AtKaaZ,"\o(println "test")"
23:04clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o>
23:04AtKaaZ,"\o(println 'test)\"
23:04clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o>
23:12ivan,(try (keys "hey") (catch Throwable e nil))
23:12clojurebotivan: I don't understand.
23:12ivan&(try (keys "hey") (catch Throwable e nil))
23:12lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
23:12AtKaaZso that's why lol
23:12ivananyway, why doesn't that catch the ClassCastException?
23:14tomoj&(class (keys "hey"))
23:14lazybot⇒ clojure.lang.APersistentMap$KeySeq
23:14tomoj&(try (dorun (keys "hey")) (catch Throwable e nil))
23:14lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
23:14tomojd'oh
23:15tomoj(answer: it's lazy)
23:15ivantomoj: thanks
23:15tomojnotice that the stack trace goes back to printing
23:15ivanah, yeah
23:18nsxtwhy is catch bad?
23:18ivandid someone claim it was bad?
23:18ivanoh, the bot
23:18ivanit's running in a paranoid sandbox
23:19nsxtah
23:19AtKaaZ,(dorun (keys "hey"))
23:19clojurebotnil
23:20AtKaaZ,(dorun (take 1 (keys "hey")))
23:20clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.util.Map$Entry>
23:20AtKaaZmuch better lol
23:20AtKaaZI was wondering why the catch never triggered
23:20AtKaaZ,(try (dorun (take 1 (keys "hey"))) (catch Throwable f (println f "now it triggers")))
23:20clojurebotAtKaaZ: I don't understand.
23:21AtKaaZhow do I unlazily take 1 ?
23:22ivan,(doall (take 1 '(1 2 3)))
23:22clojurebot(1)
23:23AtKaaZthank you
23:37ivanuser=> (try (doall (split-with "hey" "you")) (catch Throwable e))
23:37ivan[(ClassCastException [trace missing]
23:39ivanoh, because it returns a vector with two lazies
23:40ivannow I need to write deep-unlazy
23:40technomancythere's always prn
23:40technomancyor rather, doto prn
23:41tomojstr?
23:41clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))
23:41ivanI kind of wanted the value instead of some string, but I'm doing a crazy test thing anyway
23:42technomancyivan: hence doto
23:42ivanoh, nice, thanks
23:44aperiodicdoto: instant chaining syntax
23:44aperiodicexcept better
23:44Sgeo,(-> 5 inc inc (doto println) dec)
23:44clojurebot7
23:44clojurebot6
23:45aperiodici use it a lot for java interop
23:45technomancy(doto 'my.ns require in-ns)
23:46aperiodic(doto object (mutatey java crap)+) always evaluates to the object
23:48yedihow closely tied is functional programming to declarative programming
23:48aperiodici realized recently that with clojure i think a lot more about shape of code than flow of time
23:48aperiodicwhich i think is super neat
23:57ivanlet's train a new generation of programmers capable only of thinking functionally, leaving us with the high-paying procedural maintenance