#clojure log - Sep 08 2011

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

0:07 nickmbailey: new question, is there an easy way to prevent lein from shutting down agent threadpools if the main function returns but the process still runs due to non-daemon threads?

0:07 jli: it seems like multimethods and protocols can solve a lot of the same problems. is there a preference, when either could work?

0:14 brehaut: jli: multimethods are a lot more general

0:14 but protocols are a bunch faster

0:14 jli: brehaut: is that because they can dispatch on anything and aren't really tied to types?

0:15 brehaut: correct

0:15 jli: protocols also seem a bit heavier weight

0:15 brehaut: multimethods can also dispatch on more than just the first argument

0:16 jli: oh, is that because protocols are java interfaces?

0:16 brehaut: i guess

0:16 ive not looked at the implementation

0:30 bartj: what is the best way to preserve the inner-most sequences, but still flatten a sequence

0:30 for eg: [[(1 2 3) (4 5 6)] (7 8 9)]

0:30 I would like to have '((1 2 3) (4 5 6) (7 8 9))

0:34 nickmbailey: if anyone else cared about the answer to my question above ^^: doing '(.join (java.lang.Thread/currentThread))' at the end of the main function is an easy way to stop it from returning

0:35 Tcepsa: bartj: Can you guarantee that there won't be both atoms and seqs in a given seq?

0:35 bartj: Tcepsa, no atoms

0:36 I tried: (flatten above-sequence)

0:36 Tcepsa: (using atom here to be not-a-seq)

0:36 bartj: which obviously tries to flatten everything

0:36 brehaut: bartj: apply concat ?

0:36 (apply concat [[(1 2 3) (4 5 6)] (7 8 9)])

0:36 ,(apply concat [[(1 2 3) (4 5 6)] (7 8 9)])

0:36 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

0:38 Tcepsa: ,(apply concat [['(1 2 3) '(4 5 6)] '(7 8 9)])

0:38 clojurebot: ((1 2 3) (4 5 6) 7 8 9)

0:38 brehaut: oh right

0:38 Tcepsa: Hmm, close, but I'm guessing not quite

0:38 bartj: yes, maybe pass it through reduce

0:39 Tcepsa: Since they're at different levels... hey, would this be a case where a zipper might be useful?

0:40 Go until you hit a leaf, then bounce back up one and that's a seq, add it to an accumulator and continue through the "tree"

0:40 bartj: I can guarantee that there will only be lists and vectors

0:40 * Tcepsa has never actually used a zipper, so doesn't quite know how they work and might be wrong

0:40 clojurebot: Gabh mo leithscéal?

0:40 bartj: ditto

0:41 Tcepsa: Let me give it a try...

0:42 brehaut: ,(mapcat (fn [s] (if (vector? s) s [s])) [['(1 2 3) '(4 5 6)] '(7 8 9)])

0:42 clojurebot: ((1 2 3) (4 5 6) (7 8 9))

0:42 Tcepsa: Nice

0:42 brehaut: everything is better with a mapcat

0:42 Tcepsa: What does it do?

0:43 brehaut: roughly (def mapcat (comp (partial apply concat) map))

0:43 Tcepsa: Ahh

0:43 brehaut: its the plumbing of list comps basicly

0:44 Tcepsa: So would your solution be able to handle more deeply nested things? (Mostly just curious; I don't know if it would need to for this situation)

0:44 brehaut: ,(for [s [['(1 2 3) '(4 5 6)] '(7 8 9)]] (if (vector? s) s [s])) ; is identical

0:44 clojurebot: ([(1 2 3) (4 5 6)] [(7 8 9)])

0:44 bartj: there are multiple/different levels of nesting

0:44 brehaut: huh no its no. what have i do wrong

0:45 Tcepsa: not without recursing explicitly in the mapcat fn

0:47 Tcepsa: Hmm, okay. I'd need to spend some more time with it when I'm not also trying to learn zippers ^_^

0:47 bartj: , (mapcat (fn [s] (if (vector? s) s [s])) [[['(1 2 3) '(4 5 6)] '(7 8 9)] '(10 11 12)])

0:47 clojurebot: ([(1 2 3) (4 5 6)] (7 8 9) (10 11 12))

0:48 jli: brehaut: that for is just map, right? there's no concat

0:49 brehaut: jli ?

0:49 bartj: (defn flatten-vectors [s] (mapcat (fn [s] (if (vector? s) (flatten-vectors s) [s])) s)

0:50 jli: brehaut: your (for ...) isn't identical to your original mapcat because the for just does the "map" part, no?

0:50 brehaut: jli for is definately mapcat, but ive screwed something up and its too late in the day for me to work out what

0:51 bartj: brehaut, I am writing one with a loop/recur

0:51 brehaut: sounds complicated ;0

0:51 s/0/)/

0:51 lazybot: <brehaut> sounds complicated ;)

0:54 bartj: actually I think I am approaching it wrong

0:54 I have (merge-with concat {:a (list 1 2 3)} {:a (list 4 5 6)})

0:54 and I do a (apply merge-with vector)

0:54 to get {:a [(1 2 3) (4 5 6)]}

0:54 which is inturn causing multiple vectors to get formed unnecessary

0:55 jli: brehaut: I'm not sure why. the function for mapcat needs to return a collection, but the expression in a (for) doesn't

0:56 bartj: if I have this: {:a (list 1 2 3)} {:a (list 4 5 6)} {:a (list 7 8 9)}

0:57 I am trying to get: {:a ((1 2 3) (4 5 6) (7 8 9))}

0:57 brehaut: ,(for [a [1 2 3] b [:x :y]] {:a a :b b})

0:57 clojurebot: ({:a 1, :b :x} {:a 1, :b :y} {:a 2, :b :x} {:a 2, :b :y} {:a 3, :b :x} ...)

0:57 brehaut: jli: thats why its mapcat not map

0:58 jli: that's only when you're using it with more than 1 collection though

0:59 brehaut: bartj: (merge-with (fn [a b] (if (vector? a) (conj a b) [a b])) …

1:00 jli: theres two reasons im not going get more detailed. 1) its late in the day and 2) amalloy will mock me for talking about monads again

1:00 (not that for is actually implemented with monads)

1:00 jli: and doesn't mapcat work over its collections in parallel, and for iterates nested?

1:01 anyway, okay :)

1:01 bartj: ,(merge-with (fn [a b] (if (vector? a) (conj a b) [a b]) {:a (list 1 2 3)} {:a (list 4 5 6)} {:a (list 7 8 9)})

1:01 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

1:01 bartj: )

1:01 brehaut: mapcat isnt magical, its just concat and map

1:02 bartj: ,(merge-with (fn [a b] (if (vector? a) (conj a b) [a b]) {:a (list 1 2 3)} {:a (list 4 5 6)} {:a (list 7 8 9)}))

1:02 clojurebot: nil

1:02 jli: yeah, I know. I just don't think it's equivalent to mapcat :)

1:02 or, to for

1:03 brehaut: well, your welcome to think that, but its wrong ;) go read about the list or sequence monad, and how bind is mapcat

1:03 jli: I know. but how is for equal to bind?

1:04 brehaut: for isnt, for is a comprehension. comprehensions can be generalised over bind

1:06 jli, it helps if you realise that mapcat where the function returns a single value wrapped in a sequence is equivalent to map

1:07 jli: right. mapcat is more general.

1:07 brehaut: exactly

1:07 jli: I think mapcat can do more than for.

1:07 which is why you can't write the function you wanted with for

1:08 all list comprehensions can be written with monad operations, but not vice versa

1:08 brehaut: yeah probably

1:12 actually its because i did my transformation wrong

1:12 ,(for [s [['(1 2 3) '(4 5 6)] '(7 8 9)] a (if (vector? s) s [s])] a)

1:12 clojurebot: ((1 2 3) (4 5 6) (7 8 9))

1:18 Tcepsa: Nice

1:18 bartj: Sorry, no luck with the zipper thing. I think it still might be a (messy) option, but I'm not up for getting it working tonight

1:19 (where messy==more than one line ~wry grin~)

1:20 Good night, and good luck!

1:23 jli: oh I'm wrong. you're right. any mapcat should be expressible as a for.

1:24 brehaut: cool :)

1:24 jli: and you're right, it's too late to think about monads :P

1:24 brehaut: you can make that claim at any time of day

1:25 (def time-to-think-about-monads? (constantly false))

1:26 jli: :)

1:50 aloiscochard: yo hackers, I'v just installed cljr on a computer at job, but when trying to do 'cljr repl' I got a class not found "jline/ConsoleRunner" ... same thing worked yesterday on an other computer, any idea ? something went wrong during setup ?

2:19 anyone alive ?

4:32 neotyk: Good morning everyone!

4:33 Fossi: hi

4:33 mduerksen: greetings

4:34 neotyk: do you know how to get contrib.logging/tools.logging to log using current *ns*?

4:37 here is what I do and results I'm getting: https://gist.github.com/1202938

4:38 basically my current *ns* is not used but "clojure.tools.logging" is used

6:13 wunki: is there a clojure function for (if x x y) ?

6:13 so, return x if x exists, else y

6:15 khaliG: wunki, (or x y) ?

6:15 but then y need be true

6:15 nevermind

6:16 although if its nil, its fine - so yes or ;P

6:16 wunki: khaliG: no, that's fine, y, in this case, is always true.

6:16 khaliG: yep!

6:16 wunki: khaliG: I'm a bit ashamed though, because it's so obvious

6:17 khaliG: wunki, haha don't be ashamed - sometimes you can see it straight away other times not

7:23 kzar: I don't understand the question for this puzzle, how come in the first example it can go from 1 to 3, surely it has to go from 1 to 0 or 2? http://4clojure.com/problem/79

7:28 Oh I see it means adjacent as in directly to left or right, not as in 1 higher or 1 lower

7:29 raek: I don't see any zeros in the triangles...

7:29 kzar: well exactly heh

7:32 raek: I think valid moves are diagonally down to the left and diagonally down to the rigth (since there is no element straight down if you think of the rows as "centered")

7:35 kzar: raek: Yea I think I just misread it

7:48 ZabaQ: Think I might ditch emacs for netbeans.

7:51 khaliG: ZabaQ, for enclojure?

8:02 ZabaQ: khaliG: More for Java integration.

8:04 khaliG: ZabaQ, makes sense to me. Honestly i'm not really using many features of slime myself so I could probably change over to netbeans too. Would be nice if matisse spit out clojure code!

8:05 mklappstuhl: hey..

8:06 i am just playing a bit on 4clojure and have problems with the #6 problem... when i type my solution into a repl it asserts true... the unittests on 4clojure however fail

8:06 (= '(:a :b :c) (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))

8:08 khaliG: there should be a 4clojure channel ..

8:09 mklappstuhl: oh okay :)

8:13 khaliG: there are only very few people in #4clojure ...

8:24 chouser: mklappstuhl: It's perfectly ok to ask here about 4clojure things.

8:33 solussd: Does marginalia ignore docstrings created as the second argument to defn? e.g. (defn my-func "a function" [x] (…))

8:35 manutter: ZabaQ: if you're looking at emacs alternatives, have you looked at Intellij IDEA? They have a free community edition, and a nice La Clojure plugin

8:36 mklappstuhl: chouser: so, do you have any idea how this is wrong? "'(:a :b :c)" is the koan

8:37 manutter: mklappstuhl: are you typing the parens into your answer?

8:39 chouser: mklappstuhl: I think manutter's on to it -- the square brackets are in the question already.

8:39 manutter: ,(= [(:a :b :c)] (list :a : b :c) (vec '(:a :b :c)) (vector :a :b :c))

8:39 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :>

8:40 manutter: oh, duh, missed a quote

8:41 ,(= ['(:a :b :c)] (list :a : b :c) (vec '(:a :b :c)) (vector :a :b :c))

8:41 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :>

8:41 manutter: time to go suck on some coffee...

8:44 Chousuke: manutter: you have a space between : and b there

8:45 manutter: ah, the old "can't see the spaces because they're empty" ploy, I see

8:45 ,(= ['(:a :b :c)] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))

8:45 clojurebot: false

8:45 manutter: there

8:45 I either need a better font or better keyboarding skills

8:59 chouser: 4clojure is fun. https://gist.github.com/1203334

9:01 manutter: chouser: what's in that gist? I don't want any spoilers now :)

9:02 chouser: spoilers are in the gist!

9:02 sorry, should have labelled that better

9:03 That was my solution for reading roman numerals

9:03 manutter: Ah, I've done that one, I'll take a look then :)

9:04 mklappstuhl: manutter: chouser, it was as easy as

9:04 ,(= [:a :b :c] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))

9:04 clojurebot: true

9:05 manutter: yeah, that one tricky by virtue of seeming TOO easy.

9:05 I wanted to try something more complicated first.

9:06 chouser: oo, nice use of ->>

9:07 chouser: :-)

9:23 mindbender1:

9:36 clgv: Is there any other approach than "jark" to use clojure in script form?

9:43 manutter: Does "other" need to mean "as good as"?

9:43 clgv: manutter: no. but a persistent vm running as daemon would be great for performance.

9:43 manutter: I would think you could use the same kind of nailgun-based approach that jark does

9:44 but it seems like jark has bundled that up for you already, so I don't think there'd be much advantage

9:45 out of curiosity, do you have a good use case for writing scripts in clojure?

9:45 chouser: doesn't cake provide a persistent vm?

9:45 there's also now the possibililty of clojurescript + nodejs

9:45 manutter: chouser: that sounds familiar too

9:45 yeah, I was going to mention that

9:46 I'm thinking that for scripting you want a platform with good hooks into the local OS, and I don't have the impression that OS hooks are Java's strong point

9:47 (which doesn't mean I wouldn't LOVE to write scripts in clojure)

9:49 chouser: nodejs solves both the fast-startup and to some extent the OS-hooks problems.

9:49 manutter: I suspected it might :)

9:50 chouser: and the only drawbacks are slow compilation speeds and an embriotic development environment. :-)

9:51 manutter: indeed. kind of hard to make a good case for not just whipping up a quick bash or perl script for most tasks you'd use a script for

9:52 or python or whatever

9:52 but not php.

9:52 :p

9:54 clgv: manutter: I have bootstrap script to build all my projects for a newly cloned git repo

9:54 manutter: ah, cool

9:55 clgv: I use leiningen for it ;)

9:55 it's kinda hack to load its jar but it works. cant wait to have leiningens core as lib ;)

9:56 * manutter ponders...how hard would it be, really, to write a clojure-to-bash DSL...?

9:56 manutter: run it once, it builds a bash script, then run the bash script as needed :)

9:57 chouser: that's clojurescript, but substitute nodejs for bash. *shrug*

9:57 poet: manutter: probably a lot more time than it would take to write the bash script :P

9:57 manutter: but if it works, and would compile good scripts, there might be a break-even at some point

9:58 clgv: I hate bashscripts. the syntax is so awful^^

9:58 manutter: well that's the beauty of DSL's, you never have to see the underlying code

9:59 (except if you're the one *writing* the DSL, then god help you)

9:59 clgv: lol

10:00 hugod: manutter: pallet's stevedore is a clojure-to-bash DSL…

10:00 manutter: Ha, I call vindication

10:00 chouser: manutter: http://pragprog.com/magazines/2011-07/growing-a-dsl-with-clojure "Our goal will be to define a DSL that allows us to generate various scripting languages. The DSL code should look similar to regular Clojure code."

10:00 manutter: Pallet is on my to-learn-more-about list

10:01 hugod: stevedore is an independent library these days, so no need to use the whole of pallet

10:02 manutter: true, but it seems like I'm setting up a lot of vm's these days, and I hear pallet's a good fit for that

10:02 stevedore is just icing on the cake.

10:03 neotyk: Is there an idiom for doing: (let [m {:a 1 :b 2}] (assoc (dissoc m :a) :a 3)) ?

10:03 ,(let [m {:a 1 :b 2}] (assoc (dissoc m :a) :a 3))

10:03 clojurebot: {:a 3, :b 2}

10:06 neotyk: there is

10:06 ,(update-in {:a 1 :b 2} [:a] #(+ 2 %))

10:06 clojurebot: {:a 3, :b 2}

10:07 manutter: ,(assoc {:a 1 :b 2} :a 3)

10:07 clojurebot: {:a 3, :b 2}

10:08 neotyk: manutter: true, though I need previous val for calculation

10:10 manutter: ,(let [m {:a 1, :b 2}] (assoc m :a 3))

10:10 clojurebot: {:a 3, :b 2}

10:11 manutter: yeah, I don't think you need anything fancy, plain old assoc does what you're looking for (if I understand correctly)

10:13 neotyk: assoc version reads better

10:13 clgv: neotyk: if you need to calculate the new value based on the old one use update-in

10:14 neotyk: (assos params :birthday (long (or (:birthday params) 0)))

10:14 (update-in params [:birthday] #(long (or % 0)))

10:14

10:15 manutter: yeah, update-in to do a direct calculation

10:34 saua: Hey, I'm trying to learn about lazy-evaluation. I

10:35 If you look at the code here http://pastebin.com/R3bqcQkx, what I don't understand is why you need to (def fib (fib-maker)), why can't you just use fib-maker directly?

10:37 clgv: saua: you dont have to

10:37 saua: (take 10 fib-maker)

10:37 java.lang.IllegalArgumentException: Don't know how to create ISeq from: Euler$fib_maker

10:37 (take 10 fib)

10:37 (0 1 1 1 2 3 5 8 13 21)

10:37 ?

10:38 Chousuke: saua: the code doesn't even work as you pasted

10:38 saua: the fib calls in fib-maker should be calls to fib-maker

10:38 and there is no need to def the fib sequence. in fact, deffing it is bad practice

10:38 saua: oh yes, i just copied it from a stackoverflow post, had to change it first

10:39 Chousuke: you want to do (take 10 (fib-maker))

10:39 saua: ah, that makes more sense

10:39 oh, right. because fib-maker is a function, while (fib-maker) is the actual sequence

10:39 Chousuke: yeah

10:40 saua: ty

10:40 Chousuke: deffing an infinite sequence is usually a bad idea :P

10:40 saua: oh?

10:40 Chousuke: if you take too many items from it, you end up with a large amount of memory that will never be gc'd

10:41 because defs never go away (unless you redef, but that's not usually done in application code)

10:42 khaliG: oops, really? :0

10:42 Chousuke: more precisely, because defs never go away AND lazy seqs cache generated items, you're essentially creating a permanent reference to something that may grow indefinitely

10:44 lpetit: Chousuke: ns-unmap to the rescue ?

10:44 Chousuke: that works, but also isn't really used in application code :P

10:44 lpetit: clearly :-D

10:44 (I'm jumping in the chat, slowly recovering context :-p )

10:48 clgv: lpetit: how is CCW progressing?

10:48 saua: Would making an inner function like this http://pastebin.com/nSFJJpVq fix the gc problem?

10:49 clgv: saua: not if you still def the output of fib - it's all about that def^^

10:51 Chousuke: saua: the function itself is completely fine

10:51 it's binding the resulting sequence to a var that is a problem

10:54 bendlas: saua: it's called holding onto the head

10:55 TimMc: I wonder at what threshold fib would be better off using floating point math to find the answer instead of iterating up to the index.

10:56 clgv: TimMc: much better when you use the explicit solution - the higher index the better. ^^

10:57 TimMc: clgv: Explicit solution meaning exponentiation + rounding?

10:57 Of course, that also only gets so you high up.

10:57 clgv: TimMc: as far as I remember that solution, yes

11:01 lnostdal_: anyone tried running clojure using the jamvm? .. is it solid?

11:01 -the

11:02 (jamvm is a "jvm mode" included with openjdk it seems)

11:02 (faster than "server mode")

11:02 or faster startup time that is

11:02 clgv: TImMc: but there seems to be an optimization due to a property of the golden ratio ;)

11:05 TimMc: lnostdal_: Never heard of it. If you experiment with it, let us know how it goes!

11:09 bendlas: lnostdal_: Is that the new mode where the -client JIT gets used at first, transitioning to the -server JIT over time?

11:22 choffstein: Hello everyone! I have a pretty stupid question, I think. I am using a library that requires reading a file from disk. I generate the data I want to pass the library then do something like: (do (ds/spit file-name file-data) (library/library-call filename)). My concern is whether or not ds/spit (and other such file-writing operations) are going to be completely blocking and whether or not there is a potential issu

11:22 the library call getting called before the file is completely written.

11:24 Cozey: choffstein: spit closes the file, which flushes its content

11:24 choffstein: perfect

11:28 lnostdal_: bendlas, i'm not sure, but i don't think so .. TimMc, ok! .. :)

11:31 edw: If http-agent has been deprecated since clojure-contrib 1.2, what is not the recommended way to do an HTTP request?

11:32 bendlas: edw: clj-http is the best for that, IMO

11:32 https://github.com/dakrone/clj-http

11:32 edw: bendlas: Thanks. Is there something cooking for 1.3 on this front, or is this something that is now considered outside the scope of the core (contrib) libraries?

11:35 arohner: edw: not everything good has to be in core

11:35 TimMc: edw: clj-http has been unmaintained for a bit, so dakrone is taking over.

11:36 choffstein: anyone familiar with using cemerick's rummage library?

11:37 edw: arohner: Notice I mentioned contrib...

11:38 arohner: edw: there are no plans for an http library in 1.3, and https://github.com/dakrone/clj-http is your best bet

11:42 edw: arohner: Thanks for seconding TimMc's pointer. SLURP has been swapped out with CLIENT/GET for about seven minutes now.

11:48 choffstein: Anyone have any idea why when I run my code through swank, it "exits", but when I run it as a jar, it hangs?

11:48 and by idea, I mean "ever heard of anyone else having this issue?"

11:52 arohner: choffstein: what kind of code are you running?

11:52 devn: anyone here toying with clojurescript and nodejs?

11:52 choffstein: Basically, I download some data from an internet source, play with it a bit, and then send it out via an email.

11:52 arohner: and knowing nothing else, my first guess is it has to do with the agent threadpools

11:53 choffstein: The email delivery is the last statement, and I get the email to my test inbox … but the code never seems to return.

11:53 arohner: choffstein: are you using threads? a webserver? agents?

11:53 choffstein: pmap is the closest I come to using threads.

11:53 devn: (def os (node/require "os")), (defn get-hostname [] (println (.hostname os))), (get-hostname), (set! *main-cli-fn* get-hostname)

11:53 arohner: choffstein: have you tried waiting more than 60 seconds after the last statement?

11:53 devn: that should work right?

11:53 choffstein: unless I am doing something behind the hood that I am not aware of.

11:54 arohner: choffstein: try adding (shutdown-agents) after the last statement

11:55 choffstein: i'll give that a whirl.

12:02 Hmm. Now I just keep getting a RejectedExecutionException. This is confusing.

12:02 arohner: choffstein: there's a lein bug that covers that. one sec

12:03 choffstein: https://github.com/technomancy/leiningen/issues/265 and http://tech.puredanger.com/2010/06/08/clojure-agent-thread-pools/

12:03 basically, your code needs to block until it's done

12:04 you'll probably need google cache for that second link

12:05 choffstein: Ah, I see...

12:07 how do I explicitly block?

12:07 bendlas: choffstein: def a promise called exit-status

12:08 deref it in your main

12:08 when you're ready to exit, do (deliver exit-status 0)

12:08 nickik: Is there e fix for the (read-line) problem in swank?

12:09 choffstein: Thanks

12:09 technomancy: choffstein: I'm thinking about backing that out in the next lein release

12:09 choffstein: if you want to block forever you can just do @(promise)

12:09 (System/exit 0) or Ctrl-c or whatever will still work

12:11 choffstein: Alright. Time to give this a spin!

12:11 technomancy: the prettier approach is to .join whatever thread's keeping the JVM open

12:12 nickmbai`: that was my solution. .join the current thread at the end of the main function

12:13 choffstein: Nope. Still getting all sorts of beautiful RejectedExecutionExceptions.

12:15 chewbranca: so I've officially been corrupted (enlightened?) by clojure/lisp, I'm using a java stack and I switched over to emacs... two things I never thought I would hear myself say

12:15 hiredman: technomancy decided to test out emacs again after our debate on emacs vs vim the other night, was impressed enough that I'm progressively switching

12:18 mindbender1:

12:18 manutter: Woot! Finally solved that pesky graph tour problem on 4clojure :D

12:18 choffstein: If I just do "lein swank", connect from emacs, and try something like (pmap #(println %) [1 2 3 4 5]) I get the RejectedExecutionException.

12:18 That's harsh.

12:19 technomancy: choffstein: half a second

12:20 choffstein: lein upgrade

12:20 choffstein: okay

12:21 Running 1.6.1.1

12:22 AH! It works!

12:23 technomancy: ~o/

12:23 clojurebot: \o ... High five!

12:28 choffstein: Ah, I wonder if cemerick's rummage is keeping some threads open and preventing me from exiting when I run the jar.

12:33 technomancy: chewbranca: welcome to the club

12:34 don't let me forget to teach you the secret handshake at the next meeting

12:34 choffstein: Interesting. If I don't put a (System/exit 0) at the end of my main function, it just hangs.

12:34 That's strange to me.

12:35 technomancy: choffstein: see the puredanger link above; that's a clojure issue

12:35 choffstein: okay. that explains a lot of issues in some old code. I was running cron jobs and they wouldn't freakin' die.

12:36 chewbranca: technomancy: hahaha sounds good

12:37 choffstein: I love clojure, but these corner issues sometimes make me pull out my hair. I've gotta stop trying to solve them myself and just come to irc sooner :)

12:37 chewbranca: technomancy: yeah I'm actually using vimpulse which I'm impressed with. I've been thinking a lot latey about the different approaches between emacs and vim. I would say the defining feature of vim is modal editing, and one of the big defining features of emacs is its customizability and its ability to run background processes

12:39 technomancy: and the thing I started to realize about lisp, (which dnolen's match library helped me realize) is that you can build on these features of other languages and tools if you have the underlying infrastructure, so really, modal editing is a feature, and one that can be built on after that fact in emacs, so its more important to have the underlying infrastructure to do things like run background tasks and have a solid wa

12:40 srid: is there a clojure library for user registration (including email confirmation)?

12:40 eg: there is ring-basic-authentication, but that is only basic auth

12:40 (and no registration)

12:43 chewbranca: technomancy: btw emacs-starter-kit and clojure-mode have been very handy, thanks!

12:43 technomancy: yeah, awesome

12:44 edw: srid: I would doubt it. I don't tihnk ring, compojure, noir, or any other web framework has gotten to that level of django-esque-ness.

12:47 srid: In my experience--in Django--I've had to do a lot of hand-rolling with registration because all of these libraries make assumptions that are often not the case in many particular situations. They *have* to do that of course, but I've found user registration one of those things that is hard to simply bolt on to your product.

12:49 TimMc: ~rejectedexecutionexception

12:49 clojurebot: RejectedExecutionException is fixed in Leiningen 1.6.1.1, so give it an upgrade

12:49 chewbranca: srid: edw while it won't help on the clojure side of things, I think devise in the ruby world does a good job of a bolt on registration system: https://github.com/plataformatec/devise

12:50 srid: edw one of the things that I really like is they broke everything down into self contained modules, so provided email confirmation on registration, or validations or password recovery is all separate modules and you can pick and choose what you want

12:50 srid: interesting, i'll take a look

12:51 chewbranca: srid: yeah its interesting, they also decoupled the actual authentication system so you can use: https://github.com/intridea/omniauth which is basically an oauth wrapper providing 3rd party login support to just about everything under the sun

12:52 aaelony: it seems [org.clojure.contrib/sql "1.3.0-SNAPSHOT"] has moved from clojars, can anyone point me to where the current version might be for my project.clj ?

12:53 chewbranca: aaelony: https://github.com/clojure/java.jdbc

12:53 aaelony: chewbranca: thank you

12:53 chewbranca: aaelony: np

12:56 seancorfield: [org.clojure/java.jdbc "0.0.6"] will get you the latest

12:56 should be completely compatible - with additional functionality added

12:58 edw: chewbranca: That sounds nice.

13:06 chewbranca: edw: yeah wanted to point it out because if anyone is going to rebuild an auth system for clojure, devise/omniauth is a nice pattern

13:13 aaelony: seancorfield: looks great, thx

13:38 wwmorgan: So I've checked out a new project and I want to start hacking on it with vimclojure. Right now my process is adding a couple of :dev-dependencies to the project.clj, then running lein deps, then a nailgun server, then I open vim on the project. I feel like this ought to be possible without editing the project.clj. Any ideas?

13:38 seancorfield: lein plugin install?

13:39 (so instead of them being dev dependencies, they're installed for all projects)

13:39 wwmorgan: seancorfield: awesome :-)

13:42 jli: I wanted to deploy a clojure webapp to heroku. I was using swank during development, but then it wouldn't start in heroku

13:42 chewbranca: wwmorgan: I would recommend checkign out slimv, which works very well and also just uses the standard lein swank plugin

13:43 wwmorgan: thanks chewbranca, I will

13:43 jli: I was swank via lein plugin, so it wasn't in project.clj at all. adding it as a dev-dependency wasn't evough either. I'm guessing I would have to have it as normal dependency for it to start?

13:43 the heroku error was not being able to find swank

13:43 poet: chewbranca: I found slimv to be pretty sluggish for Common Lisp dev, have you had a good experience with it?

13:44 chewbranca: poet: it was working well for me on clojure dev, and did some proof of concept common lisp dev (ie got it working with clisp and sbcl), didn't notice any performance issues

13:44 jli: perhaps I'm just using swank incorrectly. I have a conditional "swank/start-server" in my main function

13:44 chewbranca: although to be honest, I just switched over to emacs lol

13:45 I figure, the primary issue is that vim doesn't support background tasks, so slimv or vimclojure is always going to be a hack

13:45 poet: chewbranca: ha yeah I hear ha. if I didn't hate emac's documentation system so much I probably would switch over too

13:45 *emacs'

13:46 chewbranca: poet: oh? I haven't used it long enough to have an opinion on the docs, seem to be an abundance of them which is always nice, also, vimpulse works well, enjoying emacs +vimpulse

13:47 poet: yeah, just seems overly complex compared to my experience with vim. stuck in a hard place though because i think clearly elisp plugins + slime support > vim + vimscript

13:48 Apage43: I really like vimclojure -when i can get it to work-. And of course, vim is ingrained -hard- in my muscle memory.

13:48 I sometimes feel like i should learn emacs for working with lisps but it always seems so daunting

13:48 wunki: I'm about to open-source a web application written in clojure. Some things need to stay secret though (like twitter auth keys). Any tips on how to create a production settings file?

13:48 poet: you pick it up quick enough, but it's defintely a different design philosophy

13:49 if only vim was written in lisp TT

13:50 chewbranca: poet: Apage43 yeah I hear that, been using vim for better part of a decade, but I setup slimv with a repl and paredit for clojure dev, and realized that I stopped typing as much and that I also stopped needing as much of the text manipulation tools vim provides as I get most of it with paredit

13:50 poet: yeah after using emacs for 2 years the paredit on vim makes me want to jump off a cliff

13:57 Cozey: hello. When I (use ) a clojure file from swank, and have a syntax error, i don't get the linue number information anywhere. How is it possible to fetch it?

14:06 technomancy: wunki: just load config off the classpath with c.j.io/resource and configure your classpath to include secret files in production

14:08 wunki: technomancy: thank you, will do that!

14:15 technomancy: what's the program?

14:15 clojurebot: "In practice, nothing works." -- Brad Fitzpatrick

14:18 gigamonkey: Hey, I recognize that quote! ;-)

14:26 dnolen: whoa 349 peeps in here today?

14:29 * chouser is pretty sure he's not a peep.

14:29 chouser: Just sayin'

14:30 jodaro: i could be a leftover peep from three easters ago

14:30 the peep of easters past

14:30 or should that be easter's

14:32 hugod: dnolen: from what I see match 0.1.0 was never released, but went straight to 0.2.0-SNAPSHOT, correct? (you'll be getting bored of me asking for a release jar …)

14:33 dnolen: hugod: yeah probably not a cut a release until I get backtracking in. a bit swamped with other things (work and Dan Friedman's forthcoming constraint logic programming paper)

14:34 maybe next week or after Strange Loop.

14:35 chouser: apologies, I meant people of course ;)

14:35 hugod: dnolen: sure, I've got several projects I would like to use it on :)

14:35 chouser: dnolen: just kidding around. Don't mind me.

14:35 technomancy: inc on requesting a stable match

14:38 kephale: well, the only way to tell if you are a peep or not is the microwave test

14:40 bhenry: kephale: if that's the case then we're all peeps

14:55 icey: there's not really a way to assign a css class to a form input using hiccup, is there?

14:56 bhenry: icey: put it in curly braces:

14:57 [:div {:class "myclass"} "divcontent"]

14:57 joegallo: icey: are you talking about the form-to defelem, specifically?

14:57 https://github.com/weavejester/hiccup/blob/master/src/hiccup/form_helpers.clj#L115

14:58 icey: joegallo: no, i want to attach a class to a textarea

14:58 bhenry: [:textarea {:class "class"}]

14:58 joegallo: so are you using the text-area defelem?

14:58 https://github.com/weavejester/hiccup/blob/master/src/hiccup/form_helpers.clj#L88

14:59 icey: joegallo: yeah, so it looks like i'll have to move away from using the text-area defelem and use the regular syntax like bhenry mentioned. thanks.

15:00 bhenry: (assoc-in [1 :class] (text-area "name" "value") "my-class")

15:01 joegallo: icey: yup

15:02 bhenry: icey: see my last one if you are using the defelem. remember that the element is still a vector

15:04 icey: bhenry: I see how that would have worked, but using [:textarea ...] ended up looking a lot cleaner; thanks again :)

15:05 bhenry: icey: cool. i honestly didn't even know about defelem.

15:06 icey: it's great that there are many ways to skin this cat. i'm glad i asked about it now

15:08 arohner: icey: you can also do [:textarea.class]

15:08 [:div#my-id] and [:div.my-class] are both supported

15:09 and classes can be chained: [:div.foo.bar.baz]

15:09 icey: arohner: yeah, moving away from using the form helpers makes it a lot more flexible

15:09 arohner: now i'm not sure why i was using the form helpers... they didn't really gain me much

15:21 user317: why do i get an error when i (use :reload)? that a function already refers to something

15:29 raek_: user317: it probably means that you defn'ed a name that already exists in clojure.core, e.g. (defn conj ...)

15:29 user317: no, i doubt it

15:29 hist-data-conn

15:29 raek_: hrm, ok. then it sound less likely... :-)

15:30 you can remove the namespace with (ns-remove 'the.ns)

15:30 and then require it again

15:30 user317: whast the difference between use and require

15:30 raek_: also remove any other namespaces that has used or required that one

15:31 require only makes sure that the namespace has been loaded

15:31 after that you can acces a var x in namescape foo.bar with foo.bar/x

15:31 user317: i see, what about use?

15:31 raek_: use does what refer does but also "pulls in" all public vars of the namespace so you don't have to use the namespace prefix

15:32 a bit like import in java

15:32 jfletcher: is there a list of which structures are optimized for what? or a way I can just use lists/hashtables?

15:34 raek_: user317: this is a good reference: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

15:34 user317: raek_: thanks

15:35 raek_: it is recommended to only use 'use' with the :only option

15:36 (after trying to read code from someone who didn't, you will see what I mean)

15:54 chouser: jfletcher: http://www.innoq.com/blog/st/2010/04/clojure_performance_guarantees.html

16:01 user317: any reason why test would return :no-test when i have a test defined?

16:13 jfletcher: chouser: thanks, that's a much more helpful answer than I expected.

16:13 chouser: jfletcher: set your expectations low enough and you'll never be disappointed :-)

16:14 Raynes: chouser: You disappoint me all the time.

16:14 chouser: Raynes: your expectations need to be lower, then.

16:14 Raynes: But what if I expect to be disappointed?

16:14 Then I suppose my expectations are low enough.

16:15 chouser: jfletcher: I just noticed the header on that table is messed up -- shifted to the left one column.

16:15 jfletcher: chouser: Yeah noticed that after looking at the vector column

16:16 Another question I'm a little hesitant to ask, am I the only person to find clojure's syntax more confusing than CL?

16:17 the reason I liked CL in the first place was the fact it was the same every time, and no need to think about order or evaluation etc,

16:18 plus you could do like (let ([x 1] [y 2]) (+ x y)) if you really wanted

16:18 chouser: jfletcher: no, you're not the only one. But for me, those little differences between () and [] helped a *lot* in learning to read Clojure.

16:19 jfletcher: it's not a massive problem, the fact I've never written a line of java before is a bigger problem

16:19 chouser: Clojure sits in an interesting spot, attracting Java, Lisp, and Unix-scripty programmers

16:20 jfletcher: which is also because of syntactic politics, in that I didn't like camelback notation 15 years ago.

16:20 chouser: Each of them already had some of Clojure's features but are attracted by something they were missing

16:20 user317: how do i construct a record?

16:20 chouser: But that also means each of them finds some part of Clojure uncomfortable

16:21 jfletcher: mm

16:22 user317: (apply HQ. '(1 2)) gives me a ClassNotFoundException HQ.

16:22 chouser: Lispers tend to complain about too much syntax, cons acting differently, nil != (), core functions being named differently, lack of user-defined reader macros, and requiring functions be defined before use.

16:23 user317: try (apply ->HQ [1 2]) or (HQ. 1 2)

16:23 jfletcher: yea, why isn't empty list null?

16:23 chouser: jfletcher: heh. see?

16:23 user317: java.lang.Exception: Unable to resolve symbol: ->HQ

16:23 jfletcher: personally I think it's great, not that () is (), but nil is nil and nothing else

16:24 user317: i have (defrecord HQ [foo bar])

16:24 jfletcher: but yea, the rest I admit to.

16:24 chouser: jfletcher: Java people complain about parens everywhere, dynamic typing, lack of infix math

16:24 jfletcher: infix suck

16:24 s

16:24 they should try being around when you had to load your arguments into stacks.

16:24 that's how polish notation came about in the first place. :)

16:25 user317: chouser, this is the only thing that worked (apply #(HQ. %1 %2) [1 2])

16:25 chouser: Unix scripty people (that's me) complain about the JVM startup time, classpaths, lack of good access to underlying OS

16:25 jfletcher: mm, they're valid points though

16:26 though no lisp has brilliant access to OS, without 3rd party interface.

16:26 user317: chouser, any idea why? is -> something that i need to import/require?

16:26 chouser: user317: HQ. isn't a function, that's why you can't pass it as an argument to apply. (HQ. x) is essentially a macro that expands to (new HQ x)

16:27 user317: When you use defrecord in recent versions of Clojure, it also generates ->HQ and map->HQ functions. My guess would be your version of Clojure doesn't have that yet

16:27 user317: or perhaps those functions are in a different namespace and you're importing the HQ class but not the functions.

16:28 jfletcher: there is probably some validity to all those arguments, but a lot of difficult engineering tradeoffs were made to design Clojure and I'm generally pleased with the results.

16:29 jfletcher: one reason for nil != () is that nil is Java's null and thus can't implement any interfaces, while () is a real object that implements ISeq, Counted, etc.

16:32 I'm taking off.

16:32 jfletcher: Take care, and thanks again.

16:40 user317: so i defined a record in one file, but i cant seem to use it from my test file when i call (RecordName. blah) it gives me a an error that it cant resovle calssname

16:49 seancorfield: you need to import it

16:49 bhenry: user317: you have to import it.

16:49 user317: i have :use [namespace] in my namespace

16:50 is there a maximum number of fields in a record?

16:50 bhenry: (:import [namespace.classname])

16:50 dnolen: user317: no but at certain point you should probably just use plain maps.

16:54 user317: :14

16:58 dnolen: user317: well, actually you're probably limited by the max number fields for Java classes.

17:09 seancorfield: might it be limited by the max number of args in a function call? (just curious)

17:09 user317: man, this is driving me nuts, so i have (:import [ibclj.defs.HQuote]) but i still get Unable to resolve classname: HQuote, when i reference Hquote.

17:09 HQuote. that is

17:11 jkkramer: user317: gist?

17:12 hiredman: user317: look at example :import usage, and some :import usage in some sample code

17:12 user317: whats gist

17:12 jkkramer: gist.github.com

17:12 hiredman: you don't need to paste anything

17:12 the problem is immediately obvious

17:13 compare that :import to a working :import

17:13 dnolen: seancorfield: if it's true it's only for the default type/record ctors I think, not actually syntax for constructing an type/record instance.

17:14 user317: requiring someone to use :import isn't very nice tho, better to provide ctor fn, then people can just use that to get an instance of your type.

17:17 user317: ctor function seems the way to go, thanks

17:18 seancorfield: (:import [ibclj.defs HQuote]) - is that right?

17:18 hmm, i got it working in a repl and then it doesn't work via lein test

17:18 ignore me :)

17:19 i haven't had to use records yet so i'm curious about the solution...

17:26 user317: do reify methods need to be the same order as they are declared in the class i am trying to implement?

17:27 coopernurse: what's the right way to setup a local dependency when using lein? for example, I'm working on project X which depends on lib Y. I want to hack on Y and test those changes in X without having to deploy a jar to a maven repo.

17:28 seancorfield: ah, figured it out! you have to require or use the containing namespace _and_ import the record type, yes?

17:28 technomancy: coopernurse: check lein help readme for the section on checkout dependencies

17:29 brehaut: seancorfield: yes

17:29 seancorfield: so (:require ibclj.defs) (:import ibclj.defs.HQuote)

17:29 none of the clojure books are very clear about that

17:29 user317: seancorfield: i wrapped it with a ctor function

17:29 seancorfield: i couldn't find a multi-namespace example with records in Clojure in Action

17:30 Clojure Programming kinda glosses over it too

17:30 hiredman: seancorfield: it depends what the record does, if the record doesn't do anything with the namespace it is created in you don't need to load it

17:30 seancorfield: Joy of Clojure gave me the hint...

17:30 coopernurse: technomancy: thanks. so the "checkouts" bit is wwhat I'm after?

17:30 user317: seancorfield: which also lets me use it in apply, etc..., the use/import/require seems the ugliest part of clojure so far

17:30 technomancy: coopernurse: right

17:30 coopernurse: cool, thanks

17:31 seancorfield: hiredman: my test case just had (defrecord Test [first last]) in one ns and in the other ns I had to require and import

17:31 hiredman: seems unlikely

17:31 what errors did you get?

17:31 brehaut: has anyone else run into problems around clj 1.2.0 and 1.2.1 where records in a namespace that contains a hyphen (eg necessary-evil.fault.Fault) run into hyphen munging problems?

17:31 seancorfield: hiredman: ClassNotFoundException on the record name

17:32 went away when i required the containing ns

17:32 hiredman: I would double check that, make sure you actually ran the import

17:34 seancorfield: https://gist.github.com/1204829

17:34 shows the two files

17:35 without that (:require ...) i get this failure: Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: beta3.trial.TrialRecord

17:36 hiredman: must be a repl thing

17:38 seancorfield: i was not running it in the repl

17:39 when i ran it in the repl, i loaded both files and could import without require (if that's what you mean) - which makes sense

17:39 ...since both files were loaded

17:39 but just running beta3.core (-main) via lein run doesn't load beta3.trial without the require

17:40 hiredman: works for me

17:40 1.2 or 1.3?

17:40 seancorfield: 1.3 beta3

17:40 (hence the beta3 in my namespaces - i have a lein project for each version of clojure so i can experiment easily :) )

17:41 you tried on 1.2 i assume?

17:41 hiredman: both

17:42 pastebin the exact exception?

17:43 you are missing a :gen-class if you are expecting to generate a main method

17:47 seancorfield: lein run doesn't need :gen-class

17:47 hiredman: correct

17:48 just saying, missing :gen-class can show up as a classnotfound

17:48 seancorfield: http://pastebin.com/ffJrkRV6

17:48 uncomment the (:require) and it works, comment it out and it fails

17:50 hugod: without the require there is no defined load order, so it could load beta3.core before beta3.trial

17:51 hiredman: ah, of course

17:51 but if you aot the class will be available regardless

17:51 it never loads beta3.trial so the record is never defined

17:53 hugod: brehaut: using records containing underscores is not source code compatible between 1.2.0 and 1.2.1

17:53 brehaut: hugod: yes ive noticed

17:54 hugod: unfortunately i made the (apparently flawed) decision prior to 1.2.1

17:54 hugod: if theres a work around so i can fix my lib, that'd be handy

17:55 hugod: it has to work with both 1.2.1 and 1.2.0?

17:56 brehaut: hugod: i have uses of my lib on both i believe

17:56 hugod: i guess i could put out a release that requires 1.2.1

17:56 user317: ((memfn charAt i) "foo" 1), where does the `i' come from?

17:57 hugod: brehaut: or wrap all references to the classname in functions, so library users don't use the class name directly

17:57 user317: oh, its the arg name

17:58 brehaut: hugod: ah right

17:58 hugod: thanks

18:07 dsantiago: Is there some way, if there's a function that is using map destructuring, to collect its arguments into a map and use that map to call the function recursively?

18:09 brehaut: ,((fn [{a :a c :b :as m}] (prn a c m)) {:a 1 :b 2 :c 3})

18:09 clojurebot: 1 2 {:a 1, :c 3, :b 2}

18:09 brehaut: dsantiago: im not quite sure if thats what you are asking

18:09 dsantiago: brehaut, Yeah, I think what I mean is actually the keyword args in the map destructuring after &.

18:10 brehaut: ,((fn [& {a :a c :b :as m}] (prn a c m)) :a 1 :b 2 :c 3) ; more like that ?

18:10 clojurebot: 1 2 {:a 1, :c 3, :b 2}

18:11 dsantiago: Well, yes, but now I want to call that function with the actual map (m).

18:12 brehaut: ,(apply prn (flatten (seq {:a 1}))) ; is a horrible way to achieve it ?

18:12 clojurebot: :a 1

18:12 dsantiago: Ah, OK, I had tried apply, but I didn't think of that.

18:13 Thanks.

18:14 brehaut: dsantiago: perhaps a wrapper function with variadic args and a real function with a map arg would be nicer though

18:14 dsantiago: Yeah, that's where I was heading anyhow, it just felt like there should be a more direct way.

18:22 jkkramer: is (binding [*read-eval* false] (read-string input)) safe to use with untrusted input? like, is there any way for it to instantiate arbitrary classes or do nefarious things?

18:29 based on available documentation/code, it appears the answer is yes. would be nice if read or read-string mentioned *read-eval* and safety

18:32 seancorfield: hiredman: good point about aot and defrecord (sorry, stepped away for a bit)

18:38 brehaut: hugod: hmm. it turns out that im implementing a protocol from one namespace on the record from another namespace internally

19:01 patchwork: hey all, I doing a "use" to import a library into my namespace

19:02 but when I import THAT namespace, none of the original symbols are bound

19:02 do I need to do another use in this namespace, or is there a way to transmit used symbols into the next namespace?

19:02 Just curious what the idiomatic usage is here

19:12 technomancy: patchwork: calls to use are not transitive

19:13 people have experimented with transitive use, but the consensus was that it's undesirable

19:14 patchwork: technomancy: Gotcha

19:14 so just use the same use call

19:14 if that is what I desire

19:14 thanks!

19:14 technomancy: yep, sure

20:18 jli: hum, is there a nice way to convert from clojure maps to javascript objects? I thought .strobj was it, but doesn't seem to be working for me

20:23 seancorfield: is there an idiomatic and/or performance preference for #(f a %) over (partial f a) - any compelling reasons / situations when one is better than the other?

20:25 hiredman: #() creates new classes all the time, (partial f a) doesn't

20:26 or, I should say evertime #() is compiled

20:26 ,(type #())

20:26 clojurebot: sandbox$eval5412$fn__5413

20:26 hiredman: ,(type #())

20:26 clojurebot: sandbox$eval5440$fn__5441

20:26 hiredman: ,(type (partial + 1))

20:26 clojurebot: clojure.core$partial$fn__3822

20:26 hiredman: ,(type (partial + 1))

20:26 clojurebot: clojure.core$partial$fn__3822

20:26 hiredman: and partial is just prettier

21:00 hugod: brehaut: then a macro would be the only way to make it work across versions

21:00 brehaut: hugod: thanks

21:38 jli: okay, I think I finally understand strobj

21:39 well, that's not true. I'm just less mistaken about it.

22:07 is there any sugar for building a map like this? (let [x ... y ... val ...] {:x x, :y y, :val val})

22:07 well, not sugar, but idiomatic shorthand

22:08 S11001001: jli: don't do the wrapping let, just stick the computing exprs as the values in the literal map

22:08 jli: well, the expressions can be big

22:08 S11001001: jli: indentation saves you here

22:09 jli: really big.

22:09 S11001001: how would putting them as let vars be any clearer?

22:09 jli: or maybe it's (let [[x y] ... {val :val} ...] {:x x :y y :val val})

22:10 S11001001: if you want to compute the value collection separately from the key collection, zipmap is your friend

22:12 jli: I don't

22:19 gfrlog: what might I be doing wrong if I try to implement an interface with deftype and it complains that the method is not in the interface?

22:21 seancorfield: hiredman: your argument about #() vs (partial) is persuasive - and since i was already moving that way in my code, i feel vindicated :)

22:21 cemerick: gfrlog: check the arity of your implementing method body, as well as a method name typo

22:23 gfrlog: cemerick: it's a java-ey interface, do I need to worry about the types of my arguments, or does the compiler take care of that?

22:25 brehaut: seancorfield: as a bonus you can join the church of point free

22:25 jli: use with comp for an even higher score

22:26 I don't think it's possible to attain haskell-like pointlessness without flip though

22:27 gfrlog: dangit now I need to look up the irc logs to see what hiredman's argument was

22:27 brehaut: gfrlog: #() generates a new class each time, where partial does not

22:27 cemerick: gfrlog: So it's an interface with overloaded method sigs? Yeah, you'll have to hint the args in that case, but then you would get an error like...

22:28 "Must hint overloaded method: m"

22:28 gfrlog: cemerick: no, it's not overloaded

22:28 cemerick: so I assume it's supposed to just work

22:28 jli: http://www.haskell.org/haskellwiki/Pointfree#Combinator_discoveries

22:28 gfrlog: cemerick: oh I forgot the this arg

22:28 cemerick: gfrlog: Yeah; I'm guessing an arity issue

22:28 Ah, sure, explicit this :-)

22:29 * cemerick should've mentioned that to start

22:29 gfrlog: cemerick: thanks for the help

22:29 cemerick: hah, FWIW

22:30 gfrlog: brehaut: yeah I agree that's rather compelling

22:31 does anybody know/suspect a rationaled behind the clojure regex syntax? Every language I know of with a regex syntax uses //, so I'm surprised clojure doesn't use that or at least #//

22:31 brehaut: gfrlog: its purely a reader macro that way?

22:32 gfrlog: brehaut: I don't follow -- how does a syntax choice determine whether or not something is a reader macro?

22:32 brehaut: and it can hook into the # dispatch thing

22:32 gfrlog: what about #/regex/

22:32 brehaut: # is a dispatch thing; it takes the next thing and gives it a different meaning

22:33 theres no /something/ literal

22:33 arohner: wait, how does #() create a new class each time, but partial does not? and what context does "each time" mean?

22:33 gfrlog: arohner: each time it's compiled

22:33 arohner: every function literal is a separate class

22:33 partial is not a function literal

22:34 brehaut: arohner: http://clojure-log.n01se.net/#20:25 for hiredmans examples

22:34 arohner: oh, I see. #() creates a new class, (partial) creates a new instance of the same class

22:34 gfrlog: brehaut: does # operate at the parser(==? reader) level?

22:35 arohner: gfrlog: reader. Go check out LispReader.java

22:35 I don't think there's really a separate parser in clojure

22:35 brehaut: arohner: each macro or special form is its own parser?

22:36 although i guess parsers dont typically work on trees?

22:36 arohner: brehaut: each form calls read() as necessary

22:36 so when the reader sees (, it calls readList(), which reads() until )

22:36 gfrlog: can macros have preconditions?

22:39 brehaut: arohner: i think ive managed to not articulate what i mean

22:41 arohner: typically a parser process a stream of symbols generated by the lexer; in clojure the reader creates a tree which is more complex than a lexer would create but less complex than what you'd get out of a parser?

22:42 gfrlog: The reader returns a clojure data structure I believe

22:42 brehaut: exactly

22:42 gfrlog: with all the reader-macros having been processed

22:43 brehaut: but the meaning of that as a program is still unknown until its run through the evaluator / compiler

22:44 gfrlog: yeah, clojure/lisp trade less "syntax" for less meaningful parses

22:44 brehaut: im beginning to think theres no point trying to draw an analogy to a more conventional language here

22:44 gfrlog: hah

22:44 brehaut: gfrlog: thats the thing though; the result of the read is more information rich than a lexer stream, but less so than an AST

22:45 (lets ignore the argument about whether sexp's are ASTs)

22:45 gfrlog: Abstract Lysptax Trees

22:46 (that's where the alt key comes from)

22:46 srid: has any deployed apps to heroku with scheduled tasks (cron)? i wonder how the pricing for cron (assuming you run 1-5 mins task per day) is determined on the Cedar stack.

22:49 TheBusby: account list

22:49 whoops, sorry wrong window

22:49 gfrlog: lame password

22:50 brehaut: gfrlog: how do you know? it just came through as ************ to me

22:51 gfrlog: brehaut: because any password with fewer than 20 characters is lame

22:51 brehaut: haha

22:51 gfrlog: [org.clojure/clojure-contrib "1.2.1"]

22:51 anybody know what's wrong about that?

22:51 * gfrlog perfectly phrased the question so it had the same number of characters as the previous line

22:51 brehaut: it doesnt exist?

22:52 gfrlog: brehaut: ah, good point, I'll go fix it then :P

22:52 "lein new" doesn't include contrib anymore so now I gotta go lookup the maven line

22:53 brehaut: ah yeah. i need to go find out where the contrib libs necessary-evil depends on now live

22:54 gfrlog: I switched it to 1.2.0 and that worked :/

23:03 when clojure starts throwing an arrayindexoutofboundsexception whenever you load your namespace, it's time to go to bed.

23:16 lrenn: i just updated my emacs (emacs starter kit) config after what was probably a year and now I don't get a repl. slime work, clojure mode works, i can compile etc, but i don't get a repl buffer. do i have to turn on slime-fancy or something?

23:48 slime-repl is a separate package now. following the current documentation new users won't get a repl :( That's a bummer.

Logging service provided by n01se.net