#clojure log - Jan 04 2014

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

0:10 egghead: is there anything like hiccup for om dom fns

0:10 noonian: https://github.com/r0man/sablono maybe

0:12 egghead: ah, thanks

0:12 noonian: np

0:13 egghead: all the om/el #js stuff feels very boilerplate :3

0:13 https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/item.cljs#L66-L83

0:40 t3soro: Is there some lock object like a multi-semaphore that can signal all waiting threads?

0:41 marcopolo`: t3soro: what are you trying to do?

0:42 t3soro: synchronize an object and block all ops on it until it's ready

0:43 I have a state machine and i dont want to allow ops during a busy state.. never mind i see how its not necessary

0:43 hiredman: there are lots of those infact

0:43 t3soro: how much do i have to pay you?

0:44 lol

0:44 hiredman: every jvm object has wait/notify

0:44 not that those are great, but they are there

0:46 t3soro: Hmm these are interesting but i got it figured out.. just requires an atomic boolean busy state

0:50 indigo: bitemyapp: http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java :D

1:39 alew: is reduce lazy?

1:40 TEttinger3: alew: you can reduce over lazyseqs. I believe even then it evaluates them though. to the docstring! ##(doc reduce)

1:41 lazybot: ⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well... https://www.refheap.com/22458

1:41 alew: I guess it doesn't really make sense for reduce to be lazy

1:41 TEttinger3: so no, not lazy

1:42 but you can do something like...

1:42 ,(reduce (fn [_ __] (reduced)) 0 (repeat 1))

1:42 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/reduced>

1:43 TEttinger3: ,(reduce (fn [_ __] (reduced "whee")) 0 (repeat 1))

1:43 clojurebot: "whee"

1:43 TEttinger3: (repeat 1) is an infinite sequence

1:45 alew: right

2:30 john2x: how do I try out my leiningen template locally?

2:33 TEttinger3: john2x, maybe lein install? I've never used anything but the default template though

2:41 noonian: yeah, lein install

2:42 then add it to your plugins in .lein/profiles.clj i think

2:42 in mine its in the form of [<template-name>/lein-template "0.1.0-SNAPSHOT"]

3:09 Clome_: Is there a macro, form, or fn that allowes you to apply a single argument to multiple function (do (fn1 a) (fn2 a) (fn3 a) (fn4 a) (fn5 a)) => (something a fn1 fn2 ...)

3:16 egghead: Clome_: ((juxt fn1 fn2 fn3 fn4) a)

3:17 ,((juxt < >) 1 0)

3:17 clojurebot: [false true]

3:18 `cbp: (doto a f1 f2 f3 f4)

3:36 pyrtsa: Ouch, the semantics of (reduce f xs) could be better than: "If coll has only 1 item, it is returned and f is not called. (...) If coll contains no items, returns val and f is not called."

3:37 ^ That works fine for (+) and (*), but not so much for monoids like sets where the type of the first argument of f is different from the element type of xs.

3:38 Fortunately (reduce f init xs) works. :)

3:39 (IMO, a better option would've been to define (reduce f xs) as an error if xs is empty, regardless of f.)

3:45 arcatan: my favorite would be to define f like (defn f ([] unit-value) ([x y] (operation x y))) and then (reduce f xs) = (reduce f (f) xs)

3:45 (not actually a good idea, but hey)

5:52 abaranosky: anyone there?

6:13 ddima: probably ;)

6:25 john2x: hmm i'm getting "No such var: clojure.core.cache/through" when trying to start the repl of a project created by my fork of luminus-template. what does it mean?

6:34 anildigital: what's wrong with this code? https://gist.github.com/anildigital/c3f47416b8986bd6b59b

6:34 mrcheeks: john2x: do you depend on it?

6:35 john2x:depend as lein dependency

6:36 john2x: mrcheeks: no, but probably one of the dependencies that's added by luminus.. strange thing is that the changes I introduced don't remove/add any dependencies.. I just switched some template files around.

6:38 ddima: anildigital: how do you call functions in clojure?

6:38 mrcheeks: anildigital: looks like you're writing code the java way and mixing it up, I'm also still learning though... (1) vs 1 (* 1 1 ) vs (1 * 1)

6:38 ddima: anildigital: you multiply n with a function instead of calling it

6:39 john2x: here's the stacktrace https://www.refheap.com/22463

6:39 ddima: and you also call an int

6:39 anildigital: ddima: corrected that but still get same error

6:39 https://gist.github.com/anildigital/c3f47416b8986bd6b59b

6:39 ddima: basically its completely wrong unfortunately, see https://gist.github.com/anildigital/c3f47416b8986bd6b59b

6:39 err

6:39 http://stackoverflow.com/questions/1662336/clojure-simple-factorial-causes-stack-overflow

6:40 wrong link

6:40 john2x: and as a sidenote, since I `lein install`ed my fork of luminus-template, how do I go back to the official version?

6:40 ddima: anildigital: the recursive call is not a proper call still

6:41 anildigital: what helps if you absolutely dont see your error, try every line on its own in the repl

6:41 mrcheeks: ddima: indeed, but the syntax is all wrong

6:41 ddima: with imaginary values

6:41 mrcheeks: yeah, as mentioned

6:43 anildigital: its actually pretty easy to understand, whatever is in the first position of a 'list' () is viewed as a call to this function and the rest are arguments. so if the thing at position one is not a function it wont work. usially X cannot be cast to clojure.lang.IFN

6:43 this would also happen for (1)

6:43 ,(1)

6:43 mrcheeks: anildigital: Check again function calls in lisp and that should do it (prefix notation)

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

6:47 ddima: anildigital: fixed? ;)

6:49 there's one more thing you need to understand for your example: whatever statement was evaluated last will be returned by your function - thus 1 or the result of the recursive call, but you dont need to wrap any value in braces

6:49 ,(do (defn footest [] 1 2 3) (footest))

6:49 clojurebot: 3

6:54 john2x: found the culprit that's depending on clojure.core/memoize. it's https://github.com/ngrunwald/ring-middleware-format/blob/master/project.clj. But I've added clojure.core.cache to my project.clj already, and it's still throwing the exception

6:54 pyrtsa: arcatan: That's incidentally what clojure.core.reducers asks you to do. :) (Re: "semantics of (reduce f xs)")

6:54 john2x: does it need to be added in core.memoize's dependencies?

6:55 or in ring-middleware-format's dependencies?

7:07 Clome_: why this (map #(do {% (inc %)}) a) does work but this does not (map #({% (inc %)}) a)? You are allowed to define a fn that just returns a map.

7:12 amalloy: #(x) is (fn [] (x)), not (fn [] x), Clome_. if you substitute {% (inc %)} for x there, you'll see that it expands not to the (fn [x] {x (inc x)}) that you want, but instead to (fn [x] ({x (inc x)}))

7:13 Clome_: thanks

7:14 ddima: Clome_: sometimes macroexpand-1 is your friend ;)

7:15 amalloy: but not in this case, ddima :P

7:15 it's really just quote

7:15 ,'#({% (inc %)})

7:15 clojurebot: (fn* [p1__25#] ({p1__25# (inc p1__25#)}))

7:15 ddima: oh, true, the expand does nothing ;)

7:15 til

7:19 amalloy: do you know how thats implemented btw?

7:21 amalloy: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L624

7:21 ddima: thx

7:23 haven't peeked into the code very much yet, so wasnt able to quickly find it. initially thought it might still be something different than just hardcoded shorthand

7:26 Clome_: I have a vector and I would like to apply a fn to each ele, this ele, when applied to this fn would return a vector. I would like at the end to have a map whos keys are ele of the original vector and values being vectors returned by the function applied on this ele.

7:26 example (map #(do {% [% % %]}) [1 2 3 4 5]), now I get a seq of maps, and I would like to merge them all in one map

7:26 Is this even the best way to do this?

7:30 amalloy: &(into {} (for [x (range 1 6)] [x (repeat 3 x)]))

7:30 lazybot: ⇒ {1 (1 1 1), 2 (2 2 2), 3 (3 3 3), 4 (4 4 4), 5 (5 5 5)}

7:30 ddima: you coult either do a (into {} (map ...) or you could do a (apply merge (map ...))

7:30 could

7:30 sry

7:30 and probably any other number of interesting ways ;)

7:31 hyPiRion: ,(let [f #(repeat 3 %)] (reduce #(assoc %1 %2 (f %2)) {} (range 1 6)))

7:31 clojurebot: {5 (5 5 5), 4 (4 4 4), 3 (3 3 3), 2 (2 2 2), 1 (1 1 1)}

7:32 ddima: amalloy: btw, why does the indentation suck so much in the jvm code? ;)

7:32 amalloy: rich is some kind of lunatic, ddima

7:32 he purports to like it that way

7:32 ddima: is that so? ;)

7:32 hehe

7:33 at first i suspected those parts were generated or something, but nah

7:51 anildigital: ddima: nope not yet. . here is updated gist https://gist.github.com/anildigital/c3f47416b8986bd6b59b

7:55 pyrtsa: anildigital: (n - 1) -> (- n 1). There are no infix operators in Clojure.

7:55 anildigital: ddima: got it right https://gist.github.com/anildigital/c3f47416b8986bd6b59b

7:55 pyrtsa: thanks

7:56 if you use emacs.. what emacs plugins would help me to do clojure development.. I am already using cider, clojure-mode clojure-test-mode

8:06 guns: Anyone have any tips for performance regression testing? I'm hoping there's already a test wrapper around criterium or something like that…

8:10 TEttinger: guns, I actually don't know what that is, but it sounds like something I could use... if I used unit tests <.<

8:11 anildigital, there's lots of ways to write a factorial in clojure. a fun one is:

8:11 ,(reduce * (range 1 10))

8:11 clojurebot: 362880

8:12 TEttinger: err needs to be incremented, the 10

8:12 guns: yes, tests that scold you when you make things slower are a good way to keep things fast

8:12 TEttinger: that's actually factorial 9, because range excludes the end

8:13 anildigital: yep

8:13 (defn factorialm

8:13 [n]

8:13 (reduce *' (range 1 n)))

8:13 TEttinger: don't paste multi-lones in the channel please

8:13 *lines

8:13 anildigital: btw.. just for my knowledge... since when reduce is there in clojure?

8:13 I heard reducers were introduced couple years back

8:14 TEttinger: you can define them in privmsg to clojurebot

8:14 well

8:14 reduce is different from reducers

8:15 pyrtsa: reduce has been there from the start.

8:15 TEttinger: reduce is a function that takes a collection and a function of two args, like + or *, and goes through and collects them into one value. it's been around since before 1.0

8:15 anildigital: TEttinger: I sent it to clojurebot in privmsg .. does it respond back with pastie

8:15 TEttinger: reduced is a function that can short-circuit eval

8:15 not multiline uuhhhhh

8:16 hang on

8:16 ,(defn factorial-m [n] (reduce *' (range 1 n)))

8:16 clojurebot: #'sandbox/factorial-m

8:16 TEttinger: like that

8:16 IRC handles things on a line-by-line basis

8:16 ,(factorial-m 9)

8:16 clojurebot: 40320

8:16 pyrtsa: Krhm. ,(defn factorial-m [n] (reduce *' (range 1 (inc n))))

8:17 TEttinger: yeah, just copying his

8:17 pyrtsa: Heh, yeah.

8:17 TEttinger: ,(defn factorial-m [n] (reduce *' (range 1 (inc n))))

8:17 clojurebot: #'sandbox/factorial-m

8:17 TEttinger: ,(factorial-m 9)

8:17 clojurebot: 362880

8:17 TEttinger: heyyy

8:17 ,(factorial-m 90)

8:17 clojurebot: 1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000N

8:17 TEttinger: snappy

8:18 capital N is for Big Integer

8:18 capital M is for Big Decimal

8:19 ,(factorial-m 90.0M)

8:19 clojurebot: 1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000N

8:19 TEttinger: ,(factorial-m 90.5M)

8:19 clojurebot: 135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000N

8:19 TEttinger: oh that's interesting

8:21 the range makes reduce behave differently than (I think) the recursive solution on decimal inputs

8:21 anildigital: factorial of 9 was wrong above

8:21 TEttinger: first one yeah?

8:21 anildigital: it is supposed to be 40320

8:21 TEttinger: ,(* 1 2 3 4 5 6 7 8 9)

8:21 clojurebot: 362880

8:21 anildigital: ,(factorial-m 9)

8:21 clojurebot: 362880

8:21 anildigital: that's wrong

8:21 TEttinger: I redefined it

8:21 wait

8:22 so factorial doesn't multiply by the number as an arg?

8:22 anildigital: ,(defn factorialm [n] (reduce *' (range 1 n)))

8:22 clojurebot: #'sandbox/factorialm

8:22 anildigital: ,(factorialm 9)

8:22 clojurebot: 40320

8:22 anildigital: that's true

8:22 TEttinger: ,(* 1 2 3 4 5 6 7 8 9)

8:22 clojurebot: 362880

8:22 TEttinger: that's what a factorial boils down to right?

8:22 anildigital: TEttinger: that's factorial of 10

8:22 ,(factorialm 10)

8:22 clojurebot: 362880

8:23 pyrtsa: ,(factorialm 3)

8:23 clojurebot: 2

8:23 anildigital: what is best way to learn clojure syntax .. I am long time ruby programmer..

8:23 pyrtsa: Yeah right.

8:24 anildigital: let me know most interesting and fun book to learn clojure .. clojure programming feels like covering eveything.. but not that applicable

8:24 TEttinger: anildigital, you just get used to the parentheses after a while. editors with optional rainbow parentheses help match braces easier

8:24 anildigital: TEttinger: I am long time user of emacs.. so paretheis is okay for me

8:25 TEttinger: ok, then the syntax is just prefix

8:25 function first, then args

8:25 insamniac: I'm reading the Joy of Clojure right now, which I find pretty good for someone with no FP experience.

8:25 shock_one: There is a *file* var to get the current file's path. But how would I get its directory?

8:27 anildigital: so Joy of Clojure is it?

8:27 shock_one: anildigital: it's called RPN. Also, there is structural editing mode in Emacs for Clojure, I would recommend you to take a look at ti.

8:27 insamniac: I like it.. I also got Programming Clojure, but I left that one at work and haven't looked at it as much.

8:27 TEttinger: parentheses mean try to call the first item in this list. if it fails, (like if the first item is a number), it errors, but quote stops it from trying to call anything inside. that's why lists in clojure are '(1 2 3) instead of (1 2 3)

8:28 anildigital: there was Poignant's Guide To Ruby.. that was fun read..

8:28 TEttinger: shock_one, minus the R in RPN

8:28 anildigital: hope similar exists in Clojure world too

8:28 btw how many Ruby devs are here?

8:28 insamniac: there's also 4clojure.com which I like

8:28 TEttinger: a lot of former rubyists actually

8:28 clojuredocs.org (is that right?) is ruby on rails internally

8:31 pyrtsa: Heh, I haven't seen anything similar to _why's Poignant Guide for Clojure. The closest I know of is for Haskell (known as LYAH).

8:36 shock_one: anildigital: I know ruby.

8:37 And I don't consider Poignant's Guide To Ruby a very good material for studying. Funny, yes, but not helpful.

8:38 So, how to get *file*'s directory. Nobody knows?

8:38 anildigital: clojuredocs.org is so old now

8:38 somebody needs to update it

8:41 lnostdal: TEttinger / TEttinger2 : yes, it was a circular symlink .... x)

8:41 TEttinger: shock_one: *file* gets a File right?

8:42 http://docs.oracle.com/javase/7/docs/api/java/io/File.html#getParent()

8:42 ,(.getParent *file*)

8:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getParent for class java.lang.String>

8:43 TEttinger: ,(.getParent (File. *file*))

8:43 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: File, compiling:(NO_SOURCE_PATH:0:0)>

8:43 anildigital: anything there like docco in clojure

8:43 basically I want to setup up a clojure code snippet examples page

8:44 TEttinger: anildigital, what is docco?

8:44 anildigital: http://fogus.github.io/marginalia/ ..

8:44 docco like the one for backbone.js and underscore.js documentation

9:33 can namespace be like (ns Hello Wolrd)

9:33 or (ns "Hello World")

9:34 looks like no

9:44 rovar: (ns (md5 "hello world"))

9:51 anildigital: https://gist.github.com/anildigital/0fbdd70a2075db8dc17e what handler i need to provide in ring project.clj if my code is this

10:04 is getting this error.. ? any obvious error there? https://gist.github.com/anildigital/e34826a48143af3aa4a4

10:10 anyone has example code to show how to serve static html files using ring and compojure

10:15 kzar: I'm messing around trying to implement an example in the book I'm reading myself and the recursion is going wrong somehow. It's running out of heap space but weirdly when I chuck a println in the function I only get a printed output once.

10:16 (I would have expected the println to be called lots of times, because the recursive function is being called lots of times and therefore printed out tonnes of crap.)

10:17 zerokarmaleft: kzar: paste the code to refheap or something

10:17 kzar: I'd rather not it's pretty awful

10:18 I'm more asking how do you debug recursion gone-awry? I thought chucking in a println would elucidate but apparently not

10:18 llasram: kzar: It should

10:19 kzar: OK I'll paste but don't judge me heh

10:19 zerokarmaleft: llasram: https://gist.github.com/kzar/07067986085d63f274b9

10:24 rovar: where can one find more information about pods? It seems there was a big todo in late 2011 and 2012, and I haven't heard anything about them until Fogus' talk from Clojure Conj

10:25 zerokarmaleft: rovar: rhickey's keynote from conj '2012 talks about the idea briefly

10:25 llasram: kzar: I need to go eat, but I'll take a look when I get back if no one else has commented

10:25 zerokarmaleft: I'm not sure if there's an implementation that's fully baked

10:26 john2x: how do I fix "Could not find artifact org.clojure:clojure.core.cache:jar:0.6.3 in central (http://repo1.maven.org/maven2/)" when I try `lein deps :tree`

10:26 ?

10:26 My connection is fine.. and I can find it in .m2/repository

10:33 zerokarmaleft: kzar: I think you need to examine your base cases again

10:34 kzar: zerokarmaleft: Yes I see a few problems

10:34 I think it roughly worked I just underestimated how inefficient it was

10:34 (Which was the point they were making in the book)

10:34 I'm guessing

10:36 zerokarmaleft: kzar: map is lazy, which is why (println amount) doesn't output anything...it doesn't get a chance to because the recursion blows up before the first value can resolve

10:37 kzar: Yea

10:37 zerokarmaleft: Updated with slightly better version

10:37 justin_smith: I'm gonna make a single serve page: whydoesn'tyourclojureprogramdoanything.com

10:37 the only content will be "because map is lazy"

10:38 kzar: I'm not sure that's a valid URL

10:38 justin_smith: no, I'll have to refactor that runon

10:40 kzar: This the best way to remove nil's from a sequence? (filter #(not (nil? %)) [nil nil 1 2])

10:40 zerokarmaleft: justin_smith: y-u-no-eager.com

10:40 justin_smith: heh

10:40 kzar: keep

10:40 ,(keep [0 1 nil 2 4 nil 5])

10:40 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/keep>

10:40 justin_smith: err

10:40 ,(keep identity [0 1 nil 2 4 nil 5])

10:40 clojurebot: (0 1 2 4 5)

10:40 kzar: justin_smith: Why not

10:41 ,(filter identity [nil 1 2])

10:41 clojurebot: (1 2)

10:41 justin_smith: one sec - I know I was going for something better than that here

10:42 ((juxt (partial filter identity) (partial keep identity)) [0 1 nil false true 2 nil false]) ; kzar

10:42 ,((juxt (partial filter identity) (partial keep identity)) [0 1 nil false true 2 nil false]) ; kzar

10:42 clojurebot: [(0 1 true 2) (0 1 false true 2 ...)]

10:42 justin_smith: oops

10:42 notice keep lets false through

10:43 and it's a shorter word too!

10:46 kzar: Hmm my version in the gist works OK for smaller things now except it creates a crazy nested sequence unnecessarily

10:47 Oh because of the map I think

10:48 llasram: kzar: Do you want `mapcat` instead of `map`?

10:49 kzar: Hmm well I want a sequence of sequences

10:50 So the first time around I guess I want to use map and the other times I want mapcat... can't help but feel I'm doing this a dumb way though

10:50 llasram: It's an expensive algorithm, but there's nothing fundamentally flawed about your approach to implementing it

10:52 kzar: Good to know, thanks

10:53 llasram: kzar: mapcat only concatenates the immediate results of the applied function. So if your base case returns a sequence of results (where each result is a sequence), then using `mapcat` will give you the concatenated sequence of all results (where each result is still a sequence)

10:54 kzar: llasram: Ah right of course, well again this looks ugly to me but it works OK now https://gist.github.com/kzar/07067986085d63f274b9

10:55 anildigital: I need to serve static files in a directory. any solution in clojure with ring or compojure?

10:57 llasram: kzar: I don't believe you need the `(filter identity ...)`, and the formatting is slightly unusual, but what else bother you about it?

10:58 anildigital: http://ring-clojure.github.io/ring/ring.middleware.file.html

10:58 justin_smith: anildigital: yeah, there is a static file middleware for ring

10:58 kzar: llasram: Oh does the mapcat do away with the need for filtering away nil values?

10:59 llasram: ,(mapcat (constantly nil) (range 10))

10:59 clojurebot: ()

10:59 mullr: anildigital: https://github.com/ring-clojure/ring/wiki/Static-Resources perhaps?

10:59 llasram: kzar: As long as none of your `options` are `nil`

11:00 kzar: llasram: Is it idiomatic to wrap options in a vector like I ahve there?

11:00 justin_smith: anildigital: I use ring.middleware.resource/wrap-resource

11:00 anildigital: https://gist.github.com/anildigital/8325ea2381c0edf60939 wrote something like this .. but it's returning 'Hello Another World always"

11:00 justin_smith: which can also serve static assets out of a jar

11:00 llasram: kzar: To make the base case of a recursive algo be a 1-element sequence? Totally

11:01 kzar: llasram: OK I've sorted out the indentation - pasting from repl sort of ballsed it - does it look OK apart from the fact the thing I'm actually doing is dumb?

11:01 anildigital: justin_smith: how to use it in the snippet I shared

11:03 llasram: kzar: Oh, I missed the `lazy-seq` somehow -- you don't need that either :-)

11:03 justin_smith: (wrap-resource root) would work where you have (wrap-file root) - the only difference is that wrap-resource works for things inside a packed jar

11:03 kzar: llasram: I do in case I do (take 10 (change-ways 100 ....

11:04 anildigital: justin_smith: nope.. I have physical directory

11:04 justin_smith: anildigital: wait, the other difference would be not checking "user.dir" and just giving a path relative to the top level of your app

11:04 anildigital: justin I want to point to that directory .. which has html files

11:05 justin_smith: anildigital: I am saying it works for both

11:05 but your wrap-file should work

11:05 llasram: kzar: `mapcat` already returns a lazy sequence. Unless I'm missing something, I don't believe it helps

11:05 kzar: Well I can't explain exactly why but I've tried with and without and it seems to make a difference

11:06 llasram: kzar: You're right -- it does matter! You learn something every day...

11:06 kzar: (Why does it matter?)

11:06 anildigital: https://gist.github.com/anildigital/2de18198a0f203135174 justin_smith this is updated gist as suggested by you .. but it always prints 'Hello Another World'

11:06 kzar: Oh I see maybe mapcat doesn't return a lazyseq

11:06 (Why not?)

11:07 llasram: No, it does

11:08 Oh, chunking, of course

11:08 kzar: ?

11:08 anildigital: justin_smith: do you see any changes that needs to be done in gist so that it doesn't return 'Hello Another World' and starts serving files

11:09 llasram: No, maybe not

11:09 zerokarmaleft: llasram: heh

11:11 kzar: llasram: Maybe because it's applying functions to the list that realises the list?

11:11 justin_smith: anildigital: don't specify it in terms of user.dir

11:11 kzar: Either way I've got to go get some food myself, thanks for the help

11:11 justin_smith: try with root as "output"

11:11 llasram: kzar: np.... Thank you for the mystery to solve :-)

11:11 kzar: haha

11:12 llasram: (I think if you type (source mapcat) it's pretty clear what's going on.)

11:12 justin_smith: anildigital: scratch that: make sure "output" is in your resources path, and then you can just use "" as root (you can set resource path in project.clj)

11:13 anildigital: justin_smith: as per https://github.com/mmcgrana/ring/wiki/Static-Resources what is your-hundler there..

11:13 I don't get it..

11:13 justin_smith: (-> #'handler (wrap-resource "public")) is the same as (wrap-resource #'handler "public")

11:14 anildigital: justin_smith: but if you see my handler just returns a response map

11:14 so it will always return that map... how will it return the files then?

11:14 justin_smith: because you are not setting your resource root properly

11:14 like I said, it needs to be relative to your resource path

11:14 not to the filesystem root

11:15 anildigital: Here is another snippet https://gist.github.com/anildigital/352cf0a463420ea167fb

11:16 justin_smith: well, is "

11:16 sorry

11:16 is "." in your resource path?

11:16 anildigital: it always prints Hello Another World

11:16 justin_smith: what is your resource path, the default is "resources" but you can add other directories

11:16 anildigital: justin_smith: even if I replace "." with "output" .. it returns "Hello Another World"

11:17 justin_smith: by default the top level directory is not in the resources path, so "." will not work there

11:17 do you understand what I am saying about the resource path? I feel like you are ignoring it

11:17 anildigital: justin_smith: okay... but my question is that in my code.. defn handler will always return map.. how (wrap-resource "output" ) will ever get executed

11:18 justin_smith: because it short circuits

11:18 it doesn't always call the handler

11:18 anildigital: https://gist.github.com/anildigital/81044bef044667283bb1

11:18 here is latest snippet

11:19 zerokarmaleft: ,(time (dotimes [_ 1e4] (take 10 (mapcat (fn [x] [(identity x)]) (range 1e6)))))

11:19 clojurebot: "Elapsed time: 114.322084 msecs"\n

11:19 zerokarmaleft: ,(time (dotimes [_ 1e4] (take 10 (lazy-seq (mapcat (fn [x] [(identity x)]) (range 1e6))))))

11:19 clojurebot: "Elapsed time: 4.773144 msecs"\n

11:19 justin_smith: is "output" in your resources-path? how many fucking times do I need to say resources-path? it is a thing you need to modify here!

11:19 anildigital: justin_smith: yes

11:19 zerokarmaleft: wow

11:19 justin_smith: what is your resources-path?

11:19 show me that part of your project.clj

11:20 anildigital: https://gist.github.com/anildigital/bf5af4c882b8d97cacda

11:20 lgs32a: zerokarmaleft: that is a known problem. mapcat is not really lazy

11:20 zerokarmaleft: due to it's use of apply concat

11:21 zerokarmaleft: http://clojurian.blogspot.de/2012/11/beware-of-mapcat.html <- also has a lazy impl.

11:21 zerokarmaleft: lgs32a: cool, thanks for the link

11:23 justin_smith: anildigital: the resources-path is something you need to specify in project.clj

11:23 shock_one: Here's a function that take a file's path and returns its parent folder. Please help me make it more concise.

11:23 (defn get-parent [file-path] (->> file-path reverse (drop-while #(not= \/ %)) reverse (apply str)))

11:23 justin_smith: it determines which directories will be available for finding resources

11:23 anildigital: justin_smith: here is the code https://github.com/anildigital/clojurebyexample

11:24 justin_smith: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L247

11:24 lgs32a: zerokarmaleft: http://dev.clojure.org/jira/browse/CLJ-1218 <-- they consider it minor. I think they should just replace it.

11:24 zerokarmaleft: given that currently it's semi-lazy, which can hardly be intended.

11:24 justin_smith: anildigital: what you need to do is specify a root for wrap-resource that is relative to one of the resource-paths

11:25 anildigital: justin_smith: okay ..

11:25 justin_smith: so if you have :resource-paths ["output"]

11:25 then the root can be ""

11:26 see my github/technomancy/leiningen link above

11:26 it explains in more detail, and shows an example

11:27 anildigital: justin_smith: changed that.. as you can see in https://github.com/anildigital/clojurebyexample but it prints 'Hello Another World'

11:28 justin_smith: the resources-path is not part of the :ring key

11:28 it goes one level above

11:28 so :plugins ... :resources-path ... :dependencies ...

11:29 and not "/" for the root, just "" I think

11:29 though that may not even matter

11:29 lgs32a: could an implementation expert shed some light on why OPs solution here even outperforms a reducer based solution (reducer based solution not included in link)? http://stackoverflow.com/questions/20914683/in-clojure-can-i-optimize-scans

11:29 (it also outperforms a simple reduce-based solution, even when freed from destructoring)

11:31 anildigital: justin_smith: https://github.com/anildigital/clojurebyexample added as separate key and above .. but it still prints 'Hello Another World'

11:32 justin_smith: I think you are not getting what I am saying.. the handler is returning hardcoded response.. how will it ever serve static files?

11:32 justin_smith: anildigital: try changing "/" to "" in the last line of core.clj

11:33 you changed it back to wrap-file

11:33 wrap-file does not use the resource path

11:33 wrap-whatever has the option of returning something without ever calling the handler

11:34 if you configure the wrap-file or wrap-resource properly they will return a static file and the handler never gets called

11:34 anildigital: justin_smith: as you can see in updated git repo.. I changed to wrap-resource .. it still doesn't work..

11:34 justin_smith: so if you keep your :resource-paths configuration and change wrap-file to wrap-resources it should work

11:35 OK

11:35 anildigital: also there is no wrap-resources .. there is wrap-resource

11:35 it's not short circuiting as expected..

11:36 if you could clone that repo and try on your side..

11:36 justin_smith: anildigital: http://localhost:3000/toc.html

11:36 I cloned it, that url works

11:37 with your current codebase

11:37 http://localhost:3000/Hello.html

11:37 anildigital: ah

11:37 justin_smith: that one also, with your current codebase

11:37 anildigital: thanks a lot

11:37 yeah..

11:38 justin_smith: it would be more usual to put static resources in resources/output/ and then have "resources" in :resource-paths and "output" as the root for wrap-resources

11:38 btw

11:38 but at least we have something that works now

11:39 the names are not important, what is important is that by having "" or "/" as the resource-root someone could navigate to anything in the top level of any of your jars in classpath (which may not be a serious issue, but is at least weird)

11:47 anildigital: justin_smith: somehow I want to make toc.html as the default resource.. will try to add there

11:49 and that is done by putting "toc.html" instead of ""

11:49 justin_smith: anildigital: you could set a redirect of "" to "toc.html"

11:49 or even do a request rewrite on the server side

11:49 anildigital: justin_smith: possibly yes.. but having toc.html as starting point is ok

11:52 justin_smith: anildigital: this could be adapted to turn "" or "/" into "/toc.html" https://www.refheap.com/22471

11:54 anildigital: justin_smith: cool

11:54 justin_smith: anildigital: the definition of tweak-handling was missing before, I just updated

11:54 anildigital: I need to run the app like 'lein run -m clojurebyexample.core/app 4000' so that I can have it in Procfile

11:54 justin_smith: in your case you likely won't care about the request method, and you don't need to check .endsWith, since you have a literal route to rewrite, not a class of routes

11:54 anildigital: but by default there is no jetty.clj or anything. not sure how can I run it that way

11:55 justin_smith: you can create a main that starts up ring

11:56 https://github.com/caribou/caribou-development/blob/master/src/skel/core.clj#L99 like this

11:57 where "server/run-server" would be replaced by jetty/run-jetty I think

11:57 ring.adapter.jetty/run-jetty

11:58 which is basically what lein ring is doing anyway

11:58 but having a real main function is better

11:59 also, for dev lein works, of course, but for deployment you should create an uberjar

11:59 anildigital: ah.. not aware of all these..

12:00 justin_smith: procfile makes me think you are talking about deployment scenarios

12:00 anildigital: justin_smith: yes.. deploy the same on heroku

12:00 https://devcenter.heroku.com/articles/getting-started-with-clojure

12:00 justin_smith: oh, heroku expects you to use lein doesn't it

12:00 that's dumb, but I can't fix that

12:01 oh, wait

12:01 it does let you specify a standalone, good

12:01 so don't mind the above

12:02 so yeah, you need a -main function which starts the server

12:02 I think lein ring uberjar creates main for you though

12:02 if you still want to use lein ring

12:02 but what I described / linked to above shows how to create the jar

12:02 *create the main function

12:06 anildigital: java -cp target/clojurebyexample-0.1.0-SNAPSHOT-standalone.jar clojure.main -m clojurebyexample.core.app doesnt work

12:07 justin_smith: you should not need to specify clojure.main

12:07 and app does not start a server

12:08 first off, try "lein ring uberjar"

12:08 then try java -jar target/<some-uberjar>.jar

12:08 anildigital: https://gist.github.com/anildigital/6c95684c9d4849b9a33c done.. but gives error

12:08 justin_smith: yep.. same thing

12:09 justin_smith: for uberjar, you should not specify a :main in project.clj

12:09 anildigital: java -jar target/clojurebyexample-0.1.0-SNAPSHOT-standalone.jar .. this worked

12:09 justin_smith: oh, ok

12:10 anildigital: but with that http://localhost:3000/toc.html it's printing 'Hello Another World' only..

12:10 short circuit code is not working

12:10 justin_smith: hmm

12:10 wrap-resource should be able to find content inside jars, that is the point of wrap-resource after all

12:11 anildigital: justin_smith: :(

12:11 justin_smith: I have deployed many webapps that do this stuff

12:11 it's just a question of getting everything configured properly

12:12 anildigital: it would be great if this can be run without jar

12:12 means dev mode is ok

12:12 justin_smith: try changing resource-paths to "resources", and change the root in wrap-resources to "output" and move output/ to resources/output/

12:13 that would be closer to the usual setup

12:17 anildigital: justin_smith: keeping output as it is 'works' in lein ring server mode

12:17 didn't try with standalone yet

12:21 okay that worked.. but now I need redirect headers so that instead of 'Hello Another World' .. it redirect to /toc.html

12:24 justin_smith: right, you should be able to use some variation on the funcitons I posted above

12:34 anildigital: justin_smith: somehow heroku needs $PORT to be passed from outside..

12:34 java -jar target/clojurebyexample-0.1.0-SNAPSHOT-standalone.jar starts on default port 3000

12:37 justin_smith: wow http://boiling-oasis-5467.herokuapp.com/

12:37 justin_smith: I am trying to build something similar to https://gobyexample.com .. do contribute if possible

12:37 thanks a lot

12:37 justin_smith: congratulations

12:43 anildigital: http://clojurebyexample.com/toc.html

12:43 \m/

12:53 maku: Anyone here using Zepto.js with Clojurescript? I am interested in using it with Chris Granger's Library, jayq. The reason being that Zepto can be compiled with The Google Clojusure Compiler in advanced mode.

12:55 danno1: n00b Q: Is the the meta character ^, analogous to annotations?

12:56 lsdafjklsd: maku: i've been getting by with google closure library and a dom management library (om)

12:57 maku: dannol: it is, but we usually call it metadata http://clojure.org/metadata

12:58 dnolen: maku: haven't heard of anyone using Zepto.js, but why do you need to use it with jayq? Isn't the whole idea behind Zepto.js that you don't need jQuery?

12:58 maku: dnolen: jayq is just a wrapper (uses jquery) since zapto and jquery have the same API, I was hoping to use the same wrapper.

12:59 danno1: thanks maku

12:59 dnolen: maku: I would just give it a shot then.

13:00 maku: dnolen: thanks, will do

13:06 bvvd: \whois rhickey

13:08 jtoy: silly question, in my ns I import java.util.Local, then call it like Locale/ENGLISH, but I am getting Caused by: java.lang.ClassNotFoundException: java.util.Local errrors, is there anything else I need to do to use this class?

13:09 Tolstoy: jtoy: (import [java.util Locale]), note the space?

13:09 ivan: also Local != Locale

13:09 hyPiRion: jtoy: I would guess appending an e would help

13:09 jtoy: doh, yes

13:10 I hate when that kind of stuff happens

13:10 is it just me?

13:10 Tolstoy: Ah, I thought that was just a typo here. ;)

13:10 hyPiRion: nah, I hate it as well

13:11 Clome_: Exists something like this (-> a (fn1 b) (fn b)) => (fn2 (fn a b) b), just that puts "a" as the last argument to fn instead of the first one?

13:12 ivan: ->>

13:13 Clome_: >_>

13:13 thanks

13:13 i will try it

13:13 jtoy: Tolstoy: interesting name

13:15 shock_one: I have some time interval in milliseconds, say 134000. How to convert it to "2 minutes and 14 seconds"

13:18 hyPiRion: shock_one: have a look at clj-time

13:18 shock_one: Already. It can only convert intervals to DateTime.

13:18 hyPiRion: Or, if you want to actually do it manually, I guess you can do something like

13:19 shock_one: No, I want to find some library, but go ahead.

13:19 hyPiRion: ah.

13:19 Well, then I'm not sure =/ I thought clj-time would provide some of that functionality

13:21 shock_one: Something like this http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words

13:29 Clome_: a hack (let [sec (/ 134000 1000) min (int (/ sec 60)) rem(- sec (* min 60))] (str min " minutes and " rem "seconds"))

13:30 ,(let [sec (/ 134000 1000) min (int (/ sec 60)) rem(- sec (* min 60))] (str min " minutes and " rem " seconds"))

13:30 clojurebot: "2 minutes and 14 seconds"

13:31 llasram: It's surely in the underlying JodaTime library

13:38 arcatan: yeah, maybe Joda-Time's PeriodFormatter would be helpful?

13:45 jergason: in clojure, does your declared namespace need to match the directory structure of your project?

13:46 Clome_: as far as I know yes

13:46 noonian: yes, because java does, plus your file names need to use underscores instead of hyphens

13:47 Clome_: be careful about "-" in the namespace. foo-bla => foo_bla.clj

13:47 seangrove: Anyone with a clue able to tell what might be causing this all of the sudden? https://www.refheap.com/06b8f72dc72f0cda8f72545ef

13:49 Clome_: you are allocating too much memory

13:49 check for memory leaks or allocate more heap for your jvm

13:50 noonian: do you have :main in project.clj?

13:50 xeqi: seangrove: did you recently change your project.clj file or lein plugins?

13:51 shock_one: I'm pretty sure it's not about lein, try to start repl in another project's directory.

13:52 seangrove: xeqi: No, not at all actually

13:52 I've even reverted to a known-good checkout

13:52 Although the stack trace is different now..

13:53 Tolstoy: What happens with "lein deps :tree"?

13:55 seangrove: Tolstoy: that runs, shows the dependencies

13:55 shock_one: Interesting, looks like it happens elsewhere as well. Maybe something changed with my JVM while I was asleep. I'll look into it

13:55 Tolstoy: seangrove: Ah, well. I was guessing there was some crazy circular thing going on with one of the dependencies (if that's even possible).

13:57 seangrove: Maybe all it needs is a good restart and a warm hug. Might as well give it a try.

13:57 xeqi: seangrove: is that the full stack trace? I'd expect to see where `apply` was being called from?

14:15 devn: shock_one: you could use cl-format as well

14:16 hyPiRion: oh yeah

14:16 ,(require 'clojure.pprint)

14:16 clojurebot: nil

14:17 shock_one: devn: it's pretty cool.

14:17 hyPiRion: hmm,

14:19 shock_one: Tolstoy: are you from Russia?

14:19 Tolstoy: shock_one: Nope. Oregon. ;)

14:21 devn: ,(require '[clojure.pprint :as p])

14:21 clojurebot: nil

14:23 devn: ,(p/cl-format nil "~D minute~:P and ~D second~:P" 3 30)

14:23 clojurebot: "3 minutes and 30 seconds"

14:23 devn: ,(p/cl-format nil "~D minute~:P and ~D second~:P" 1 1)

14:23 clojurebot: "1 minute and 1 second"

14:23 devn: shock_one: ^

14:25 shock_one: Yes, thank you, I got it from the description.

14:26 devn: gotcha. just trying to help! :)

14:26 hyPiRion: Hm, is cl format turing complete?

14:26 devn: uh oh

14:26 a new swearjure approaches

14:27 hyPiRion: by my googling "full CL format is Turing-complete"

14:27 I don't know how close clojure's port comes

14:28 hyPiRion: yeah, the cl one can call functions, not possible yet in the clojure.pprint one

14:28 chchjesus: \

14:28 devn: hyPiRion: btw, i still need to jump into that nasty format string for clojure's pprint-code bug with #()

14:28 hyPiRion: pprint needs a rewrite

14:29 it's a mess

14:29 hyPiRion: haha

14:30 devn: hyPiRion: you laugh, but im not kidding, you've been in there and seen it

14:30 hyPiRion: I should send them an email re: my patch

14:30 devn: yeah =/

14:30 devn: i was looking at the git blame

14:30 and tom faulhaber is basically the only guy to ever have touched it

14:30 and i think for good reason

14:31 so... now that I've said that, it's time to put my money where my mouth is and start refactoring it into something that resembles clojure 1.5 code

14:31 hyPiRion: did you ever submit a patch on that #() bug?

14:32 hyPiRion: no, because I am not sure what would be correct to do right there

14:32 but it's not too hard to implement it

14:32 just need some response

14:33 devn: ah, ill bump it then

14:33 do you have a link handy?

14:34 hyPiRion: uh, no

14:34 devn: lol ill find it

14:34 hyPiRion: (I'm making dinner, so I'm a bit busy)

14:35 devn: hyPiRion: make extra, im coming over

14:36 hyPiRion: in common lisp i wonder what the behavior of this particular issue with fn* would be

14:36 http://dev.clojure.org/jira/browse/CLJ-1181

14:36 not that it is exactly 1 to 1 equivalent with clojure

14:37 but surely there's a similar situation

14:42 NeedMoreDesu: Is there a way to add metadata to any object, like adding it to numbers and still use them as numbers?

14:45 dnolen: NeedMoreDesu: not possible in Clojure, you can do this in ClojureScript via specify.

14:55 NeedMoreDesu: Hm, I guess I need to use WeakHashMap to store meta myself

15:07 stuartsierra: ,(identical? (Long. 2) (Long. 2))

15:07 clojurebot: false

15:21 gfredericks: I was just asking the other day about the implications of using proxy to get a Number that has metadata

15:21 nobody responded I don't think :)

15:24 ,(let [two (proxy [java.lang.Number] [] (longValue [] 2))] (+ two two))

15:24 clojurebot: 4

15:25 stuartsierra: (identical? (.longValue 3) (.longValue 3))

15:26 ,(identical? (.longValue 3) (.longValue 3))

15:26 clojurebot: false

15:27 gfredericks: ,(let [two-foo (proxy [java.lang.Number clojure.lang.IMeta] [] (longValue [] 2) (meta [] {:foo :foo}))] [(+ two-foo two-foo) (meta two-foo)])

15:27 clojurebot: [4 {:foo :foo}]

15:41 cark: hello

15:43 gfredericks: hello

15:43 cark: I'm not clear about some details of core.async on the jvm

15:44 gfredericks: which details are those.

15:44 cark: for instance, if i make IO and it blocks for some time, is it correct to use a thread block instead of a go block ?

15:45 thread macro instead of go macro i should maybe say

15:45 devn: cark: thread is basically promises and futures under the covers

15:46 cark: right, but are they there for this kind of scenario, just like send-off and send for agents ?

15:47 also, if i use the go macro, and there are many "automatons" doing computationally intensive stuff, am i safe to assume that there will be cores+2 threads when using the go macro ?

15:48 devn: cark: check out this https://www.youtube.com/watch?v=enwIIGzhahw

15:49 it will give you what you're looking for

15:49 cark: ok doing this right now, thanks !

16:01 pandeiro: is it possible to chmod +x files via lein new templates?

16:01 gfredericks: I think C-u C-u C-x C-e should eval the form, expect a string returned, then insert the raw string into the buffer unescaped

16:01 would be nice for doing formatted stuff

16:04 noonian: pandeiro: you can use clojure.java.shell

16:04 pandeiro: noonian: within the render function?

16:05 noonian: yeah, your main templates fn, after you call ->files

16:05 pandeiro: noonian: perfect, thanks

16:06 technomancy: you don't need to shell out to do +x

16:06 pandeiro: technomancy: use java file api?

16:06 technomancy: right

16:06 pandeiro: k, i just wasn't clear at what point i could do it, thanks

16:07 technomancy: the main thing to remember about Leiningen plugins/templates: "It's Just A Function" =)

16:08 gfredericks: (TM)

16:08 technomancy: unless it's a map

16:08 pandeiro: ah the fine print...

16:08 :)

16:08 technomancy: offer not valid in all jurisdictions; consult a physician before use if you are pregnant or on medication

16:17 gfredericks: side-effects may include, creating a jarfile, erasing your classfiles, or delpoying to clojars.

16:20 pandeiro: so i was expecting the path (.setExecutable (io/file path) true) to be the same as specified in the ->files fn above it... but that method call is returning false

16:20 am i doing something wrong?

16:24 think i maybe have to include the project name in the path as it is relative to the parent directory

16:25 voila

16:32 rukor: what happened to webfui

16:34 jonasen: rukor: https://groups.google.com/d/msg/reactjs/e3bYersyd64/qODfcuBR9LwJ

16:40 rukor: jonasen: ah ok. i just stumbled upon a video on webfui on youtube, and it seemed to have a lot in common with reactjs/om. Thanks.

16:42 dnolen: rukor: Om is more a less a more "serious" version of the WebFUI concept.

16:43 rukor: dnolen: indeed.

16:43 tim__: Bronsa: do the latest tools.analyzer snapshots work?

16:44 tbaldridge: Bronsa: I'm getting "could not locate clojure/tools/analyzer__init.class" from my repl.

16:45 Bronsa: tbaldridge: they work, yes

16:45 tbaldridge: weird, how are you getting that error?

16:46 tbaldridge: I'm getting that error because I'm an idiot. I never saved my project.clj file

16:47 kzar: I did (source let) and it seems to be defined in terms of let* but I can't find let*

16:47 tbaldridge: I think my vacation was too long this year.

16:47 llasram: kzar: It's part of the compiler itself, in Compiler.java

16:47 A "special form"

16:47 kzar: ah right, so that's not written in Clojure

16:48 llasram: Not yet -- Bronsa is hard at work on Clojure-in-Clojure though :-)

16:48 kzar: (Just in the book I was reading it said how let could be implemented in terms of a lambda so I was curious if that was how Clojure did it.)

16:48 Hmm I wonder how many non-clojure functions you could get it down to

16:48 tbaldridge: kzar: it can be done that way, that's not to say that it "should"

16:49 kzar: surely

16:49 tbaldridge: kzar: implementing let via fn would most likely be slower than a custom let that just sets a local

16:49 kzar: Yea and also it might be more limited, say how you can define vars in terms of themselves with Clojure's let

16:49 sorry I mean in terms of previous vars in the let

16:51 hiredman: tbaldridge: it would be more complicated you would compile to lambdas, then when compiling lambdas have some heuristics about turning them in to jvm locals, etc, which actually a lot of papers on optimizing scheme compilers do similar things

16:52 which is a lot of work when you can just make let a special form

16:53 tbaldridge: agreed

16:54 marcopolo`: I remember hearing work being done on a browser repl using websockets, anyone know where I can find that?

17:03 arcatan: kzar: using previous vars is not a problem as you can transform that to nested let expressions

17:03 koreth: Hi! I'm a Clojure n00b. I am slightly confused by the "commute" function. The documentation implies it doesn't do retries (and the book "Clojure Programming" says so outright), but when I play with it in the REPL it does seem to retry occasionally. Is that expected behavior?

17:03 kzar: Yea I was just thinking that arcatan

17:04 juanpablo: Clojure noob here. How do I get the first element from a list of the form (1 2 3). What function can I use? (get list 0) fails, same with (first list). Seems like a dumb question, but my googling has failed me.

17:04 cark: ,(first '(1 2 3))

17:04 clojurebot: 1

17:04 cark: you probably didn't quote your list

17:05 kzar: ,(first [1 2 3])

17:05 clojurebot: 1

17:05 cark: (1 2 3) is applying 2 and 3 to the function 1, which does not exist

17:05 technomancy: koreth: ref operations can always retry; not sure where the implications otherwise are coming from

17:06 juanpablo: what if my list is not known at compile time? Adding the quote just gets me a compile error

17:06 Don't know how to create ISeq from: clojure.lang.Symbol

17:07 cark: ,(let [l '(1 2 3)] (first l))

17:07 clojurebot: 1

17:07 cark: maybe you should post your function in a gist

17:09 juanpablo: It's pretty simple. I have a list of the form ((10 11) (5 2) (3 2)) and want to filter that list using the first element of each list member

17:09 marcopolo`: koreth: can you give an example?

17:09 koreth: technomancy: Thanks. I think I just misinterpreted what I was reading -- the "you must accept last-one-in-wins behavior" in the docs on clojuredocs.org implied to me that conflicting writes would just be discarded.

17:09 cark: juanpablo: you obliviously have a little mistake somewhere, showing your coe would help

17:09 code*

17:10 technomancy: koreth: oh dear

17:10 koreth: fwiw clojuredocs.org are not official docs; that is a very misleading way of putting it

17:11 commute just means the order can change; there's no implication that anything "loses" necessarily

17:11 juanpablo: I'll try to figure it out myself. Clojure is a fun language :). If I fail I'll post back

17:12 hiredman: ~alter

17:12 clojurebot: alter is always correct

17:12 koreth: And my confusion started in "Clojure Programming" which says, "A change made to a ref by using commute will *never* cause a conflict, and therefore never cause a transaction to retry." But apparently that just means the *entire* transaction won't retry, not that *nothing* in the transaction will retry. So yeah, my misinterpretation.

17:12 rukor: dnolen: I have a question regarding Om. Lets say I have a table component. Now I want to create calendar component that uses the table c\

17:12 omponent. No client of the calendar component will ever need to directly provide the table parameters so the data for the underlying tab\

17:12 le would not be present in the root tree as it is local to the calendar component. Previously, I could knock up the data structure from \

17:12 within the calendar component and call om/build with it. Now that om/build requires a cursor, what is the best way to handle this sort o\

17:12 f situation?

17:13 hiredman: use alter and commute is an optimization you can take advantage of in the future if required/possible

17:13 dnolen: rukor: if it's local to the component then doesn't om/IInitState, om/set-state! om/get-state not work for you?

17:13 koreth: hiredman: Totally. Just want to make sure I understand what it's doing so I can use it correctly when the time comes.

17:14 dnolen: rukor: or is the issue that you want to build and don't want to take a cursor? I was going to allow this today.

17:14 rukor: via an option I think.

17:15 technomancy: koreth: yeah I thought that commute transactions would never have retries, but I realized that might not always be true

17:15 rukor: dnolen: for things local to the component, yes those will suffice, but need to use this data as the model for another component

17:15 koreth: technomancy: That "you must accept last-one-in-wins behavior" is actually in the official docs too.

17:16 Or at least I assume http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/commute is official.

17:16 technomancy: huh, that's unfortunate

17:16 rukor: dnolen: to elaborate, it may just be bad design on my part. the table takes as opts, the column specs, and as data, the actual data

17:17 dnolen: the calendar only takes as data date.

17:17 dnolen: rukor: hm, I think it's legitimate use case

17:17 technomancy: the whole point of commute is that it's safe to use when a conflict doesn't result in one attempt "winning" and one "losing" but both harmoniously succeeding

17:17 rukor: dnolen: so the calendar must build both the cursor for the embeded table component

17:18 dnolen: without depending on the tree above it

17:18 dnolen: rukor: just to be extra clear, you want to be able to pass raw data to build right?

17:18 juanpablo: Only thing I'm missing is pattern matching to unpack data structures.

17:18 rukor: yes

17:18 dnolen: juanpablo: core.match

17:20 rukor: dnolen: or would detached trees be a possible solution? where the calendar component can create its own root cursor, which it can update when there is an update in the cursor of its own date data, so that the underlying table component would be agnostic of pure data vs cursor

17:21 dnolen: rukor: hrm, I don't want to overthink it, and the details might change in the future

17:21 rukor: I think the best thing for now is to provide build-raw for this use case.

17:21 rukor: dnolen: ok

17:21 clojurebot: No entiendo

17:26 sritchie: any graph database users here?

17:26 neo4j, etc?

17:29 kzar: Is SICP worth reading for someone without a maths background? People seem to praise it so I'm giving it a go but the first chapter so far seems to be more about maths than code

17:29 sritchie: kzar: I don't have a maths background and thought it was great -

17:30 kzar: it's more that the examples are algorithmish

17:30 kzar: Yea

17:30 Hmm I'll stick with it for a bit longer I guess

17:31 sritchie: kzar: just trying to have fun and get your mind expanded about functional programming?

17:31 I always recommend working through the little schemer,

17:32 but no one seems to get through the whole thing

17:32 (I did, but I did it with pen and paper, didn't have a computer for a few weeks. I think that was the right way)

17:33 kzar: Yea, thought it might help as I've done some Clojure before but never fully grokked it all. I figured perhaps reading it might help. Aim for this year is to get to the point where I'm half productive in Clojure, not sure the best way to go about it though

17:33 I'm a programmer by trade and I'm generally not bad but I find it hard to get anything done in Clojure if I'm honest which is a shame as I think it's pretty great

17:35 akhudek: kzar: many people seem to recommend http://clojurekoans.com/

17:36 kzar: akhudek: Thanks, well I'll give those a go sometime.

17:36 sritchie: kzar: what kinds of stuff are you building with clj?

17:36 kzar: yeah, just for getting started in clj, sicp is too heavy

17:36 kzar: Well currently nothing

17:37 (I think taking on another project in it might be a good idea.)

17:39 sritchie: kzar: yeah, pick up compojure and try a tiny webapp

17:39 kzar: I've done some webapps a while back using noir and stuff although apparently that's not used anymore

17:40 ordnungswidrig: kzar: there's libnoir now, IMHO

17:40 ered: anyone tried liberator? tempted to give it a go next time i write a rest api

17:40 sritchie: ered: yeah, I have

17:40 yeah, it's nice

17:41 ered: i really like what i've read about it

17:41 and that flowchart that tells you exactly what it does when looks really helpful oto

17:41 too*

17:42 technomancy: liberator is great, but I'd recommend starting with more basic ring and pulling it in once your requirements grow

17:43 the raw ring abstraction is really great and worth getting familiar with

17:44 I guess if you've used noir that might count

17:44 but it obscures the simplicity of ring

17:44 ordnungswidrig: the simplicity of ring is great. unfortunately http is anything but simple.

17:45 kzar: technomancy: Yea I remember a lot of people (you maybe!) said that at the time, I think using noir was probably a mistake

17:46 technomancy: ordnungswidrig: real-world http, yes. learning-project http... maybe so, maybe no =)

17:46 ordnungswidrig: technomancy: that's a point!

17:48 technomancy: seeing the progression of a project from raw ring to using liberator could give you an interesting perspective and probably help you appreciate what you get

17:49 ordnungswidrig: My presentation at the conj used this approach.

17:49 technomancy: yeah, I enjoyed that a lot

17:50 dnolen: rukor: added experimental build-raw to master - will think about this more later and see if I can't see a better solution.

17:51 ordnungswidrig: technomancy: this should be mandatory for any library talk :) Hopefully shows the motivation^h^h^h^hright for existence

17:55 ordnungswidrig1: re

17:55 rukor: dnolen: thanks

18:02 sritchie: hmm, google searches are making a heavy case for datomic instead of neo4j for graph modeling

18:02 interesting

18:02 tbaldridge: it's really good for that sort of thing

18:13 sritchie: tbaldridge: looks like it. I'm looking at storing GPS coordinates

18:13 similar to strava - essentially dumping in a bunch of points of sensor data,

18:14 so i can graph the info, and try to extract "pieces" - if someone's doing mile time trials, for example

18:17 kzar: ,#{#{true false} #{true false}}

18:17 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: #{true false}>

18:17 sritchie: yup, not in a literal

18:17 kzar: ,#{#{(= "true") false} #{(symbol "true") 'false}}

18:17 clojurebot: #{#{true false} #{true false}}

18:17 S11001001: ,(random)

18:17 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: random in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:17 S11001001: ii eee

18:17 CaptainLex: Why does ring.middleware wrap-multipart-params turn keys into strings instead of keywords?

18:18 kzar: ,(rand)

18:18 clojurebot: 0.7820192852765594

18:23 devn: is reduce-kv just a performance thing?

18:23 clojurebot: Gabh mo leithscéal?

18:31 thirdy: Functions like my-addition are usually created first in the REPL , and then tested with various inputs. Once you’re satisfied that the function works, you copy the test cases into an appropriate test file. You also copy the function definition into an appropri- ate source file and run the tests.

18:31 as in copy paste?

18:38 noonian: thirdy: I prefer to just write them in a namespaced file, and keey running (use 'my.namespace :reload) in the repl

18:40 thirdy: ,(doc use)

18:40 clojurebot: "([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."

18:40 turtil: could someone comment on clojure and how low level it is? im learning Clojure, but i havnt really seen much about its low level-ness... i understand it hinges itself off the jvm, and therefore java, but im not a java developer, never really developed anything in java

18:40 comments, opinions?

18:41 noonian: it's very high level

18:42 you can use type hints and transients and things to get closer to raw java but it isn't as idiomatic to do so usually

18:43 thirdy: noonian: coming from java-world, ain't F11 (debug in eclipse), faster than what you mentioned?

18:43 andyf: turtil: It is a high level language, and while you can do some medium-level things for performance, the best way to get closer to the machine details for performance is to write Java or C and call that from Clojure, if you need it.

18:45 noonian: thirdy: maybe, i'm not very familiar with eclipse but that works for me. i also use light tables instarepl but lein repl is simpler to get started with

18:45 thirdy: in Java, I even use an eclipse-plugin to automatically call the corresponding test class upon saving your source code.

18:45 tbaldridge: thirdy: I have that in emacs ALT-` runs all tests

18:45 noonian: i think there are a few eclipse plugins for Clojure

18:47 turtil: noonian: andyf thanks for that, that confirms my thoughts

18:48 akhudek: vw

18:48 oops

18:49 andyf: turtil: The Benchmarks Game web site has some sample short Clojure programs for the benchmarks that are often within a factor of 1 to 4 times the run time of Java programs for the same problems, but those Clojure programs are not like ones people typically write in Clojure. Then again, the programs on that site are not typically what anyone would write in any of the languages represented.

18:49 http://benchmarksgame.alioth.debian.org/

18:50 devn: tbaldridge: just finished watching your deep macros and go macro internals videos

18:50 nice work

18:50 tbaldridge: thanks!

18:51 devn: tbaldridge: it's funny, i've used the multimethod dispatch thing to build little JRuby interop toys, but i never emitted an AST-like thing

18:51 that was an ah-ha moment

18:51 tbaldridge: also, the core.async talk at the conj was fantastic

18:52 * devn golf claps

18:52 turtil: andyf: yeah i have been looking at that, i wasnt so much concerned with Performance, more like doing things with network bytestreams, and playing with the GPIO on Pi, or Pi, similar boards etc

18:53 devn: tbaldridge: there has been some discussion on the overtone mailing list about using core.async -- it made me wonder about broadcast and multiplex in the core.async lab namespace. any idea on whether those things will creep into core.async or not?

18:54 tbaldridge: those have been replaced with mult/mix in the main namespace

18:54 devn: tbaldridge: sam aaron asked about one->many pub/sub capabilities

18:55 tbaldridge: ah, that would be helpful to know as someone peeking at source. they have subtley different docstrings

18:55 tbaldridge: also in the main namespace now

18:55 devn: subtly*

18:56 tbaldridge: which ones have different docstrings?

18:57 thirdy: learning lisp or clojure is a lot harder than a thought. it's like learning programming all over again. even though I'm already using functors in Java

18:58 functors in Java as in org.apache.commons.collections.Closure

19:00 devn: tbaldridge: the lab namespace's broadcast and multiplex are subtly different than mult and mix

19:00 the broadcast docstring read, to me, more like what i was thinking of at the time

19:00 tbaldridge: yeah, the lab versions are pretty old, they were created to see what something like that would look like. Rich wrote the stuff in then main ns later on

19:01 devn: could lab's versions be blown away to prevent future confusion along those lines>

19:01 tbaldridge: yeah, they should be remove

19:01 *removed

19:02 thirdy: any good online class for Clojure, like from Coursera?

19:02 logic_prog_: (1) sign up for the scala one

19:02 (2) get motivated to study clojure

19:03 devn: tbaldridge: in any event, one more compliment and then i'm off, but: i think you've done a really great job with conj talk about using core.async. it would be cool to see the way you explained it moved into a mini guide or something.

19:03 logic_prog_: ha!

19:04 logic_prog_: tbaldridge: along what devn said, I liked your youtube videos on core.async

19:04 devn: tbaldridge: i should have been more clear, one more compliment/request/suggestion ;)

19:05 a lot of what i've seen with core.async was like: 'look how great this is! it's wildly opaque!' simply knowing that promise/future was underneath (thread) was extremely important to my ability to understand what was happening

19:07 describing it in terms of things i understand != "read CSP by Tony Hoare"

19:07 thirdy: logic_prog_: I did search for a free online class, but none so far

19:08 devn: thirdy: there has been talk in the past about a clojure coursera course

19:08 thirdy: yep, i saw that in the google group

19:08 devn: thirdy: do you strongly value the structure of a course?

19:08 thirdy: I did watch this last night: www.youtube.com/watch?v=CvRGJGK09tc

19:09 devn: I think so

19:09 devn: courses are funny things, you know. there rarely exists a one size fits all version of the material that appeals to everyone

19:09 a lot of people with previous background come to clojure with very specific goals

19:09 so you start explaining how lisp works and half the audience yawns

19:10 you start talking concurrency and half the audience already understands a bunch of that material

19:10 etc

19:12 thirdy: devn: haha i agree. however, a good basics course should be there

19:13 ordnungswidrig1: just a quicky: how do I enumerate all paths in a deep datastructure, i.e. everthing I can access with get-in

19:13 thirdy: the video I watch last night explained all the syntax of clojure. however, right now, i'm having trouble with namespaces

19:14 ordnungswidrig1: e.g. {:a 1 :b [:x] :c {:y :z}} => [[:a] [:b] [:b 0] [:c] [:c :y]]

19:14 shoky: thirdy: http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols

19:14 thirdy: devn: imho, apparently, the guy in the video was wrong to say that, "You're ready to write code". Apparently, theres a swarm of functions/macros/special forms to master

19:16 I'm correct to say that Clojure syntax is the tip of the iceburg? mastering def, defn, let, ns is the bulk?

19:17 ordnungswidrig1: thirdy: it's actually a very thin tip. like most lisps the syntax is small in clojure

19:17 thirdy: but don't get afraid

19:17 thirdy: ordnungswidrig1: i was gonna type tip of the tip of the iceburg

19:18 shoky: thanks, that should be a good watch, as all the other infoq i've watched previously

19:18 ordnungswidrig1: thirdy: that would be too extreme. And keep in mind: it's a beautiful iceburg!

19:20 thirdy: ordnungswidrig1: yeah thanks. I'm just frustrated to find out that I can't write the Swing-based tool I want as easy as I thought it would be

19:26 hiredman: isn't swing just going to be gross regardless?

19:35 noonian: how can i compare cursors for equality in om?

19:36 dnolen: noonian: should just work

19:37 noonian: hmm

19:37 dnolen: noonian: for maps and IIndexed anyway.

19:38 noonian: what types are you trying to compare?

19:38 noonian: maps

19:39 sritchie: anyone here using the hidden input for DELETE reqs in compojure?

19:39 dnolen: noonian: not for cursors equivalence includes state and path

19:39 s/not/note

19:40 noonian: hmm, i bet the path is different

19:41 dnolen: noonian: perhaps it make sense to love state and path out of it like when cursors were done via metadata

19:41 s/love/leave

19:42 noonian: yeah, i'm just trying to compare pieces of them for value equality

19:48 dnolen: noonian: -value is technically part of the public api

19:48 noonian: so you can extract the underlying value and compare those

19:49 noonian: dnolen: thanks, that works great

22:08 m0g: I have a very basic script that loads a bunch of files and put them in a map. My function extract-content-map seems except for the fact that it only handles 8 items in the list of files it is given (that is around 1k files). Any idea why it doesn't process the whole list?

22:08 https://gist.github.com/m09/8263780

22:19 gfredericks: m0g: nope. but I do know you don't need to use transients

22:19 rovar_: is there a right way to inject variables into an environment when executing a function?

22:19 I want to provide the function creator some "implicits" which change based on the context of when the function was executed..

22:20 llasram: gfredericks, m0g: Also, you are trying to bash transients in place, which leads to the results you are seeing

22:20 m0g: You still need to operate on them functionally -- they just may use mutation as an optimization, so they aren't fully persistent

22:20 gfredericks: llasram: oh? does a transient update function not always return the original object?

22:20 llasram: gfredericks: It does not

22:21 gfredericks: llasram: fascinating

22:21 llasram: So e.g. (doseq ... (assoc! ...)) is always a mistake

22:21 gfredericks: I'm curious why it would be useful not to

22:23 llasram: gfredericks: I don't know, but my guess is that it's related to the interface guarantee that the `transient` function will operate in constant time

22:23 gfredericks: o_O

22:23 okay time to crack open the java files

22:25 bbloom: ha I just noticed the conj edge case is duplicated in the transient variants; as it must be of corse

22:27 llasram: oh I think there's no reason for that to happen except when upgrading from ArrayMap to HashMap

22:27 thus the magic number 8

22:27 bbloom: gfredericks: you mean the conj a seq from a map thing? yeah, annoying

22:27 i think at this point, that's forever :-/

22:27 llasram: gfredericks: That makes sense, although I feel like I saw a case where it was happening with ! and transient vectors in someone's code too

22:27 s,!,conj!,

22:31 gfredericks: is the obsceletization of programmers synonymous with the singularity?

22:32 llasram: I personally sure hope so

22:33 rovar_: the language preferred by the AI would most certainly be a lisp

22:33 gfredericks: llasram: why the strong feelings?

22:34 llasram: gfredericks: Oh, a friend just recently had me read Vonnegut's /Player Piano/, and the it ended up mostly annoying me

22:34 * gfredericks has not read

22:35 llasram: The premise essentially involves people automating themselves out of their jobs, and the subsequent social results

22:35 But I think it's pretty much impossible to automate away the job of automating things w/o hitting the singularity

22:36 gfredericks: yay we are forever employed until such time as we cannot plan for anyhow

22:37 so it annoyed you because you expect that most people can stay employed as programmers?

22:37 rather than massive unemployment?

22:42 llasram: haha. Kind of. It presented the vast majority of people with nothing to do and hence doing nothing, to a degree I found almost offensively dismissive of the ingenuity of the average person

22:43 npatten: .join #emacs

22:43 whoops!

22:43 gfredericks: npatten: what a weird password

22:43 llasram: Joining another channel!

22:43 ~guards

22:43 clojurebot: SEIZE HIM!

22:44 npatten: at least emacs enables clojure =)

22:44 gfredericks: clojure: powered by emacs

22:45 seangrove: Not for much longer, LT is steamrolling in

22:45 You watch!

22:45 Just give it another ~20-25 years.

22:45 gfredericks: in the singularity all the AIs use LT

22:46 tbaldridge: if LT ever figures out what it wants to be

22:46 npatten: good things come to those who wait?

22:46 llasram: pfft. Emacs is clearly a better interface for machine intelligences

22:46 Especially with their ability to select key combinations unhindered by the limitations of physical hands

22:46 gfredericks: I watched some of rhickey's harmonikit talk; he made a sex joke about emacs

22:47 seangrove: gfredericks: Is it online yet?

22:47 gfredericks: I guess that's what happens when you let him not keynote

22:47 npatten: m-x foreplay

22:47 gfredericks: seangrove: yeah it's on youtube somewhere

22:47 tbaldridge: youtube.com/clojuretv

22:47 seangrove: Ah, see it now, thanks

23:02 bellkev: has anyone noticed austin's browser-connected-repl being broken in newer versions of clojurescript?

23:02 I noticed that it works in v1847 and not in v2138

23:03 so far, I've tracked it down to an error being thrown in cljs.closure/get-compiled-cljs in the new version but not the old...

23:04 gfredericks: if a polymorphic dispatch is closed, should a case be faster than a protocol?

23:04 (case on the class, I mean)

23:04 or maybe a condp with instance?

23:04 tbaldridge: gfredericks: condp probably not, it has to run p for every value

23:04 protocols have some tricks to make them fast in places where you're always dispatching on the interface

23:05 gfredericks: the interface is irrelevant here

23:05 all via extend-protocol

23:05 shoulda said that initially

23:06 tbaldridge: in that case there is still some caching involved.

23:06 gfredericks: so stick with the protocols?

23:06 tbaldridge: Use protocols unless you can reduce it to case

23:06 gfredericks: what would the case type be?

23:06 a string?

23:06 (comp str class)?

23:07 tbaldridge: (case x val1 expr val2 expr2 ...)

23:07 only works for keywords, ints and something else....

23:07 gfredericks: so probably not applicable here, right?

23:07 just making sure I'm not missing some trick

23:08 tbaldridge: yeah it depends on your use case I guess.

23:08 Protocols are pretty darn fast

23:10 gfredericks: $findfn :foo/bar "foo/bar"

23:10 lazybot: []

23:11 Bronsa: ,(str (.sym :foo/bar))

23:11 clojurebot: "foo/bar"

23:11 gfredericks: ooh, clever

23:13 hmm

23:13 that involves a call to String#intern

23:13 oh I guess just once

23:16 unionx: hello?

23:16 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline unionx

23:16 Bronsa: lol

23:17 gfredericks: (inc clojurebot)

23:17 lazybot: ⇒ 32

23:17 unionx: (inc clojurebot)

23:17 lazybot: ⇒ 33

23:17 unionx: (dec clojurebot)

23:17 lazybot: ⇒ 32

23:17 unionx: lol

23:18 gfredericks: well that was worthwhile

23:20 Bronsa: tbaldridge: AFAIK case works with everything, ints & keywords should simply be faster

23:21 tbaldridge: , (case x (atom 42) true)

23:21 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:21 tbaldridge: , (case 4 (atom 42) true)

23:21 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: 4>

23:21 gfredericks: Bronsa: not classes though, I wouldn't expect

23:21 tbaldridge: , (case (atom 42) (atom 42) true)

23:21 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: clojure.lang.Atom@a6b3cd>

23:21 tbaldridge: yeah...so not refs...dumb example

23:21 gfredericks: ,(case '(atom 42) (atom 42) true)

23:21 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: (atom 42)>

23:21 Bronsa: tbaldridge: that's because the test don't get evaluated

23:22 tbaldridge: yeah

23:22 gfredericks: Bronsa: ^ still didn't work

23:22 tbaldridge: ,(case '(atom 42) '(atom 42) true)

23:22 clojurebot: true

23:22 gfredericks: wat

23:22 Bronsa: gfredericks: that's because.. ##(case 1 (1 2) true)

23:22 lazybot: ⇒ true

23:22 tbaldridge: case is really really odd, I try to only use it when working with ints or keywords

23:22 gfredericks: oh geez

23:23 ,(case '(atom 42) ((atom 42)) true)

23:23 clojurebot: true

23:23 Bronsa: so you're not actually quoting it, you're matching on 'quote and '(1 2)

23:23 gfredericks: ,(case 'quote '(atom 42) :hahaha)

23:23 clojurebot: :hahaha

23:23 gfredericks: that's a neat trick :)

23:24 Bronsa: gfredericks: it'd work on classes, if you can embed one there either via #=(Class/forname "..") or via a macro

23:25 gfredericks: ,(binding [*print-dup* true] (print-str *ns*))

23:25 clojurebot: "#=(find-ns sandbox)"

23:25 gfredericks: ,(binding [*print-dup* true] (print-str Number))

23:25 clojurebot: "#=java.lang.Number"

23:26 Bronsa: i.e (eval `(case Integer ~Integer 1)) will work

23:26 gfredericks: that would be an interesting benchmark

23:28 jergason: what is the standard clojure http library that everyone uses?

23:28 err http request library

23:29 gfredericks: clj-http

23:29 jergason: thanks friend

23:30 gfredericks: (inc me)

23:30 lazybot: ⇒ 3

23:33 TEttinger: ,(print (double-array [0.0 1.1 2.2]))

23:33 clojurebot: #<double[] [D@10ef4d>

23:33 TEttinger: ,(binding [*print-dup* true] (print-str (double-array [0.0 1.1 2.2])))

23:33 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No method in multimethod 'print-dup' for dispatch value: class [D>

23:34 TEttinger: oh that's interesting

23:34 ,(defmethod print-dup (Class/forName "[D") [a out] (.write ^java.io.FileWriter out (str "#=" `(double-array ~(vec a)))))

23:34 clojurebot: #<MultiFn clojure.lang.MultiFn@f02ba0>

23:34 TEttinger: it doesn't seem to defmethod in a sandbox

23:34 ,(binding [*print-dup* true] (print-str (double-array [0.0 1.1 2.2])))

23:34 clojurebot: "#=(clojure.core/double-array [0.0 1.1 2.2])"

23:35 TEttinger: oh, i just did it in privmsg...

23:39 bvvd: ,((fn [n] (cond (= n 0) 0 (= n 1) 1 :else (recur (+ (- n 1) (- n 2)))) 4)

23:40 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:41 bvvd: ,((fn [n] (cond (= n 0) 0 (= n 1) 1 :else (recur (+ (- n 1) (- n 2))))) 4)

23:41 clojurebot: #<ArithmeticException java.lang.ArithmeticException: integer overflow>

23:41 gfredericks: timeout

23:41 oh or that

23:41 timeout if you give it 4N :)

23:43 TEttinger: the (recur (+ (- n 1) (- n 2))) thing is pretty silly

23:43 since for 4 that recurs with 5, not going lower

23:44 gfredericks: unless the extremely strong goldbach conjecture holds

23:46 ,((fn [n] (case n (0 1) n (recur (+ (- n 1) (- n 2))))) 4N)

23:46 clojurebot: Execution Timed Out

23:49 bvvd: hmm... i realized i was adding the 2, w/ (recur (+ (- n 1) (- n 2))) once u pointed that out

23:53 gfredericks: ,(.nextProbablePrime (java.lang.BigInteger. "77777777777777777777"))

23:53 clojurebot: #<CompilerException java.lang.ClassNotFoundException: java.lang.BigInteger, compiling:(NO_SOURCE_PATH:0:0)>

23:53 gfredericks: ,(.nextProbablePrime (java.math.BigInteger. "77777777777777777777"))

23:53 clojurebot: 77777777777777777789

23:57 bvvd: ,((fn fib [n] (cond (= n 0) 0 (= n 1) 1 :else (+ (fib (- n 1)) (fib (- n 2))))) 6)

23:57 clojurebot: 8

23:59 bvvd: spent over an hour trying to get that to work, TEttinger observation 'for 4 that recurs with 5', made it obvious thanks!

Logging service provided by n01se.net