#clojure log - Apr 27 2013

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 andyfingerhut: So what are you comparing the 288 msec Clojure run time against?

0:00 echo-area: andyfingerhut: http://pastebin.com/uxPNyFwg

0:00 this

0:01 (time (p1)) against the timed iteration

0:01 As I don't see much difference in the assemble code, I can't explain the slowness here

0:02 andyfingerhut: I see 0.07user time. That is not 1/100 of 288 msec, is it?

0:02 echo-area: It's 288 msec vs 10 msec

0:02 andyfingerhut: sorry, I meant 10x.

0:03 echo-area: ~28.8x, IMO

0:03 clojurebot: Excuse me?

0:03 andyfingerhut: With the Java program you can start and finish a JVM in 10 msec?

0:03 amalloy: andyfingerhut: for a JVM that just starts up, does nothing, and then closes, that's pretty reasonable

0:03 echo-area: No, please see the java program below. 10826513 nanoseconds is ~11 msec

0:04 and it is the time of the whole iteration, not the java process

0:04 andyfingerhut: Sorry, finally catching up here.

0:06 echo-area: Except the bigger minor pagefaults in the clojure run, I don't see anything else slowing down it. Do you?

0:06 And how would you explain it?

0:06 *bigger number of

0:13 Or could it be that the VM is loading code?

0:25 andyfingerhut: I 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.

0:28 echo-area: The Clojure version becomes ~2x slower and the Java version ~5x slower. What does this imply?

0:30 andyfingerhut: Well, the Clojure is getting better relative to the Java performance, for one :-)

0:31 Exactly 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.

0:32 The 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.

0:34 echo-area: Looking at it right now, thanks

0:37 andyfingerhut: You might also see something interesting if you try (dotimes [j 10] (time (p1)))

0:44 mindbender1: what's the idiomatic way of throwing error in cljs

0:46 echo-area: andyfingerhut: `criterium' reported the same level of execution time. I'll look into it to seek for an explaination. Thanks.

1:28 n_b: people who write parsers with regular expressions :(

1:28 Ack, wrong window.

1:29 amalloy: there's no window in which it's wrong to point out that regexes don't parse

1:31 n_b: In 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.

1:40 callen: nothing like playing tech support for random entrepeneurs on Facebook.

2:26 isson0926: hello. i have a question. (i am not good to speak english)

2:28 haskell's recursive function(not tail recursion) do not occur stack overflow. but common lisp do. does clojure do stack overflow?

2:30 brainproxy: isson0926: owing to the way the jvm works, clojure can't automatically optimize in the way that haskell does

2:31 isson0926: thanks . brainproxy :-)

2:31 amalloy: haskell's functions can stackoverflow too

2:31 brainproxy: however, clojure provides some facilities so you can have recursive calls that don't blow the stack

2:31 e.g. loop and recur

2:32 isson0926: http://clojuredocs.org/clojure_core/clojure.core/loop

2:32 http://clojure.org/special_forms#recur

2:33 isson0926: good doc. thanks brainproxy.

2:33 amalloy , when haskell's functons can stackoverlow?

2:35 amalloy: $heval foldr (+) 0 [1..1000000]

2:35 lazybot: ⇒ *Exception: stack overflow

2:36 amalloy: strict 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

2:36 isson0926: that's righit. so it comes strict version foldr.

2:37 thanks amally.

2:40 amalloy: if 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

2:45 isson0926: i 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 .

2:45 adu: amalloy: I <3 tail-calls

2:45 isson0926: then you might try SBCL

2:45 isson0926: but as i know , sheme is slow (but common lisp is fast). is write?

2:45 is right?

2:45 adu: SBCL beats some other languages on the computer language shootout

2:47 isson0926: but sbcl and common lisp do not abstract list like clojure, haskell, it represent points (like cons..)

2:47 points -> pointers

2:47 i hate it.

2:49 adu: isson0926: for example, in http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=spectralnorm&lang=all&data=u64q

2:49 SBCL is faster than Java, C#, and Haskell

2:50 Raynes: Combined!

2:50 In quicksand!

2:52 isson0926: good. but i cannot understand the result. i know common lisp using hint for type inference. but it is high abstraction language. surprise result.

2:53 surprise -> surprising result.

3:15 corpsan: i 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.

3:15 possible?

6:25 nmadan: if I have an int-array, is the nth function still going to be O(n)?

6:27 morphling: nmadan: nth is O(1) for arrays

8:10 jjttjj: anyone know of any good examples/source code of using agents to process message queues? (besides the one in Clojure Programming)

8:12 silasdavis: how can I get the fully qualified symbol for '+'

8:12 jjttjj: ,`+

8:12 clojurebot: clojure.core/+

8:12 silasdavis: oh of course, thanks

8:12 jjttjj: no prob

8:31 varadharajan: I'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.

8:33 Bronsa: varadharajan: you're calling the set, not only creating it

8:34 ((fn [x y] (hash-set x y)) 1 2) vs ((fn [x y ] (#{x y})) 1 2)

8:37 varadharajan: Bronsa: Got it. Thanks :)

8:40 gfredericks: that's a limitation of the #() syntax -- you can't give a literal to return, you have to call something

8:41 Bronsa: well

8:42 you can still use the clojure.core functions

8:42 ,(map hash-set [1 2 3] [2 3 4])

8:42 clojurebot: (#{1 2} #{2 3} #{3 4})

8:43 varadharajan: gfredericks: Yeah. I was not aware of that limitation and hence messed it up

8:43 gfredericks: it seems to trip people up quite commonly

8:43 Bronsa: I would not call it a "limitation" though

8:43 gfredericks: no?

8:43 clojurebot: no is tufflax: there was a question somewhere in there, the answer

8:44 Bronsa: gfredericks: it's how #() works

8:44 how could it work otherwise?

8:44 special-casing on collection literals?

8:44 gfredericks: no, you're right that there's no obvious way

8:45 but if there _were_, there'd be no reason not to add it

8:45 I think "limitation" is a word most people would be comfortable with there

8:45 it'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

8:46 I certainly don't mean to imply that #() is poorly designed or should be changed

8:46 Bronsa: well. 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)

8:46 gfredericks: true

8:46 Bronsa: actually, every literal probably

8:46 gfredericks: I wouldn't want that, but it does sound like it would work

8:54 Glenjamin: ,(#(-> {:a %}) 1)

8:54 clojurebot: {:a 1}

8:54 Glenjamin: misusing -> a bit, but keeps it fairly readable

9:16 gfredericks: that's clever

9:16 I wonder if the swearjure guys know about that

9:18 we were doing nastier stuff to get the same effect

9:18 hyPiRion: Glenjamin: it's the same as using "do", isn't it

9:18 ,(#(do {:a %}) 1)

9:18 clojurebot: {:a 1}

9:18 Glenjamin: yeah, but it looks a tad nicer imo

9:18 :D

9:18 gfredericks: but do is not allowed in swearjure

9:18 hyPiRion: gfredericks: this is true

9:19 gfredericks: clojurebot: swearjure is <reply> there is no do

9:19 clojurebot: Ik begrijp

9:19 hyPiRion: We tend to do ##(#([{:+ %}](+)) 10) instead

9:19 lazybot: ⇒ {:+ 10}

9:19 gfredericks: which is great for making swearjure look more complicated

9:19 hyPiRion: heh

9:19 silasdavis: damn 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)

9:20 gfredericks: silasdavis: sure does

9:20 Glenjamin: the errors from the ns form are very cryptic

9:20 silasdavis: can anyone explain why that lead to cast...

9:20 gfredericks: I have no idea where a boolean would have come from

9:21 my repl gives the same error

9:21 Glenjamin: the one i get often is when i go from :refer [something] to :as something, i often accidentally do :as [something]

9:21 jjttjj: I think

9:21 silasdavis: by comparison haskell has some pretty helpful errors a lot of the time... I suppose it's a mixture of macros and java poking through

9:21 jjttjj: woops

9:21 gfredericks: silasdavis: well the ns macro could be enhanced to have error checking with nice messages

9:22 silasdavis: that'd be nice

9:23 these little data structure based mini-languages can be a bugger to remember

9:24 gfredericks: ns is probably the worst combination of design and high-profile-ness

9:24 it is much hated but expensive to change

9:25 Glenjamin: http://dev.clojure.org/jira/browse/CLJ-272

9:25 a fairly old and rather vague issue :D

9:25 gfredericks: haha it's over 3 years old

9:26 I guess require got updated recently

9:26 but certainly not an overhaul

9:29 silasdavis: perhaps it could be superseded by a differently named macro

9:29 or perhaps you could explicitly include something that overrode it

9:29 to not break backward compatibility

9:30 I'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

9:31 but perhaps it's alright in this case

9:31 borkdude: silasdavis lobos requires migrations to be in lobos.migrations, so you need a lobos dir in your src dir

9:32 does someone have a good example of usage of noir validation outside a noir project, so with lib-noir?

9:32 silasdavis: borkdude, I could override the default

9:32 borkdude: silasdavis you probably can

9:32 silasdavis: the 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

9:33 also it's not lobos' migrations, it's this app's

9:33 borkdude, try lein new luminus myapp

9:33 I think it has some noir validation in it

9:34 borkdude: silasdavis yes, it feels wrong to me to

9:34 silasdavis will try, thanks

9:35 silasdavis grep -R 'vali' . returns nothing

9:36 Glenjamin: Thus, to use another namespace you must change the lobos.migration/*migrations-namespace* dynamic variable

9:37 plet

9:37 silasdavis: borkdude, sorry try lein new luminus myapp +site

9:37 Glenjamin: whoops, that was supposed to be a find :)

9:37 silasdavis: then you should find some in auth.clj

9:37 Glenjamin: is there a public log of this channel somewhere?

9:38 silasdavis: Glenjamin, yeah.. I'm not the first: http://stackoverflow.com/questions/10986293/how-to-set-a-dynamic-var-in-another-namespace

9:39 borkdude: silasdavis you're right, thanks, now I find a lot of of references

9:44 innotune: hey, 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?

9:48 Glenjamin: what's the collective term for people who do clojure?

9:48 clojurist, clojurian, clojurer?

9:50 borkdude: silasdavis do I need wrap-validation from noir if I want to use validation?

9:51 silasdavis I can't find it in the example, so I assume not

9:53 Glenjamin: borkdude: i suspect you do, i think it uses a dynamically bound variable

9:53 silasdavis: borkdude, I think you do, it's called within noir.util.middleware/app-handler

9:53 which I think luminus uses by default

9:53 borkdude: silasdavis ah no problem then, I use that one already..

9:53 Glenjamin thanks

10:04 hmm, why is this true? https://www.refheap.com/paste/14006

10:05 got it, name should be :name

10:06 yay, validation works now

10:37 Jernau: Hi 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:38 When I try: (map read-string ["2" "4"]) it gives me the result I expected: (2 4).

10:38 However, 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:38 I get the result ["2" "4"] as though it hasn't applied read-string at all. Which basic concept am I missing here?

10:39 cap10morgan: Jernau: you want (defn strings-to-numbers [strings] (map read-string strings))

10:39 you need to call the map function inside your function

10:40 putting a something in "function position" (i.e. the beginning of a list) does that

10:41 Jernau: okay, thanks cap10!

10:41 Knew it was basic :)

10:42 cap10morgan: Jernau: np, happy Clojuring!

10:53 gfredericks: ,(-> (a b c) quote reverse)

10:53 clojurebot: (c b a)

10:54 pandeiro: anybody know the way to invoke `lein run` so that my "platform encoding" is UTF-8?

10:55 gfredericks: is that a jvm option?

10:55 pandeiro: gfredericks: not sure, but non-ascii filenames are getting garbled by ring-multipart-params

10:56 what i tracked down on stackoverflow so far is that commons-fileupload looks for something called the platform encoding

10:56 gfredericks: oh; I'm not familiar enough with the issues involved to guess

10:56 pandeiro: me neither

10:56 gfredericks: if it turns out to be a jvm opt, you can set those in the project.clj

10:58 maio: any native english speaker willing to do quick grammar check of my Clojure related blogpost please? :) https://gist.github.com/maio/2fb5e49353b28925cea5

11:00 * gfredericks is on it

11:00 pandeiro: "we chose Heroku"

11:00 ^ maio

11:01 gfredericks: maio: curious what your native language is

11:01 pandeiro: "their Git repository"... "Heroku then builds"

11:01 "a custom build script"

11:02 gfredericks: somewhere on the internets or in a book there was a listing of english grammar mistakes categorized by native language; terribly interesting

11:02 pandeiro: maio: dunno if it matters to you, the rest are mostly missing articles like the above... "the compass gem"...

11:02 maio: gfredericks: czech / slovak :)

11:03 thank you guys :)

11:03 pandeiro: yes when i do my bad russian/slovak imitation the first thing that goes are the articles :)

11:03 maio: pandeiro: sure - I would like to learn how to write correctly so any correction will help :)

11:03 gfredericks: maio: "To make build process[es] more ..."

11:04 "...that you use [the] same versions..."

11:04 probably replace "one" with "you" in the previous sentence

11:04 "will create [an] example Gemfile"

11:05 "requires [the] compass gem"

11:05 "you will find that [the] build fails"

11:06 "[the] presence of [the] Gemfile", "[The] fix is"

11:07 it's like clojure with parens -- just sprinkle a few articles around the sentences :)

11:08 pandeiro: article 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:08 gfredericks: spanish has a dialect with that I think

11:08 pandeiro: and English not putting articles before abstract nouns is also bizarre to speakers of other languages

11:09 gfredericks: I 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:10 pandeiro: gfredericks: know the link? that would be very useful for me

11:10 gfredericks: pandeiro: at this point I'm probably no better at googling it than you are

11:10 I'm 80% sure this was a linguistics textbook though

11:11 pandeiro: yeah not pulling up anything specific here

11:12 gfredericks: I wonder how infeasible it would be to compile the n^2 sized list of all combinations of native/foreign language

11:14 maio: thanks 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:14 * gfredericks is finally famous

11:14 maio: <gfredericks> probably replace "one" with "you" in the previous sentence

11:15 "one use the same" or "one uses the same"? :)

11:15 pandeiro: latter

11:15 gfredericks: huh? I was recommending changing "one" to "you" not the other way around

11:17 pandeiro: generally "one" just wants to stay consistent so "you" don't confuse the reader

11:17 gfredericks: "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:17 I would not expect to see "one" used in a technical tutorial

11:18 maio: I see. fixed :)

11:18 gfredericks: at least not something aimed at english speakers. I have no idea about the optimal way to communicate in english between non-native speakers :)

11:20 maio: ouch. 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:22 gfredericks: lol; your attribution sentence should be "for [the] grammar check"

11:22 arkh: I have a lazy-seq I'd like to make but I'm running up against a wall when trying to make it :/

11:23 ,(let [y [{:a "a" :b "b"}]] (into [] [y]))

11:23 clojurebot: [[{:a "a", :b "b"}]]

11:23 arkh: ,(let [y [{:a "a" :b "b"}]] (into (into [] [y]) [y]))

11:23 clojurebot: [[{:a "a", :b "b"}] [{:a "a", :b "b"}]]

11:24 arkh: (let [y [{:a "a" :b "b"}]] (into (into (into [] [y]) [y]) [y]))

11:24 ,(let [y [{:a "a" :b "b"}]] (into (into (into [] [y]) [y]) [y]))

11:24 clojurebot: [[{:a "a", :b "b"}] [{:a "a", :b "b"}] [{:a "a", :b "b"}]]

11:24 arkh: That's the cycle I'd like it to follow

11:27 dnolen: no more js* in core.cljs http://github.com/clojure/clojurescript/commit/7a89d636fb9426754248d54ac35d01bcd986eebd

11:28 ,(doc repeat)

11:28 clojurebot: "([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."

11:29 dnolen: ,(take 3 (map #(repeat % {:a "a" :b "b"}) (rest (range))))

11:29 clojurebot: (({: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:29 pandeiro: dnolen: that's sad, what is the reasoning?

11:29 (about js*)

11:30 dnolen: pandeiro: 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:30 pandeiro: i 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:31 it's moved to another ns?

11:31 gfredericks: oh so it's still available for use (unofficially), but just not used by cljs itself?

11:31 dnolen: pandeiro: no js* is still available, the only thing is that core.cljs just doesn't refer to it directly anymore.

11:31 gfredericks: it is used but only via macros.

11:31 pandeiro: ah ok great

11:33 dnolen: arkh: ^ not sure if have lazy seqs instead of vecs works for you

11:33 gfredericks: is 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:34 I guess doubles are sufficient 99% of the time

11:34 dnolen: gfredericks: I think people just have low expections on numerics when targeting JS

11:35 arkh: dnolen: 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:35 dnolen: tricky part being it must be vector of a map in a vector

11:36 kawas44: hello les gens

11:36 dnolen: ,(take 3 (map #(into [] (repeat % {:a "a" :b "b"})) (rest (range))))

11:36 clojurebot: ([{: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:36 dnolen: arkh: ^

11:36 arkh: dnolen: that's close! :)

11:38 * dnolen is thinking about constant literal optimization (including symbols/keywords) in CLJS

11:38 arkh: it needs to be [ [{:foo nil}] [{:foo nil}] [{:foo nil}] ]

11:39 I'm close to either finishing it w/ lazy seq or, if not, then I'

11:39 I'll try repeat / map / something like you did

11:39 dnolen: ,(into [] (take 3 (map #(into [] (repeat % {:foo nil})) (rest (range)))))

11:39 clojurebot: [[{:foo nil}] [{:foo nil} {:foo nil}] [{:foo nil} {:foo nil} {:foo nil}]]

11:39 dnolen: arkh: ^ or something else?

11:40 arkh: dnolen: unfortunately, slightly different than that

11:42 ,(vec (repeat 3 {:foo nil}))

11:42 clojurebot: [{:foo nil} {:foo nil} {:foo nil}]

11:42 arkh: ... that, but lazy

11:42 er

11:43 ,(vec (repeat 3 [{:foo nil}]))

11:43 clojurebot: [[{:foo nil}] [{:foo nil}] [{:foo nil}]]

11:43 arkh: sorry, _that_, but lazy

11:44 pepijndevos: vectors arn't lazy right...

11:44 arkh: pepijndevos: right

11:44 pepijndevos: so how can it be lazy?

11:45 ( just dropped in, did I miss something important?)

11:45 arkh: I was just showing what I'm shooting for as an example of the end result

11:45 mynomoto: Glenjamin: public log: http://clojure-log.n01se.net/

11:46 arkh: I'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:46 I'll have to take off for a while - thanks dnolen for your time, though

11:47 gfredericks: arkh: if you just don't call vec, it's lazy

11:47 because repeat is lazy

11:47 arkh: gfredericks: that's true but I'd like to feed the above into partition-all

11:47 gfredericks: arkh: no reason you can't do that

11:47 lmarburger: can 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:48 arkh: gfredericks: the consumer needs a lazy vector of map-in-a-vector

11:48 Morgawr: hi... 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:49 arkh: [ [{:m v}] [{:m v}] ... ]

11:49 gfredericks: Morgawr: you want the result to be [(f1 x) (f2 x) (f3 x)]?

11:49 Morgawr: gfredericks: I want it to be (f3 (f2 (f1 x)))

11:49 like with ->

11:49 gfredericks: arkh: what is a lazy vector? why can the consumer not have a regular sequence instead of a vector?

11:50 Morgawr: (reduce #(%1 %2) x [f1 f2 f3]) should work

11:50 unless I got the arguments backwards

11:50 AimHere: I'd say %2 %1

11:50 arkh: gfredericks: excellent question ... I bet I'm messing up there ...

11:50 Morgawr: gfredericks & AimHere, I'll try, thanks

11:51 arkh: gfredericks: I'll have to try that later tho - thank you

11:51 gfredericks: sure

11:57 maio: woah look at that dynamic terminal thing on your previous blog

12:02 pandeiro: anyone know where in commons-fileupload FileItemStream's methods are defined (not just the interface)

12:04 i'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:10 svedubois: I am trying to translate this javascript to clojurescript:

12:10 sliceX.container = 'sliceX';

12:10 I try this:

12:10 (.-container sliceX "sliceX")

12:10 And I get this error:

12:10 java.lang.Error: Unknown dot form of (. sliceX -container ("sliceX")) with classification [:cljs.analyzer/expr :cljs.analyzer/property :cljs.analyzer/expr]

12:10 And if I try another one:

12:10 (.container sliceX "sliceX")

12:10 I get another error:

12:10 "Error evaluating:" (.container sliceX "sliceX") :as "xtk.sliceX.container(\"sliceX\");\n"

12:10 gfredericks: you need set!

12:10 svedubois: #<TypeError: Property 'container' of object #<xg> is not a function>

12:10 What I am doing wrong?

12:10 gfredericks: (set! (.-container sliceX) "sliceX") I think

12:13 svedubois: "Error evaluating:" (set! (.-container sliceX) "sliceX") :as "xtk.sliceX.container = \"sliceX\";\n"

12:13 #<Error: Could not find the given container.>

12:14 (set! (.container sliceX) "sliceX")

12:14 java.lang.AssertionError: Assert failed: set! target must be a field or a symbol naming a var

12:15 gfredericks: your namespaces is called xtk?

12:15 svedubois: Yes

12:16 (.-container sliceX)

12:16 #<[object HTMLBodyElement]>

12:16 gfredericks: it looks like it's compiling to what you want then?

12:16 xtk.sliceX.container = "sliceX"

12:16 is there some sort of setter handler on this library? I don't know how fully JS supports that stuff

12:16 haven't been paying attention

12:24 svedubois: It 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:24 And I don't know why?

12:25 gfredericks: my guess is you'd get the same error if you were running the JS directly; i.e., it's not a clojurescript issue

12:25 you can try js* to verify that

12:25 (js* "xtk.sliceX.container = \"sliceX\")

12:25 with a closing quote at the end

12:32 svedubois: Yes I obtain the same error with: (js* "xtk.sliceX.container = \"sliceX\";\n")

12:33 Do you think it is a JS support problem?

12:33 gfredericks: well I can't imagine an assignment failing in that way unless that new javascript setter method thing is going on

12:33 such that arbitrary code is being executed by the assignment

12:42 svedubois: The 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:43 The line 23 is: sliceX.container = 'sliceX';

12:43 gfredericks: like I said, I think you've translated it correctly, and your problem is something unrelated to clojurescript

12:52 honkfestival: in ClojureScript: Up and Running, I'm having trouble getting the example running at the top of page 11

12:52 https://gist.github.com/anonymous/4982cb289a10422cde01

12:56 https://gist.github.com/anonymous/28368bf67d0b37d7f5bf project.clj

12:56 arkx: honkfestival: :pretty-print true

12:57 honkfestival: ugh of course

12:57 arkx: Also, you don't need the commas. :)

12:58 honkfestival: I just pasted the text from the cljsbuild plugin

12:58 I should have looked it over a bit first

12:59 woot, thanks arkx

13:10 gfredericks: huh; I wonder how honeysql compares to the new java.jdbc API

13:33 svedubois: Is this js->cljs translation correct?

13:33 var opacityController = volumegui.add(volume, 'opacity', 0, 1).listen();

13:33 (def opacityController (-> (set! (.-add volumegui) [volume "opacity"]) .-listen))

13:34 gfredericks: no

13:34 (-> volumegui (.add volume "opacity" 0 1) (.listen))

13:34 the .-foo syntax is only for when you're referencing or setting attributes rather than calling methods

13:41 svedubois: #<TypeError: Object Volume has no method 'add'>

13:41 TypeError: Object Volume has no method 'add'

13:42 gfredericks: well if it has no method called 'add' I wouldn't expect the JS you gave to work either

14:20 tomoj: does c.c.l.unifier not work with nominal ties? https://www.refheap.com/paste/5a68e6676060a41c464f02e5b

14:23 oh, d'oh

14:44 danneu: My 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:45 I'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:47 In 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:48 ucb_home: danneu: I'd use a combination of promise, future and deliver

14:48 danneu: I actually wrote a simple thing that does that (modulo the re-ordering of realized? promises)

14:49 danneu: 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:49 danneu: it's crude, but it works

14:53 gfredericks: wouldn't a queue be sensible there?

14:53 with maybe some dedicated worker threads?

15:02 svedubois: Is this JS to CLJS correct?

15:02 volume.dimensions[2] - 1

15:02 (- (nth (.-dimensions volume) 2) 1)

15:04 ucb: gfredericks: that would be the right thing to do; yes

15:05 SegFaultAX: svedubois: dec might be nicer.

15:11 dnolen: svedubois: (dec (aget (.-dimensions volume) 2))

15:24 goracio: hey, anyone used monger ? there are couple of questions )

15:25 svedubois: How I can translate this JS to CLJS? https://www.refheap.com/paste/14018

15:26 jrheard: hi 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:26 does anyone have a favorite code snippet / library that shows off the power/usefulness of multimethods?

15:26 (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:31 weavejester: Does anyone have any good suggestions for a the name of a protocol that defines a system that self-updates

15:32 Glenjamin: updatotron

15:32 weavejester: Haha

15:33 I guess I could just call it "system" perhaps

15:33 goracio: damn only questions here and no answers ))

15:33 ivan: clojurebot: anyone?

15:33 clojurebot: Just 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:34 Glenjamin: oh, you mean a clojure protocol declaration, rather than a communication protocol

15:34 goracio: where are any clojure hackers )

15:34 gfredericks: jrheard: multimethods are one of the features with a large talk-to-use ratio

15:34 jrheard: heh

15:34 gfredericks: like refs

15:34 Glenjamin: weavejester: SelfUpdatable ?

15:34 gfredericks: probably a lot of their use cases have been superseded by protocols

15:34 weavejester: Glenjamin: Yeah, it'll have functions: deref, amend!, and update!

15:34 jrheard: gfredericks: that is excellent context to have

15:34 weavejester: I'm using it to interface to a physics engine

15:35 But it essentially defines any system with internal rules

15:35 Glenjamin: SelfContained ?

15:35 gfredericks: jrheard: I think they would be very natural to use if you wanted the inheritance mechanism

15:35 but again I've never even seen anybody use that

15:36 jrheard: nor i, although i've probably read less clojure source than you have

15:36 weavejester: SelfContained… Not really very catchy :)

15:36 danneu: there are various species that churn 100% of their internals.

15:36 weavejester: But thanks for the suggestion

15:36 danneu: maybe there's some catchy lingo on relates wiki pages

15:36 Glenjamin: Bubble

15:36 danneu: perhaps something hard to spell too, like 'anenome'

15:37 jrheard: is 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:37 weavejester: Glenjamin: Yeah, Bubble might do it. Or PocketUniverse. Or just Universe.

15:38 dnolen: wow wacky Closure dead code elimination issue finally isolated related to constructors that's been plaguing CLJS

15:38 http://dev.clojure.org/jira/browse/CLJS-500

15:38 weavejester: Or maybe I should call it "Resource" or something.

15:39 goracio: so about monger (monger/find "documents" {:first_name "Ringo"}) is this request sync ? so it waits for response ?

15:39 gfredericks: jrheard: not that I know of

15:39 jrheard: glad i asked then :) thanks for the help!

15:39 gfredericks: jrheard: except asking in #clojure :)

15:39 jrheard: :D

15:41 dnolen: erg, or not ...

15:42 svedubois: Is this JS->CLJS correct? From https://www.refheap.com/paste/14018 to this https://www.refheap.com/paste/14019

15:42 goracio: any thoughts ?

15:44 kencausey: Have I been in detention long enough?

15:44 weavejester: Autoverse perhaps...

15:45 jrheard: svedubois: i don't think that's right

15:45 you probably want when-not instead of if

15:46 if 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:46 which doesn't seem like what you want

15:46 Glenjamin: oh crap, hiccup doesn't auto escape

15:48 now i need to go find all of the bits of user input :(

15:49 xeqi: Glenjamin: nope, it doesn't. possibly relevant: https://groups.google.com/d/msg/ring-clojure/P2Jrk6SyYCo/q20vdOJsnpgJ

15:50 Glenjamin: i quite like the whole escaped and unescaped strings are different types approach

15:50 i wonder if that's doable

15:50 svedubois: What about the first line onChange, is it necessary to use set!? Is there any other way? (set! (.-onChange meshVisibleController)

15:51 Glenjamin: been meaning to look at switching to laser, but been a bit lazy so far

15:51 jrheard: Glenjamin: a la https://pypi.python.org/pypi/MarkupSafe in python

15:51 we use that at work and like it very much

15:51 svedubois: i actually have never touched cljs so i have no idea :( sorry!

15:52 Glenjamin: jrheard: yeah, that's the idea

15:52 ah, thats exactly what this safe hiccup thing does

15:53 weavejester: Ah, I think I'll call the protocol Autonomy

15:54 Glenjamin: heh, 2 hard problems and all that...

15:56 Bronsa: kencausey: enough that nobody remembers anymore what happened :)

15:56 Glenjamin: xeqi: looks good - do you know why String's to-str does (escape-html (raw s)) instead of just (escape-html) ?

15:57 oh crap, i just realised i forgot to do CSRF protection too

15:57 goracio: so about monger (monger/find "documents" {:first_name "Ringo"}) is this request sync ? so it waits for response ?

15:58 xeqi: Glenjamin: because it would infinite loop: to-str -> escape-html -> as-str -> to-str -> escape-html ....

15:59 so marking the string as raw it goes to-str -> escape-html -> as-str -> just return the string

15:59 and then escapes it

16:00 Glenjamin: ah, i missed that bit in as-str

16:00 the escaping is typed to String, instead of Object - so anything string-like would be left raw?

16:00 kencausey: Bronsa: if only, but thanks

16:02 xeqi: Glenjamin: it extends more types on https://github.com/weavejester/hiccup/blob/master/src/hiccup/util.clj#L34

16:02 I'm not sure I understand your question

16:02 Glenjamin: safe-hiccup defines ToString on String to escape

16:03 but hiccup defines ToString on Object to just (str), so if you use a non-string Object it'd not get escaped?

16:04 xeqi: ... I think thats correct

16:05 Glenjamin: cool, i think i follow this

16:05 although latest hiccup has an HtmlRenderer protocol in compiler.clj

16:06 xeqi: hmm, that might be a better place

16:07 I fully admit this is a hacky thing to do

16:07 Glenjamin: yeah, i'll give it a go

16:07 weavejester: 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:07 xeqi: I'd be happy to see you pull something similar into a well tested library :p

16:08 previous discussions say its on the roadmap for hiccup 2, since it breaks semver

16:08 weavejester: Glenjamin: It's been on the cards for a while, it just means a substantial redesign of the library.

16:08 I've got some code in a branch, but never actually finished it.

16:09 Glenjamin: is it really that big? presumably most internal functions return a seq?

16:09 weavejester: It would also mean losing some of the speed Hiccup current has.

16:09 Well, currently Hiccup functions return strings

16:09 Glenjamin: ah

16:09 weavejester: That would need to change to return DOMs of some type.

16:09 Like maybe clojure.xml-style

16:09 Glenjamin: i've been making my helper functions return (list ..stuff..) because i assumed it auto escaped

16:10 weavejester: Except you might also want to encode comments and so forth, I'm not sure.

16:10 Glenjamin: and just letting it resolve the vector at the end

16:10 svedubois: Do you know any examples written in CLJS to use methods like:

16:10 render.onShowtime = function() {}

16:10 Or like onShowtime, onChange, onRender, onClick, etc.

16:10 The only translation thar I have found is this one, and I am not sure if it is correct:

16:10 (set! (.-onShowtime render) ...

16:13 gfredericks: svedubois: yes that is how to set a property. the function(){} part would be (fn [] ...)

16:19 is jayq still the easiest way to do ajax in cljs?

16:28 svedubois: When 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:28 render.onShowtime = function() {body ...}

16:29 danneu: ucb: is that promise/future/deliver code in arm's reach? if so i'd love to see it

16:57 Glenjamin: would a CSRF protection lib that didn't use sessions be useful to release?

16:59 i'm writing something modelled on ring-anti-forgery, but my app currently avoids sessions and i'm keen to keep that

16:59 unsure whether it'd be any use to people other than me

17:00 xeqi: how would that work? static key on startup?

17:00 svedubois: In clojure, how can I wait until one statement (for example, load a large file) is finished before continuing to the next statement?

17:02 For example, if I want to read a pdf, I would like to wait until the file is completed before execute the read function.

17:04 Glenjamin: svedubois: that's what usually happens, it'll depend on the function you call

17:04 xeqi: just straight cookies

17:05 kencausey: lein 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:05 Bronsa: svedubois: clojure is generally a synchronous language

17:06 svedubois: I 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:06 So in this case it doesn't wait.

17:07 Bronsa: wait are you talking about clojue or clojurescript?

17:07 svedubois: ClojureScript

17:07 Bronsa: oh.

17:07 svedubois: I have to use something like realized?

17:07 Bronsa: then I cannot help you, sorry

17:07 xeqi: kencausey: can you rename the file .lein/profiles.clj, with an s

17:08 kencausey: *sigh*

17:08 thanks

17:09 Not my week for seeing the obvious it seems.

17:11 stian: I'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:11 Just 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:11 provider.init();

17:16 raek: stian: the package name is usually easy to discover from the Javadoc (if there is one)

17:16 Glenjamin: java devs assuming you're using an IDE :)

17:17 raek: stian: in this case Provider is really com.tulskiy.keymaster.common.Provider

17:18 (ns ... (:import (com.tulskiy.keymaster.common Provider)))

17:18 stian: so I do (import [com.tulskiy.keymaster]) or [com.tulskiy.keymaster.common.Provider])? Sorry - no experience with java

17:18 raek: stian: you cant do the equivalent of "import com.tulskiy.keymaster.common.*;" in clojure. this is considered a feature.

17:19 (com.tulskiy.keymaster.common Provider) and com.tulskiy.keymaster.common.Provider means the same for :import

17:19 but with the first one you can list multiple classes

17:20 stian: if there is not javadoc you can figure out the full name of the class from the filename of its .java file

17:24 stian: rack: 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:25 hadronzoo: Is it possible to add new fields to a type previously defined with deftype?

17:27 raek: stian: (let [provider (Provider/getCurrentProvider)] ...)

17:28 static method calls are written like as if the method of the class was a function in a namespace

17:29 stian: raek: 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:29 raek: stian: did you have the paretheses there when you tried that?

17:30 (Foo/bar) and Foo/bar are not the same things (and from the error message it sounds like you try the latter)

17:30 stian: raek: https://gist.github.com/houshuang/5474778

17:31 raek: stian: did you import Provider in the test namespace? (import '(com.tulskiy.keymaster.common Provider))

17:32 the (:import ...) form is only used inside (ns ...) in source files

17:32 stian: yes I did (ns test (:import (com.tulskiy.keymaster.common Provider)))

17:32 raek: ok, so evaluating just Provider works? (it should just echo the class name back)

17:33 stian: Yes

17:33 And keyboard completion shows all the methods

17:33 Provider without parenthesis shows com.tulskiy.keymaster.common.Provider

17:33 raek: weitd

17:33 *weird

17:34 stian: I tried the other function available (Provider/logger) and that worked fine, so maybe there's a bug in the library or something

17:34 raek: stian: the documentation seems to be wrong.

17:34 stian: https://github.com/tulskiy/jkeymaster/blob/master/src/main/java/com/tulskiy/keymaster/common/Provider.java#L50

17:34 stian: the getCurrentProvider method should take an argument

17:36 stian: raek: 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:36 raek: perhaps you should open an issue and tell the authors that the gh page example is broken?

17:36 stian: raek: will do

17:36 raek: stian: haha. det var så lite. (jag är svenne)

17:40 svedubois: Does it work Thread/sleep in CLJS?

17:41 hadronzoo: If 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:42 amalloy: svedubois: does Thread.sleep() work in JS?

17:42 svedubois: no

17:43 amalloy: hadronzoo: 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:45 hadronzoo: amalloy: Thanks, that makes sense. I want to memoize an expensive calculation on types I don't control.

17:46 amalloy: makes a little sense, i guess, although it's not clear to me why you can't just use memoize

17:49 hadronzoo: amalloy: Ha, well that would be a lot easier -- just use memoize in the protocol implementation. Thanks.

17:55 Glenjamin: arohner: yo, do you have any plans to expand bond?

17:55 arohner: Glenjamin: I don't have any pressing need. what are you interested in?

17:57 Glenjamin: there'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:58 (bond/called fn) => num, (bond/called-once? fn) => boolean etc

17:58 arohner: I like called, called-once?

17:58 I forgot about the PR

17:59 Glenjamin: called-with? could be handy too, but potentially quite complex

18:04 but in general, is the idea to keep bond small and simple, or try and provide lots of utility for spies/stubs ?

18:04 if the former, I might spin off a fork for the latter :)

18:07 arohner: I prefer small and simple

18:07 you might say bond is a reaction to midje's bloated mess

18:09 Glenjamin: fair 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:17 gfredericks: a spies lib?

18:17 I've been wanting one of those

18:21 danneu1: i'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:23 arohner: gfredericks: github.com/circleci/bond

18:26 gfredericks: danneu1: what went wrong with the agents approach

18:28 arohner: the example there is really weird

18:28 arohner: gfredericks: ah, good point

18:29 fixed

18:30 oh, I remember the point I was trying to convey

18:30 gfredericks: arohner: this is your lib?

18:30 arohner: yes

18:31 gfredericks: how about now?

18:31 gfredericks: yeah that's better

18:32 hmm

18:32 when I took a stab at something like this I also had a function for creating a spy without vars

18:33 that wouldn't be hard to expose, right?

18:35 arohner: gfredericks: see bond.james/spy

18:36 gfredericks: pardon me for not even looking :)

18:36 Glenjamin: have 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:37 danneu1: gfredericks: 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:38 gfredericks: danneu1: you started a bunch of threads manually?

18:39 where each thread was in an infinite loop?

18:39 danneu1: gfredericks: 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:40 gfredericks: well right you'll get a few of them going and then nothing

18:41 Glenjamin: can you just throw doseq on the front?

18:41 or is that a bad idea?

18:41 gfredericks: danneu1: but your agent idea -- that wasn't pmap right? with the agent did you start your own threads?

18:42 danneu1: Glenjamin: 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:43 Glenjamin: you probably want a slightly more managed pool i guess? queue + worker model

18:43 danneu1: gfredericks: I was using pmap this whole time so far. here's my first attempt: https://gist.github.com/danneu/820c024cb62859371f4c

18:43 (developed on a small screen)

18:44 gfredericks: ah

18:44 yeah definitely stop using pmap

18:44 danneu1: gfredericks: but wouldnt that code there still at least fill a threadpool?

18:44 gfredericks: no because of the problems with pmap you've mentioned

18:45 you could use the agent and just start your own threads

18:46 danneu1: gfredericks: ah, that code launches two threads

18:46 gfredericks: in main do a (dotimes [_ 8] (.start (Thread. #(while true (work (gen-seed))))))

18:46 and there you have 8 workers running and your agent spitting things to the file

18:47 you could do the spitting in the agent function instead of a watcher which would be simpler, but should work either way

18:51 danneu1: Thanks for these ideas

18:59 If (pmap mycomputation coll) starts only two threads without anything consuming the sequence, how come (map println (pmap mycomputation coll)) will fill the cores?

19:00 gfredericks: you're doing these in main?

19:00 danneu1: yes

19:02 gfredericks: running it with `lein run` or an executable jar?

19:02 danneu1: lein run

19:02 well, also a jar.

19:03 gfredericks: when you say "will fill the cores" do you mean it runs forever or just till it gets a couple answers?

19:06 danneu1: Let me actually re-test my assumption real quick

19:06 Glenjamin: how do i get an unqualified symbol in a macro?

19:07 aha, ~'

19:09 danneu1: gfredericks: 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:10 i get it now

19:36 Is the most terse way to update an agent: (send myagent (fn [_] 42))

19:37 Nevermind. 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:02 Glenjamin: is the equivalent of the traditional FP 'zip' in clojure just (partial map list) ?

20:03 danneu1: zipmap?

20:03 gfredericks: yep

20:03 danneu1: oh

20:03 amalloy: ~zip

20:03 clojurebot: zip 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:04 Glenjamin: ok, cool

20:04 gfredericks: ~clojure

20:04 clojurebot: clojure is not scheme

20:05 gfredericks: oh what if the inference engine knew about negation

20:05 ~scheme

20:05 clojurebot: scheme 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:05 Glenjamin: now to see if i can understand zippers...

20:06 i suspect if it was call clojure.tree, i'd have figured out what was going on a bit sooner

20:07 mthvedt: ~lisp

20:07 clojurebot: "if you never learnt Lisp, then you never learned to program" -- some rant on some blog somewhere

20:07 mthvedt: ~haskell

20:07 clojurebot: "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:08 Glenjamin: ~python

20:08 clojurebot: python is ugly

20:08 nightfly__: ~common-lisp

20:08 clojurebot: Gabh mo leithscéal?

20:08 Glenjamin: heh

20:08 mthvedt: ~java

20:08 clojurebot:

20:08 mthvedt: ~cobol

20:08 clojurebot: The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. -- Dijkstra

20:08 danneu1: ~ruby

20:08 clojurebot: Chunky bacon!

20:08 Glenjamin: ~dijkstra

20:08 clojurebot: Huh?

20:08 honkfestival: ~factor

20:08 clojurebot: bus factor is best if you try not to think about it. (https://github.com/clojure/clojure/graphs/contributors)

20:09 gfredericks: ~javascript

20:09 clojurebot: javascript is beautiful, you're just too conformist to appreciate its quirks: http://tinyurl.com/7j3k86p

20:09 mthvedt: ~racket

20:09 clojurebot: Cool story bro.

20:09 mthvedt: ~ocaml

20:09 clojurebot: Excuse me?

20:09 Glenjamin: hrm, that bus factor this is somewhat alarming :D

20:09 honkfestival: ~forth

20:09 clojurebot: excusez-moi

20:10 mthvedt: ~c

20:13 stian_: 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:16 Glenjamin: you usually get that when you pass a single symbol into :refer

20:16 but that paste looks right to me

20:16 gfredericks: this isn't clojurescript is it?

20:18 stian_: gfredericks: No, I just run it with lein run.

20:22 gfredericks: try `lein clean`?

20:22 are you sure it's not the ns form in your other namespace?

20:25 stian_: 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:26 gfredericks: phew

20:26 clojure still works

20:28 stian_: gfredericks: Haha! :)

20:29 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:29 (defn conv-listener [f](proxy [com.tulskiy.keymaster.common.HotKeyListener] [] (onHotKey [hotKey] (f))))

20:31 Glenjamin: you might want to (:import [com.tulskiy.keymaster.common HotKeyListener]) in your ns, to make that a bit shorter :)

20:33 i think this link does what you're after http://clojuredocs.org/clojure_core/clojure.core/proxy#example_1026

20:34 stian_: Glenjamin: Thanks, will have to chew on that a bit.

20:35 gfredericks: if you're trying to detect the arity of a function, that's not generally possible

20:37 if you could...that would lead to some weird-ass APIs

20:37 I wonder if that's why rich didn't have defn put metadata on functions...for our own good.

20:43 amalloy: well, 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:50 unlike the metadata approach, it would only cost a pointer per function instance, if implemented carefully

21:12 mthvedt: amalloy: wouldn't it cost some fixnum per function class, not instance?

21:13 oh that's

21:13 old

21:17 amalloy: good point, mthvedt. it might be easier to implement storing it on instances, but it ought to work on classes

21:25 danneu1: jvisualvm is amazing. never profiled anything in my life but this was really easy

21:28 gfredericks: amalloy: curious what the use cases for supportsArity would be

21:28 the non-evil ones I mean

21:29 stian: Would 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:32 danneul: Very cool, just read http://www.fatvat.co.uk/2009/05/jvisualvm-and-clojure.html. Looks quite useful

21:44 gfredericks: guys I kind of like chickens

22:05 andyfingerhut: gfredericks: It has been 22 minutes, and apparently everyone is still stunned into silence. :-)

22:29 gfredericks: I tend to have that effect on the channel

22:40 ha I typed "lein ring" into google and it autocompleted to "that's not a task"

22:55 howdynihao: what do you guys feel clojure excels at ?

23:05 danneu1: howdynihao: parens

23:05 u?

23:11 technomancy: clojure is best at making the shortcomings of other languages painfully obvious

23:20 gfredericks: lein bundle install rubygems

23:43 shelducks: hello. has SLIME support for clojure been dropped? what mode is there instead?

23:43 gfredericks: nrepl

23:46 shelducks: thanks, I'll give it a try

23:52 danneu: (.start (Thread. (println "hello"))) doesn't output anything for me in nrepl.

23:53 so i've to use lein run to test my threaded stuff

23:53 grueling really

23:53 every day is another hardship for me

Logging service provided by n01se.net