#clojure logs

2013-04-27

00:00andyfingerhutSo what are you comparing the 288 msec Clojure run time against?
00:00echo-areaandyfingerhut: http://pastebin.com/uxPNyFwg
00:00echo-areathis
00:01echo-area(time (p1)) against the timed iteration
00:01echo-areaAs I don't see much difference in the assemble code, I can't explain the slowness here
00:02andyfingerhutI see 0.07user time. That is not 1/100 of 288 msec, is it?
00:02echo-areaIt's 288 msec vs 10 msec
00:02andyfingerhutsorry, I meant 10x.
00:03echo-area~28.8x, IMO
00:03clojurebotExcuse me?
00:03andyfingerhutWith the Java program you can start and finish a JVM in 10 msec?
00:03amalloyandyfingerhut: for a JVM that just starts up, does nothing, and then closes, that's pretty reasonable
00:03echo-areaNo, please see the java program below. 10826513 nanoseconds is ~11 msec
00:04echo-areaand it is the time of the whole iteration, not the java process
00:04andyfingerhutSorry, finally catching up here.
00:06echo-areaExcept the bigger minor pagefaults in the clojure run, I don't see anything else slowing down it. Do you?
00:06echo-areaAnd how would you explain it?
00:06echo-area*bigger number of
00:13echo-areaOr could it be that the VM is loading code?
00:25andyfingerhutI think you may be partly seeing a different JIT warmup time for the two bits of code. Try increasing N by a factor of 10 in the two cases and compare Java-to-java and Clojure-to-Clojure times before and after that change.
00:28echo-areaThe Clojure version becomes ~2x slower and the Java version ~5x slower. What does this imply?
00:30andyfingerhutWell, the Clojure is getting better relative to the Java performance, for one :-)
00:31andyfingerhutExactly why that is happening I don't know off hand, but the two version of the code could be having JIT kick in at a different point in time, perhaps.
00:32andyfingerhutThe criterium library is good for ensuring that code is "warmed up" and JIT should have completed, before it starts making any measurements that it reports.
00:34echo-areaLooking at it right now, thanks
00:37andyfingerhutYou might also see something interesting if you try (dotimes [j 10] (time (p1)))
00:44mindbender1what's the idiomatic way of throwing error in cljs
00:46echo-areaandyfingerhut: `criterium' reported the same level of execution time. I'll look into it to seek for an explaination. Thanks.
01:28n_bpeople who write parsers with regular expressions :(
01:28n_bAck, wrong window.
01:29amalloythere's no window in which it's wrong to point out that regexes don't parse
01:31n_bIn that case I'd also like to point out the MediaWiki people have done an admirable job on making knowledge easier to share, but their markup format is insane.
01:40callennothing like playing tech support for random entrepeneurs on Facebook.
02:26isson0926hello. i have a question. (i am not good to speak english)
02:28isson0926haskell's recursive function(not tail recursion) do not occur stack overflow. but common lisp do. does clojure do stack overflow?
02:30brainproxyisson0926: owing to the way the jvm works, clojure can't automatically optimize in the way that haskell does
02:31isson0926thanks . brainproxy :-)
02:31amalloyhaskell's functions can stackoverflow too
02:31brainproxyhowever, clojure provides some facilities so you can have recursive calls that don't blow the stack
02:31brainproxye.g. loop and recur
02:32brainproxyisson0926: http://clojuredocs.org/clojure_core/clojure.core/loop
02:32brainproxyhttp://clojure.org/special_forms#recur
02:33isson0926good doc. thanks brainproxy.
02:33isson0926amalloy , when haskell's functons can stackoverlow?
02:35amalloy$heval foldr (+) 0 [1..1000000]
02:35lazybot⇒ *Exception: stack overflow
02:36amalloystrict and non-strict languages exhibit stack overflows in different scenarios, but if you're using a stack to represent things, and it's not infinite, you can always write code to make it run out
02:36isson0926that's righit. so it comes strict version foldr.
02:37isson0926thanks amally.
02:40amalloyif you're interested in exploring languages without a stack, you might take a look at some papers about using only tail-calls in scheme with CPS
02:45isson0926i want native compiler, i want purity functional language (like haskell, as i know clojure) , i like lisp syntax. generating fast running code like common lisp .
02:45aduamalloy: I <3 tail-calls
02:45aduisson0926: then you might try SBCL
02:45isson0926but as i know , sheme is slow (but common lisp is fast). is write?
02:45isson0926is right?
02:45aduSBCL beats some other languages on the computer language shootout
02:47isson0926but sbcl and common lisp do not abstract list like clojure, haskell, it represent points (like cons..)
02:47isson0926points -> pointers
02:47isson0926i hate it.
02:49aduisson0926: for example, in http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=spectralnorm&amp;lang=all&amp;data=u64q
02:49aduSBCL is faster than Java, C#, and Haskell
02:50RaynesCombined!
02:50RaynesIn quicksand!
02:52isson0926good. but i cannot understand the result. i know common lisp using hint for type inference. but it is high abstraction language. surprise result.
02:53isson0926surprise -> surprising result.
03:15corpsani was in here earlier wondering about calling arbitrary code from within datomic transaction functions. suppose i wanna use some random clojure library inside my transaction functions. i don't want to have to "install" those functions (in the parlance of http://docs.datomic.com/database-functions.html) by sending transactions which store the code. i just wanna dump the requisite .jar on the transactor class path or something.
03:15corpsanpossible?
06:25nmadanif I have an int-array, is the nth function still going to be O(n)?
06:27morphlingnmadan: nth is O(1) for arrays
08:10jjttjjanyone know of any good examples/source code of using agents to process message queues? (besides the one in Clojure Programming)
08:12silasdavishow can I get the fully qualified symbol for '+'
08:12jjttjj,`+
08:12clojurebotclojure.core/+
08:12silasdavisoh of course, thanks
08:12jjttjjno prob
08:31varadharajanI'm wondering what i missing in this code (#(#{ %1 %2}) 1 2) . I'm expecting it to give a set #{1 2}. I was able to get an equivalent version of it with (#(hash-set %1 %2) 1 2) . But not sure why the first one did not work.
08:33Bronsavaradharajan: you're calling the set, not only creating it
08:34Bronsa((fn [x y] (hash-set x y)) 1 2) vs ((fn [x y ] (#{x y})) 1 2)
08:37varadharajanBronsa: Got it. Thanks :)
08:40gfredericksthat's a limitation of the #() syntax -- you can't give a literal to return, you have to call something
08:41Bronsawell
08:42Bronsayou can still use the clojure.core functions
08:42Bronsa,(map hash-set [1 2 3] [2 3 4])
08:42clojurebot(#{1 2} #{2 3} #{3 4})
08:43varadharajangfredericks: Yeah. I was not aware of that limitation and hence messed it up
08:43gfredericksit seems to trip people up quite commonly
08:43BronsaI would not call it a "limitation" though
08:43gfredericksno?
08:43clojurebotno is tufflax: there was a question somewhere in there, the answer
08:44Bronsagfredericks: it's how #() works
08:44Bronsahow could it work otherwise?
08:44Bronsaspecial-casing on collection literals?
08:44gfredericksno, you're right that there's no obvious way
08:45gfredericksbut if there _were_, there'd be no reason not to add it
08:45gfredericksI think "limitation" is a word most people would be comfortable with there
08:45gfredericksit's not inherent in the design of #() that you shouldn't be able to do that, there's just no obvious simple way to make it possible
08:46gfredericksI certainly don't mean to imply that #() is poorly designed or should be changed
08:46Bronsawell. actually since calling a collection literal as a function with no arguments throws an exception, #(coll-literal) could be expanded automatically to #(do coll-literal)
08:46gfrederickstrue
08:46Bronsaactually, every literal probably
08:46gfredericksI wouldn't want that, but it does sound like it would work
08:54Glenjamin,(#(-> {:a %}) 1)
08:54clojurebot{:a 1}
08:54Glenjaminmisusing -> a bit, but keeps it fairly readable
09:16gfredericksthat's clever
09:16gfredericksI wonder if the swearjure guys know about that
09:18gfrederickswe were doing nastier stuff to get the same effect
09:18hyPiRionGlenjamin: it's the same as using "do", isn't it
09:18hyPiRion,(#(do {:a %}) 1)
09:18clojurebot{:a 1}
09:18Glenjaminyeah, but it looks a tad nicer imo
09:18Glenjamin:D
09:18gfredericksbut do is not allowed in swearjure
09:18hyPiRiongfredericks: this is true
09:19gfredericksclojurebot: swearjure is <reply> there is no do
09:19clojurebotIk begrijp
09:19hyPiRionWe tend to do ##(#([{:+ %}](+)) 10) instead
09:19lazybot⇒ {:+ 10}
09:19gfrederickswhich is great for making swearjure look more complicated
09:19hyPiRionheh
09:19silasdavisdamn clojure has some unhelpful errors for beginners. example: writing (:require optic.config.database :as db) instead of (:require [optic.config.database :as db]) throws a ClassCastException java.lang.Boolean cannot be cast to clojure.lang.Symbol clojure.core/alias (core.clj:3870)
09:20gfrederickssilasdavis: sure does
09:20Glenjaminthe errors from the ns form are very cryptic
09:20silasdaviscan anyone explain why that lead to cast...
09:20gfredericksI have no idea where a boolean would have come from
09:21gfredericksmy repl gives the same error
09:21Glenjaminthe one i get often is when i go from :refer [something] to :as something, i often accidentally do :as [something]
09:21jjttjjI think
09:21silasdavisby comparison haskell has some pretty helpful errors a lot of the time... I suppose it's a mixture of macros and java poking through
09:21jjttjjwoops
09:21gfrederickssilasdavis: well the ns macro could be enhanced to have error checking with nice messages
09:22silasdavisthat'd be nice
09:23silasdavisthese little data structure based mini-languages can be a bugger to remember
09:24gfredericksns is probably the worst combination of design and high-profile-ness
09:24gfredericksit is much hated but expensive to change
09:25Glenjaminhttp://dev.clojure.org/jira/browse/CLJ-272
09:25Glenjamina fairly old and rather vague issue :D
09:25gfrederickshaha it's over 3 years old
09:26gfredericksI guess require got updated recently
09:26gfredericksbut certainly not an overhaul
09:29silasdavisperhaps it could be superseded by a differently named macro
09:29silasdavisor perhaps you could explicitly include something that overrode it
09:29silasdavisto not break backward compatibility
09:30silasdavisI'm using a migration library that by default stores migrations in the namespace 'lobos.migrations'. It feels a bit wrong to have my file in/a/different/directory not have the corresponding ns to its location
09:31silasdavisbut perhaps it's alright in this case
09:31borkdudesilasdavis lobos requires migrations to be in lobos.migrations, so you need a lobos dir in your src dir
09:32borkdudedoes someone have a good example of usage of noir validation outside a noir project, so with lib-noir?
09:32silasdavisborkdude, I could override the default
09:32borkdudesilasdavis you probably can
09:32silasdavisthe problem with having a lobos directory is it would sit outside my app root namespace, which feels wrong since all my other db and config is there
09:33silasdavisalso it's not lobos' migrations, it's this app's
09:33silasdavisborkdude, try lein new luminus myapp
09:33silasdavisI think it has some noir validation in it
09:34borkdudesilasdavis yes, it feels wrong to me to
09:34borkdudesilasdavis will try, thanks
09:35borkdudesilasdavis grep -R 'vali' . returns nothing
09:36GlenjaminThus, to use another namespace you must change the lobos.migration/*migrations-namespace* dynamic variable
09:37Glenjaminplet
09:37silasdavisborkdude, sorry try lein new luminus myapp +site
09:37Glenjaminwhoops, that was supposed to be a find :)
09:37silasdavisthen you should find some in auth.clj
09:37Glenjaminis there a public log of this channel somewhere?
09:38silasdavisGlenjamin, yeah.. I'm not the first: http://stackoverflow.com/questions/10986293/how-to-set-a-dynamic-var-in-another-namespace
09:39borkdudesilasdavis you're right, thanks, now I find a lot of of references
09:44innotunehey, I have a problem with an OOM Error that occurs to me, but not to others (http://stackoverflow.com/questions/16194841/clojure-lazy-sequences-in-math-combinatorics) can somebody help me in finding reasons why I get this error?
09:48Glenjaminwhat's the collective term for people who do clojure?
09:48Glenjaminclojurist, clojurian, clojurer?
09:50borkdudesilasdavis do I need wrap-validation from noir if I want to use validation?
09:51borkdudesilasdavis I can't find it in the example, so I assume not
09:53Glenjaminborkdude: i suspect you do, i think it uses a dynamically bound variable
09:53silasdavisborkdude, I think you do, it's called within noir.util.middleware/app-handler
09:53silasdaviswhich I think luminus uses by default
09:53borkdudesilasdavis ah no problem then, I use that one already..
09:53borkdudeGlenjamin thanks
10:04borkdudehmm, why is this true? https://www.refheap.com/paste/14006
10:05borkdudegot it, name should be :name
10:06borkdudeyay, validation works now
10:37JernauHi everyone, I have a real beginners question here... I'm trying to write a function that takes a vector of strings and returns a vector of numbers.
10:38JernauWhen I try: (map read-string ["2" "4"]) it gives me the result I expected: (2 4).
10:38JernauHowever, when I try to define a function using the same code: (defn strings-to-numbers [strings] map read-string strings) (strings-to-numbers ["2" "4"])
10:38JernauI get the result ["2" "4"] as though it hasn't applied read-string at all. Which basic concept am I missing here?
10:39cap10morganJernau: you want (defn strings-to-numbers [strings] (map read-string strings))
10:39cap10morganyou need to call the map function inside your function
10:40cap10morganputting a something in "function position" (i.e. the beginning of a list) does that
10:41Jernauokay, thanks cap10!
10:41JernauKnew it was basic :)
10:42cap10morganJernau: np, happy Clojuring!
10:53gfredericks,(-> (a b c) quote reverse)
10:53clojurebot(c b a)
10:54pandeiroanybody know the way to invoke `lein run` so that my "platform encoding" is UTF-8?
10:55gfredericksis that a jvm option?
10:55pandeirogfredericks: not sure, but non-ascii filenames are getting garbled by ring-multipart-params
10:56pandeirowhat i tracked down on stackoverflow so far is that commons-fileupload looks for something called the platform encoding
10:56gfredericksoh; I'm not familiar enough with the issues involved to guess
10:56pandeirome neither
10:56gfredericksif it turns out to be a jvm opt, you can set those in the project.clj
10:58maioany native english speaker willing to do quick grammar check of my Clojure related blogpost please? :) https://gist.github.com/maio/2fb5e49353b28925cea5
11:00pandeiro"we chose Heroku"
11:00pandeiro^ maio
11:01gfredericksmaio: curious what your native language is
11:01pandeiro"their Git repository"... "Heroku then builds"
11:01pandeiro"a custom build script"
11:02gfrederickssomewhere on the internets or in a book there was a listing of english grammar mistakes categorized by native language; terribly interesting
11:02pandeiromaio: dunno if it matters to you, the rest are mostly missing articles like the above... "the compass gem"...
11:02maiogfredericks: czech / slovak :)
11:03maiothank you guys :)
11:03pandeiroyes when i do my bad russian/slovak imitation the first thing that goes are the articles :)
11:03maiopandeiro: sure - I would like to learn how to write correctly so any correction will help :)
11:03gfredericksmaio: "To make build process[es] more ..."
11:04gfredericks"...that you use [the] same versions..."
11:04gfredericksprobably replace "one" with "you" in the previous sentence
11:04gfredericks"will create [an] example Gemfile"
11:05gfredericks"requires [the] compass gem"
11:05gfredericks"you will find that [the] build fails"
11:06gfredericks"[the] presence of [the] Gemfile", "[The] fix is"
11:07gfredericksit's like clojure with parens -- just sprinkle a few articles around the sentences :)
11:08pandeiroarticle usage varies a lot from language to language.. in the Brazilian vernacular you use the definite article before everyone's name when referring to them in the third person, which sounds so bizarre in English
11:08gfredericksspanish has a dialect with that I think
11:08pandeiroand English not putting articles before abstract nouns is also bizarre to speakers of other languages
11:09gfredericksI liked the list of mistakes categorized by native language because it gives a quick appreciation for the great variety of language characteristics, but put in terms that are natural to an english speaker
11:10pandeirogfredericks: know the link? that would be very useful for me
11:10gfrederickspandeiro: at this point I'm probably no better at googling it than you are
11:10gfredericksI'm 80% sure this was a linguistics textbook though
11:11pandeiroyeah not pulling up anything specific here
11:12gfredericksI wonder how infeasible it would be to compile the n^2 sized list of all combinations of native/foreign language
11:14maiothanks a lot for the check. I really appreciate it :) if you guys don't mind I mentioned you at the end of the post :)
11:14maio<gfredericks> probably replace "one" with "you" in the previous sentence
11:15maio"one use the same" or "one uses the same"? :)
11:15pandeirolatter
11:15gfrederickshuh? I was recommending changing "one" to "you" not the other way around
11:17pandeirogenerally "one" just wants to stay consistent so "you" don't confuse the reader
11:17gfredericks"one" isn't incorrect the way you had it, but it's quite formal and didn't match the "you" of the next sentences
11:17gfredericksI would not expect to see "one" used in a technical tutorial
11:18maioI see. fixed :)
11:18gfredericksat least not something aimed at english speakers. I have no idea about the optimal way to communicate in english between non-native speakers :)
11:20maioouch. now comes the fun part - I have to make it render properly at blogger :) http://blog.maio.cz/2013/04/heroku-build-css-using-compasssass-for.html
11:22gfrederickslol; your attribution sentence should be "for [the] grammar check"
11:22arkhI have a lazy-seq I'd like to make but I'm running up against a wall when trying to make it :/
11:23arkh,(let [y [{:a "a" :b "b"}]] (into [] [y]))
11:23clojurebot[[{:a "a", :b "b"}]]
11:23arkh,(let [y [{:a "a" :b "b"}]] (into (into [] [y]) [y]))
11:23clojurebot[[{:a "a", :b "b"}] [{:a "a", :b "b"}]]
11:24arkh(let [y [{:a "a" :b "b"}]] (into (into (into [] [y]) [y]) [y]))
11:24arkh,(let [y [{:a "a" :b "b"}]] (into (into (into [] [y]) [y]) [y]))
11:24clojurebot[[{:a "a", :b "b"}] [{:a "a", :b "b"}] [{:a "a", :b "b"}]]
11:24arkhThat's the cycle I'd like it to follow
11:27dnolenno more js* in core.cljs http://github.com/clojure/clojurescript/commit/7a89d636fb9426754248d54ac35d01bcd986eebd
11:28dnolen,(doc repeat)
11:28clojurebot"([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."
11:29dnolen,(take 3 (map #(repeat % {:a "a" :b "b"}) (rest (range))))
11:29clojurebot(({:a "a", :b "b"}) ({:a "a", :b "b"} {:a "a", :b "b"}) ({:a "a", :b "b"} {:a "a", :b "b"} {:a "a", :b "b"}))
11:29pandeirodnolen: that's sad, what is the reasoning?
11:29pandeiro(about js*)
11:30dnolenpandeiro: js* is and alway was an implementation detail, js* isn't likely to go anywhere because of interop reasons but there's no reason for it pollute core.cljs
11:30pandeiroi had hacked up a way to eval pure js via the cljs browser repl instead of trying to set up swank js -- will i still be able to do that somehow?
11:31pandeiroit's moved to another ns?
11:31gfredericksoh so it's still available for use (unofficially), but just not used by cljs itself?
11:31dnolenpandeiro: no js* is still available, the only thing is that core.cljs just doesn't refer to it directly anymore.
11:31dnolengfredericks: it is used but only via macros.
11:31pandeiroah ok great
11:33dnolenarkh: ^ not sure if have lazy seqs instead of vecs works for you
11:33gfredericksis my lib still the only option for cljs numerics? I don't know that anybody uses it and it's still surprising nothing else has popped up
11:34gfredericksI guess doubles are sufficient 99% of the time
11:34dnolengfredericks: I think people just have low expections on numerics when targeting JS
11:35arkhdnolen: it's tricky because the consumer of the lazy-seq is a datomic transact - I'd like to insert an arbitrary amount of test data as datoms
11:35arkhdnolen: tricky part being it must be vector of a map in a vector
11:36kawas44hello les gens
11:36dnolen,(take 3 (map #(into [] (repeat % {:a "a" :b "b"})) (rest (range))))
11:36clojurebot([{:a "a", :b "b"}] [{:a "a", :b "b"} {:a "a", :b "b"}] [{:a "a", :b "b"} {:a "a", :b "b"} {:a "a", :b "b"}])
11:36dnolenarkh: ^
11:36arkhdnolen: that's close! :)
11:38arkhit needs to be [ [{:foo nil}] [{:foo nil}] [{:foo nil}] ]
11:39arkhI'm close to either finishing it w/ lazy seq or, if not, then I'
11:39arkhI'll try repeat / map / something like you did
11:39dnolen,(into [] (take 3 (map #(into [] (repeat % {:foo nil})) (rest (range)))))
11:39clojurebot[[{:foo nil}] [{:foo nil} {:foo nil}] [{:foo nil} {:foo nil} {:foo nil}]]
11:39dnolenarkh: ^ or something else?
11:40arkhdnolen: unfortunately, slightly different than that
11:42arkh,(vec (repeat 3 {:foo nil}))
11:42clojurebot[{:foo nil} {:foo nil} {:foo nil}]
11:42arkh... that, but lazy
11:42arkher
11:43arkh,(vec (repeat 3 [{:foo nil}]))
11:43clojurebot[[{:foo nil}] [{:foo nil}] [{:foo nil}]]
11:43arkhsorry, _that_, but lazy
11:44pepijndevosvectors arn't lazy right...
11:44arkhpepijndevos: right
11:44pepijndevosso how can it be lazy?
11:45pepijndevos( just dropped in, did I miss something important?)
11:45arkhI was just showing what I'm shooting for as an example of the end result
11:45mynomotoGlenjamin: public log: http://clojure-log.n01se.net/
11:46arkhI'd like the above, but lazy. It's to use as dummy data for datomic. I'd like to generate an arbitrary amount so I can feed it into partition-all, pmap, etc.
11:46arkhI'll have to take off for a while - thanks dnolen for your time, though
11:47gfredericksarkh: if you just don't call vec, it's lazy
11:47gfredericksbecause repeat is lazy
11:47arkhgfredericks: that's true but I'd like to feed the above into partition-all
11:47gfredericksarkh: no reason you can't do that
11:47lmarburgercan anyone recommend a project that has a suite of good, idiomatic clojure unit tests? i'm new to clojure and some test examples would be a big help.
11:48arkhgfredericks: the consumer needs a lazy vector of map-in-a-vector
11:48Morgawrhi... I have a list of lambdas I need to execute in succession on a data structure, I'd usually do something like (-> x (f1) (f2) (f3)) but now I have [f1 f2 f3], which function do I need to use to run these lambdas in sequence?
11:49arkh[ [{:m v}] [{:m v}] ... ]
11:49gfredericksMorgawr: you want the result to be [(f1 x) (f2 x) (f3 x)]?
11:49Morgawrgfredericks: I want it to be (f3 (f2 (f1 x)))
11:49Morgawrlike with ->
11:49gfredericksarkh: what is a lazy vector? why can the consumer not have a regular sequence instead of a vector?
11:50gfredericksMorgawr: (reduce #(%1 %2) x [f1 f2 f3]) should work
11:50gfredericksunless I got the arguments backwards
11:50AimHereI'd say %2 %1
11:50arkhgfredericks: excellent question ... I bet I'm messing up there ...
11:50Morgawrgfredericks & AimHere, I'll try, thanks
11:51arkhgfredericks: I'll have to try that later tho - thank you
11:51gfrederickssure
11:57gfredericksmaio: woah look at that dynamic terminal thing on your previous blog
12:02pandeiroanyone know where in commons-fileupload FileItemStream's methods are defined (not just the interface)
12:04pandeiroi'm trying to track down why the encoding of the multipart is UTF-8 but the filename itself doesn't decode non-ascii chars properly..
12:10sveduboisI am trying to translate this javascript to clojurescript:
12:10sveduboissliceX.container = 'sliceX';
12:10sveduboisI try this:
12:10svedubois(.-container sliceX "sliceX")
12:10sveduboisAnd I get this error:
12:10sveduboisjava.lang.Error: Unknown dot form of (. sliceX -container ("sliceX")) with classification [:cljs.analyzer/expr :cljs.analyzer/property :cljs.analyzer/expr]
12:10sveduboisAnd if I try another one:
12:10svedubois(.container sliceX "sliceX")
12:10sveduboisI get another error:
12:10svedubois"Error evaluating:" (.container sliceX "sliceX") :as "xtk.sliceX.container(\"sliceX\");\n"
12:10gfredericksyou need set!
12:10svedubois#<TypeError: Property 'container' of object #<xg> is not a function>
12:10sveduboisWhat I am doing wrong?
12:10gfredericks(set! (.-container sliceX) "sliceX") I think
12:13svedubois"Error evaluating:" (set! (.-container sliceX) "sliceX") :as "xtk.sliceX.container = \"sliceX\";\n"
12:13svedubois#<Error: Could not find the given container.>
12:14svedubois(set! (.container sliceX) "sliceX")
12:14sveduboisjava.lang.AssertionError: Assert failed: set! target must be a field or a symbol naming a var
12:15gfredericksyour namespaces is called xtk?
12:15sveduboisYes
12:16svedubois(.-container sliceX)
12:16svedubois#<[object HTMLBodyElement]>
12:16gfredericksit looks like it's compiling to what you want then?
12:16gfredericksxtk.sliceX.container = "sliceX"
12:16gfredericksis there some sort of setter handler on this library? I don't know how fully JS supports that stuff
12:16gfrederickshaven't been paying attention
12:24sveduboisIt seems that it's compiling to "xtk.sliceX.container = \"sliceX\";, but I am not able to set the value "sliceX": #<Error: Could not find the given container.
12:24sveduboisAnd I don't know why?
12:25gfredericksmy guess is you'd get the same error if you were running the JS directly; i.e., it's not a clojurescript issue
12:25gfredericksyou can try js* to verify that
12:25gfredericks(js* "xtk.sliceX.container = \"sliceX\")
12:25gfrederickswith a closing quote at the end
12:32sveduboisYes I obtain the same error with: (js* "xtk.sliceX.container = \"sliceX\";\n")
12:33sveduboisDo you think it is a JS support problem?
12:33gfrederickswell I can't imagine an assignment failing in that way unless that new javascript setter method thing is going on
12:33gfrederickssuch that arbitrary code is being executed by the assignment
12:42sveduboisThe code that I am trying to translate to clojurescript is here: http://jsfiddle.net/gh/get/toolkit/edge/xtk/lessons/tree/master/13/#run
12:43sveduboisThe line 23 is: sliceX.container = 'sliceX';
12:43gfrederickslike I said, I think you've translated it correctly, and your problem is something unrelated to clojurescript
12:52honkfestivalin ClojureScript: Up and Running, I'm having trouble getting the example running at the top of page 11
12:52honkfestivalhttps://gist.github.com/anonymous/4982cb289a10422cde01
12:56honkfestivalhttps://gist.github.com/anonymous/28368bf67d0b37d7f5bf project.clj
12:56arkxhonkfestival: :pretty-print true
12:57honkfestivalugh of course
12:57arkxAlso, you don't need the commas. :)
12:58honkfestivalI just pasted the text from the cljsbuild plugin
12:58honkfestivalI should have looked it over a bit first
12:59honkfestivalwoot, thanks arkx
13:10gfrederickshuh; I wonder how honeysql compares to the new java.jdbc API
13:33sveduboisIs this js->cljs translation correct?
13:33sveduboisvar opacityController = volumegui.add(volume, 'opacity', 0, 1).listen();
13:33svedubois(def opacityController (-> (set! (.-add volumegui) [volume "opacity"]) .-listen))
13:34gfredericksno
13:34gfredericks(-> volumegui (.add volume "opacity" 0 1) (.listen))
13:34gfredericksthe .-foo syntax is only for when you're referencing or setting attributes rather than calling methods
13:41svedubois#<TypeError: Object Volume has no method 'add'>
13:41sveduboisTypeError: Object Volume has no method 'add'
13:42gfrederickswell if it has no method called 'add' I wouldn't expect the JS you gave to work either
14:20tomojdoes c.c.l.unifier not work with nominal ties? https://www.refheap.com/paste/5a68e6676060a41c464f02e5b
14:23tomojoh, d'oh
14:44danneuMy attempt writing a multithreaded app is built around (pmap work (repeatedly gen-random-str)). the work fn does a long computation and returns a string or nil.
14:45danneuI'd like to consume the lazy sequence and append any strings to a file. Is there any way to consume a pmaps sequence without getting blocked waiting for the next element?
14:47danneuIn other words I'd like to consume any of the pmap threads that finish since one can take 100 seconds while another takes 1 second.
14:48ucb_homedanneu: I'd use a combination of promise, future and deliver
14:48ucb_homedanneu: I actually wrote a simple thing that does that (modulo the re-ordering of realized? promises)
14:49ucb_homedanneu: the principle is like this: for each item in your seq, wrap that in a promise which you will deliver in a future (that's where you get your multi-threading)
14:49ucb_homedanneu: it's crude, but it works
14:53gfrederickswouldn't a queue be sensible there?
14:53gfrederickswith maybe some dedicated worker threads?
15:02sveduboisIs this JS to CLJS correct?
15:02sveduboisvolume.dimensions[2] - 1
15:02svedubois(- (nth (.-dimensions volume) 2) 1)
15:04ucbgfredericks: that would be the right thing to do; yes
15:05SegFaultAXsvedubois: dec might be nicer.
15:11dnolensvedubois: (dec (aget (.-dimensions volume) 2))
15:24goraciohey, anyone used monger ? there are couple of questions )
15:25sveduboisHow I can translate this JS to CLJS? https://www.refheap.com/paste/14018
15:26jrheardhi all! where i work, we've got a brownbag group going through "clojure programming", and this week it's my turn to present on multimethods. i've read the chapter know what they are and how to use 'em, but i'm trying to find good examples of their use in standard clojure libraries on github and haven't found anything yet.
15:26jrhearddoes anyone have a favorite code snippet / library that shows off the power/usefulness of multimethods?
15:26jrheard(i'm @jrheard on twitter if any idlers read the scrollback later on and have a good answer but i'm not around) thanks!
15:31weavejesterDoes anyone have any good suggestions for a the name of a protocol that defines a system that self-updates
15:32Glenjaminupdatotron
15:32weavejesterHaha
15:33weavejesterI guess I could just call it "system" perhaps
15:33goraciodamn only questions here and no answers ))
15:33ivanclojurebot: anyone?
15:33clojurebotJust 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 ..."
15:34Glenjaminoh, you mean a clojure protocol declaration, rather than a communication protocol
15:34goraciowhere are any clojure hackers )
15:34gfredericksjrheard: multimethods are one of the features with a large talk-to-use ratio
15:34jrheardheh
15:34gfrederickslike refs
15:34Glenjaminweavejester: SelfUpdatable ?
15:34gfredericksprobably a lot of their use cases have been superseded by protocols
15:34weavejesterGlenjamin: Yeah, it'll have functions: deref, amend!, and update!
15:34jrheardgfredericks: that is excellent context to have
15:34weavejesterI'm using it to interface to a physics engine
15:35weavejesterBut it essentially defines any system with internal rules
15:35GlenjaminSelfContained ?
15:35gfredericksjrheard: I think they would be very natural to use if you wanted the inheritance mechanism
15:35gfredericksbut again I've never even seen anybody use that
15:36jrheardnor i, although i've probably read less clojure source than you have
15:36weavejesterSelfContained… Not really very catchy :)
15:36danneuthere are various species that churn 100% of their internals.
15:36weavejesterBut thanks for the suggestion
15:36danneumaybe there's some catchy lingo on relates wiki pages
15:36GlenjaminBubble
15:36danneuperhaps something hard to spell too, like 'anenome'
15:37jrheardis there any way i could have figured this out myself? e.g. are there any mailing list threads to this effect? or is this just the general feeling i'll also end up with after programming in clojure for a while longer?
15:37weavejesterGlenjamin: Yeah, Bubble might do it. Or PocketUniverse. Or just Universe.
15:38dnolenwow wacky Closure dead code elimination issue finally isolated related to constructors that's been plaguing CLJS
15:38dnolenhttp://dev.clojure.org/jira/browse/CLJS-500
15:38weavejesterOr maybe I should call it "Resource" or something.
15:39goracioso about monger (monger/find "documents" {:first_name "Ringo"}) is this request sync ? so it waits for response ?
15:39gfredericksjrheard: not that I know of
15:39jrheardglad i asked then :) thanks for the help!
15:39gfredericksjrheard: except asking in #clojure :)
15:39jrheard:D
15:41dnolenerg, or not ...
15:42sveduboisIs this JS->CLJS correct? From https://www.refheap.com/paste/14018 to this https://www.refheap.com/paste/14019
15:42goracioany thoughts ?
15:44kencauseyHave I been in detention long enough?
15:44weavejesterAutoverse perhaps...
15:45jrheardsvedubois: i don't think that's right
15:45jrheardyou probably want when-not instead of if
15:46jrheardif i'm reading this right, the doto will be evaluated if meshWasLoaded is false, and if meshWasLoaded is true the set! will be evaluated
15:46jrheardwhich doesn't seem like what you want
15:46Glenjaminoh crap, hiccup doesn't auto escape
15:48Glenjaminnow i need to go find all of the bits of user input :(
15:49xeqiGlenjamin: nope, it doesn't. possibly relevant: https://groups.google.com/d/msg/ring-clojure/P2Jrk6SyYCo/q20vdOJsnpgJ
15:50Glenjamini quite like the whole escaped and unescaped strings are different types approach
15:50Glenjamini wonder if that's doable
15:50sveduboisWhat about the first line onChange, is it necessary to use set!? Is there any other way? (set! (.-onChange meshVisibleController)
15:51Glenjaminbeen meaning to look at switching to laser, but been a bit lazy so far
15:51jrheardGlenjamin: a la https://pypi.python.org/pypi/MarkupSafe in python
15:51jrheardwe use that at work and like it very much
15:51jrheardsvedubois: i actually have never touched cljs so i have no idea :( sorry!
15:52Glenjaminjrheard: yeah, that's the idea
15:52Glenjaminah, thats exactly what this safe hiccup thing does
15:53weavejesterAh, I think I'll call the protocol Autonomy
15:54Glenjaminheh, 2 hard problems and all that...
15:56Bronsakencausey: enough that nobody remembers anymore what happened :)
15:56Glenjaminxeqi: looks good - do you know why String's to-str does (escape-html (raw s)) instead of just (escape-html) ?
15:57Glenjaminoh crap, i just realised i forgot to do CSRF protection too
15:57goracioso about monger (monger/find "documents" {:first_name "Ringo"}) is this request sync ? so it waits for response ?
15:58xeqiGlenjamin: because it would infinite loop: to-str -> escape-html -> as-str -> to-str -> escape-html ....
15:59xeqiso marking the string as raw it goes to-str -> escape-html -> as-str -> just return the string
15:59xeqiand then escapes it
16:00Glenjaminah, i missed that bit in as-str
16:00Glenjaminthe escaping is typed to String, instead of Object - so anything string-like would be left raw?
16:00kencauseyBronsa: if only, but thanks
16:02xeqiGlenjamin: it extends more types on https://github.com/weavejester/hiccup/blob/master/src/hiccup/util.clj#L34
16:02xeqiI'm not sure I understand your question
16:02Glenjaminsafe-hiccup defines ToString on String to escape
16:03Glenjaminbut hiccup defines ToString on Object to just (str), so if you use a non-string Object it'd not get escaped?
16:04xeqi... I think thats correct
16:05Glenjamincool, i think i follow this
16:05Glenjaminalthough latest hiccup has an HtmlRenderer protocol in compiler.clj
16:06xeqihmm, that might be a better place
16:07xeqiI fully admit this is a hacky thing to do
16:07Glenjaminyeah, i'll give it a go
16:07Glenjaminweavejester: is there any way that html-escape-by-default could get into hiccup core, or would that be a too big of a BC break?
16:07xeqiI'd be happy to see you pull something similar into a well tested library :p
16:08xeqiprevious discussions say its on the roadmap for hiccup 2, since it breaks semver
16:08weavejesterGlenjamin: It's been on the cards for a while, it just means a substantial redesign of the library.
16:08weavejesterI've got some code in a branch, but never actually finished it.
16:09Glenjaminis it really that big? presumably most internal functions return a seq?
16:09weavejesterIt would also mean losing some of the speed Hiccup current has.
16:09weavejesterWell, currently Hiccup functions return strings
16:09Glenjaminah
16:09weavejesterThat would need to change to return DOMs of some type.
16:09weavejesterLike maybe clojure.xml-style
16:09Glenjamini've been making my helper functions return (list ..stuff..) because i assumed it auto escaped
16:10weavejesterExcept you might also want to encode comments and so forth, I'm not sure.
16:10Glenjaminand just letting it resolve the vector at the end
16:10sveduboisDo you know any examples written in CLJS to use methods like:
16:10sveduboisrender.onShowtime = function() {}
16:10sveduboisOr like onShowtime, onChange, onRender, onClick, etc.
16:10sveduboisThe only translation thar I have found is this one, and I am not sure if it is correct:
16:10svedubois(set! (.-onShowtime render) ...
16:13gfrederickssvedubois: yes that is how to set a property. the function(){} part would be (fn [] ...)
16:19gfredericksis jayq still the easiest way to do ajax in cljs?
16:28sveduboisWhen I useIn ClojureScript, how I can use this method (onShowtime) that allows to execute the body after all files were fully loaded and just before the first rendering attempt?
16:28sveduboisrender.onShowtime = function() {body ...}
16:29danneuucb: is that promise/future/deliver code in arm's reach? if so i'd love to see it
16:57Glenjaminwould a CSRF protection lib that didn't use sessions be useful to release?
16:59Glenjamini'm writing something modelled on ring-anti-forgery, but my app currently avoids sessions and i'm keen to keep that
16:59Glenjaminunsure whether it'd be any use to people other than me
17:00xeqihow would that work? static key on startup?
17:00sveduboisIn clojure, how can I wait until one statement (for example, load a large file) is finished before continuing to the next statement?
17:02sveduboisFor example, if I want to read a pdf, I would like to wait until the file is completed before execute the read function.
17:04Glenjaminsvedubois: that's what usually happens, it'll depend on the function you call
17:04Glenjaminxeqi: just straight cookies
17:05kencauseylein on windows doesn't seem to be seeing my plugin settings in .lein/profile.clj. Note that I'm on Win7. Am I missing something? For example: {:user {:plugins [[lein-pprint "1.1.1"] [lein-midje "3.0.1"]]}} Yet lein pprint returns 'not a task'.
17:05Bronsasvedubois: clojure is generally a synchronous language
17:06sveduboisI am using JS external libraries to load a volume of images (a big one), when I execute the level window it tells me infinite, but when I rexecute the same level window some seconds after it gives me the true values.
17:06sveduboisSo in this case it doesn't wait.
17:07Bronsawait are you talking about clojue or clojurescript?
17:07sveduboisClojureScript
17:07Bronsaoh.
17:07sveduboisI have to use something like realized?
17:07Bronsathen I cannot help you, sorry
17:07xeqikencausey: can you rename the file .lein/profiles.clj, with an s
17:08kencausey*sigh*
17:08kencauseythanks
17:09kencauseyNot my week for seeing the obvious it seems.
17:11stianI'm trying to use this Java library in my Clojure app but I'm not sure how to import it. https://github.com/tulskiy/jkeymaster
17:11stianJust adding [com.github.tulskiy/jkeymaster "1.1"] in project.clj and run lein deps seemed to work, but I can't translate this to Clojure, and not sure what namespace to import Provider provider = Provider.getCurrentProvider();
17:11stianprovider.init();
17:16raekstian: the package name is usually easy to discover from the Javadoc (if there is one)
17:16Glenjaminjava devs assuming you're using an IDE :)
17:17raekstian: in this case Provider is really com.tulskiy.keymaster.common.Provider
17:18raek(ns ... (:import (com.tulskiy.keymaster.common Provider)))
17:18stianso I do (import [com.tulskiy.keymaster]) or [com.tulskiy.keymaster.common.Provider])? Sorry - no experience with java
17:18raekstian: you cant do the equivalent of "import com.tulskiy.keymaster.common.*;" in clojure. this is considered a feature.
17:19raek(com.tulskiy.keymaster.common Provider) and com.tulskiy.keymaster.common.Provider means the same for :import
17:19raekbut with the first one you can list multiple classes
17:20raekstian: if there is not javadoc you can figure out the full name of the class from the filename of its .java file
17:24stianrack: Thanks a lot! So the REPL gives me this list of functions (turns out cmd line REPL was much more helpful than Sublime REPL) https://gist.github.com/houshuang/5474778 - now how do I rewrite "Provider provider = Provider.getCurrentProvider();" from the GH docs to Clj? I tried (new com.tulskiy.keymaster.common.Provider.getCurrentProvider)
17:25hadronzooIs it possible to add new fields to a type previously defined with deftype?
17:27raekstian: (let [provider (Provider/getCurrentProvider)] ...)
17:28raekstatic method calls are written like as if the method of the class was a function in a namespace
17:29stianraek: Weird, When I type in (Provider/) it autocompletes the getCurrentProvider, but when I try to execute (Provider/getCurrentProvider) just to see what it returns, it says CompilerException java.lang.NoSuchFieldException: getCurrentProvider
17:29raekstian: did you have the paretheses there when you tried that?
17:30raek(Foo/bar) and Foo/bar are not the same things (and from the error message it sounds like you try the latter)
17:30stianraek: https://gist.github.com/houshuang/5474778
17:31raekstian: did you import Provider in the test namespace? (import '(com.tulskiy.keymaster.common Provider))
17:32raekthe (:import ...) form is only used inside (ns ...) in source files
17:32stianyes I did (ns test (:import (com.tulskiy.keymaster.common Provider)))
17:32raekok, so evaluating just Provider works? (it should just echo the class name back)
17:33stianYes
17:33stianAnd keyboard completion shows all the methods
17:33stianProvider without parenthesis shows com.tulskiy.keymaster.common.Provider
17:33raekweitd
17:33raek*weird
17:34stianI tried the other function available (Provider/logger) and that worked fine, so maybe there's a bug in the library or something
17:34raekstian: the documentation seems to be wrong.
17:34raekstian: https://github.com/tulskiy/jkeymaster/blob/master/src/main/java/com/tulskiy/keymaster/common/Provider.java#L50
17:34raekstian: the getCurrentProvider method should take an argument
17:36stianraek: Yes! I tried (Provider/getCurrentProvider true) and it started a clojure.main icon on the task bar etc. Tack så jättemycke (jag är norrbagge)
17:36raekperhaps you should open an issue and tell the authors that the gh page example is broken?
17:36stianraek: will do
17:36raekstian: haha. det var så lite. (jag är svenne)
17:40sveduboisDoes it work Thread/sleep in CLJS?
17:41hadronzooIf it's not possible to add new fields to a type defined using deftype, would it be reasonable to use extend-type to add a new method that references a closure?
17:42amalloysvedubois: does Thread.sleep() work in JS?
17:42sveduboisno
17:43amalloyhadronzoo: no. if you need to attach data to an object that doesn't "understand" the data you want, that's what metadata is for
17:45hadronzooamalloy: Thanks, that makes sense. I want to memoize an expensive calculation on types I don't control.
17:46amalloymakes a little sense, i guess, although it's not clear to me why you can't just use memoize
17:49hadronzooamalloy: Ha, well that would be a lot easier -- just use memoize in the protocol implementation. Thanks.
17:55Glenjaminarohner: yo, do you have any plans to expand bond?
17:55arohnerGlenjamin: I don't have any pressing need. what are you interested in?
17:57Glenjaminthere's that PR which lets you define values on stubs, thinking about allowing defining fake implementations - also some handy functions for grabbing info out of calls
17:58Glenjamin(bond/called fn) => num, (bond/called-once? fn) => boolean etc
17:58arohnerI like called, called-once?
17:58arohnerI forgot about the PR
17:59Glenjamincalled-with? could be handy too, but potentially quite complex
18:04Glenjaminbut in general, is the idea to keep bond small and simple, or try and provide lots of utility for spies/stubs ?
18:04Glenjaminif the former, I might spin off a fork for the latter :)
18:07arohnerI prefer small and simple
18:07arohneryou might say bond is a reaction to midje's bloated mess
18:09Glenjaminfair enough, i'm seeing a fair bit of repetition in my test code around spies, so will probably pull that out into a higher level lib
18:17gfredericksa spies lib?
18:17gfredericksI've been wanting one of those
18:21danneu1i'm grappling with my first multi-threaded app and tried to organize my questions on /r/clojure if anyone has a moment: http://www.reddit.com/r/Clojure/comments/1d8erc/my_first_attempt_at_a_multithreaded_program_am_i/
18:23arohnergfredericks: github.com/circleci/bond
18:26gfredericksdanneu1: what went wrong with the agents approach
18:28gfredericksarohner: the example there is really weird
18:28arohnergfredericks: ah, good point
18:29arohnerfixed
18:30arohneroh, I remember the point I was trying to convey
18:30gfredericksarohner: this is your lib?
18:30arohneryes
18:31arohnergfredericks: how about now?
18:31gfredericksyeah that's better
18:32gfrederickshmm
18:32gfrederickswhen I took a stab at something like this I also had a function for creating a spy without vars
18:33gfredericksthat wouldn't be hard to expose, right?
18:35arohnergfredericks: see bond.james/spy
18:36gfrederickspardon me for not even looking :)
18:36Glenjaminhave you ever looked at http://sinonjs.org/ ? it's full of spy goodies for javascript - that's the sort of stuff i'd be keen to build on top of bond
18:37danneu1gfredericks: it maxed out my laptop's cores but only sat at 20% cpu in a single thread when i moved my jar to my linode box. having no idea how to debug that, i thought i'd try another implementation and see how it fares. and i considered that i was just doing it the wrong way
18:38gfredericksdanneu1: you started a bunch of threads manually?
18:39gfrederickswhere each thread was in an infinite loop?
18:39danneu1gfredericks: originally i had just (defn -main [& args] (pmap work (repeatedly gen-seed))), so i considered that pmap might not work how i think unless something is actually consuming the pmap sequence.
18:40gfrederickswell right you'll get a few of them going and then nothing
18:41Glenjamincan you just throw doseq on the front?
18:41Glenjaminor is that a bad idea?
18:41gfredericksdanneu1: but your agent idea -- that wasn't pmap right? with the agent did you start your own threads?
18:42danneu1Glenjamin: that's what i tried, but my problem is that worker runtime varies considerably an doseq will always wait on the next element even tho other elements are done and ready to by realized
18:43Glenjaminyou probably want a slightly more managed pool i guess? queue + worker model
18:43danneu1gfredericks: I was using pmap this whole time so far. here's my first attempt: https://gist.github.com/danneu/820c024cb62859371f4c
18:43danneu1(developed on a small screen)
18:44gfredericksah
18:44gfredericksyeah definitely stop using pmap
18:44danneu1gfredericks: but wouldnt that code there still at least fill a threadpool?
18:44gfredericksno because of the problems with pmap you've mentioned
18:45gfredericksyou could use the agent and just start your own threads
18:46danneu1gfredericks: ah, that code launches two threads
18:46gfredericksin main do a (dotimes [_ 8] (.start (Thread. #(while true (work (gen-seed))))))
18:46gfredericksand there you have 8 workers running and your agent spitting things to the file
18:47gfredericksyou could do the spitting in the agent function instead of a watcher which would be simpler, but should work either way
18:51danneu1Thanks for these ideas
18:59danneu1If (pmap mycomputation coll) starts only two threads without anything consuming the sequence, how come (map println (pmap mycomputation coll)) will fill the cores?
19:00gfredericksyou're doing these in main?
19:00danneu1yes
19:02gfredericksrunning it with `lein run` or an executable jar?
19:02danneu1lein run
19:02danneu1well, also a jar.
19:03gfrederickswhen you say "will fill the cores" do you mean it runs forever or just till it gets a couple answers?
19:06danneu1Let me actually re-test my assumption real quick
19:06Glenjaminhow do i get an unqualified symbol in a macro?
19:07Glenjaminaha, ~'
19:09danneu1gfredericks: Okay, just (pmap myfunc coll) enqueues two jobs at once. they finish. then nothing forever since it's not being consumed. got that. (map println (pmap myfunc coll)) enqueues coreCount+2 immediately, but won't enqueue more until the head of the seq is realized
19:10danneu1i get it now
19:36danneu1Is the most terse way to update an agent: (send myagent (fn [_] 42))
19:37danneu1Nevermind. I can extract that function into the fn you were talking about — `spit`ing my file within it. I'll stop rubber ducking now. Thanks again
20:02Glenjaminis the equivalent of the traditional FP 'zip' in clojure just (partial map list) ?
20:03danneu1zipmap?
20:03gfredericksyep
20:03danneu1oh
20:03amalloy~zip
20:03clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
20:04Glenjaminok, cool
20:04gfredericks~clojure
20:04clojurebotclojure is not scheme
20:05gfredericksoh what if the inference engine knew about negation
20:05gfredericks~scheme
20:05clojurebotscheme is Scheme is like a ball of snow. You can add any amount of snow to it and it still looks like snow. Moreover, snow is cleaner than mud.
20:05Glenjaminnow to see if i can understand zippers...
20:06Glenjamini suspect if it was call clojure.tree, i'd have figured out what was going on a bit sooner
20:07mthvedt~lisp
20:07clojurebot"if you never learnt Lisp, then you never learned to program" -- some rant on some blog somewhere
20:07mthvedt~haskell
20:07clojurebot"you have to see features like that in the context of Haskell's community, which is something like Perl's community in the garden of Eden: detached from all shame or need to do any work." -- ayrnieu
20:08Glenjamin~python
20:08clojurebotpython is ugly
20:08nightfly__~common-lisp
20:08clojurebotGabh mo leithscéal?
20:08Glenjaminheh
20:08mthvedt~java
20:08clojurebot
20:08mthvedt~cobol
20:08clojurebotThe use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. -- Dijkstra
20:08danneu1~ruby
20:08clojurebotChunky bacon!
20:08Glenjamin~dijkstra
20:08clojurebotHuh?
20:08honkfestival~factor
20:08clojurebotbus factor is best if you try not to think about it. (https://github.com/clojure/clojure/graphs/contributors)
20:09gfredericks~javascript
20:09clojurebotjavascript is beautiful, you're just too conformist to appreciate its quirks: http://tinyurl.com/7j3k86p
20:09mthvedt~racket
20:09clojurebotCool story bro.
20:09mthvedt~ocaml
20:09clojurebotExcuse me?
20:09Glenjaminhrm, that bus factor this is somewhat alarming :D
20:09honkfestival~forth
20:09clojurebotexcusez-moi
20:10mthvedt~c
20:13stian_Could anyone tell me why I keep getting Don't know how to create ISeq from: clojure.lang.Symbol on this ns macro https://gist.github.com/5475274?
20:16Glenjaminyou usually get that when you pass a single symbol into :refer
20:16Glenjaminbut that paste looks right to me
20:16gfredericksthis isn't clojurescript is it?
20:18stian_gfredericks: No, I just run it with lein run.
20:22gfrederickstry `lein clean`?
20:22gfredericksare you sure it's not the ns form in your other namespace?
20:25stian_gfredericks: Ah! You are completely right! Argh, better Clojure error messages could have saved me a lot of time, I didn't even consider looking in that other file.
20:26gfredericksphew
20:26gfredericksclojure still works
20:28stian_gfredericks: Haha! :)
20:29stian_I'm trying to wrap a Java API in Clojure. I use this function to return a listener - any way I can make it work whether the function f accepts an argument (hotKey) or not? (Ie. the final part should be (f hotKey) or (f) depending on f's arity
20:29stian_(defn conv-listener [f](proxy [com.tulskiy.keymaster.common.HotKeyListener] [] (onHotKey [hotKey] (f))))
20:31Glenjaminyou might want to (:import [com.tulskiy.keymaster.common HotKeyListener]) in your ns, to make that a bit shorter :)
20:33Glenjamini think this link does what you're after http://clojuredocs.org/clojure_core/clojure.core/proxy#example_1026
20:34stian_Glenjamin: Thanks, will have to chew on that a bit.
20:35gfredericksif you're trying to detect the arity of a function, that's not generally possible
20:37gfredericksif you could...that would lead to some weird-ass APIs
20:37gfredericksI wonder if that's why rich didn't have defn put metadata on functions...for our own good.
20:43amalloywell, the way things are now you can't tell what the supported arities of a function are. i wonder why, back at the Beginning, rich didn't add something like boolean IFn.supportsArity(int numArgs)
20:50amalloyunlike the metadata approach, it would only cost a pointer per function instance, if implemented carefully
21:12mthvedtamalloy: wouldn't it cost some fixnum per function class, not instance?
21:13mthvedtoh that's
21:13mthvedtold
21:17amalloygood point, mthvedt. it might be easier to implement storing it on instances, but it ought to work on classes
21:25danneu1jvisualvm is amazing. never profiled anything in my life but this was really easy
21:28gfredericksamalloy: curious what the use cases for supportsArity would be
21:28gfredericksthe non-evil ones I mean
21:29stianWould love some feedback on what's an idiomatic design of a Clojure API http://codereview.stackexchange.com/questions/25575/api-wrapper-for-clojure-idiomatic-style-for-libraries
21:32stiandanneul: Very cool, just read http://www.fatvat.co.uk/2009/05/jvisualvm-and-clojure.html. Looks quite useful
21:44gfredericksguys I kind of like chickens
22:05andyfingerhutgfredericks: It has been 22 minutes, and apparently everyone is still stunned into silence. :-)
22:29gfredericksI tend to have that effect on the channel
22:40gfredericksha I typed "lein ring" into google and it autocompleted to "that's not a task"
22:55howdynihaowhat do you guys feel clojure excels at ?
23:05danneu1howdynihao: parens
23:05danneu1u?
23:11technomancyclojure is best at making the shortcomings of other languages painfully obvious
23:20gfrederickslein bundle install rubygems
23:43shelduckshello. has SLIME support for clojure been dropped? what mode is there instead?
23:43gfredericksnrepl
23:46shelducksthanks, I'll give it a try
23:52danneu(.start (Thread. (println "hello"))) doesn't output anything for me in nrepl.
23:53danneuso i've to use lein run to test my threaded stuff
23:53danneugrueling really
23:53danneuevery day is another hardship for me