#clojure log - May 01 2012

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

0:00 LuminousMonkey: Editors tend to be a religious choice as well.

0:00 ibdknox: yep

0:00 wmealing: i want the good tools, not a religious choice.

0:00 i'm sure i'm not the only one

0:01 muhoo: religions tend to arise out of ignorance and limited technology.

0:01 LuminousMonkey: wmealing: Clojure is the reason I went to Emacs, SLIME.

0:01 wmealing: LuminousMonkey, me too.. vim did everything i needed till clojure

0:02 and it wasn't a "religion" for me, just the first thing i knew

0:02 change when i need to

0:02 ibdknox: vim does fine for Clojure for me

0:02 wmealing: i had issues with nailgun

0:02 ie, not being able to find the server

0:02 ibdknox: huh, never had any issues there

0:03 wmealing: the authors link on his webpage simply doesn't exist

0:03 LuminousMonkey: I had a problem running nailgun under Solaris, had to submit a patch.

0:03 muhoo: ibdknox: anyway, sorry for bothering you with iwbyp. i hadn't seen latest lighttable status, looks like you're going to be very busy, very soon. good luck!

0:04 LuminousMonkey: But, at the end of the day, it was just my own personal feeling of programming Clojure in Emacs vs Vim.

0:04 ibdknox: muhoo: already am, haha. Thanks :)

0:04 wmealing: tbh, editor doesn't really matter with midje lazytest

0:04 LuminousMonkey: And that's what's important, I guess that's why no matter what editor you use, as long as you can make it how you want it to be, that's the important thing.

0:04 wmealing: spend most of my time thinking, not coding.

0:05 ibdknox: yeah far more of my time is spent not at the keyboard

0:05 LuminousMonkey: Definitely true.

0:06 And having a REPL to get quick feedback is useful. :)

0:33 creese: I have java function that returns an enum but when I print the result I get some stuff enclosed in brackets ('< >') and a hash ('#") out front.

0:33 Is there an easy way to get rid of those?

0:41 kovasb: creese: that is how the clojure repl prints java objects

0:41 creese: so if you want to get rid of those, you need to convert it into a pure clojure datastructure

0:41 creese: try calling seq on it?

0:42 creese: it's a string

0:43 kovasb: on the original enum

0:43 creese: I guess the enum isn't a string

0:43 it says "don't know how to create"

0:44 kovasb: ok

0:44 i guess that isn't one of the collections that has seq implemented on it

0:44 creese: but str works

0:44 thanks

0:44 kovasb: i'd look at the clojure api docs, maybe there is something to convert it

0:45 otherwise you need to look up the keys yourself

0:45 and turn it into a map or something

0:45 creese: str works

0:45 kovasb: cool

0:45 i wonder how it does it :)

0:52 muhoo: &(seq "foobar")

0:52 lazybot: ⇒ (\f \o \o \b \a \r)

0:52 muhoo: &(str (seq "foobar"))

0:52 lazybot: ⇒ "(\\f \\o \\o \\b \\a \\r)"

0:52 muhoo: ack

0:52 &(apply str (seq "foobar"))

0:52 lazybot: ⇒ "foobar"

0:56 muhoo: &(apply str (map #(char (+ 1 (int %))) (seq "foobar")))

0:56 lazybot: ⇒ "gppcbs"

0:56 wkmanire: howdy folks.

0:57 muhoo: evenin

0:57 kovasb: what up

0:57 wkmanire: Oh not too much.

0:57 Just trying to reinvent the wheel again. again.

0:57 :/

0:57 kovasb: me too

0:58 which one?

0:58 muhoo: the round one? cool!

0:58 kovasb: lol

0:58 wkmanire: I have to build a dynamic flyout menu in javascript.

0:58 With lots of great requirements.

0:58 kovasb: nice, custom menus

0:58 creese: what do the backslashes in (\f \o \o) mean?

0:59 muhoo: creese: chars

0:59 wkmanire: creese: Character literals.

0:59 wmealing: its a char

0:59 creese: so like a string but without \n

0:59 muhoo: &(map #(class %) (seq "foobar"))

0:59 lazybot: ⇒ (java.lang.Character java.lang.Character java.lang.Character java.lang.Character java.lang.Character java.lang.Character)

0:59 muhoo: this is weird, i feel more comfortable answering questions in clojure code than in english

1:00 wkmanire: muhoo: English is overrated.

1:00 muhoo: &true

1:00 lazybot: ⇒ true

1:03 muhoo: &("wkmanire is right" true)

1:03 lazybot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

1:03 muhoo: &(do "wkmanire is right" true)

1:03 lazybot: ⇒ true

1:03 muhoo: see, lazybot agrees with you :-)

1:28 creese: how do I interrupt the repl without killing it?

1:30 _tca: creese: I don't know what you mean by interrupt, but I'd guess you want "Ctrl-z"

1:30 creese: I had a runaway process like (while true)

1:31 ivan: creese: (clojure.repl/set-break-handler!)

1:31 creese: aright

1:32 wkmanire: weird.

1:32 I think someone just tried to PM me but erc bugged out.

1:33 &(make ('sammich))

1:33 lazybot: java.lang.RuntimeException: Unable to resolve symbol: make in this context

1:33 wkmanire: Don't think he's gonna do it.

1:35 muhoo: sudo?

1:39 wkmanire: Veeeird

1:39 ERC pretended that I had received a PM then died a horrible death.

1:42 Tired programmer is hungry.

1:49 * wkmanire loves the Javascript hates the DOM.

2:20 zanes: Is parsley the parsing library du jour, or is there something better?

2:27 creese: can you create a hash where you only store keys?

2:28 amalloy: you mean...a set?

2:28 creese: is the lookup as fast as a hash?

2:35 ivan: creese: yes

2:35 creese: ok

2:42 kovasb: anyone willing to test this web repl i just made?

2:43 Raynes: kovasb: No way dude, what if it haz viruz!!?!?!1!!1!

2:43 kovasb: it is very viral. it contains the clojure har

2:43 jar

2:44 shit is spreading everywhere

2:45 https://github.com/kovasb/session

2:45 i wouldn't recommend looking at the source unless u want ur eyes to blee

2:45 d

2:45 I'm just curious if this works at all

2:45 though i suppose i can try more rigorous testing myself :)

2:46 Raynes: kovasb: Please don't put closing parens on their own lines.

2:46 Kittens die when you do that.

2:46 kovasb: lol

2:47 i told u not to look at the source ;)

2:47 LuminousMonkey: I like to punch kittens in the face.

2:47 That's like telling someone on a ledge not to look down...

2:47 kovasb: alright, looks like it definitely doest work in safari..

2:47 Raynes: Two kittens die at once when you find it difficult to type out all three letters of 'you'.

2:47 kovasb: wtf

2:47 Raynes: Nothing works in Safari except for apple.com.

2:48 That's how they corner the market.

2:49 creese: Can someone tell me what's wrong with this?

2:49 https://refheap.com/paste/2484

2:50 kovasb: creese: false is not a function

2:51 but you are invoking it as a function

2:51 creese: how do I return false then?

2:51 Raynes: Just... 'false'

2:51 kovasb: unwrap it from its parens

2:51 creese: but it's in a do

2:51 Raynes: It doesn't matter.

2:51 creese: oh

2:51 Raynes: The last thing in a do is returned.

2:51 kovasb: do evaluates each of its arguments in order

2:51 Raynes: creese: Also, is @mem a map?

2:51 creese: set

2:52 (def mem (atom #{}))

2:52 Raynes: (if (@mem letter) ..)

2:52 contains? is unnecessary here, since sets are functions that do the same thing (for all intents and purposes in this case).

2:53 &(#{:foo :bar :baz} :bar)

2:53 lazybot: ⇒ :bar

2:53 Raynes: &(if (#{:foo :bar :baz} :bar) "yea" "nea")

2:53 lazybot: ⇒ "yea"

2:53 Raynes: &(if (#{:foo :bar :baz} :quux) "yea" "nea")

2:53 lazybot: ⇒ "nea"

2:54 Raynes: Not that you're hurting anything by using contains?. Just not doing it saves a bit of space. :)

2:54 Chousuke: code golf: (or (@mem letter) (swap! mem conj letter)) :p

2:54 the if form may be clearer though

2:54 creese: got it

2:54 Chousuke: and hm, I guess you'd need a not around the swap

2:55 creese: not around the swap?

2:55 Chousuke: in my example

2:55 creese: oh

2:55 Chousuke: just to negate the return value of swap!

2:55 creese: would I need contains? if it was a hash?

2:56 Raynes: Nope.

2:56 Chousuke: you'd need contains? for java sets

2:56 Raynes: Or if you really needed the exact true/false values for some reason.

2:57 Chousuke: well you could have a map containing :key false.

2:57 in that case you'd need contains? to check whether :key is there

2:58 creese: heh

2:58 my keys are all going to be letters

3:06 Raynes: Sure, you say that now. Eventually numbers are going to start looking real nice and you're not going to be able to maintain your composure.

3:08 wmealing: why did i read that in a pirate voice.

3:10 LuminousMonkey: Sure purty numbers.

3:10 Really purty.

3:25 zblut_: Hello I have a simple question

3:25 regarding addition

3:27 OK never mind sorry

3:27 LuminousMonkey: I like those kinds of questions, I'm good at those.

3:28 AimHere: Simplest. Question. Ever.

3:34 Raynes: "Excuse me, I have a problem. One moment while I fix it myself, please."

3:34 LuminousMonkey: Do we get credit for the answer?

3:34 I need that warm fuzzy feeling.

5:46 angerman: why would clojure (via lein run) print "????" instead of "äöüß"?

5:50 raek: angerman: are you running this on Mac OS X?

5:50 angerman: yes

5:50 reak I can type those characters into the terminal though.

5:50 raek: the "default encoding" is broken in the java distributed with mac os x

5:51 angerman: reak how to rectify?

5:51 raek: I think you can set an environment variable

5:51 wait a minute

5:51 angerman: ok.

5:52 raek: the java option is -Dfile.encoding=UTF-8

5:52 angerman: ok. that way I can run the jar. but how can I tell leinignen?

5:53 raek: I think you can set it via the JAVA_OPTS environment variable

5:53 angerman: i did try the :jvm-opts

5:53 but that didn't work.

5:53 ok. let's see

5:54 raek: could perhaps be related to this: https://github.com/technomancy/leiningen/issues/326

5:55 angerman: which version of lein do you use?

5:55 angerman: Leiningen 1.7.1 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM

5:56 raek: ah, sorry. it should be JVM_OPTS

5:56 angerman: hmm. no JAVA_OPTS seems right.

5:56 clojurebot: Excuse me?

5:56 raek: hm, ok.

5:56 angerman: it's working now.

5:57 raek: angerman: you should set this option globally on your system (I don't have a mac, so I don't know how to do that)

5:57 TEttinger: ,(str :hello :bruce)

5:57 clojurebot: ":hello:bruce"

5:57 angerman: reak: that's what I'm trying. JAVA_OPTS is what lein picks up. java -jar seems not to.

6:00 goodieboy: could someone explain to me how the Clojure delay class works?

6:00 Checking out the source here, there's not much: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Delay.java

6:01 If I do a google search for clojure.lang.IDeref there's even less code to look at

6:02 raek: goodieboy: if 'fn' is non-null and 'val' is null, then the delayed computation has not been forced yet and the function to compute the value is in 'fn'

6:03 goodieboy: if 'fn' is null, then he value has been forced and is stored in val

6:03 goodieboy: raek: OK makes sense so far

6:03 raek: How does it "block" other threads while the computation is running for the first time?

6:03 raek: goodieboy: the "synchronized" keyword takes care of that

6:04 goodieboy: raek: ahh!

6:04 excellent, so simple. i get it now.

6:04 thanks for pointing that out

6:04 laurus: What are the numeric types for Clojurescript based on? JavaScript ones?

6:06 bruce: what IDE do most people use - I am new to clojure

6:06 TEttinger: bruce: as far as I know, emacs is very popular, but most of them are fairly good

6:07 bruce: Anybody use eclipse? I am mixing Java a lot and like the debugger

6:07 TEttinger: bruce: http://timpner.com/computing/clojure-importing-a-leiningen-project-into-eclipse/ is useful for eclipse integration with leiningen. leiningen is a work of art; a project manager that auto-handles dependencies

6:08 (also, you use clojure instead of XML)

6:08 bruce: everybody tells me it is sweet :-)

6:08 TEttinger: the important thing with that example is to make the leiningen project first. you will rely on your project.clj primarily, and only use the eclipse .project file locally

6:10 by changing the dependencies in project.clj, you can update with `lein deps`

6:10 lein also has the wonderful `lein uberjar` for distribution, which is an uncommon feature that bundles everything in one jar -- no dependencies scattered around or in necessary adjacent folders

6:11 lein can be found at https://github.com/technomancy/leiningen/

6:12 you probably don't want lein 2.0 yet, I know of a few libs that aren't updated yet

6:12 wmealing: uncommon feature, i thought it was _the_ feature for leiningen

6:12 it is awesome

6:13 TEttinger: wmealing, yeah, that's what I mean. it is rare in the JVM ecosystem

6:13 but easy to use in leiningen

6:14 uberjar is great

6:15 angerman: how do I use clojure 1.4 date parsing function?

6:15 raek: thanks. it does work nicely now :)

6:16 so I have a date that looks like: 2012-04-30T19:18:00-07:00

6:16 and I want to get a DateTime Object from it.

6:16 bradwright: That's ISO8601 format

6:17 No idea what the latest good way of parsing that is though, sorry

6:17 angerman: I thought clojure 1.4 was able to deal with those natively, no?

6:19 progo: well, 'natively' (just a reader macro that expands to code as native as the old way). Try #inst

6:20 TEttinger: http://snipplr.com/view/62060/ ?

6:24 raek: angerman: joda-time (or the clj-time wrapper) is THE library you should use for date handling

6:25 angerman: hmm. alright. I just though stuff like this would get magically easier with clojure 1.4

6:25 raek: two iterations of date handling libraries are included in the java standard library, but both have serious defects

6:26 I think the difference is that you can write #datetime "2012-04-30T19:18:00-07:00" instead of (DateTime/parse "2012-04-30T19:18:00-07:00"), or something like that

6:26 which can be useful for serialization

6:26 since the conversion to a DateTime is done at read-time

6:27 angerman: well, now It's with Joda Time :)

6:28 raek: yeah, the design of joda time fits very well with clojure

6:28 immutable values, etc

6:29 it also treats instants differently from datetimes, which I like

6:52 goodieboy: is it considered bad practice to call code other than def and defn in a namespace, for example... *executing* functions that change the state of vars in that namespace?

6:58 raek: goodieboy: there are some legitimate uses. multimethods and derive, for example, mutate global things

6:59 you should consider what happens if you run "lein uberjar" and have AOT compilation activated for that ns

7:00 a bad thing would be to start a web server and block indefinitely

7:00 but executing alter-var-root to register a plugin, or something like that, would be perfectly fine, IMHO

7:09 goodieboy: raek: ok thanks!

7:35 casperc: hello

7:37 Is there any way to sort a map by more than one than one key with each key having it's own function to compare by?

7:39 it seems easy when the values are numeric, but how do I do it if they are not numeric and needs a custom sorting?

7:41 sattvik: casperc: Well, a map can only have one key for each value, but it can be anything you want.

7:41 You can set the method to sort the map by building it using (sorted-map-by)

7:41 casperc: sattvik: sorry, i meant a list of maps :)

7:42 sattvik: Ah, well then you can use sort-by, and provide a comparator.

7:43 casperc: like this [{:foo "x" :baa "a"} {:foo "y" :bar "b"}], where foo and bar has their own function to sort by (where foo is primary and bar is secondary to sort by)

7:43 sattvik: An easy way to create a comparator is to use the comparator function and pass it a function that will do the comparison

7:44 casperc: sattvik: ah, didn't know that one. That is probably what i need, thanks :)

7:45 sattvik: No problem.

8:09 raek: casperc: juxt is very useful here: ##(sort-by (juxt :foo :bar) [{:foo "x" :baa "a"} {:foo "y" :bar "b"}])

8:09 lazybot: ⇒ ({:foo "x", :baa "a"} {:foo "y", :bar "b"})

8:09 raek: you can of course replace :foo and :bar with other functions

8:14 casperc: raek: cool, this just extracts the right keys to sort by though, right? How do I then write the comparator for each key?

8:16 raek: casperc: first, sort-by takes a "key-fn", i.e. a function that takes a value and produces another value used for comparison. this is a little bit different than a comparator function, which takes to values and returns an integer

8:16 you can sort using a comparator too

8:17 to make a key-fn for foo that sorts by the string reversed, do something like this

8:17 (juxt (comp reverse :foo) :bar)

8:18 (comp reverse :foo) extracts the :foo value from the map and then reverses it (assuming it's a string)

8:18 juxt will evaluate some functions "in parallel" with the same arguments, and then make a vector of the results

8:19 and vectors compare the way you want here, i.e. lexicographically

8:19 &(< [1 1 0] [1 2 0])

8:19 lazybot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number

8:19 raek: &(compare [1 1 0] [1 2 0])

8:19 lazybot: ⇒ -1

8:23 casperc: raek: sry, didn't see your messages. Let me just show the solution i arrived at. It works but is not idiomatic probably

8:23 i have a vector of maps which i need sorted according to two predified orders:

8:23 (def handling-order ["OPRET", "SKIFT", "OPSIG", "ANNULLER", "GENAABEN", "PROVISIONER", "FLYT", "OVERDRAG", "SKIFT_MODEMAKTIVERINGSKODE", "SKIFT_ANUMMER", "FORTRYD_SKIFT_ANUMMER"])

8:23 (def fo-ordering ["clear" "dtv" "bb" "mobb" "tlf"])

8:24 then i wrote a comparator: (defn handling-comparator [x y] (let [x-handling [(.indexOf handling-order (:handling x)) (.indexOf fo-ordering (:fo x))] y-handling [(.indexOf handling-order (:handling y)) (.indexOf fo-ordering (:fo y))]] (compare x-handling y-handling)))

8:24 then i can sort like this: (sort handling-comparator [{:handling "SKIFT" :fo "clear"} {:handling "OPRET" :fo "dtv"} {:handling "ANNULLER" :fo "tlf"}])

8:27 raek: I would do something like (def handling-order (zipmap ["OPRET" ...] (range))) (def fo-ordering (zipmap ["clear" ...] (range)))

8:27 those vars will then contain maps from strings to integers

8:27 and handling-order can be used as a key-fn

8:28 (sort-by (juxt handling-order fo-ordering) [...])

8:29 casperc: I usually find it easier to work with key-fns instead of comparators

8:29 they are easier to compose

8:29 casperc: raek: yeah, I agree my solution is not very composable :)

8:30 I'll just give yours a spin

8:30 raek: sorry, the last example is incorrect. it should be: (sort-by (juxt (comp handling-order :handling) (comp fo-ordering :fo)) [...])

8:31 and it's probably wise to split out that key-fn into its own def

8:31 madsy: What's considered best in general? A lot of repeated expressions, or a big let form?

8:32 raek: code duplication should be avoided

8:32 casperc: what language is this? Danish?

8:32 casperc: yeah :)

8:33 achin: This is weird. When I run "lein ring war" now, lein throws an NPE in leiningen.core.main. I'm having trouble debugging this. Any ideas?

8:33 madsy: raek: Yeah, I agree. It's just that all my books emphasize to avoid state. I guess let is okay.

8:33 raek: madsy: what does let has to do with state?

8:34 madsy: raek: Even though the data is immutable, you do store it somewhere as opposed to using functions only.

8:36 raek: I wouldn't consider assign-once variables to be mutation

8:37 madsy: then function parameters would be bad for the same reason

8:38 achin: Ah. Looks like updating to 0.6.6 fixes things.

8:38 raek: madsy: if clojure books say that you should avoid state in calculations, they probably mean that you shouldn't use things like atoms or refs

8:40 madsy: yep

8:46 solussd_: does clojurescript's 'ns' support :use now?

9:18 jroes: so I heard all the cool kids are using clojure

9:18 thought I would join in

9:23 devn: jroes: welcome!

9:24 fdaoud: jroes: indeed clojure is very cool, hope you like it too.

9:25 jroes: thanks for the welcome :)

9:25 anything neat you guys are working on?

9:26 michaelr525: hey

9:27 fdaoud: jroes: I'm using it to run a hockey playoff pool at http://www.fdaoud.com/hockey

9:31 jroes: fdaoud: cool. Jimbo is killing it!

9:32 fdaoud: jroes: indeed, and he finished 1st and 2nd in the last two years, too

9:32 jroes: not bad

9:32 fdaoud: jroes: in case you're interested: http://oreillynet.com/pub/e/2273

9:33 jroes: hey, that's pretty cool! I think I might check that out

9:33 fdaoud: yeah, I'm looking forward to it. cemerick is a cool cookie.

9:34 jroes: at the bottom of the pool, Nadia, that's my wife :) She got every single team wrong in the first round, which is just as "difficult" as getting them all right, when you think about it..

9:34 jroes: hahahaha, that's awesome

9:34 she must be picking all dogs

9:35 fdaoud: well, there were some surprises and some non-surprises.. she really got unlucky

9:35 casperc: raek: sry, just had to leave for a while. Thanks for the help, i'll go with your solution now that I had time to understand it a bit better :)

9:36 jcromartie: this is weird… when I have an org.mozilla.javascript.NativeArray object, Clojure throws lots of "No matching field found" errors when I try to call methods

9:36 this class http://www.docjar.org/docs/api/org/mozilla/javascript/NativeArray.html

9:36 but (.get a 0) says "No matching method found: get for class org.mozilla.javascript.NativeArray"

9:36 that's obviously a real method

9:36 michaelr525: anyone knows how to pprint into a string instead of stdout?

9:36 jcromartie: but Clojure doesn't think so

9:38 joegallo: michaelr525: well, print-str takes whatever you print, and turns it into a string. and pprint prints things prettily...

9:38 so, you could (print-str (pprint whatevs))

9:38 ,(print-str (clojure.pprint/pprint "whatevs"))

9:38 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.pprint>

9:39 joegallo: lies!

9:40 michaelr525: '(user 'clojure.pprint)

9:40 '(use 'clojure.pprint)

9:40 joegallo: itym (use 'clojure.pprint), but i dunno if that works here with the bots.

9:40 ,(use 'clojure.pprint)

9:40 clojurebot: nil

9:41 joegallo: ,(print-str (clojure.pprint/pprint "whatevs"))

9:41 clojurebot: "whatevs"

9:41 "nil"

9:41 joegallo: so it does.

9:41 fdaoud: joegallo: score!

9:41 Bronsa: michaelr525: use with-out-str

9:41 joegallo: heh, yeah, good call Bronsa.

9:41 Bronsa: ,(with-out-str (print "derp"))

9:41 clojurebot: "derp"

9:41 Bronsa: joegallo: :)

9:41 joegallo: haven't had any coffee yet today.

9:41 fdaoud: I'm surprised that worked, I thought the bot would have sent you packing joegallo

9:41 Bronsa: hah, another coffee addicted

9:42 michaelr525: thanks with-out-str works great :)

9:46 achin: Does lein support subprojects or modules or something similar?

9:48 fdaoud: Bronsa: mmmm coffeeee

9:50 xeqi: achin: look at checkouts

9:50 achin: xeqi: Thanks.

10:03 michaelr525: what would be a good way to retrieve an element at a specified path from clojure/xml structure?

10:03 something like xpath for clojure i guess

10:04 ambrosebs: does anyone have a Clojure project that could especially benefit from static typing?

10:04 devn: michaelr525: i wrote something really simple that frankly isn't very good

10:04 ambrosebs: looking for examples

10:05 devn: ambrosebs: i dont personally, but my guess is the list would provide a number of answers

10:05 jsabeaudry: How can I go a document.getElementById in clojurescript? (I tried (js/getElementById js/document "myid") and (js/document.getElementById "myid")

10:05 halgari: ambrosebs: I would suggest looking at graphics processing...there's dozens of simple algorithms that work with 2d bitmaps

10:06 ambrosebs: most of these algorithms will perform horribly if done with boxing, but run quite well when used with static typing.

10:07 devn: michaelr525: https://github.com/devn/yokogiri

10:07 it's really...really nothing fancy, but it works

10:09 jsabeaudry: Ah, (.getElementById js/document "myid") of course!

10:10 ambrosebs: halgari: so using static typing to prove that certain code doesn't get boxed? I hadn't really considered that

10:10 does the compiler help you write such code atm?

10:12 halgari: ambrosebs: currently the compiler should generate optimal code if you throw the right tags at it.

10:12 What might be interesting though is that there are two ways to refer to colors. if you use bytes for each pixel then then each element will be 0-255 if you use floats then it's 0-1

10:13 fliebel: ambrosebs: Is typed clojure typed in the sense that java is typed, or just to prove things about your fns?

10:13 halgari: so static typing might be able to help there, you wouldn't be able to throw the wrong pixel info at the wrong algorithm until the type is converted

10:13 ambrosebs: oh right, I'm not looking to affect compilation

10:14 no it's basically a static type checking phase performed a la carte

10:15 the plan is to build something as a separate phase, then consider how it might fit in with compilation

10:15 fliebel: ambrosebs: That is, it's for security, not for speed?

10:16 Chousuke: correctness, rather, I guess.

10:16 ambrosebs: fliebel: Basically yes. you could possibly also avoid some runtime assertions

10:16 halgari: ambrosebs: ah! I see, well them my suggestion isn't as broad as you're looking for then.

10:16 Chousuke: from what I can tell, it would be a library for compile time assertions about code. That can be useful for many things

10:16 jimduey: ambrosebs: Re: Conduit. It could use static type checking because you often end up passing around hash-maps.

10:17 And if you have missing keys, the errors can be tough to track down

10:17 So I was pretty psyched about your efforts. Looking forward to seeing what comes of them.

10:17 ambrosebs: jimduey: would it be possible to convert the hash-maps to Records?

10:18 jimduey: Yep

10:18 ambrosebs: heterogeneous maps are tougher

10:18 I'm expecting a few style rules:

10:18 use records over maps

10:18 Chousuke: you could statically check literals at least.

10:18 jimduey: You can actually pass anything you want. Hash maps are just very convenient. Records would be totally doable.

10:19 ambrosebs: only use heterogenous maps over short distnaces (destructuring)

10:19 Chousuke: yes, that's essential for destructuring and keyword args

10:19 but in general, it gets really tough

10:26 devasia: whois beepboop

10:38 ambrosebs: fliebel: two of the main goals are to prevent runtime arity exceptions and to eliminate null pointer exceptions

10:38 it will interesting how far I get with the latter goal.

10:39 madsy: Uh.. has anyone experienced leinigen crashing for no apparent reason?

10:40 I did a lein search tools.trace and suddenly even starting it with "lein help" crashes.

10:42 bhenry: ping ibdknox

10:43 michaelr525: devn: it should work with xml documents as well?

10:44 bhenry: can i access $this with jayq?

10:46 in a click event

10:46 jcromartie: so someone help me understand this: IllegalArgumentException No matching method found: get for class org.mozilla.javascript.NativeArray clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:52)

10:46 for (.get a 0)

10:47 a is a NativeArray, and "get" is definitely a method of NativeArray taking an integer as its only argument

10:47 as indicated by http://www.docjar.org/docs/api/org/mozilla/javascript/NativeArray.html

10:48 err, these docs are better http://marianoguerra.com.ar/docs/rhino-1-7R3/org/mozilla/javascript/NativeArray.html

10:48 it's supposed to implement java.util.List but Clojure doesn't believe it

10:48 http://marianoguerra.com.ar/docs/rhino-1-7R3/org/mozilla/javascript/NativeArray.html#get(int)

10:49 jtoy: is it ok to do nested lets ?

10:49 madsy: jtoy: sure

10:50 jtoy: But if your function grows so big as to need more than one scope, maybe consider splitting it up.

10:51 jcromartie: and every time I use a method like .get it yields a reflection warning, too

10:53 hm, so (.get a 0 a), which is get(int index, Scriptable start), seems to work, but not just get(int index)

10:53 raek: jcromartie: it looks like the get method takes two parameters (in addition to the instance)

10:53 (.get array index start)

10:54 jcromartie: raek: yeah, I just discovered that works, but it's supposed to implement other interfaces

10:54 i.e. java.util.List

10:54 but (isa? a java.util.List) is false… hmm

10:55 raek: jcromartie: use instance? here

10:55 jcromartie: hm

10:55 raek: isa? checks the relationship of two types

10:55 jcromartie: false

10:56 however, the source code clearly says it implements List https://github.com/mozilla/rhino/blob/master/src/org/mozilla/javascript/NativeArray.java

10:56 raek: in the first javadoc you linked it doesn't implement java.uti.List

10:56 maybe that interface was implemented in a later version

10:58 jcromartie: maybe

10:59 it was added 2 years ago in source

10:59 madsy: Hm. So leiningen crashed due to a non-working jar. Doesn't org.clojure/tools.trace 0.7.3 work with Clojure 1.3?

11:02 jcromartie: damn yeah, it's the main Maven repos

11:02 they only have a release from 2009

11:02 and nobody has ever added the latest from 2011!

11:02 lazy bastards

11:03 and the package name changed

11:04 Googling "maven rhino" yields this artifact, which is outdated: http://mvnrepository.com/artifact/rhino/js while the new one is here http://mvnrepository.com/artifact/org.mozilla/rhino and doesn't really show up in my Googlings

11:05 devn: what's the old name for the io portion of contrib? duck...

11:07 dakrone: devn: duck-streams I believe

11:07 redinger: definitely duck-streams

11:08 devn: ah right, thanks

11:14 raek: devn: at one point there were two: clojure.contrib.duck-streams and clojure.contrib.io

11:16 S11001001: duck-streams sounds cooler than io

11:16 antares_: madsy: see https://github.com/clojure/tools.trace

11:18 madsy: antares_: I did. It says it should work with Clojure 1.3. No idea what the issue is then.

11:19 Leiningen tries to download it from maven, then crashed with a zip archive exception

11:19 antares_: madsy: can you gist stack trace?

11:20 S11001001: madsy: rm -rf ~/.m2/repository/org/clojure/tools.trace

11:21 madsy: S11001001: I already deleted the jar. Redownloading it made no difference.

11:23 jtoy: can someone help me with this logic : http://pastebin.ca/2142919 I'm not quite sure what I'm doing wrong

11:27 joegallo: jtoy: ((.close (:body resp))

11:27 madsy: antares_: https://gist.github.com/2568726

11:28 joegallo: that looks an awful lot like you're invoking the result of a java method as if the result were a clojure function.

11:28 a double opening paren is a rarish thing in clojure, typically.

11:28 might not be the problem at hand, of course.

11:29 Raynes: Yeah, no way that can actually work.

11:29 antares_: madsy: looks like one of the .jar files is broken (is empty)

11:29 madsy: yep

11:29 jtoy: joegallo: oh, i had a do in there, got lost somehow

11:29 antares_: madsy: but it happens to be at leiningen.plugin$install$fn__3241.invoke(plugin.clj:63)

11:29 madsy: can it be one of your plugins? is this with lein2?

11:30 madsy: No, lein 1.7.1

11:30 And I only have swank-clojure installed, nothing else

11:44 antares_: Sorry, I was being an idiot

11:50 wkmanire: Gooooooooooooood mrning.

11:59 fmn: Can I limit the stack, let's say during unit tests to assert that it won't blow up after refactoring?

12:00 wkmanire: fmn: You want to set an artificial stack size limit?

12:00 fmn: Yes

12:00 wkmanire: That's an interesting idea.

12:00 So you can assert that you've achieved tail-call optimization?

12:01 fmn: Precisely

12:01 wkmanire: I have no idea how you would do that.

12:01 clojurebot: Gabh mo leithscéal?

12:01 S11001001: give it unbounded input and fail if your program ever finishes

12:01 I think there's an algorithm you can use to tell that

12:02 TimMc: haha

12:05 robnik: anyone here working with clojurescript? I'm about to port a GWT app and wondering if it works the same way as far as having some .clj files that are compiled to both JVM and JS. ?

12:06 In GWT you have 3 kinds of java code: server, client, shared.

12:06 creese: has anyone posted the link to the webcast already?

12:06 fdaoud: creese: http://oreillynet.com/pub/e/2273

12:07 creese: I'm already signed up. Just wanted to make sure it had been mentioned in the channel.

12:08 fdaoud: creese: I mentioned it earlier to someone..

12:08 creese: I just ordered his book. Haven't got it yet.

12:08 fdaoud: I got fed up of delays and got the ebook instead

12:09 creese: http://clojure.org/cheatsheet

12:09 by far the best resource I have found yet

12:09 fdaoud: nice!

12:12 ibdknox: bhenry: you use (this-as me ... (css me ..))

12:15 bhenry: ibdknox: is this-as in core?

12:16 ibdknox: bhenry: yeah, it's a macro

12:16 bhenry: and by core you mean cljs.core, right?

12:16 bhenry: sweet. yeah

12:16 thanks. i'll give it a shot.

12:18 madsy: Yay, found my bug thanks to tools.trace

12:20 bhenry: ibdknox: thanks again. it's just what i needed.

12:20 ibdknox: bhenry: np

12:20 jsabeaudry: How to transform 3 in :3 ?

12:21 I cant remember the bot command to ask this

12:21 dnolen: ,(keyword (str 3))

12:21 clojurebot: :3

12:21 jsabeaudry: dnolen, thank you good sir

12:22 fliebel: But what is the command to ask lazybot to return a function that does what you want?

12:23 $findfn 1 1 2

12:23 lazybot: [clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int clojure.core/bit-shift-left]

12:23 fliebel: that one

12:23 mdeboard: &(keyword 3)

12:23 lazybot: ⇒ nil

12:23 mdeboard: huh

12:23 why is it thus, dnolen

12:23 fliebel: $doc +'

12:24 mdeboard: I guess keyword just requires a string type arg

12:24 dnolen: ,(doc keyword)

12:24 clojurebot: "([name] [ns name]); Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically."

12:24 dnolen: mdeboard: yes, keyword expects strings.

12:24 fliebel: what is +' ?

12:24 dnolen: fliebel: autopromoting +

12:25 fliebel: &(doc +')

12:25 lazybot: ⇒ "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +"

12:25 fliebel: (doc +")

12:25 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>

12:25 mdeboard: I appreciate the dearth of type coercion in Clojure.

12:25 fliebel: (doc +'')

12:25 clojurebot: Titim gan éirí ort.

12:27 fliebel: dnolen: To BigInt? Because + already promotes ints to long, right? At least, I thought unsafe-add did *not* do that.

12:28 * fliebel facepalm at +"

12:28 dnolen: fliebel: + isn't about promotion.

12:28 mdeboard: Is there a command for the repl to output the source of a fn?

12:29 dnolen: mdeboard: there is, but it's easier to just use lein2

12:29 fdaoud: ,(source +)

12:29 clojurebot: Source not found

12:29 fliebel: dnolen: What is it about then?

12:30 dnolen: fliebel: checked arithmetic on 64 bit primitives.

12:32 fliebel: checked, promoting... *confused* So... checked math does what when something overflows? I thought it promoted in that case, but maybe it just raises an exception?

12:32 dnolen: fliebel: exception

12:32 fliebel: aha

12:33 not sure why I would want an exception, as opposed to just promoting or overflowing.

12:34 dnolen: fliebel: this is a 2 year old conversation perf

12:36 mdeboard: dnolen: Before I tell someone wrong, are you the author of core.logic

12:36 fliebel: dnolen: ?

12:36 dnolen: mdeboard: yes, though to be clear it's an implementation of an existing system for Scheme - miniKanren.

12:37 fliebel: performance

12:39 ibdknox: woah

12:39 did you guys see this: http://int3.github.com/doppio/about.html

12:39 fdaoud: dnolen: as in The Reasoned Schemer?

12:39 dnolen: fdaoud: yes.

12:42 ibdknox: no one has something to say about the JVM implemented in CoffeeScript? :p

12:42 dnolen: ibdknox: seemed wacky and not useful?

12:42 ibdknox: neat, nonetheless

12:42 fdaoud: Java 4?

12:42 technomancy: ibdknox: we're all just trying to avoid the yo dawg jokes

12:42 ibdknox: technomancy: haha

12:42 fdaoud: that's so 1999

12:49 TimMc: fdaoud: nope

12:50 That would be... Java v1.2, I think?

12:50 I remember because that's when I learned Java. :-)

12:51 fdaoud: TimMc: whatever :) That's so 2002.

12:57 Raynes: ibdknox: This is me berating you about lein-noir for metajack.

12:57 Go write things and do stuff.

13:00 hcumberdale: damn!

13:00 computer defect

13:05 jroes: everyone here checking out this clojure intro webcast? :)

13:07 Mordus: Is anyone using Vaadin from Clojure?

13:07 solussd_: jayq question: how do I kick off an 'anim' animation when some event happens to some element, e.g. can I bind a function that kicks off an animation? What would that look like? '

13:07 creese: jroes: yes

13:08 looking forward to seeing the tools setup

13:09 Raynes: ~anyone

13:09 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 ..."

13:10 Mordus: Looking for opinions on the use of Vaadin from Clojure, and stories based on people's experience with it. Thinking of trying it out for a project.

13:16 fliebel: Mordus: I think the usual Java XML inheritance boilerplate will leak trough, but otherwise it looks nice.

14:11 scottj_: Mordus: looks cool so long as heavy server resources per user and latency aren't a problem (enterprise apps).

14:27 hcumberdale: anyone know what small noiseless computer to buy?

14:27 qu1j0t3: for what

14:27 robertstuttaford: hello, are there any clojurescript adepts here?

14:28 austinh: ~anyone

14:28 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 ..."

14:29 robertstuttaford: ok. can i have clojurescript generate an externs for all the exported symbols in the source?

14:29 i want to load in a cljs js binary as a module into an existing gclosure codebase

14:30 dnolen: robertstuttaford: that would be a nice feature to add to the Closure bit of CLJS. :emit-externs flag or something like that.

14:30 robertstuttaford: ad to do that i need to extern it so that the gcl base knows not to minify the bridging symbols

14:31 ibdknox: it's a problem I'll need to solve eventually

14:31 robertstuttaford: i figure since the exports are metadata, there must be some niftacular way of adding em all up?

14:31 aside: i'm a clojure newb. haven't written a damn thing yet. still reading the new Programming Clojure book.

14:33 very excited by ClojureScript One, although the module i would like to write is the backend + client-side api for same, which'll probably only use bits and pieces found in One

14:34 cemerick: Well, that was hell.

14:34 robertstuttaford: has anyone produced cljs apps that are broken up in this manner? using symbol exports + externs

14:34 scottj_: hcumberdale: macbook air

14:35 dnolen: robertstuttaford: a simple way would be to regex out goog.exportSymbol(...) after basic compilation.

14:35 ibdknox: scottj_: totally not silent

14:35 dmi3y: cemerick: thanks for the webcast, well done

14:35 cemerick: So, if you were in the O'Reilly webcast just now, I apologize for me stuffing the thing.

14:35 dnolen: robertstuttaford: a better way would be to augment the compiler - patch welcome.

14:35 robertstuttaford: dnolen: sure thing. lemme just get 3-6 months of clojure under my belt, first

14:36 scottj_: ibdknox: oh my bad, I thought Linus had one in large part because it was quiet.

14:37 robertstuttaford: i asked this on the ggroup as well, but since you're here :-) any plans for the compiler to instrument the interim js with jsdoc annotations? those really help with producing a faster, tighter advanced-mode js binary

14:37 samaaron: cemerick: you didn't stuff it - it rocked

14:37 ibdknox: scottj_: it's got a fan, so if you do anything hefty with it, it'll take flight ;)

14:37 dnolen: robertstuttaford: ;) you probably don't need that much time. CLJS compiler is not nearly as scary as it sounds still only ~3000 lines of code.

14:37 samaaron: although i think you threw a couple of people with the ref

14:37 JustinCampbell: @cemerick figured it out, problem was ab sucks ;)

14:37 siege worked great

14:37 samaaron: and your weird pronunciation of leiningen

14:37 :-)

14:37 cemerick: JustinCampbell: oh, apachebench :-)

14:37 cool

14:37 JustinCampbell: ya

14:38 dnolen: robertstuttaford: no one's working on that at the moment.

14:38 fdaoud: cemerick: nice presentation and I admire your courage of doing it unrehearsed!

14:38 cemerick: samaaron: gah, it was super when I did my dry run, and then I decided to swap out a couple of things and confused myself all to hell. Bad move.

14:38 scottj_: hcumberdale: raspberry pi maybe, I don't see a fan on wikipedia. doesn't get much smaller than that.

14:38 cemerick: fdaoud: I did a dry run, but stupidly changed things for the real deal.

14:38 samaaron: cemerick: it's all part of the learning process

14:38 robertstuttaford: i'm so unhappy i was unable to watch that 'cast, cemerick. i'm so totally the target market

14:38 was it recorded?

14:39 samaaron: cemerick: you motivated your ref with arguments that also apply to atoms

14:39 cemerick: robertstuttaford: should be

14:39 fdaoud: cemerick: that's ok, I have respect for people who don't pretend like everything always works perfectly.

14:39 samaaron: still, i think it was a drop in the ocean

14:39 it was a great presentation overall

14:40 scottj_: first keynote of railsconf is up, so maybe rich's is close behind.

14:40 cemerick: well, lesson #1 is: just copy/paste the code, and focus on the explanation

14:40 fdaoud: I was just wondering why eclipse was giving you that one red X at the top, throughout

14:40 robertstuttaford: cemerick: i don't see anything about it on the page. will you tweet about it when you find out?

14:40 cemerick: robertstuttaford: certainly

14:41 robertstuttaford: wicked. btw, LOVING your book. first FP book i can actually read

14:41 kudos. seriously.

14:42 qu1j0t3: robertstuttaford: which book is this?

14:42 robertstuttaford: right-hand side of http://cemerick.com/

14:42 http://www.clojurebook.com/

14:43 qu1j0t3: robertstuttaford: which books did you find opaque?

14:43 robertstuttaford: cemerick: your decision to include the practicums was a wise one. i've plenty web experience with all the languages, bad and good. it's nice to be able to read some theory and then switch over to see that theory in practice in a space i'm comfy with

14:44 scottj_: cemerick: one thing I like about the pricing of your book on amazon is that it's just enough to get free shipping. it's always annoying when books end up at $24 and you have to either pay $5 shipping or find another item to get over the bump.

14:45 cemerick: fdaoud: because I had the Clojure builder on while there was an error, but turned it off before I fixed it.

14:45 robertstuttaford: qu1j0t3: i've tried to read online tuts for haskell and erlang and those just left me wondering just how stupid i actually am. i got about half way through The Little Schemer, which i actually quite enjoy, and will attack again soon

14:45 cemerick: scottj_: tragically, we have no control at all over the book's pricing. :-)

14:45 qu1j0t3: robertstuttaford: TLS has a good rep. Did you try SICP, btw?

14:45 creese: cemerick: great talk

14:46 cemerick: creese: you are too kind :-)

14:46 robertstuttaford: i think i was also finally ready for it. um, i have SICP. haven't tried it, yet

14:46 cemerick: robertstuttaford: I'm glad you're liking it. :-)

14:46 ibdknox: cemerick: it's a very hard medium, I hated doing screencasts

14:47 robertstuttaford: it's a little frustrating because i'm only at chapter 4 and i'm having to accept that i don't know how atoms or refs or multimethods or macros work yet and still puzzle out what's going on in the code i'm reading everywhere

14:47 qu1j0t3: robertstuttaford: there are some non-lisp books that are pretty approachable, too. I like ML For the Working Programmer, Applicative High Order Programming, and Henderson's Functional Programming Application and Implementation. -- though I have finished none of them yet, they cover a lot of ground.

14:47 robertstuttaford: but i'll get there. having fun

14:47 qu1j0t3: robertstuttaford: SICP is very rewarding, but I am only in Ch.2.

14:48 robertstuttaford: thanks for the recommends, qu. i'll add them to the list

14:50 cemerick: ibdknox: My screencasts rarely involve me coding, and even those I do multiple takes on. Programming and talking at the same time is clearly not a good idea. :-P

14:51 I should have talked while I did my (very clean) dry run last night, so I could see just how rough it was going to be.

14:51 technomancy: if anyone is looking for an easy way to contribute to Leiningen we've got a bunch of issues tagged "newbie" that should be pretty accessible: https://github.com/technomancy/leiningen/issues?direction=desc&labels=&milestone=4&sort=created&state=open

14:52 ibdknox: cemerick: I'm sure you did fine. :) But yeah, I learned that the hard way a couple of times. Never code in front of people unless you're willing to practice the hell out of it. Most of the time it's better to just make the code magically appear :)

14:52 robertstuttaford: i quite like watching folks code. you learn a whole bunch, generally speaking

14:52 ibdknox: cemerick: the only way it works is if you have don't have to think about the code at all

14:53 robertstuttaford: absolutely, it's just very hard to give a coherent presentation at the same time

14:53 robertstuttaford: true :)

14:53 ibdknox: you literally have to make it automatic

14:53 cemerick: ibdknox: my biggest problem is that my dry run included compojure the whole way through, but I decided at the last minute to talk in detail about ring. Of course, what happens when you return a string from an unadorned ring hander? :-x

14:54 ibdknox: cemerick: haha

14:54 cemerick: I was pretty thrown from there on out.

14:54 creese: I thought the talk was very useful. I've seen enough power points.

14:54 robertstuttaford: +++ OUT OF CHEESE ERROR +++ ?

14:54 cemerick: Figured it out, but…sheesh.

14:54 robertstuttaford: *exactly* that.

14:54 :-)

14:54 robertstuttaford: -chuckle-

14:54 ibdknox: cemerick: yeah.. that happened to me in a keynote once

14:54 * ibdknox sigh

14:54 ibdknox: fucking VB

14:54 lol

14:54 cemerick: Then I look over and three people in the chat room are yelling DUDE YOU NEED A RESPONSE MAP!

14:56 robertstuttaford: good luck with lighttable, ibdknox. looking forward to seeing where you end up

14:56 ibdknox: robertstuttaford: thanks :)

14:56 shadowh511: ibdknox: areyou the lighttable dev?

14:56 ibdknox: yep

14:56 shadowh511: :D

14:56 madsy: ibdknox: I wonder, how are you going to make the instant-feedback work with other languages than clojure? (and maybe javascript)

14:57 shadowh511: I'm really excited for it

14:57 ibdknox: madsy: live evaling code is pretty straightforward

14:57 shadowh511: hell, I should donate

14:57 ibdknox: madsy: given a dynamic runtime

14:57 shadowh511: how far are you from the goal?

14:57 ibdknox: 76% of the way there

14:57 robertstuttaford: i kinda blame you for tipping the balance on my decision to go clojure. that video was really interesting, it got me curious. then i discovered cljs and its relation to gclosure (i'm around 8kloc into a gclosure base now .. yick), and then the HackerNews post about the new Programming Clojure book landed like a day later

14:58 cemerick: robertstuttaford: which video?

14:58 ibdknox: I have a couple of very neat things I'm working on to show before it closes, so I think I shouldn't have too much issue pushing it over

14:58 robertstuttaford: the lighttable one

14:58 madsy: ibdknox: Care to explain? It sounds a bit scary if you use it on accident on some code that writes to network/files or something else.

14:58 cemerick: ah

14:58 madsy: by*

14:58 cemerick: robertstuttaford: well, when things go pear-shaped, you need to talk to ibdknox then. ;-)

14:58 madsy: I thought maybe you could read clojures metadata for that, but what do I know.

14:59 robertstuttaford: i guess seeing the live values moving through the clojure code in the vid turned a light on somewhere

14:59 ibdknox: madsy: it won't be on for everything, you'll have to opt in - just like you would for executing code in a repl

14:59 robertstuttaford: cemerick: noted :)

14:59 ibdknox: madsy: that particular notion isn't perfect for everything, that's for sure

14:59 madsy: ibdknox: So you could for example opt-in by setting a metadata variable?

14:59 Because that was my first impression

14:59 Mark code as safe/unsafe

14:59 technomancy: yeah, I was thinking about implementing it using metadata to provide seed values

14:59 ibdknox: madsy: there are a whole host of potential solutions there

14:59 madsy: ok

14:59 ibdknox: technomancy: yeah

15:00 robertstuttaford: how does ClojureOne get the live page changes right if cljs doesn't support eval?

15:00 ibdknox: technomancy: I was thinking of annotating something so that you could say "instead of executing provide this value"

15:00 technomancy: annotating defns?

15:00 ibdknox: technomancy: yep

15:01 technomancy: like a pre-memoization?

15:01 emezeske: cemerick: Hey, did you happen to see my pull request for friend? I'm curious if you have any thoughts.

15:01 ibdknox: more like a mock I think

15:01 shadowh511: ibdknox: lighttable will have a linux binary, yes?

15:01 ibdknox: yeah

15:01 technomancy: ibdknox: oh sure; I've done that

15:01 cemerick: emezeske: I did; it's in a browser tab, so it shouldn't be long now ;-)

15:01 ibdknox: technomancy: that up somewhere? :)

15:01 technomancy: ibdknox: http://technomancy.us/141

15:01 shadowh511: ibdknox: as soon as I get home, I will donate

15:02 emezeske: cemerick: Haha, so I'm not the only one that has a bunch of tabs as my todo list? :)

15:02 cemerick: emezeske: oh, actually: those "unused" bindings in authenticate are there for documentation, as workflows and such are expected to use them :-)

15:02 ibdknox: technomancy: cool

15:02 alright, gotta run

15:02 technomancy: I don't think I ever used it though

15:02 ibdknox: Going to go talk to David Pollack :)

15:03 minus the c

15:03 emezeske: cemerick: Oh? I can undo that. They never get passed into the workflow function, though, or do they?

15:03 shadowh511: be back later guys

15:03 cemerick: emezeske: the entire authentication config is added as a key to request maps

15:04 emezeske: cemerick: Ahh, gotcha, makes sense, I will just amend that commit

15:04 cemerick: thanks

15:05 emezeske: cemerick: One other question I had -- in workflows.clj, is it right to refer to e.g. ::friend/workflow instead of :friend/workflow?

15:05 cemerick: I'm trying to figure out how they differ.

15:05 cemerick: yes

15:05 fdaoud: cemerick: just to add to the fun, and totally not your fault but still distracting, when you showed your screen the first time, a ton of people started screaming that it wasn't working, and then it was mentioned that IE and FF (but not chrome) were supported, and it was using flash, and... I braced myself for the whole thing to go to <...> !

15:06 cemerick: ,(require '[clojure.set :as set])

15:06 clojurebot: nil

15:06 cemerick: heh, cook

15:06 ,(namespace ::set/foo)

15:06 clojurebot: "clojure.set"

15:06 cemerick: ,(namespace :set/foo)

15:06 clojurebot: "set"

15:06 cemerick: emezeske: ^^

15:06 emezeske: cemerick: Ahh, so it makes sure the namespace is fully qualified

15:06 cemerick: yes

15:06 emezeske: cemerick: Thank you, easy explanation

15:07 cemerick: I need to file bug reports with kibit and eastwood, which blow up upon seeing those

15:07 cemerick: fdaoud: heh, you should see what the speaker side of things looks like :-O

15:07 * robertstuttaford downloads all of Mostly λazy

15:08 fdaoud: cemerick: eek!

15:08 doesn't sound, er, stress-free

15:10 emezeske: cemerick: I amended the commit.

15:10 cemerick: fdaoud: FF only AFAICT, flash, and translucent applets for screen sharing. :-P

15:11 emezeske: cemerick: FYI, I've built a very nice login system on top of friend, with login throttling and password recovery. It was pretty easy to do!

15:11 fdaoud: cemerick: was your CPU usage through the roof?

15:11 samaaron: cemerick: does the speaker side of things look different???

15:11 lazybot: samaaron: Oh, absolutely.

15:12 cemerick: lazybot: botsnack

15:12 lazybot: cemerick: Thanks! Om nom nom!!

15:12 cemerick: That was the best lazybot response I've ever seen.

15:12 samaaron: haha

15:12 lazybot: botsnack

15:12 lazybot: samaaron: Thanks! Om nom nom!!

15:12 cemerick: fdaoud: No; it was smooth enough, just lots of knobs, pipes, and widgets.

15:12 I think the main console accidentally wafted into the screen sharing near the end.

15:13 fdaoud: cemerick: yes it did

15:13 amalloy: emezeske: there's not much eastwood and kibit can do about ::foo/bar

15:14 it's a token that the reader will only process if you're actually compiling/executing the namespace - it's meaningful only in context of a namespace. if you just read the source-code forms it doesn't work

15:15 haha cemerick, i'm glad you like the ??? plugin. i added it because questions that end with ?? usually get answered with a "no", but i added the positive ???-endings for symmetry

15:15 jonasen: amalloy: I think ::foo/bar will work in eastwood

15:15 but not in kibit

15:15 amalloy: jonasen: i don't remember, do you (or rather analyze) actually execute the forms as you read them, or just read?

15:15 cemerick: Is amalloy awesome???

15:15 lazybot: cemerick: Yes, 100% for sure.

15:16 jonasen: analyze requires the namespace

15:16 samaaron: amalloy is awesome except for the part of his life where he ate a whole pint of bacon

15:17 amalloy: yes, a more superlative word than awesome is necessary for that

15:17 emezeske: amalloy: I see, interesting.

15:17 fdaoud: I thought he shared some of that bacon.

15:17 amalloy: i did!

15:17 samaaron: fdaoud: perhaps he pretended to..

15:17 amalloy: would it be at all polite to eat the WHOLE thing in front of such a crowd of nice guys??

15:17 lazybot: amalloy: Definitely not.

15:18 amalloy: clojurebot: bacon is <reply> Thanks! Om nom -- error: emotion overload

15:18 clojurebot: c'est bon!

15:18 lynaghk: dnolen: ping.

15:18 dnolen: lynaghk: pong

15:19 lynaghk: dnolen: do you have any experience with FRTime?

15:19 dnolen: hmm not really why?

15:19 lynaghk: dnolen: it's a reactive dataflow evaluator for scheme

15:19 dnolen: yeah

15:19 lynaghk: dnolen: I'm considering porting it to Clojure/ClojureScript. To show up those meteor folks =P

15:19 dnolen: cool!

15:20 lynaghk: dnolen: except I'm in no way qualified or familiar with any of that stuff, so I was hoping I could mention it and you'd pull it out of your hat some evening

15:21 dnolen: in all seriousness though, I'm worried that performance would be really hard to nail down on something like that

15:22 dnolen: lynaghk: why, isn't that mostly chaining functions together?

15:23 lynaghk: porting FrTime would be cool, but you probably want to look at RxJS too.

15:23 lynaghk: dnolen: there is a lot of lifting (converting regular immutable objects into behaviors), so I'd be worried about GC churn

15:23 dnolen: yeah, I looked into that a bit too (though not the implementation details yet)

15:24 dnolen: lynaghk: I don't see why you would create anymore GC events than RxJS if done properly.

15:25 lynaghk: devil is in that last part.

15:25 halgari: lynaghk: have you seen the talk Stuart Sierra gave on Rx in Clojure? (http://vimeo.com/18970727)

15:25 dnolen: lynaghk: yes, it's informative building a CLJS library with an eye for perf, it requires just a little bit more consideration up front.

15:26 lynaghk: halgari: I haven't, thanks!

15:26 shadowh511: umm, would clojure be affected by the oracle "copyrights" on the java API?

15:26 kuz jython and jruby might be affected by it

15:26 http://yro.slashdot.org/story/12/05/01/1828247/oracle-and-the-end-of-programming-as-we-know-it

15:27 Chousuke: hmm, that would be weird

15:27 dnolen: lynaghk: often it just means being a little more careful about critical fns, for example https://github.com/clojure/core.logic/blob/master/src/main/clojure/cljs/core/logic.cljs#L111

15:27 Chousuke: if it were the case, then every java library would be affected as well

15:27 dnolen: lynaghk: notice that I avoid higher level functions, I use direct property access, and I make liberal use of identical?

15:27 robertstuttaford: ok so i'm probably going to start with building a simple json rest service in clojure. i'm thinking i should use compojure for routing and friend for auth, monger for database access and i believe json is natively supported?

15:28 shadowh511: wouldn't that effectively kill Java and make the IP worthless?

15:28 dnolen: lynaghk: I remember correctly all those things added up to a 10X boost, assq gets called all the time.

15:28 qu1j0t3: shadowh511: that appears to be Oracle's intention in most things.

15:28 shadowh511: qu1j0t3: they want to make their IP worthless?

15:29 qu1j0t3: that's what i conclude from their actions since buying Sun, yes.

15:29 but ymmv

15:29 shadowh511: ymmv?

15:29 qu1j0t3: your mileage may vary

15:29 shadowh511: ah

15:30 kovasb: lynaghk: ping

15:30 lynaghk: dnolen: good tip. The perf of such a library depends on two orthogonal parts: the DOM manipulation/traversal (the actual DOM and its representation in cljs) and the dataflow graph traversal to see when things need to get updated.

15:30 kovasb: pong.

15:31 dnolen: lynaghk: yes, don't be afraid of custom data structures for the critical parts. CLJS abstractions are nice, but they aren't free.

15:32 kovasb: lynaghk: i think I'm ready to rock some c2 in my project

15:33 lynaghk: got a bare bones thing working, https://github.com/kovasb/session

15:33 lynaghk: dnolen: yeah, thats what this really comes down to---do I want to get a general, FRTime like thing that automatically lifts and does dataflow calculations, or should I come up with yet-another-DSL/framework that covers 90% of use cases in a performant way.

15:34 michaelr525: what's the best way to go from {:a 1 :b 2} into {:a :some1 :b :some2}?

15:34 lynaghk: kovasb: "class not found session.server" I'm on lein2

15:35 kovasb: lynaghk: ok, haven't tested it with lein2.. will take a look

15:35 michaelr525: map?

15:35 clojurebot: map and the other sequence functions used to be lazy, but with the advent of chunked sequences, may or may not be lazy, consult your local ouija board

15:35 michaelr525: or maybe something else?

15:35 lynaghk: kovasb: okay, it's just a source path thing then. lein1 works fine.

15:35 kovasb: lynaghk dnolen: my conclusion with frp stuff is that data flow isn't enough. you need to know the deltas

15:36 lynaghk dnolen: esp since dealing with collection updates is maybe the most common perf bottleneck

15:36 lynaghk: kovasb: doesn't that just mean you are relying on mutable state outside of your dataflow system?

15:36 emezeske: michaelr525: A decent way: (into {} (for [[k v] m] [k (f v)]))

15:36 lynaghk: kovasb: oh, if it's for performance that's understandable.

15:37 dnolen: lynaghk: btw, did you see rhickey's reduce lib changes?

15:37 lynaghk: that should be a big win for CLJS too.

15:37 michaelr525: emezeske: thanks!

15:37 kovasb: lynaghk: yes. i think thats gonna happen anyway (your models are mutable state, even if wrapped in a atom or whatever)

15:38 lynaghk: dnolen: I saw him in the channel yesterday but I didn't exactly grok what was going on. It will provide perf benefits for anything that uses reduce?

15:38 kovasb: lynaghk: updating graphics is a great thought experiment. much of the time you are updating color, position rather than creating new objects

15:38 dnolen: lynaghk: map/filter become reduce combinators.

15:39 lynaghk: basically allocation free pipelines - less GC churn and likely a very a big performance boost.

15:39 (reduce + some-vector) - allocation free.

15:39 lynaghk: dnolen: okay. boss =) Does someone need to port the reduce lib to cljs.core?

15:39 dnolen: lynaghk: mmarczyk working on it.

15:39 lynaghk: dnolen: he's a machine.

15:39 dnolen: man totally!

15:40 lynaghk: kovasb: have you seen ymacs?

15:40 kovasb: lynaghk: yeah, but i thought it was left for dead until that recent update

15:41 LauJensen: Evening gents

15:41 kovasb: lynaghk: i'm not gonna try to solve the code editor problem, other people are on that :)

15:41 lynaghk: kovasb: oh man, I didn't even know there was a recent update. That is the only in-browser code editor I'd consider using

15:41 since I am addicted to emacs.

15:42 kovasb: yeah, but isn't that going to be a blocking problem for anyone to use something like session?

15:42 kovasb: lynaghk: haha yeah. IMHO a repl is a radically different beast than a code editor

15:42 lynaghk: its about producing artifacts, not producing code

15:42 lynaghk: I'm not sure what you mean

15:42 kovasb: lynaghk: different use case, different goals

15:42 lynaghk: for instance, collaborating on a data analysis problem in realtime

15:43 lynaghk: can happen in session, not gonna happen in a code editor

15:43 kij: LauJensen: Hey

15:43 kovasb: lynaghk: producing artifacts means, you create the thing at the repl and hit the publish button, it goes live

15:44 lynaghk: writing code means you create some text, and deal with deployment etc in some other set of tools

15:45 lynaghk: kovasb: so it is like a napkin? It's there, you can write little things on it and use it to explain ideas to others?

15:46 kovasb: lynaghk: yeah, I think that is a good analogy

15:46 lynaghk: or, like evernote for clojure repl sessions

15:47 lynaghk: often i run some sequence of steps, want to save that sequence and come back to it

15:48 lynaghk: kovasb: somehow I'm not surprised to hear that coming from a guy with Mathematica background =)

15:49 kovasb: lynaghk: yeah, it was eye opening to get work done without writing "programs" per se

15:49 lynaghk: the idea that you have to write a totally repeatable, general program to get anything done is constricting

15:50 lynaghk: sometimes you just want to do some computations with specific data, rather than deal with the general case upfront

15:51 lynaghk: kovasb: yeah, I'm sold on the idea of the REPL.

15:51 kovasb: lynaghk: yeah.. so i just want to make a much more awesome repl then what we have now :)

15:52 lynaghk: kovasb: ping me if c2 gives you any trouble. I'm tidying up the API and cutting an official 0.1.0 release this upcoming Monday

15:54 kovasb: lynaghk: i think i just need to read the source closely to understand the return values and how they get updated

15:54 lynaghk: kovasb: return values of what?

15:55 kovasb: lynaghk: like, how is the final output inserted into the dom?

15:55 lynaghk: since I might need to intercept that point

15:55 lynaghk: if you are using the CLJS unify! fn, it calls dom/append!

15:56 kovasb: lynaghk: ideally, I want a hiccup structure

15:56 lynaghk: which I then insert myself

15:56 lynaghk: you can pass :enter :update and :exit fns to unify! to examine the DOM nodes and mutate them yourself if necessary (return false to cancel c2's default behavior)

15:56 kovasb: why do you want to insert yourself?

15:56 (also, fyi, all of c2's dom methods take hiccup structures)

15:57 kovasb: lynaghk: they need to go into a specific place (the loop "output")

15:57 lynaghk: Using the unify! fn might not be your best bet. If you just want a clojurescript hiccup compiler though, you can use that.

15:58 kovasb: lynaghk: yea, i have my own hiccup implementation

15:59 lynaghk: the contract of unify! is "I want this seq of data to be mapped to elements that match this CSS selector, according to this fn that transforms each datum to a hiccup structure"

15:59 kovasb: heh, I think we all do now =P

15:59 kovasb: lynaghk: hehe

16:00 so I'm looking at the pie.clj example

16:01 lynaghk: is all i need to do is take whatever is inside [:svg …] and stuff it into my hiccup function?

16:01 lynaghk: on clj "unify" (no bang) is just "map" with the args reordered. You need to pass the resulting output to hiccup to get an HTML string.

16:01 yeah, there's nothing really to do on the server since there isn't a DOM or interaction.

16:02 kovasb: lynaghk: are there examples in there that have interaction?

16:03 lynaghk: no, there are no cljs examples at the moment

16:03 kovasb: one question on unify! ..

16:03 lynaghk: but if you want updates, just pass unify! an atom containing data, and it will update the DOM whenever the atom changes.

16:04 kovasb: when do the things that match the selector need to exist? presumably at the time it is executed right?

16:04 dnolen: ibdknox: http://www.quora.com/Computer-Programming/Does-Light-Table-the-IDE-proposed-by-Chris-Granger-in-a-current-Kickstarter-project-offer-important-new-advances-for-programmers

16:04 kovasb: lynaghk: ok

16:05 lynaghk: kovasb: the first arg selector is the container. the :selector kwarg arg is optional, and specifies what elements within the container you want to manipulate (defaults to all container children)

16:06 kovasb: lynaghk: cool. will see how far I can get

16:06 lynaghk: kovasb: rad. I'm going to grab some lunch, talk to you later.

16:06 kovasb: lynaghk: later!

16:42 Mordus: How is Vaadin through Clojure? I'm looking for a sanity check on that kind of development before I start a project using it.

16:56 chief_chal: I could not find a #moustache channel, so I'll post my question here, it thats ok.

16:56 How can I pass a url argument to a handler function? For example, in (app ["foo" id] my-handler) how can I get "id" inside "my-handler"?

16:57 raek: chief_chal: you can pass it as an additional parameter: (app ["foo" id] #(my-handler % id))

16:57 chief_chal: Right now I'm ripping :params open and parsing ":uri", but that doesnt seem right

16:58 mmarczyk: dnolen: http://dev.clojure.org/jira/browse/CLJS-224 -- support for terminating reduce

16:58 raek: another approach is to make my-handler work in two stages

16:58 chief_chal: raek, Oh I should wrap it in an anon funtion with the handler and argument?

16:58 raek: (defn my-handler [id] (fn [request] ...))

16:58 (app ["foo" id] (my-handler id))

16:59 chief_chal: thank you, raek. The moustache docs doc were not clear and I keep forgetting this is just Ring after all =)

16:59 raek: it's just ordinary clojure functions... :-)

17:00 the important thing is that the place (app ["foo" id] <here>) evaluates to a function that takes one argument - the request

17:00 dnolen: mmarczyk: excellent

17:01 chief_chal: raek: right, so I've gotta have two additional handler layers to deal with "id", correct?

17:02 mmarczyk: :-)

17:03 jcromartie: why is "lein repl" less snappy than java -jar clojure.jar

17:03 chief_chal: raek: I'll use the first suggestion, thanks for the help!

17:03 jcromartie: even "rlwrap java -jar ..."

17:03 TimMc: jcromartie: It has to start a second JVM for your 1.3 Clojure.

17:04 technomancy: jcromartie: because it's more complicated to work with your project

17:04 dependencies, configuration, etc

17:04 jcromartie: technomancy: not just startup… let me clarify

17:04 when I run a repl from "lein repl", command processing is slower and adds some "flicker" to the line in the terminal

17:04 technomancy: jcromartie: also because in lein 1.x I wrote the repl but didn't use it day to day. in lein 2.x, the repl task is totally rewritten and way better.

17:05 jcromartie: but the slowness is caused to some degree by the fact that two processes are involved instead of one

17:05 jcromartie: technomancy: ah, so it's hosting its own repl

17:05 technomancy: jcromartie: anyway if you are a heavy repl user you should definitely try lein 2; it's much better

17:06 jcromartie: oh OK!

17:06 I though I was up to date

17:06 after "lein upgrade"

17:06 technomancy: well lein2 is still in a preview state, so `lein upgrade` doesn't pull it in yet

17:06 but it's quite usable

17:06 jcromartie: any tips for updating?

17:07 technomancy: clojurebot: lein upgrade guide?

17:07 TimMc: I've never seen lein1's repl to be anything but snappy.

17:07 clojurebot: lein2 is still in a preview release, but see the upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading

17:07 technomancy: jcromartie: there ya go

17:07 TimMc: jcromartie: What operating system?

17:09 jcromartie: OS X 10.7

17:09 jweiss: is there a clone detection tool for clojure source (to detect copy/pasted code)? trying to show my code has very little compared to another competing codebase in python, but i can only find a tool for python.

17:10 jcromartie: hmm, lein2 repl fails: IllegalArgumentException No enum const class jline.console.Operation.DABBREV_EXPAND

17:10 jline… *shudder*

17:10 TimMc: jweiss: You want to compare Python and Clojure code?

17:10 technomancy: jcromartie: jline1 is horrible; jline2 is pretty badass

17:11 jcromartie: oh?

17:11 ok

17:11 technomancy: jcromartie: are you running from source or preview3?

17:11 jweiss: TimMc: no, just compare the amount of cloning in one codebase vs the other.

17:11 jcromartie: technomancy: preview3… I think

17:11 jweiss: TimMc: for instance, the other codebase has 45% of it's lines cloned from elsewhere in the code

17:11 i want a number for my codebase.

17:12 TimMc: I see!

17:12 technomancy: jcromartie: very strange; same thing if you run it from outside a project?

17:12 jcromartie: yeah I'm outside a project

17:12 technomancy: how about inside?

17:13 jcromartie: now it downloads tools.nrepl

17:13 downloading..

17:15 ibdknox: dnolen: lol thanks for the pointer

17:15 jcromartie: hm, weird

17:15 no luck there

17:15 TimMc: jweiss: How is clone detection defined in Python? Multiple non-empty equal blocks where whitespace has been normalized? What about variable renaming?

17:16 hiredman: also, lines cloned is dumb

17:16 jweiss: TimMc: there's various options to set the minimum block size, minimum difference within the block, etc

17:17 hiredman: well, in python it makes more sense than in clojure

17:17 hiredman: http://www.infoq.com/presentations/Decisions-Decisions is a good talk about trade offs, one of them mentioned is DRY and copy and pasted code

17:17 jweiss: i suppose in clojure it could be sexps of a certain # of items

17:18 TimMc: i used http://clonedigger.sourceforge.net/ on the python side

17:20 jcromartie: there's also gzip as a crude metric

17:21 tar+gzip your code

17:22 hcumberdale: does anyone know software to push a application server log to a website

17:22 like "tail -f"

17:22 TimMc: jcromartie: That doesn't help when comparing across languages!

17:22 jcromartie: TimMc: you can compare ratios

17:22 entropy of Python vs entropy of Clojure

17:22 TimMc: Or does it? I don't know, have to think about this...

17:23 jweiss: i don't know i think jcromartie is onto something there

17:24 snamellit: hp

17:24 jcromartie: https://gist.github.com/2571452

17:24 snamellit: hcumberdale: checkout logstash

17:24 clj_newb: Is there a standard way to read a properties file and store into a data-structure?

17:25 jweiss: clj_newb: a java properties file?

17:25 technomancy: clj_newb: (into {} (java.util.Properties.)) works

17:25 you'd want to call .load on it first though

17:25 jcromartie: that gist is a shell script to calculate entropy

17:26 find . -name "*.py" | xargs cat | entropy.sh

17:26 jweiss: jcromartie: /me tries

17:26 clj_newb: well I meant if there was a standard. As the properties file with extension .clj and format :key value or {key {value1 value2}}

17:26 technomancy: clojurebot: properties |are| easy to load into maps: (into {} (doto (java.util.Properties.) (.load (clojure.java.io/reader "stuff.properties"))))

17:26 clojurebot: Alles klar

17:27 clj_newb: thanks technomancy

17:27 technomancy: clj_newb: oh, you mean clojure format? sure; load-file

17:27 the above works with java .properties files, but if you can use whatever format you might as well use clojure

17:27 jweiss: jcromartie: what is this entropy command your script refers to? i don't have that

17:29 jcromartie: jweiss: oh it's just itself

17:29 jweiss: jcromartie: ah ok

17:29 jcromartie: yeah sorry, the .sh was for gist language detection

17:30 jweiss: jcromartie: hm, 'mktemp: too few X's in template `entropy''

17:30 Roxxi: Pop quiz! clojure/reduce : scheme/fold :: clojure/??? : scheme/fold-right

17:31 jweiss: jcromartie: oh i see

17:31 weavejester: Roxxi: I don't believe Clojure has a fold-right inbuilt.

17:32 Roxxi: Drat.

17:32 TimMc: Roxxi: Are you reducing over a vector by any chance?

17:33 Roxxi: Indeed. But I need the evaluation to be executed semantically from right to left

17:33 TimMc: Roxxi: rseq

17:33 Roxxi: Ah, clever

17:33 things

17:33 err thanks*

17:33 weavejester: Correct me if I'm wrong, but without TCO doesn't a foldr result in a new item on the stack for each iteration?

17:34 TimMc: weavejester: Even with TCO, yes.

17:34 if you're foldring over a linked-list

17:34 weavejester: TimMc: Oh, yes, obviously because it has to be combined each time.

17:34 hiredman: and it would hold on to the head of a lazy-seq

17:35 technomancy: this is why we can't have nice things

17:35 weavejester: So is a foldr ever useful?

17:35 TimMc: No, this is hy we have nice data structures.

17:35 weavejester: Compared to a (comp reduce rseq)

17:35 TimMc: weavejester: When you don't have vector.

17:35 technomancy: weavejester: that'd need to be something like rcomp anyway

17:35 which I've often wished for

17:36 mrakan: Is there a way to clear all definitions within a namespace? For instance, if I defined (def a-var 5) and others, I want a-var and the others to no longer exist.

17:36 creese: can someone explain to me why running my code with C-c C-k doesn't result in the repl to see what's been run? Is this a ns problem?

17:36 jweiss: jcromartie: i can't get it to run, mktemp fails and it then forks too many time

17:37 jcromartie: mktemp huh

17:37 I'd add a set -x

17:37 but not sure why mktemp fails… what OS?

17:37 technomancy: creese: that's not how slime works unfortunately

17:37 jweiss: jcromartie: fedora 16. mktemp: too few X's in template `entropy'

17:38 technomancy: creese: but it's best not to keep side-effects in the top-level anyway; better to put it in a defn and run the defn in the repl

17:38 jweiss: apparently the -t option is deprecated, but i get the same error without -t

17:38 creese: that's what I meant. the functions weren't seen

17:38 technomancy: creese: oh, probably in the wrong namespace? C-c M-p

17:38 jcromartie: ah OK

17:38 got it

17:39 jweiss: check the gist now

17:39 https://gist.github.com/2571452

17:40 creese: I think that's what I was missing.

17:41 jweiss: jcromartie: sweet, got 0.14 /me looks up what that means.

17:41 that's on the other codebase btw :)

17:44 mrakan: Apparently I can remove a namespace and all of its definitions with 'remove-ns, so that answers my question.

17:55 iwo: hey all, sorry i know this question must get asked *daily* but can anyone give me a link to some truly up-to-date advice on setting up a clojure development environment?

17:55 shadowh511: iwo: windows or *NIX?

17:55 iwo: linux

17:56 shadowh511: install leinigen

17:56 technomancy: iwo: the getting started wiki on dev.clojure.org isn't bad, but what do you currently use?

17:56 iwo: i'm looking for lein & emacs... plus slime/swank(?)

17:56 technomancy: i currently use counterclockwise :|

17:56 technomancy: iwo: the main thing to know about setting up emacs and swank is to only trust the swank-clojure readme rather than stuff you find via google

17:56 mefesto: iwo: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

17:56 technomancy: google WILL lead you astray

17:57 iwo: mefesto: cheers!

17:57 jcromartie: jweiss: /dev/random should yield an entropy of 1.0, while /dev/zero should be 0, meaning (in a nutshell) the higher the ratio, the more important each piece of info is

17:57 iwo: technomancy: yeah, i've tried following a couple of guides in the past, but i always get into 'out-of-date' territory

17:57 jcromartie: jweiss: information entropy is something I will not attempt to explain here, because I'll probably get it wrong :)

17:58 jweiss: but the shortest best explanation from Wikipedia is "a measure of disorder, or more precisely unpredictability"

17:58 iwo: i know things are moving on very fast, always better ways of doing things

17:59 but i'm still a bit confused about e.g. should i use lein to install _everything_, do i need to use marmalade? etc

18:00 technomancy: you don't really need marmalade anymore if you'd rather install clojure-mode by hand

18:01 it doesn't hurt, but it's more complicated

18:01 iwo: i assume if i use clojure-mode, i don't need paredit?

18:01 technomancy: actually you do

18:01 there's lots of good stuff in marmalade, but it's not needed for just swank

18:02 amalloy: jcromartie: isn't the mktemp/cat/entropy/rm dance just a complicated way to write: entropy <(cat) ?

18:03 jcromartie: amalloy: is it? I don't know :)

18:03 you're right

18:04 creese: I am trying to use map. (count (first (first x))) does what I want to the first element of the list x. What do put for f in (map f x) to do it to all of them?

18:04 jcromartie: wait, does <(cat) write to a file?

18:04 amalloy: it creates a file, writes the output of cat to it, and then expands to the file's name

18:04 probably opened in read-only mode, i'm not sure

18:05 jcromartie: never seen it before, neat

18:05 amalloy: yeah, read-only

18:05 raek: creese: so you want to do (count (first y)) for each y in the list x?

18:05 jcromartie: amalloy: hm, not working on OS X

18:05 creese: I think so

18:05 amalloy: and i guess technically it opens a pipe, not a file

18:06 raek: (map #(count (first %)) the-list)

18:06 or

18:06 (for [y the-list] (count (first y)))

18:06 creese: what are the # and % doing?

18:06 raek: it is a shorthand for an anonymous function literal

18:06 amalloy: jcromartie: works for me on OS X afaict. does the following not work? cat <(echo text goes here)

18:07 raek: the same as (map (fn [y] (count (first y))) the-list)

18:07 creese: map will apply that function on each element and make a sequence of the return values

18:07 creese: that's what I want

18:08 I didn't know I needed an anonymous function

18:08 that's what I wanted. thanks

18:09 raek: well, the function does not have to be anonymous. but you can't just put the unwrapped expression there.

18:09 creese: which is what I was trying to do

18:10 raek: map is an ordinary function, so its arguments are evaluated before the function is called

18:11 and it doesn't make sense to evaluate (count (first y)) "out of context"

18:11 so you parameterize the expression and encapsulate it in a function object

18:13 mmarczyk: dnolen: just fixed a bug in TransientVector (the one Brian Taylor reported in CLJS-208), fix @ CLJS-226

18:13 creese: thanks

18:17 iwo: is using the thread macro a lot considered bad form in the clojure community?

18:18 technomancy: iwo: no, it's quite nice

18:19 iwo: e.g. would you rather see this: (first (reverse '(1 2 3))) or this: (-> '(1 2 3) reverse first)

18:19 technomancy: with only two short calls it's a toss up; the more calls (or arguments) you add the more valuable -> becomes

18:21 S11001001: though, -?> from core.incubator can be quite valuable with only 1 call

18:21 technomancy: eh; might as well use and for that

18:21 S11001001: huh?

18:22 hiredman: (and x (f x))

18:22 technomancy: it's one line shorter since you don't need to refer it

18:22 S11001001: not having a variable, often

18:22 /binding/what-have-you

18:23 technomancy: true; it's point-free

18:24 S11001001: if you're willing to introduce temporaries willynilly, ->'s value also goes away

18:34 amalloy: personally i don't like -> much for things like (-> x foo bar baz) - it's much more useful for (-> x (foo a) (bar b) (baz z)) where otherwise the "focus" on x would get lost

18:39 solussd_: where can I find instructions on using the clojurescript repl form a project created with the noir cljs-template ?

18:41 emezeske: solussd_: Here: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/REPL.md

18:41 solussd_: cljs-template uses the lein-cljsbuild plugin for that AFAIK

18:41 pandeiro: solussd_: add :repl-init noir.cljs.repl to your project.clj, do `lein repl`, and call (browser)

18:42 that's just one way to do it... or just call browser from that ns however you decide to launch the repl

18:42 solussd_: thanks

18:43 pandeiro: you will have to refresh the browser after all of that to establish the connection

18:44 mmarczyk: the new reduce goodies in CLJS: http://dev.clojure.org/jira/browse/CLJS-227

18:44 turns out this is copy and paste with CLJS-224 in place

19:28 Frozenlock: I've defined a function with some arguments ---> [& {:keys [arg1 arg2....]}]. Now when I call this function, I would like to be able to send it a map directly, such as {:arg1 value :arg2 value...}. I've used (apply my-function (flatten (into [] arg-maps))), but surely there's a more elegant way?

19:30 mebaran151: Frozenlock: for a start, you could probably drop the call to into

19:31 , (flatten (seq {:a 1 :b 2}))

19:31 S11001001: Frozenlock: rest-args are always seqs, never maps

19:31 clojurebot: (:a 1 :b 2)

19:31 mebaran151: ,(flatten {:a 1 :b 2})

19:31 clojurebot: ()

19:31 mmarczyk: S11001001: but can be destructured in a map-like fashion

19:32 S11001001: mmarczyk: which is implemented as building a new map

19:32 mmarczyk: S11001001: indeed it is

19:33 Frozenlock: Indeed, that's better

19:33 jonaskoelker: I got a question for (mildly?) seasoned clojurers: I'm implementing a toyish language, using s-exprs as my AST. I want to basically (eval ..) it, but only allow for execution of a particular (closed) set of functions. What's the idiomatic way of doing that?

19:33 mmarczyk: S11001001: nothing wrong with Frozenlock's definition though

19:33 Frozenlock: "for a start" means there's more? :)

19:33 mebaran151: Frozenlock: just my first thought was to just use seq directly

19:34 mmarczyk: flatten is dangerous, though, as it will flatten all the way

19:34 that is, :foo [[1 2 3]] will get flattened to (:foo 1 2 3)

19:35 Frozenlock: Luckily in my case everything is at the same level

19:36 brehaut: (apply concat … or (mapcat identity …

19:36 hiredman: or use for

19:37 mebaran151: ,(apply concat {:a 1 b 2})

19:37 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0)>

19:37 S11001001: mmarczyk: unless Frozenlock truly wishes to pass a map "directly"

19:37 mebaran151: ,(apply concat {:a 1 :b 2})

19:37 clojurebot: (:a 1 :b 2)

19:38 Frozenlock: No, simply my arguments are in a map and I don't want to extract each of them.

19:38 mmarczyk: S11001001: explaining the nature of rest args is a roundabout way of making that suggestion :-)

19:38 S11001001: anyway, wasn't sure what you meant is all

19:39 S11001001: I prefer giving hints over handing out answers

19:39 quite often I err on the side of obscurity :)

19:39 anyway, concat is a great choice then

19:39 but if you ever wish to pass a map "directly", consider that you can exploit the fact that there is no way to confuse a seq meant to be destructured as a map, with a single map

19:40 mmarczyk: Frozenlock: you could of course say (.invoke your-function the-map)

19:41 S11001001: that is, (fn me ([x] (me x nil)) ([x {:keys [...]}] impl-here) ([x k1 k2 & args] (me (apply hash-map k1 k2 args))))

19:41 mmarczyk: Frozenlock: ah, wait, wrong method

19:41 S11001001: will still [likely] rebuild

19:42 Frozenlock: Hmm concat is lazy: No value supplied for key: clojure.lang.LazySeq@6bfd3bcf

19:42 S11001001: apply is lazy :)

19:42 Frozenlock: Oh? It doesn't say so in its doc.

19:43 S11001001: it's a consequence of the language

19:43 (apply concat inft-list) is therefore legal, and many others

19:44 so glad rhickey didn't try to be java there

19:46 emezeske: Here's my non-lazy, super-ghetto solution:

19:46 (defmacro mapply [f & args] `(~f ~@(butlast args) ~@(apply concat (into [] (last args)))))

19:48 amalloy: emezeske: it's not just non-lazy, it doesn't work in any interesting cases

19:48 emezeske: My solution has the advantage of having a name that can be confused with monad stuff

19:48 amalloy: For example?

19:48 amalloy: (let [argmap {:a 1 :b 2}] (mapply whatever argmap))

19:49 powrtoc: how can you connect to an external swank process with slime? Now that clojure-mode packages it I can't call slime-connect, and clojure-jack-in starts a swank server inside emacs

19:49 emezeske: amalloy: What about that does not work?

19:49 Oh

19:49 Derp

19:49 amalloy: ~mapply

19:49 clojurebot: You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))

19:49 mmarczyk: S11001001: you could also reverse that approach -- (fn me ([x opts] (let [{:keys [...]} opts] ...)) ([x k v & more] (me x (apply hash-map k v more))))

19:50 emezeske: amalloy: This question comes up enough that clojurebot knows about it?

19:50 mmarczyk: S11001001: wait, got totally mixed up

19:50 amalloy: well, i don't totally approve of having mapply exist, but TimMc (i think?) decided to teach clojurebot

19:50 technomancy: powrtoc: you have to either prime your emacs instance with a "dummy" jack-in or install slime via marmalade

19:51 mmarczyk: don't mind me, pulling together my split attention atm :-P

19:51 technomancy: slime-repl, that is

19:51 emezeske: amalloy: What do you not approve of?

19:51 amalloy: your internal functions should just take maps, and you pass maps around. having to create and rip apart maps from kwarg seqs all over the place is a pain and pointless

19:51 at the outermost level, for the user: fine, use kwargs

19:51 emezeske: That's a good point.

19:52 amalloy: (and also slow)

19:52 emezeske: I generally just pass a map even in my outermost functions, the "{" and "}" are not that hard to type.

19:54 cduffy: Hmm. I'm advised to avoid dealing with Matchers directly (being mutable objects)... but is there a way to retrieve groups without them?

19:55 amalloy: re-seq

19:55 or re-find probably works too, i dunno

19:56 &(re-seq #"f(o+)" "a bad variable name, such as foo, should be avoided")

19:56 lazybot: ⇒ (["foo" "oo"])

19:56 amalloy: &(re-find #"f(o+)" "a bad variable name, such as foo, should be avoided")

19:56 lazybot: ⇒ ["foo" "oo"]

19:59 amalloy: cduffy: ^

20:00 * cduffy nods

20:03 powrtoc: technomancy, thanks slime-repl works a trea

20:03 t

20:04 technomancy: cool

20:11 TimMc: amalloy: It was you who taught clojurebot.

20:12 (OK, technically, you clarified my factoid.)

21:03 Frozenlock: Is there a way to send something from an output stream directly to an input stream?

21:03 scottj_: video of Rich's railsconf keynote http://news.ycombinator.com/item?id=3917104

21:28 leo2007: is the jvm controlled by oracle?

21:31 Roxxi`: That's quite the loaded question you have there... :)

21:33 leo2007: sorry

21:36 leimy: Howdy. Was looking at the clojurescript sample for twitter. It doesn't seem to work for me. Is this a known issue, something about ICounter not being implemented. I'd like to show this to coworkers and see if I can't seduce them into clojure.

21:38 mebaran151: what's the best profiler for clojure?

21:40 scottj_: mebaran151: yourkit

21:41 riddochc: mebaran151: You could give criterium a try.

21:42 mebaran151: riddochc: criterium looks pretty cool

21:42 riddochc: https://github.com/hugoduncan/criterium

21:42 I haven't done much with it, though. But anything that profiles stuff running on the JVM should do. I've heard good things about yourkit, but haven't used it.

21:42 Doesn't have to be clojure-specific.

21:42 mebaran151: does it do sub-functional statistics (ie your function spent x amount of call keyword n times?)

21:43 alex_baranosky: never used YourKit with Clojure, but it works fine for JAva

21:43 riddochc: Good question, I don't know.

21:44 alex_baranosky: yourkit will tell me how much time is spent in different methods on Java classes

21:45 mebaran151: I was just looking for a way to test if this method was slow because of IO (fine) or because I'm spending all my time recursively munging keywords (less fine)

21:46 alex_baranosky: mebaran151, I can't say for sure, but I think you could look at what methods are being called by Clojure and look for an explosion of a particular method call

21:46 leo2007: is the #_ reader macro new in 1.4?

21:46 riddochc: Maybe visualvm might help too?

21:46 alex_baranosky: leo2007, nope!

21:46 leimy: nathanmarz: Just bought your MEAP book...

21:47 mmarczyk: leimy: you mean TwitterBuzz?

21:47 leimy: which version of ClojureScript?

21:48 leimy: mmarczyk: Yes

21:48 mmarczyk: I pulled from github today. Master I think. Not in front of my computer at this point.

21:49 mmarczyk: leimy: ok, I'll go and compile it now

21:49 leo2007: alex_baranosky: thanks

21:49 leimy: mmarczyk: Was using safari on Lion, I could see it pulling twitter data for sure.

21:50 alex_baranosky: leo2007, not sure which version it arrived... old I think

21:50 leimy: Also clojurescript seems awfully nice. Very impressed so far. I just started today though.

21:51 leo2007: alex_baranosky: no problem. I was just surprised that clojure-mode doesn't put the form following #_ in comment face.

21:52 mmarczyk: leimy: ok, I'm hitting the same bug -- let's see about a fix

21:52 leimy: glad you're liking it :-)

21:52 alex_baranosky: leo2007, that's kind of sad

21:53 amalloy: leo2007: i think the syntax highlighting in emacs is dumber than that - regexes, not full parse trees

21:53 leo2007: its clojure-mode's fault and can be fixed.

21:53 amalloy: sure, but it can do a lot actually.

22:01 leimy: Emacs does the best job with Perl I've ever seen...

22:01 But then I avoid Perl

22:01 alex_baranosky: ... and if it can handle Perl... you know it can handle anything :)

22:02 mmarczyk: leo2007: I wouldn't want #_ to be "commentified" at all

22:02 leo2007: because I find the highlighted syntax in #_'d forms very useful

22:03 same goes for (comment ...).

22:05 brehaut: ive gone both ways on highlighting of #_ and (comment forms

22:06 ideally i think i'd like it to be highlighted as both some how

22:07 but i havent worked out a good 'somehow'

22:07 alex_baranosky: brehaut, what would be slickest, would be it being commentified, and at the same time syntax highlighted in greyscale (or shades of whichever color is appropriate for comments in your given color scheme)

22:07 mmarczyk: fade out / change background colour ?

22:07 brehaut: something like that could work yeah

22:08 dgrnbrg: After the GSOC project to port clojure to luajit, that'll pave the way for porting clojure to vim script and elisp. It will be awesome when one editor plugin works on all the important IDEs

22:08 leo2007: mmarczyk: yeah, that could be useful too.

22:08 dgrnbrg: Especially to share functionality like the parser/syntax highlighter

22:08 brehaut: ive mostly only thought about it in terms of the javascript syntax highlighter brush,

22:08 mmarczyk: dgrnbrg: oh yeah :-D

22:08 brehaut: which has some annoying limitations, and would require CSS rules for everything

22:09 leimy: I have an aversion to IDEs. I feel like they make me do things their way.

22:12 Be back soon. Getting daughter home from dance

22:14 mmarczyk: leimy: see you later; I think I've pinpointed the source of that bug, btw

22:21 leimy: Awesome

22:24 mmarczyk: oh man, I've been thinking about why my fix doesn't work for 5 minutes only to discover that I've been running the repl in another checkout :-(

22:27 leimy: mmarczyk: Hehe. I do that stuff a lot

22:28 Home now btw... I can test things

22:28 wei_: is there a Clojure socket.io client library?

22:29 mmarczyk: leimy: got it working! will post a fix on JIRA in a sec

22:29 leimy: Awesome

22:42 mmarczyk: leimy: http://dev.clojure.org/jira/browse/CLJS-229

22:43 leimy: mmarczyk: Thank you

22:45 mmarczyk: np

22:45 jayunit100: Why does " (for [x (lazy-seq (range 1 100011111110000)) :when (= x 1)] x) " take a long time to return ???

22:45 lazybot: jayunit100: Oh, absolutely.

22:46 jayunit100: ,(for [x (lazy-seq (range 1 10)) :when (= x 1)] x)

22:46 clojurebot: (1)

22:46 leimy: mmarczyk: I have no idea how to apply this patch. :-)

22:46 tmciver: jayunit100: for has to check all the elements to see which are 1.

22:46 mmarczyk: leimy: cat ....patch | git am

22:46 leimy: in a checkout of CLJS master

22:47 leimy: I see I wanted to use straight patch.

22:47 mmarczyk: leimy: see also the earlier ticket linked to from CLJS-229 -- should provide a speed boost

22:48 leimy: then again probably not easily noticeable in TwitterBuzz, so maybe not worth your time

22:48 leimy: on second thought.

22:48 Frozenlock: Any advice on how I could make this function send the output stream directly to an input stream? I want to avoid the 'write-to-disk' step. http://pastebin.com/nn6CTc0N

22:49 leimy: Is swp some archival/compression? I suddenly feel I've been in a coma or something.

22:51 jayunit100: tmciver: I thought it would, lazily emit them though...

22:55 tmciver: jayunit100: yes, at the repl it will take a long time because the repl is realizing it; if you def it, it returns immediately.

22:57 jayunit100: hm ok i always tend to make that mistake . I guess the repl doesnt lazily stream results back.

22:57 mmarczyk: leimy: swp?

22:58 leimy: mmarczyk: did you post the vim swapfile instead of the patch?

22:58 mmarczyk: leimy: ...argh

22:58 leimy: haha.

22:59 mmarczyk: leimy: fixed, thanks for the heads up

23:00 other recent patches happily appear to be the actual patches :-P

23:03 leimy: mmarczyk: that fixed it. thanks!

23:04 mmarczyk: leimy: great, thanks for the report!

23:04 leimy: mmarczyk: sorry did not know how to patch it myself

23:05 mmarczyk: leimy: not at all

23:05 leimy: the reason for the breakage was kind of unexpected -- in count -- basically some chaos around removing some default implementations of things for perf reasons

23:06 leimy: CLJS will be the better for it, but I guess running the bundled demo apps from time to time to discover breakage wouldn't be a bad idea

23:07 leimy: mmarczyk: ah. yeah. :-). well i saw the rich hickey demo online and decided i wanted to do that.

23:07 mmarczyk: leimy: you mean the unveiling video? that was *awesome*

23:07 leimy: mmarczyk: yes

23:08 * ivan just learned of dotLisp from fricking' 2001: https://groups.google.com/group/comp.lang.lisp/browse_thread/thread/dfe5fbe9d4f0f1d2/a3b8699d9e8593b0

23:13 mmarczyk: Frozenlock: http://ostermiller.org/convert_java_outputstream_inputstream.html

23:14 Frozenlock: method 2, I guess

23:15 Frozenlock: Thanks, I stumbled uppon the same solution on stack overflow.

23:15 Still can't figure out how to make it work :(

23:18 java.io.PrintWriter would behave the same in a pipedstream, correct?

23:19 mmarczyk: ivan: hah, that's a cool link :-)

23:19 Frozenlock: I would hope so, but don't know for sure

23:25 Frozenlock: I guess you'd wrap the PipedOutputStream in the ZipOutputStream

23:26 Frozenlock: pass the other end of the pipe -- the PipedInputStream -- to the consumer

23:26 Frozenlock: then just .putNextEntry as many times as you want

23:26 Frozenlock: no writes, printlns etc.

23:27 Frozenlock: Hmm... what about the content?

23:27 If I understand correctly, the content is inserted with the .println

23:29 mmarczyk: Frozenlock: ah, right

23:29 sorry, I think I need to get some sleep

23:29 Frozenlock: So do I, but thanks :)

23:29 mmarczyk: :-)

23:30 but still, I think you should just do the same thing except w/ ZOS wrapping a PipedOutputStream

23:30 and hope the PIS will be pleasant to work with on the consumer side :-)

23:30 Frozenlock: Yes, it is somehow working... I have a .zip file, but it's corrupted

23:34 mmarczyk: hm, yeah, tried to get this working here, but not sure about the details

23:34 :-(

23:36 Frozenlock: I succeeded in making a spit-to-zip function, but can't for the life of me understand how to just send it to an input stream. Life's a bitch.

23:36 mmarczyk: heh

23:36 oh wow, need to dash now or I'll miss my train

23:37 Frozenlock: Have a nice ride

23:37 leimy: mmarczyk: thanks again

23:37 mmarczyk: thanks!

23:38 devn: I'm moving a library from 1.2 (with contrib deps) to 1.4 -- what is the preferred fn to use in place of duck-streams/read-lines?

23:39 does clojure.java.io handle automatically closing like read-lines used to?

23:59 arohner_: devn: yes, it does

Logging service provided by n01se.net