#clojure log - May 15 2012

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

0:43 muhoo: i have to punt on this one: how would i transform a tree of maps into a [:ul [:li structure in hiccup?

0:43 i started using zippers, and got.... confused.

0:44 brehaut: muhoo: what are the keys and values in the map?

0:48 muhoo: https://www.refheap.com/paste/4fb1dfb7e4b07e354afa355d ?

0:48 muhoo: brehaut: it's like [{:name "foo" :val 2} [[{:name "child" :val 5} [{:name "subchild" :val 666} ]]]]

0:48 it's more like a nested vector than a nested map

0:49 i stupidly didn't set it up right

0:49 brehaut: so whats the output you would want for that?

0:49 muhoo: your refheap is helpful though

0:50 i'd need to change it a bit. vector? would tell me if i have a child node.

0:50 brehaut: yup

0:51 and you'll want to modify the destructuring

0:51 (ie, you probably dont want to destructure)

0:51 muhoo: not in this case, i'd want to do other things, like format the stuff in that map.

0:51 hmm.. this looks promising.

0:51 thanks!

0:51 brehaut: right, but you'll probably want to create a seperate function for that and call it in the else of the map's fn

0:52 no worries

0:52 also some of the 4clojure tree problems are good practise for this sort of shenanigans

0:54 muhoo: i really need to do those. i feel like if i can understand trees, the world is mine.

0:54 or, at least, lisps are.

0:56 brehaut: you'll think so, right up till you need to understand graphs :P

0:57 kaoD: I find tress a bit awkward

0:57 even more that graphs

0:57 (I mean, trees done right)

2:15 michaelr525: hello

2:15 LuminousMonkey: G'day

2:28 ambrosebs: Should I think of the null pointer as being related to Java or to the JVM?

2:32 kovasb: ambrosebs: interesting question. what are the pros and cons?

2:40 ambrosebs: kovasb: I just wanted to get my terminology right. Did Java invent the null pointer, or is it part of the JVM?

2:41 Where can I find the answers to these kinds of things?

2:41 LuminousMonkey: Isn't it part of the JVM? http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.4 Or am I missing something?

2:42 kovasb: I'm pretty sure the null pointer predates both of them

2:42 ambrosebs: LuminousMonkey: ah, thanks!

2:42 kovasb: I meant in the context of the JVM

2:42 kovasb: yeah, seems like a jvm feature

2:42 "feature"

2:42 ambrosebs: :)

2:43 thanks!

2:44 LuminousMonkey: ambrosebs: I'm just surprised you're not doing this sort of thing at 2am, unless you're starting early today. :P

2:44 ambrosebs: LuminousMonkey: I just woke up...

2:44 hahaha

2:45 I basically was doing this at 2am

2:45 LuminousMonkey: ambrosebs: Good day for staying in bed anyway.

2:49 robertstuttaford: is it possible to conditionally bind in a value in a let form if an arg in the containing function has a value of nil, otherwise use that value?

2:49 * Raynes reads that until it makes sense.

2:50 ambrosebs: are you talking about fnil?

2:50 Iceland_jack: if-let?

2:50 ,(doc if-let)

2:50 clojurebot: "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"

2:50 Raynes: &(doc fnil)

2:50 lazybot: ⇒ "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can... https://www.refheap.com/paste/2724

2:50 robertstuttaford: gah of course

2:51 Raynes: lazybot is better for docstrings because it pastes long output.

2:51 LuminousMonkey: Like x ||= "other" in Ruby?

2:51 robertstuttaford: yes LuminousMonkey. i'll check both if-let and fnil out

2:51 thanks!

2:54 amalloy: robertstuttaford: it sounds like you just want ##(doc or)

2:54 lazybot: ⇒ "Macro ([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns a logical true value, or returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expression. (or) returns nil."

2:56 LuminousMonkey: Hooray for prefix notation.

3:04 robertstuttaford: amalloy: or is perfect, thank you

3:09 patchwork: Huh, suddenly when trying to run any lein command, I get an http timeout?

3:09 Is there any way to run a lein command without making an http request?

3:14 Why would lein clean be timing out?

3:21 robertstuttaford: it's probably trying to update deps?

3:43 how do i list all the loaded namespaces?

3:43 ie, all the valid targets for (in-ns)

3:44 LuminousMonkey: &(doc all-ns)

3:44 lazybot: ⇒ "([]); Returns a sequence of all namespaces."

3:50 cljnewb_2345: alright, has anyone here successfully run lein-beanstalk?

3:50 i'm getting all types of errors

3:50 https://github.com/weavejester/lein-beanstalk is a bit light on documentation

3:50 all all I really want is a function project.lcj + src/main.clj

3:51 then, I can start modifying it

4:07 robertstuttaford: does 'lein ring server' notify via STDOUT when it detects file modifications?

4:08 LuminousMonkey: I've never noticed if it does.

4:08 robertstuttaford: i don't think it's actually reloading files for me

4:29 argh. how do i get a java.util.Date from the string "yyyy-mm-dd hh:mm:ss"?

4:33 xeqi: &(.parse (java.text.SimpleDateFormat. "yyyy-mm-dd hh:mm:ss") "2012-04-15 03:32:13")

4:33 lazybot: ⇒ #inst "2012-01-15T11:32:13.000-00:00"

4:35 robertstuttaford: thank you xeqi

4:36 xeqi: well, something like that since it seems to have given me a different time

4:39 amalloy: xeqi: m can't be both minute and month

4:41 xeqi: &(.parse (java.text.SimpleDateFormat. "yyyy-MM-dd HH:mm:ss") "2012-04-15 03:32:13")

4:41 lazybot: ⇒ #inst "2012-04-15T10:32:13.000-00:00"

4:43 xeqi: closer

4:43 amalloy: timezone issues now. i wouldn't worry about that; it probably prints back out correctly

4:46 michaelr525: '(when-let [[i] []] (println i))

4:46 ,(when-let [[i] []] (println i))

4:47 clojurebot: nil

4:47 michaelr525: ,(when-let [[i] []] (println "hello"))

4:47 clojurebot: hello

4:47 michaelr525: why this binding evaluates to true?

4:48 it says get me the first element of the seq, right?

4:49 kovasb: so, what is the current way to convert a clojurescript hash map to a plain old javascript object?

4:49 michaelr525: the seq is empty, the binded value is nil but the binding expression evaluates to true and executes the body.

4:49 kovasb: we used to have .strobj, but I'm guessing that doesn't work for the new persistent collections

4:52 xeqi: &(macroexpand-1 '(when-let [[i] []] (println "hello")))

4:52 lazybot: ⇒ (clojure.core/let [temp__3974__auto__ []] (clojure.core/when temp__3974__auto__ (clojure.core/let [[i] temp__3974__auto__] (println "hello"))))

4:53 michaelr525: kovasb: everybody are drinking coffee :)

4:53 kovasb: yup

4:53 michaelr525: xeqi: let me parse that..

4:53 xeqi: heh

4:53 when checks the []

4:54 and sees thats not falsy

4:54 and then proceeds to do a let binding [i]

4:54 michaelr525: oh, i see

4:55 i just rewrote it as (let [[i]...] (when i))

4:55 i wonder whether there is another solution which is more elegant

4:55 clojurebot: Ack. Ack.

4:58 michaelr525: &(macroexpand '(when-let [[i] []] (println "hello")))

5:10 robertstuttaford: when i connect to an nrepl server from lein2, it works great. when i connect from ccw, it doesn't give me any errors, but i don't get any responses to my commands, either

5:11 damn frustrating because i can't leverage the evaluation tools in eclipse

5:14 ogrim: Hello, I

5:14 have a question :P

5:15 when updating deps for a forked project, I want to put it on clojars - so I add my group id, BUT whould I update the original version? I updated a project from 1.3 to 1.4. Not sure if idiomatic to do so.

6:27 ejackson: Raynes: why is clojure-py awesome ?

6:30 I don't really know the python platform, does it give you something that the JVM doesn't ?

6:32 clgv: ejackson: a global interpreter lock ;)

6:32 * clgv hides.

6:33 ejackson: hehehe

6:34 clgv: ejackson: they started an erlang like concurrency implementation afair

6:35 ejackson: hmmm. My only opinion on this is what I read from Rich :)

6:35 clgv: what did he write about clojure-py?

6:36 ejackson: no, he wrote about Erlang concurrency a while back

6:37 and why he did it differently in Clojure

6:37 clgv: ah ok

6:38 ejackson: clgv: you EuroClojuring ?

6:39 clgv: ejackson: no. have been to european lisp symposium already ;)

6:39 ejackson: how was it ?

6:39 clgv: good. also very nice city.

6:40 ejackson: well, compared to London....

6:40 clgv: London can be nice too. I have been there in a sunny warm summer week^^

6:42 ejackson: yeah its alright, provided you don't actually have to live there

6:42 a live in LSD-flashback

6:43 clgv: haha

6:48 what is the name of this rule engine with a leiningen plugin that can check clojure code for non--idiomatic code or common pitfalls?

6:52 foxdonut: clgv: just guessing, is it this? https://github.com/jonase/eastwood

6:52 Borkdude: clgv: https://github.com/jonase/kibit

6:53 clgv: oh I think I saw both - must be one of them I was thinking of

6:53 foxdonut: I just got the "eastwood" part -- clojure lint = clint :D

6:53 clgv: hehe

6:54 foxdonut: both look interesting.. glad you asked clgv

6:55 clgv: oh kibit is spitting out a lot of infos

6:56 I should try a smaller project

6:56 ejackson: clgv: yeah, eastwood, been using it, kinda fun

6:56 turns out I'm fond of swapping [arglist] and "docstring",,,, doh !

6:59 foxdonut: ejackson: (defn foo [bar] "docstring" ...) has always seemed more natural to me.

7:00 clgv: foxdonut: but it does not make clear if you want to return the string or whether it is doc ;)

7:06 foxdonut: clgv: you're right, for sure. But as I am typing, it just seems to flow more naturally to type the fn name + args, then the docstring.

7:06 clgv: also it would not make much sense for functions that have multiple arities..

7:07 clgv: yep

7:10 muhoo: is there any kind of threading macro where, if at any point in the thread i get nil, don't continue to the rest of the thread?

7:11 i.e., (-> loc z/down z/down z/branch?) ===> BOOM!! NPE because you can't do z/branch? on nil

7:11 ejackson: muhoo, yep -?>

7:11 muhoo: it'd be nice if i could do (-> loc z/down z/down z/down z/branch?) or z/node or whatever, and if there's a nil at any point, the thread would return nil

7:11 ejackson: awesome, thanks

7:12 ejackson: its in core.incubator

7:12 so you'll need to include that

7:50 augustl: looking for tools to generate static HTML pages with clojure, for my own blog

7:51 other than just building a website and wget-ing the HTML :)

7:53 michaelr525: why generate static HTML pages?

7:54 dan_b: means you don't have to install clojure on your web host, is one consideration

7:54 michaelr525: ah

7:55 ok, then why write a static site in clojure?

7:55 dan_b: perhaps you really really like hiccup

7:56 ejackson: augustl: ultimately hiccup/enlive all output html strings, so just figure a way to capture and save those ?

7:56 dan_b: similar things exist in other languages -> https://github.com/mojombo/jekyll/

7:56 augustl: michaelr525: mostly just because I want to use clojure

7:56 ejackson: yeah I guess

7:57 ejackson: do it well and release as a library for generating static html pages from clojure:)

7:57 augustl: makes sense to have a separate tool for dynamic html page => static html anyways

7:57 so that it's reusable

7:57 I think wget can only partially do it

7:57 uh, yeah, what ejackson said :)

7:57 michaelr525: then why don't you just install clojure at your webhost and run a dynamic site?

7:57 ejackson: there might exist such a thing, i dunno.

7:58 augustl: michaelr525: it's no dynamic content (user input etc) so it's easier to host it as HTML

7:58 also, it scales ;)

7:58 michaelr525: much easier to just throw a dynamic site imho

7:59 ejackson: augustl: Lau Jensen did something like this for his blog a while back, I think he posted about what he did. Might help

7:59 dan_b: can't push clojure to a cdn though

7:59 augustl: semi related, if I build such a scraping tool with clojure, how would it be distributed? A .jar?

7:59 ejackson: ah, cool

8:00 ejackson: http://www.bestinclass.dk/ ? Seems to be a tumblr for the blog

8:01 ejackson: he's subsequently changed it back :)

8:01 hahaha

8:01 augustl: heh

8:01 thanks for the help, though, I know what to do now

8:01 mittchel: ((fn [x] (clojure.string/join "Hello, " (clojure.string/join x "!"))) "Dave")

8:01 michaelr525: dan_b: is it a real use case? to host html on a cdn?

8:02 mittchel: why does this give me "!" and not Hello, Dave!

8:02 augustl: (build my webpage with clojure and optionally find or write a tool to turn any web page to static HTML)

8:08 michaelr525: mittchel: you can just write (str "Hello, " x "Dave")

8:08 mittchel: .(str "Hello, " x "Dave")

8:08 ,(str "Hello, " x "Dave")

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

8:09 michaelr525: &(let [x "something"](str "Hello, " x "Dave"))

8:09 lazybot: ⇒ "Hello, somethingDave"

8:09 mittchel: but I actually need a "!" after the "dave" without placing it in the name

8:09 so, Hello, Dave!

8:09 foxdonut: &(let [x "Dave"] (str "Hello, " x "!"))

8:09 lazybot: ⇒ "Hello, Dave!"

8:11 mittchel: hm I understand what it does

8:11 foxdonut: &(require 'clojure.string)

8:11 lazybot: java.lang.ClassNotFoundException: clojure.string

8:11 foxdonut: ,(require 'clojure.string)

8:11 clojurebot: nil

8:11 foxdonut: ,(clojure.string/join "|" ["one" "two" "three"])

8:11 clojurebot: "one|two|three"

8:12 foxdonut: mittchel: so join is more for putting a separator in between a bunch of strings

8:12 mittchel: ahh cool :D

8:12 cause I',m trying out this one: http://www.4clojure.com/problem/16

8:13 bderooms_: is there a way to let clojure use more memory?

8:13 foxdonut: mittchel: yeah, str is your friend for that one.

8:13 mittchel: do I need to use let too for the !

8:14 foxdonut: mittchel: no, you can just use (fn [x] (str "Hello, " x "!"))

8:14 mittchel: Yea I actually filled that in haha

8:14 worked:P cool

8:17 ejackson: bderooms_: you have to pass in a param to the jvm

8:18 -Xmms and friends

8:19 bderooms_: http://www.devdaily.com/blog/post/java/java-xmx-xms-memory-heap-size-control

8:20 you can pass these in via leiningen

8:20 bderooms_: I passed them to java when calling the jar

8:20 but it 'seems' to still cap on memory

8:20 kaoD: bderooms_: it shouldn't

8:20 bderooms_: my cpu's go at 90 percent, then the memory curve flattens out and the cpu's drop

8:21 if I give less load, the cpu's work at 99 percent continiously

8:21 maybe it's not the memory but I'm puzzled..

8:21 ejackson: does sound like memory

8:22 kaoD: but maybe you're still hitting memory limits even raising them

8:22 bderooms_: I gave java -Xincgc -Xmx1024m -Xms1024m -cp clojure.jar:clojure-contrib.jar clojure.main file.clj as argument

8:22 kaoD: that should be raising the limits

8:22 so probably you're still hitting them

8:23 bderooms_: kaoD: if I use thos e settings I don't see a difference. It goes from 959 ram to 1.3 gb ram when I run

8:23 but 1.3 seems to be the limit

8:23 kaoD: no wonder: 1024m is about 1.3gb ram

8:23 bderooms_: shouldn't it go +1gb

8:23 ah I was assuming the 956 mb is from my OS

8:23 kaoD: -Xmx2048m -Xms2048m

8:23 that's 2GB ram

8:23 bderooms_: that does not work

8:24 could not reserve enough heap space

8:24 kaoD: do you have enough ram to fit it?

8:25 bderooms_: 4 gb

8:25 32 bit system though

8:25 well, I actually have 8 gig, but due to the 32 bit I only have 3.2 to allocate

8:26 kaoD: hmm...

8:26 32bit should be enough for 2gb allocation

8:26 bderooms_: my friends just suggested I try on our university's server

8:26 I guess I'll try that

8:26 64 bit system

8:27 kaoD: oh, wait a sec

8:28 try -Xmx2048m -Xms1024m

8:29 also: incremental GC will lead to poor garbage collection

8:29 (although it will avoid pauses for GC)

8:31 also: try just -Xmx1850M

8:31 mittchel: Is anyone able to explain me this one: http://www.4clojure.com/problem/71 ?

8:31 kaoD: mittchel: sure, although you might wanna go to #4clojure

8:32 mittchel: (__ (sort (rest (reverse [2 5 4 1 3 6])))) is obviously == (-> [2 5 4 1 3 6] reverse rest sort __)

8:32 so you just need some way to get 5 out of those expressions

8:32 bderooms_: kaoD: same results

8:32 kaoD: &(reverse [2 5 4 1 3 6])

8:32 lazybot: ⇒ (6 3 1 4 5 2)

8:33 bderooms_: 1450 works

8:33 !

8:33 :)

8:33 kaoD: &(rest (reverse [2 5 4 1 3 6]))

8:33 lazybot: ⇒ (3 1 4 5 2)

8:33 kaoD: &(sort (rest (reverse [2 5 4 1 3 6])))

8:33 lazybot: ⇒ (1 2 3 4 5)

8:33 bderooms_: and yey.. we get more memory

8:33 kaoD: now it should be easy enough

8:33 bderooms_: so I guess the defautl was already 1024

8:33 mittchel: Well it's abracadabra for me what happens there lol

8:34 I know the reverse stuff

8:34 kaoD: what do you mean abracadabra?

8:34 mittchel: but I don't know how to solve the problem, cause I don't know what it wants as exceed output

8:34 kaoD: you want 5 as output

8:34 mittchel: like single number 5 or [1 2 3 4 5]

8:34 kaoD: bderooms_: probably you're hitting your OS limit, although 1450 seems like an odd number to be your limit :S

8:34 mittchel: as I said, the first and second expressions are equivalent

8:34 that problem is meant to show you that

8:35 -> acts like a simplification there

8:35 (__ (sort (rest (reverse [2 5 4 1 3 6])))) is obviously == (-> [2 5 4 1 3 6] reverse rest sort __)

8:35 mittchel: ah ok

8:35 kaoD: &(sort (rest (reverse [2 5 4 1 3 6])))

8:35 lazybot: ⇒ (1 2 3 4 5)

8:35 mittchel: It's just shorter

8:35 kaoD: &(-> [2 5 4 1 3 6] reverse rest sort)

8:35 lazybot: ⇒ (1 2 3 4 5)

8:35 bderooms_: kaoD: was not done testing yet, 1600 also still works

8:35 kaoD: whatever you fill in the __

8:36 both expressions will result the same

8:36 e.g.

8:36 &(first (sort (rest (reverse [2 5 4 1 3 6]))))

8:36 lazybot: ⇒ 1

8:36 mittchel: well whatever I fill in there it still gives me errors haha

8:36 kaoD: &(-> [2 5 4 1 3 6] reverse rest sort first)

8:36 lazybot: ⇒ 1

8:36 kaoD: how?

8:36 clojurebot: with style and grace

8:36 kaoD: lol

8:36 what kind of errors?

8:36 mittchel: I should fill in [1 2 3 4 5] rigjt

8:36 kaoD: nope

8:36 why would you?

8:37 mittchel: argh

8:37 I dont know

8:37 lol

8:37 kaoD: lets go through this again

8:37 mittchel: I know 2 expressions are the same

8:37 kaoD: read closely

8:37 mittchel: and I understand -> is just neater way to right the first expression

8:37 kaoD: yep

8:37 mittchel: I just don't understand what to fill on the __ to make it compile

8:37 kaoD: well... any function

8:37 (__ (sort (rest (reverse [2 5 4 1 3 6]))))

8:38 __ is the first element of a form

8:38 so it should be a function

8:38 right?

8:38 clojurebot: technomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener.

8:38 mittchel: I think so haha

8:38 kaoD: it makes no sense to put a vector there

8:38 so you have this:

8:38 &(sort (rest (reverse [2 5 4 1 3 6])))

8:38 lazybot: ⇒ (1 2 3 4 5)

8:39 kaoD: that's your partial result

8:39 BEFORE applying __

8:39 same goes for the -> form

8:39 &(-> [2 5 4 1 3 6] reverse rest sort)

8:39 lazybot: ⇒ (1 2 3 4 5)

8:39 kaoD: and since these two forms are ALWAYS the same

8:39 mittchel: it can be anything

8:39 kaoD: your goal is to get them equal to the THIRD part of the if

8:39 mittchel: ah

8:39 kaoD: (which is 5)

8:40 ambrosebs: is IFn the correct interface to extend for invocable types?

8:40 kaoD: and how would you get 5 out of (1 2 3 4 5)?

8:40 ambrosebs: IIRC it is

8:40 you mean invocable like a set, vector, map, right?

8:40 ambrosebs: yes

8:40 kaoD: then it is

8:41 ambrosebs: does it support rest args?

8:41 mittchel: ahh

8:41 lol

8:41 Something with find maybe

8:41 kaoD: ambrosebs: not sure TBH

8:41 mittchel: let me check clojure cheat sheet:P

8:41 kaoD: mittchel: find? what the hell?

8:42 okay let's do this again

8:42 mittchel: filter?:Pp

8:42 kaoD: this is what you have

8:42 &(-> [2 5 4 1 3 6] reverse rest sort)

8:42 lazybot: ⇒ (1 2 3 4 5)

8:42 kaoD: &(-> [2 5 4 1 3 6] reverse rest sort second)

8:42 lazybot: ⇒ 2

8:42 kaoD: &(-> [2 5 4 1 3 6] reverse rest sort first)

8:42 lazybot: ⇒ 1

8:42 clgv: &(ancestors map)

8:42 lazybot: ⇒ nil

8:43 clgv: &(ancestors (type map))

8:43 lazybot: ⇒ #{clojure.lang.Fn java.lang.Runnable java.io.Serializable java.util.Comparator clojure.lang.IMeta clojure.lang.AFn java.util.concurrent.Callable clojure.lang.IObj clojure.lang.IFn clojure.lang.AFunction clojure.lang.RestFn java.lang.Object}

8:43 mittchel: ahw

8:43 isn't it just last

8:43 since [1 2 3 4 5] <- last one is 5

8:43 kaoD: yup

8:43 it is

8:44 &(-> [2 5 4 1 3 6] reverse rest sort last)

8:44 lazybot: ⇒ 5

8:44 clgv: mittchel: there is also 'nth

8:44 mittchel: lol I actually understand it now

8:45 kaoD: &(-> [2 5 4 1 3 6] reverse rest sort (nth 4))

8:45 lazybot: ⇒ 5

8:45 mittchel: thanks a lot kaod

8:45 It's really easy wants you get it

8:47 basically what it does is (res(reverse 2 5 4 1 3 6)) so reverse makes it 6 3 1 4 5 2. rest says the first one should be 'skipped' so you keep 3 1 4 5 2. Sort just sorts it to [1 2 3 4 5]. Int he last if it wants to be 5, so if you call last you'll get 5 back.

8:47 kaoD: yeah, that's itr

8:48 bderooms_: it seems that JVM requires a contiguous memory block

8:48 so you might be running into memory fragmentation

8:50 mittchel: Whats the difference between -> and ->>

8:52 kaoD: -> insert as second

8:52 ->> as last

8:53 gfredericks: -<> insert wherever you want

8:53 ejackson: gfredericks: is that in core ?

8:53 kaoD: gfredericks: what?

8:53 clgv: gfredericks: where is that defined?

8:53 kaoD: lol you all came alive

8:53 ejackson: settle, settle !

8:53 gfredericks: swiss arrows

8:54 clgv: the swiss, again!

8:54 * jonaskoelker is confused

8:54 gfredericks: $google github swiss-arrows

8:54 lazybot: [rplevy/swiss-arrows · GitHub] https://github.com/rplevy/swiss-arrows

8:55 gfredericks: ha -- I like using the clojars link for "installation"

8:55 kaoD: mittchel: see this:

8:55 &( -> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )

8:55 lazybot: ⇒ ([1 2 3 4 5] 6 7 8 9) nil

8:55 gfredericks: no keeping versions uptodate in the readme

8:55 kaoD: &( ->> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )

8:55 lazybot: ⇒ (6 7 8 9 [1 2 3 4 5]) nil

8:55 clgv: clojure 1.4 has no :use anymore?

8:55 mittchel: so it switches forms basicly?

8:56 kaoD: mittchel: nope

8:56 mittchel: del other forms

8:56 well*

8:56 kaoD: mittchel: inserts as second

8:56 or last

8:56 mittchel: Yes and the -> inserts as first right?

8:56 bderooms_: kaoD: thx for the info

8:56 kaoD: second if you cound the function

8:57 *count

8:57 gfredericks: The Trystero Furcula <- what a name

8:57 mittchel: Well if you say both inserts as second

8:57 w

8:57 what the hell is the difference then

8:58 kaoD: what?

8:58 clojurebot: What is short for ,(doc ...)

8:58 kaoD: -> second (or first if you don't count the function)

8:58 ->> last

8:58 jweiss: i'm a little confused about "lein run" - seems like sometimes it compiles the main namespace for you, other times it expects you to have done it.

8:58 kaoD: see the examples again

8:58 &( -> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )

8:58 lazybot: ⇒ ([1 2 3 4 5] 6 7 8 9) nil

8:58 clgv: &(clojure-version)

8:58 lazybot: ⇒ "1.4.0"

8:59 kaoD: &( ->> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )

8:59 lazybot: ⇒ (6 7 8 9 [1 2 3 4 5]) nil

8:59 kaoD: 6 7 8 9 are SEVERAL forms

8:59 it's not a vector

8:59 clgv: &(->> (ns-publics 'clojure.core) keys (into #{}) 'use)

8:59 lazybot: java.lang.ClassNotFoundException: clojure.core

9:00 clgv: &(->> (ns-publics clojure.core) keys (into #{}) 'use)

9:00 lazybot: java.lang.ClassNotFoundException: clojure.core

9:00 clgv: &(->> (ns-publics (the-ns 'clojure.core)) keys (into #{}) 'use)

9:00 lazybot: java.lang.ClassNotFoundException: clojure.core

9:00 kaoD: &(ns-publics "clojure.core")

9:00 lazybot: java.lang.SecurityException: You tripped the alarm! ns-publics is bad!

9:01 clgv: haha lol k

9:01 that changed as well

9:03 mdeboard: &*ns*

9:03 lazybot: ⇒ #<Namespace sandbox3826>

9:03 mdeboard: :o

9:03 clgv: &*ns*

9:03 lazybot: ⇒ #<Namespace sandbox3826>

9:04 clgv: damn, we have the same sandbox - dont steal my cake!

9:04 * mdeboard pees in the sandbox

9:05 hyPiRion: &(ns foo) ?

9:05 lazybot: java.lang.ClassNotFoundException: clojure.core

9:06 duck1123: &(in-ns 'foo)

9:06 lazybot: java.lang.SecurityException: You tripped the alarm! in-ns is bad!

9:06 * clgv bans mdeboard from his sandbox.

9:07 clgv: "The Diamond Fishing Rod" :D

9:08 kaoD: ,(ns-publics 'clojure.core)

9:08 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...}

9:08 clgv: ,(clojure-version)

9:08 clojurebot: "1.4.0-master-SNAPSHOT"

9:08 kaoD: there you go

9:08 they didn't change it

9:08 it worked with the string because... it didn't work

9:08 (oh, the irony)

9:09 ,(->> (ns-publics 'clojure.core) keys (into #{}) 'use)

9:09 clojurebot: use

9:09 kaoD: ,(->> (ns-publics 'clojure.core) keys (into #{}))

9:09 clojurebot: #{sorted-map read-line re-pattern keyword? unchecked-inc-int ...}

9:10 robertstuttaford: argh my eclipse/ccw/leiningen setup is broken. no longer getting leiningen deps appearing in the project. now deleted all of eclipse and its metadata and trying from scratch

9:10 i really should spend some time learning emacs :-/

9:11 hyPiRion: robertstuttaford: I have the same issue. With emacs, that is.

9:12 robertstuttaford: i'm sure emacs is awesome. so many folks can't be wrong. but getting it all set up and comfy seems daunting. fonts, colours, getting the damn thing to properly fullscreen on osx, etc.

9:13 kaoD: robertstuttaford: it looks harder than it is

9:13 robertstuttaford: haha oh dear

9:13 kaoD: you just have to rub the lamp

9:13 and the genie comes out

9:13 and you learn all emacs hotkeys

9:13 easy-peasy

9:13 Fossi: i'm not gonna rub stallman's lamp

9:14 uvtc: robertstuttaford, hyPiRion : this might help: http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html

9:14 kaoD: Fossi: I'm sure he's disappointed :(

9:14 hyPiRion: btw, http://mrozekma.com/editor-learning-curve.png

9:14 robertstuttaford: woo, thanks uvtc

9:14 Fossi: gotta love the guy, but too much is too much :>

9:14 hyPiRion: uvtc: thanks

9:14 kaoD: btw, he's been in spain recently for a conference

9:14 uvtc: yw. Hope it's useful to you.

9:15 kaoD: and he had to leave the conference and go to the hospital

9:15 clgv: robertstuttaford: you are using the leiningen plugin already?

9:15 kaoD: an ambulance came

9:15 mdeboard: robertstuttaford: Yes setting up emacs to be the flexible, powerful editor that you can feel comfortable in is indeed a time investment, but very worth it.

9:15 robertstuttaford: clgv: i followed cemerick's screencast

9:15 Fossi: read that on /.

9:15 clgv: robertstuttaford: I am still waiting for a release before I use it in production

9:15 robertstuttaford: it said, install this plugin, so i did :)

9:16 i guess i'm paying the price, now

9:16 hyPiRion: clgv: leiningen plugin for eclipse?

9:16 * robertstuttaford decides to try emacs. what the hell

9:16 clgv: hyPiRion: yes

9:17 hyPiRion: clgv: Huh, didn't knew it existed. But then again, I'm still stuck in 1.2.

9:18 duck1123: Emacs is a lot easier now that it was in years past, package-install makes all the difference

9:18 hyPiRion: I suppose I'll just go straight to emacs though - no need to slow productivity even more.

9:18 clgv: robertstuttaford: you should report that issue. it's still alpha/beta at this stage.

9:19 michaelr`: the general emacs experience is terrible, i've tried using it a couple of times but i just can't make it

9:19 robertstuttaford: mudphone was kind enough to share this https://github.com/mudphone/clojure_basics/blob/master/emacs_clojure_setup_notes.txt

9:19 michaelr`: currently using Sublime Text to edit clojure

9:20 robertstuttaford: is there an emacs rainbow-parens addon?

9:20 i love this about ccw

9:20 kaoD: michaelr`: did you try the emacs tutorial?

9:21 robertstuttaford: yes, there are rainbow parens

9:21 duck1123: even better, there's paredit

9:21 kaoD: I had a harder time getting emacs 24 than using it tbh

9:21 I only had 23 in the repos

9:22 robertstuttaford: paredit in ccw is also awesome

9:22 kaoD: robertstuttaford: so you use CCW? how the hell do I start app's -main?

9:22 I seem to only be able to run the REPL

9:22 (which is actually why I left CCW)

9:23 (besides zero Lein support)

9:23 clgv: kaoD: start the repl in its namespace and type (-main) ;)

9:23 uvtc: duck1123, I haven't yet used any sort of Emacs package-install. Just apt-get install emacs emacs-goodies-el, and then manual set-up of my config file. Maybe the pkg installer is more useful outside of GNU/Linux?

9:23 duck1123: My experience with CCW has been "This would be great if I weren't already using emacs"

9:24 robertstuttaford: kaoD: use yes. until it broke an hour ago

9:24 duck1123: uvtc: I think it's built into 24 or 23 if you have the starter kit. (also known as ELPA)

9:24 robertstuttaford: got to taste the editor <> repl koolaid.

9:24 kaoD: clgv: seems too complicated for a fucking IDE

9:24 I just want my program to run

9:24 uvtc: robertstuttaford, maybe this: http://www.emacswiki.org/emacs/RainbowDelimiters ?

9:24 kaoD: if you can't give me that, then, what the hell, I'll switch to Emacs

9:25 robertstuttaford: awesome uvtc!

9:25 duck1123: kaoD: Can't you set up something with lein run and eclipse's launchers?

9:25 clgv: kaoD: dont know if emacs explicitel suports running some -main function

9:25 uvtc: robertstuttaford, emacswiki.org is pretty much galactic central for all Emacs info. :)

9:25 robertstuttaford: i guess emacs and lein play nicely?

9:25 clgv: duck1123: good point

9:25 kaoD: clgv: but it's got a good lein plugin, which supports "lein run"

9:25 robertstuttaford: for instance, i'm now using lein ring server-headless

9:26 kaoD: duck1123: yep, you can hack it but it feels very unnatural

9:26 duck1123: robertstuttaford: There's the elein package, but I never use it

9:27 kaoD: and, what the hell, it was the perfect excuse to try emacs

9:27 clgv: kaoD: honestly, I only use the -main function when I have a jar. otherwise I'll be using concrete functions I am developing almost all the time

9:27 uvtc: duck1123, thanks. Will read up on ELPA.

9:27 clgv: kaoD: choose the environment that suits you ^^

9:27 robertstuttaford: the main thing is being able to start a ring server and be able to interact with it via repl, and have that repl be nicely integrated with my editor so i can evaluate forms and so forth

9:27 if i can do all of that within emacs, i'm happy

9:27 kaoD: clgv: yeah, I usually do incremental development too

9:28 but it just gets annoying when the IDE gets in the way

9:28 duck1123: I would highly suggest getting emacs starter kit (even if you're not a starter) it has much better defaults and makes it a better experience

9:28 kaoD: it should be making my life easier, right?

9:28 robertstuttaford: you can do that using SLIME

9:28 Lein starts a REPL (nREPL, IIRC) and then you jack into it using SLIME

9:28 et voila, full REPL in your running project

9:28 robertstuttaford: awesome

9:29 uvtc: duck1123, you mean this <https://github.com/technomancy/emacs-starter-kit/&gt;?

9:29 duck1123: What I do is run a terminal and run 'lein swank' and then in emacs: M-x slime-connect

9:30 uvtc: yes, but be careful, there's two versions if you have 24 or earlier

9:30 robertstuttaford: duck1123: do i need lein plugins for that?

9:30 duck1123: robertstuttaford: to do that, all you need is the swank repl package

9:30 kaoD: duck1123: isn't M-x slime-jack-in the same?

9:31 and shorter

9:31 and requires no shell

9:31 robertstuttaford: so i'm going to install emacs 24, emacs-starter-kit, and swank-clojure

9:31 kaoD: (which speeds up my workflow)

9:31 robertstuttaford: https://github.com/technomancy/swank-clojure

9:31 kaoD: robertstuttaford: for some reason I had trouble using ESK

9:31 duck1123: slime-jack-in also starts the slime, In my workflow I have a server running that I connect to, so jack-in isn't useful to me

9:31 robertstuttaford: and https://github.com/technomancy/clojure-mode

9:31 echo-area: Is there a non-reflective way of getting length of an array in Clojure?

9:32 kaoD: duck1123: oh, I see

9:32 echo-area: .length?

9:32 robertstuttaford: uvtc: the keyboard shortcut list on that link you sent is great

9:33 echo-area: ,(let [v (make-array Integer/TYPE 3)] (.length v))

9:33 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: length for class [I>

9:33 echo-area: kaoD: This won't work

9:33 I find that only (count array) works, but it's using reflection

9:34 clgv: echo-area: it is?

9:34 echo-area: clgv: It is for array, isn't it?

9:35 uvtc: robertstuttaford, thanks. I put in what I thought was most useful. Also, M-n and M-p are my own doing (maybe I missed something, but I don't understand why Emacs doesn't come stock with key bindings for scrolling the window up and down).

9:35 echo-area: clgv: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L522

9:36 uvtc: robertstuttaford, Also, note that that page doesn't cover the setup described by duck1123 (regarding swank). I haven't tried that myself yet. :)

9:36 clgv: ,(let [v (make-array Integer/TYPE 3)] (Array/getLength v))

9:36 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: Array, compiling:(NO_SOURCE_PATH:0)>

9:36 kaoD: uvtc: what do you mean? C-v and M-v let you scroll down and up

9:36 uvtc: kaoD, No, I mean up-by-line and down-by-line, not -by-page.

9:37 clgv: ,(let [v (make-array Integer/TYPE 3)] (java.util.Array/getLength v))

9:37 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: java.util.Array>

9:37 kaoD: there is too

9:37 echo-area: ,(let [v (make-array Integer/TYPE 3)] (java.lang.reflect.Array/getLength v))

9:37 clojurebot: 3

9:37 clgv: ah right

9:37 kaoD: C-n and C-p if

9:37 IIRC

9:37 uvtc: kaoD, if?

9:37 kaoD: typo

9:37 uvtc: C-n and C-p move the cursor. I mean scrolling the window.

9:37 kaoD: C-n and C-p, period :P

9:37 echo-area: clgv: I guess that's really the only way

9:38 kaoD: oooh, I see

9:38 ldopa: uvtc: i somehow got into the habbit of navigating via C-s or C-r <string> and then C-l to center the window on the cursor

9:38 and don't miss single-line scrolling at all

9:39 uvtc: ldopa, Yes, I do that all the time as well. (Guess I'm just picky about where the window is scrolled to.)

9:39 ldopa: heh ok

9:40 kaoD: uvtc: did you try M-<num lines> C-v?

9:40 clgv: echo-area: those arrays seem like objects in java but do not seem like real objects on jvm level

9:40 kaoD: M-1 C-v for instance

9:41 yup, it works

9:41 M-1 C-v scrolls one line down

9:41 uvtc: kaoD, yes (well, actually C-u 1 C-v) ... that's what I bind M-n to. :)

9:41 kaoD: it's bound by default right?

9:41 robertstuttaford: nerds, the lot of you

9:41 :)

9:41 foxdonut: and proud of it!

9:42 robertstuttaford: i say this from behind the safety of my 3 monitors

9:42 uvtc: kaoD, easier to just tap M-n and M-p than to type those prefixes though. Not sure what you mean, "it's bound by default". I added those bindings to my ~/.emacs. It's noted in http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html .

9:43 echo-area: clgv: I see that java.lang.reflect.Array.getLength() is a native method. Is array.length in Java also compiled to that?

9:43 I don't know how to disassemble Java bytecode.

9:43 foxdonut: we're nerds, what are we going to do, whack you with a virtual terminal?

9:43 echo-area: (yet)

9:44 clgv: echo-area: try jd-gui

9:44 echo-area: Oh.

9:45 Thanks!

9:45 duck1123: I'm sure Rich made counting arrays as fast as he could possibly make it

9:46 clgv: duck1123: probably. but the shortcut for clojure.lang.Counted wasnt there in 1.2.1 ;)

9:46 duck1123: args. maybe confused it with indexed

9:47 kaoD: uvtc: are you sure? M-<number> is mentioned as a shortcut for C-u <number> in the emacs tutorial

9:47 oh nevermind

9:47 I got you wrong

9:47 duck1123: of course, if you know that you're getting an array, you could probably go straight for the Array/getLength

9:47 kaoD: you meant the shortcut for one-line not for C-u

9:59 bhenry1: what do i need in my project.clj so i can (import '[org.bson.types ObjectId])

10:00 duck1123: [org.mongodb/bson "2.7.3"]

10:00 bhenry: thanks

10:01 duck1123: Although you'll probably want the full mongo driver and/or a good clojure library for it

10:03 robertstuttaford: is it bad if emacs 24 crashes when i clojure-jack-in the first time? :-(

10:03 bhenry: duck1123: just grabbed karras

10:09 duck1123: bhenry: I like karras because it gives me back all my entities as records. I can then do neat things with them from there. There are a couple of other good ones as well. (congomongo and another one)

10:11 bhenry: duck1123: karras is the shiz

10:11 pandeiro: duck1123: what can you do with those records, if u dont mind my curiosity.. i dont tend to use them

10:12 ache: robertstuttaford: what OS are you on?

10:12 ejackson: pandeiro: its a typed map

10:13 ache: robertstuttaford: and does it crash on only the first time?

10:13 pandeiro: ejackson: i get the concept but i don't think to use them, maybe b/c of limited background using strongly typed langs?

10:13 robertstuttaford: ache: osx. i rebooted emacs and tried again, and it worked this time

10:13 it went nuts compiling something

10:13 ache: do you think it's fine now?

10:13 ejackson: pandeiro: it allows you to have a map participate in Protocols, so you get function dispatch on its type

10:13 robertstuttaford: seems that way. repl starts up

10:13 duck1123: pandeiro: mostly, I use them in multi-methods where I dispatch on type

10:14 When I started writing this part, Protocols weren't out yet, and I'm dispatching on more than just the type

10:15 ache: welcome to emacs. :) i map the most common keystrokes to the f1 f2 etc buttons to avoid key combinations

10:16 pandeiro: i see, that's the main draw then, dispatching on type

10:17 coming from a more js background i dont think to use multimethods as much as multiple arity fns

10:17 duck1123: I think I hit a point where I started using multimethods too much, but it works well for me

10:23 robertstuttaford: got emacs 24 up with starter-kit, starter-kit-lisp, clojure-mode and clojure-swank

10:23 let the learning begin

10:25 ache: robertstuttaford: make sure you have paredit :)

10:25 ejackson: and ibuprofen

10:25 robertstuttaford: how do i confirm that i do?

10:25 duck1123: M-x package-list-packages

10:25 robertstuttaford: oh i see it on the line

10:25 (Clojure Paredit Slime Fill)

10:25 ejackson: -grin-

10:26 ache: robertstuttaford: also you can run erc and then be on #clojure in the same emacs window

10:27 robertstuttaford: i have 3 monitors. you guys are off on the left. emacs fills the middle one

10:28 duck1123: robertstuttaford: C-x 5 2 -- emacs on all the monitors

10:28 rhc: while we're talking about emacs, how the hell do a permanently turn off hl-line-mode or change the color? i tried adding (hl-line-mode -1) to my .emacs.d/init.el and still loads up on startup

10:28 ache: robertstuttaford: ah. you guys are off to the right because my employer blocks irc and i'm ssh-ing for this

10:30 jweiss: i notice that the difference in compile time of my main namespace is huge, depending on if i do clojure-jack-in in emacs, and then compile the main class in emacs. versus 'lein compile' (which says it is only compiling that one namespace) - lein takes 10x longer.

10:33 duck1123: jweiss: even though it only says the one, it still compiles all the required namespaces. How are you compiling that main class in emacs?

10:34 jweiss: duck1123: C-c C-k

10:34 which must also compile all the req'd ns's

10:34 or does it?

10:34 i would have thought so

10:35 i don't see how you can compile any ns without first compiling the deps.

10:36 the jack-in process is slow, which makes me wonder if it's compiling. although it doesn't seem to complain if there are compile problems.

10:36 so that made me think it wasn't.

10:37 ache: jweiss: I think in emacs the first compile does do all the dependencies

10:37 jweiss: and thereafter it only has to re-def the things in the current buffer

10:37 or not "has to" but "only does"

10:38 jweiss: ache: yeah, but even the first compile in emacs is way faster than "lein compile". lein takes about 30 seconds. emacs takes about 2.

10:38 ache: so i think if you changed other buffers and saved them, but ran the compile from one buffer, compile only does that one buffer... that's my guess

10:38 jweiss: interesting. my first compile in emacs is slower than the later ones

10:38 duck1123: emacs is loading / requiring that namespace, but it's not doing a full AOT compile

10:38 jweiss: ache: that's true for me too, the 2nd compile in emacs is a fraction of a second

10:39 rhc: 30 seconds? usually my M-x clojure-jack-in takes about 2-3 seconds

10:39 jweiss: duck1123: ok, can i get leiningen to run my main namespace without AOT'ing it? it doesn't seem to want to do that.

10:40 duck1123: jweiss: you don't need to AOT to use lein run

10:40 but you do if you want an executable jar

10:40 jweiss: duck1123: yes i do. it will error out with classnotfound (on my main namespace)

10:40 if i don't run lein compile first.

10:40 maybe i'm doing something wrong

10:41 but if i do lein clean, run it will not work

10:41 if i do lein clean, compile, run it works.

10:41 let me test that again to make sure

10:41 duck1123: I was having that problem for a while.

10:43 jweiss: ok i'm lying, i had that error but lein clean, run does run it (albeit after 30+ seconds of doing something that appears to be compiling )

10:44 and in fact my classes dir does have all the class files compiled

10:45 * jweiss is not sure what the difference is between running and AOT compiling. does running not compile into class files on disk?

10:45 jweiss: everything has to be compiled one way or another. what is the difference with AOT?

10:46 clgv: jweiss: no it does not

10:46 jweiss: "running" only compiles to files if you bind/set *compile-files* to true

10:46 jweiss: you can try that in a repl

10:46 jweiss: clgv: ok so it's all normally done in-memory, which is what i want when i do "lein run". but that is not what i get. i get a classes/ dir full of compiled classes for my whole codebase.

10:47 ejackson: jweiss: you don't have a stray :aot :all in your project.clj maybe ?

10:47 clgv: jweiss: thats probably because you specified a namespace containing a -main method

10:47 jweiss: clgv: yup, how else can i do lein run?

10:48 clgv: jweiss: the problem is that everything that is used or required in the namespace of main will get compiled even transitively

10:48 jweiss: will it behave differently in terms of compiling, if i leave it off in project.clj and do lein run -m ...?

10:48 clgv: yeah, that appears to be what is happening.

10:48 technomancy: jweiss: you can do :main ^:skip-aot whatever.ns

10:49 or -m

10:49 clgv: jweiss: you can try to make a minimal -main method which just does (require 'real-main) (eval `(real-main/-main ~@args))

10:50 jweiss: clgv: that's kinda ugly :)

10:50 clgv: yeah it is

10:50 jweiss: i'll try technomancy's suggestion first

10:50 clgv: :skip-aot works in leiningen 1.7.1?

10:53 jweiss: clgv: technomancy: -m does not help, still AOT's everything

10:54 michaelr`: btw, i think i have the same problem with a noir website and it compiles for 5-7 minutes every time i 'lein run'

10:54 clgv: you can also use lein repl^^

10:54 michaelr`: i tried -m and skip-aot and it didn't help

10:54 duck1123: I think my record was 15+ minutes for a clean, compile

10:54 clgv: duck1123: with pre 1.7?

10:55 jweiss: :main ^:skip-aot my.ns does not work either.

10:55 clgv: jweiss: I guess thats for lein2

10:55 kaoD: maybe you're using something that requires AOT?

10:55 jweiss: clgv: the sample for v1 shows it in the doc

10:55 clgv: oh

10:55 jweiss: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L90

10:56 kaoD: like what? it doesn't get aot'd when i use slime.

10:56 clgv: jweiss: but clojure 1.2 didnt support ^:kw to ^{:kw true} I thought?

10:57 jweiss: clgv: i'm not sure what lein uses?

10:57 is it 1.2?

10:57 clgv: lein 1.7.1 should be using 1.2.1

10:57 jweiss: i'll try the old style

10:58 (inc clgv)

10:58 lazybot: ⇒ 2

10:58 jweiss: thanks! that did it :)

10:58 michaelr`: jweiss: what did you do?

10:59 jweiss: :main ^{:skip-aot true} my.main.ns

10:59 then lein run

10:59 did not write 1000 classfiles, just ran it :)

10:59 michaelr`: oh

10:59 doesn't work here

10:59 technomancy: jweiss: that's sample.project.clj on the master branch, not the 1.x branch

10:59 by "use -m" I mean do that instead of putting :main in project.clj

11:00 jweiss: technomancy: i see, i didn't realize master was now 2.0

11:00 last i looked, it wasn't

11:01 clgv: master usually is the snapshot/development version of clojure projects on github

11:01 jweiss: or maybe i thought it wasn't because the readme still referenced 2.0 as beta

11:01 clgv: afair^^

11:01 jweiss: but i guess that was a bad assumption on my part.

11:02 the readme on master, i mean

11:04 Dvyjones: Any idea why line 6 in test.clj fails? https://gist.github.com/e6d3fd431b7699971900

11:04 duck1123: ok, a clean compile of my project took 6minutes (included updating deps)

11:04 Dvyjones: This is the error I get: Caused by: java.lang.ClassNotFoundException: context-io.api.ApiContext

11:06 solussd: with korma I'm getting cyclic load errors because my model namespaces are co-dependent- seems like this would be a problem in just about any database driven app using korma with relationships between entities housed in different namespaces. Are we suppose to keep our entire model in one namespace?

11:07 TimMc: Dvyjones: What folder is api.clj in?

11:07 (it should have an underscore)

11:07 Dvyjones: Oh... and that should be :import, not import

11:07 Dvyjones: TimMc: :import gives the same error.

11:08 TimMc: Also, the api.clj file is in src/context_io/api.clj. The test.clj file is actually in test/context_io/test/api.clj and the ns is actually context-io.test.api. I can call functions from context-io.api with no problems, if I remove the import.

11:09 kaoD: it's clojure namespace

11:09 shouldn't it be require then?

11:09 import is for java classes amirite?

11:09 TimMc: kaoD: defrecords produce classes, not namespaces

11:10 duck1123: solussd: It sometimes takes careful planning to avoid that, but it is possible

11:10 kaoD: TimMc: I should've opened the code

11:10 TimMc: That would help. :-P

11:11 Dvyjones: TimMc: All of the code is here: https://github.com/dvyjones/context-io-clj, but without the :import stuff, since that's what I'm adding now.

11:11 solussd: duck1123: my problem is i have twqo models entities, call them 'a' and 'b' in there own namespaces that refer to each other in a defentity form. is there a solution other than having them share a namespace?

11:12 duck1123: solussd: I ended up putting all my entities in 1 ns, then I have model namespaces that refer to them, and then a higher level namespace that refers to those

11:12 it can sometimes be a pain

11:13 solussd: duck1123: interesting, thanks

11:13 duck1123: solussd: ref https://github.com/duck1123/jiksnu/blob/master/src/jiksnu/model.clj

11:27 TimMc: Dvyjones: Well, I can certainly reproduce that.

11:33 Dvyjones: Oh, ugh -- it's the underscores.

11:33 Or lack thereof.

11:33 Dvyjones: (:import context_io.api.ApiContext)

11:35 djue2012: Hi, I'm having trouble with lein install plugin on windows (7 x64)

11:36 TimMc: WHat version of lein?

11:36 djue2012: 1.7.1

11:36 java 1.6.0_21

11:37 i'm running as admin, but the stack trace is showing Caused by: java.io.IOException: Couldn't delete C:\Users\djue\AppData\Local\Temp\lein-14755f9c-f50e-451f-af04-0c3561761258\lib\cdt-

11:37 it's like it doesn't have permissions to delete the files or something

11:37 TimMc: The file is probably in use. Windows won't let you delete those.

11:37 djue2012: hmmmm

11:38 maybe my virus scanner is holding onto it and lein is too fast :)

11:38 TimMc: Why run it as admin? It'll work fine in non-privileged mode.

11:39 djue2012: i tried in non priv and it wasn't working

11:39 i thought using runas on the cmd line might help

11:39 no difference, same error

11:40 lemme try disabling any rt virus scanner stuff

11:43 ah i see

11:43 it's saying the file is open in java.exe

11:43 the cdt-

11:46 * nDuff mumbles something about silly platforms that don't allow open files to be unlinked

11:47 djue2012: hehe

11:47 nDuff: (although IIRC, NTFS added support for unlinked inodes, so it's just a backwards-compatibility piece of silliness that the API functions don't allow it still)

11:47 * nDuff has seen enough folks abusing those semantics for locking to understand _why_ it's necessary for backwards compatibility, but ugh.

11:53 djue2012: oh well. I updated an existing open ticket. https://github.com/technomancy/leiningen/issues/252

11:53 Dvyjones: TimMc: That worked. Thanks!

11:54 clgv: is there a midje checker to check a value to be in a given domain?

11:54 djue2012: thanks tim and nDuff

11:55 clgv: e.g. => (just [...G... (in-domain #{'e1 'e2 'e3})])

11:56 duck1123: clgv: checking against the raw set doesn't do it?

11:56 clgv: duck1123: how would you write that? I tried several versions

11:57 duck1123: => #{'e1 'e2 'e3} or => #(#{'e1 'e2 'e3} %)

11:58 clgv: dont forget the vector^^

11:58 with the vector the first does not work

11:59 the second works but is not that readable..

12:00 duck1123: is the left-hand side a single value?

12:01 clgv: a single function call, yes

12:01 or do you mean ...G... ?

12:01 duck1123: I mean, is it returning a single symbol in this case? I don't get what you mean about the vector

12:02 clgv: the function returns a vector like [...G... ...e...] but ...e... has to be from a given set of values

12:03 duck1123: (partial every #{'e1 'e2 'e3}) perhaps?

12:03 clgv: probably not: ##((partial every #{'e1 'e2 'e3}) 'e1)

12:03 lazybot: java.lang.RuntimeException: Unable to resolve symbol: every in this context

12:03 clgv: &((partial every? #{'e1 'e2 'e3}) 'e1)

12:03 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol

12:05 duck1123: &((partial every? #{'e1 'e2 'e3}) ['e1 'e3])

12:05 lazybot: ⇒ true

12:05 clgv: well [...G... #(#{'e1 'e2 'e3} %)] works. but I thought there would be something readable built in

12:08 duck1123: if you're using the latest midje, you could probably build something straightforward using every-checker

12:10 clgv: duck1123: not really. ...G... in the first position is no sequence and something different from the second position where the domain is limited

12:10 devn: Just got my copy of Let Over Lambda

12:10 color me excited

12:11 clgv: gotta go. see ya

12:12 espeed: I'm in the process of learning macros, and I'm getting a NullPointerException when trying to use macroexpand-1 (https://gist.github.com/2702934)

12:17 uvtc: Is standard procedure for getting Emacs 24 on Ubuntu/other-buntus pretty much to add-apt-repository ppa:cassou/emacs?

12:19 hdevalence: How do I add a local git repository as a lein dependency?

12:21 kaoD: uvtc: that's how I did it

12:22 add-apt-repository ppa:cassou/emacs -> apt-get install emacs-snapshot emacs-snapshot-gtk

12:23 uvtc: kaoD, Thanks. I'm looking at technomancy's emacs-starter-git and thinking maybe it's time. :)

12:23 kaoD: it's cool once you get it

12:23 just make sure you follow the basic emacs tutorial

12:23 even before messing with clj

12:25 uvtc: kaoD, I know basic Emacs. Just haven't ever used swank (nor the new Emacs package management)

12:26 kaoD, There's a fair number of moving parts. :)

12:27 technomancy: the starter kit is just fixing some bad defaults in Emacs

12:27 if you already know how to customize Emacs you can get all the benefit just from taking a look at what it does and trying out some of the features it enables for yourself

12:30 espeed: I'm in the process of learning macros, and I'm getting a NullPointerException when trying to use macroexpand-1 (see http://stackoverflow.com/questions/10604875/why-am-i-getting-a-nullpointerexception-when-executing-macroexpand-1-on-this-clo)

12:36 uvtc: technomancy, I don't know much elisp. It would be helpful if there were a wiki page at the emacs-starter-kit github page that simply listed what you get when you `M-x package-install starter-kit`.

12:37 technomancy: uvtc: yeah, that's a good idea. the starter kit is kind of in hibernation right now though.

12:37 uvtc: technomancy, hm. Why is it currently in hibernation mode?

12:38 technomancy: uvtc: because it's more or less done

12:39 in a perfect world, the starter kit wouldn't exist; Emacs would just work better out of the box

12:44 dnolen: espeed: config is not a map at that point in the macro - it's just a symbol.

12:47 espeed: dnolen: thanks. What should I be doing instead?

12:48 dnolen: espeed: untested, did you try `((ns-resolve (:ns config) 'create-vertex) config data) ?

12:51 jappy123: does ^ints serve as a type hint for single and multi-dimension int arrays? or are they differenciated? perhaps it doesn't care about the inner arrays?

12:51 clojure-newcomer: Hi guys, newcomer to Clojure here, looking for a bit of help with a very basic task

12:52 TimMc: espeed: As someone else answered on SO... maybe you just need a function, not a macro?

12:53 uvtc: Hi clojure-newcomer. You can just ask. :)

12:53 clojure-newcomer: uvtc: Hi, will do

12:53 I am trying to loop over return from file-seq and print every file name, sample at : http://pastebin.com/t6Fe575J

12:54 espeed: I was trying to avoid repeated calls to (ns-resolve) -- should I not be concerned with that?

12:54 clojure-newcomer: while the commented out line prints the entire collection happily… the line above it does not seem to do what I am trying to do

12:56 OwenOu: hi guys, what's the state of the art of building db backed web app in clojure? noir and korma?

12:58 dakrone: clojure-newcomer: (for ...) is lazy, so that may be your problem, what are you wanting to do that it's not doing?

12:58 uvtc: clojure-newcomer, `for` is for creating new lists. Maybe you want do-seq?

12:58 babilen: clojure-newcomer: You want doseq in lieu of for there (you want to force side-effects) -- for is lazy.

12:59 clojure-newcomer: thanks guys, appreciate it, I'll give it a go

12:59 technomancy: OwenOu: more or less

13:00 assuming you want a relational DB

13:00 OwenOu: technomancy: if you are building a web app, what would be your tech stack? any suggestion would be appreciated

13:01 espeed: TimMc: Thanks -- I see now.

13:01 technomancy: OwenOu: there's no one-size-fits-all solution

13:01 for databases especially

13:02 although postgres comes pretty close if you know you'll never outgrow a single node now that you can have schemaless tables

13:04 been meaning to take a closer look at postgres with hstore

13:04 duck1123: as far as db access goes, korma is a big load of awesome

13:05 technomancy: I am not the right person to comment on web apps though

13:06 jappy123: is the best I can do for a type hint at multidimensional int arrays ^ints? will this result in reflection still being done on a java method call that accepts a two dimensional int array

13:06 hiredman: jappy123: ^ints is an array of ints, but arrays on the jvm are one dimensional, so your "multidimensional" array is really an array of arrays

13:07 dnolen: jappy123: if you call class on your multidimensional primitive array it'll give you a class string you can use for type hinting.

13:08 TimMc: &(class (into-array [(into-array Integer/TYPE [])])) ;; jappy123

13:08 lazybot: ⇒ [[I

13:08 dnolen: so ^"[[I" will work

13:08 jappy123: perfect TY!

13:08 TimMc: &(.getCanonicalName (into-array [(into-array Integer/TYPE [])]))

13:08 lazybot: java.lang.IllegalArgumentException: No matching field found: getCanonicalName for class [[I

13:08 TimMc: &(.getCanonicalName (class (into-array [(into-array Integer/TYPE [])])))

13:08 lazybot: ⇒ "int[][]"

13:09 TimMc: ^ the "human-readable" version

13:09 duck1123: but you can't type hint with that, can you?

13:10 TimMc: Nah.

13:11 dgrnbrg: Is there a way to get a lazy seq of a string split on a character?

13:13 hyPiRion: what do you mean by split on a character?

13:13 ##(re-seq #"c" "acdcb")

13:13 lazybot: ⇒ ("c" "c")

13:13 hyPiRion: er.

13:14 &(re-seq #"[^c]*" "acdcb") should work

13:14 lazybot: ⇒ ("a" "" "d" "" "b" "")

13:14 hyPiRion: + then. I hate regex.

13:15 &(re-seq #"[^c]+" "acdcb")

13:15 lazybot: ⇒ ("a" "d" "b")

13:16 dgrnbrg: hyPiRion: I see, thanks--I was using clojure.string/split, which is eager

13:32 hyPiRion: Is it possible to destructure a hash set? e.g. (let [[a b] #{:c :d}] do-stuff)

13:39 progo: you could seq it first... But sets have no order so you don't know what you're getting

13:46 mmarczyk: dnolen: ping

13:51 TimMc: dgrnbrg: Do you want empty substrings? e.g. split "accb" on \c

13:52 dnolen: mmarczyk: pong

13:52 mmarczyk: dnolen: hi

13:52 dnolen: I've posted a patch for cljs-255 and will post one for 256 in a moment

13:53 dnolen: if only nil were not counted -- but alas, in Clojure (nth nil whatever) => nil, which looks like a bug, but...

13:54 dnolen: mmarczyk: I'm skeptical about some of the extend-type's around nil

13:54 mmarczyk: dnolen: my gut feeling is that IIndexed should be removed

13:54 dnolen: mmarczyk: I'm not against moving the nil handling into the relevant fns.

13:54 mmarczyk: dnolen: then the linear traversal helper would be used and throw -- correctly, IMO

13:54 dnolen: but that's not how it is in Clojure

13:55 dnolen: alternative solution -- handle nil explicitly in nth with a (when (coercive-not= nil ...) ...)

13:55 dnolen: mmarczyk: that's what I'm suggesting.

13:55 mmarczyk: dnolen: oh right

13:55 dnolen: ok, so I'll do that and 256 will magically go away

13:55 dnolen: mmarczyk: a lot of the extend-types are there for the world prior to a fast satisfies and coercive-not=

13:56 mmarczyk: dnolen: ...and in the present brave new world should retire peacefully :-)

13:56 dnolen: mmarczyk: I think so, it also speeds up nil handling.

13:56 mmarczyk: dnolen: I've been thinking about proto method inlining, btw -- regrettably I'm seriously overloaded this week

13:57 dnolen: mmarczyk: having to go through protocols to handle nil stinks.

13:57 mmarczyk: np

13:57 mmarczyk: dnolen: I've been thinking though

13:57 dnolen: about possibly trasmitting info from satisfies? "upwards" / "outwards"

13:57 dnolen: or onwards, I guess

13:57 dnolen: mmarczyk: well it doesn't stink, it keeps the code cleaner - but you get stuff which doesn't make sense to me - (indexed? nil) => true, (counted? nil ) => true

13:57 mmarczyk: dnolen: so that if we say (satisfies? IFoo bar) in if's test, then the branches know what we found out

13:58 dnolen: precisely

13:59 dnolen: I can live with counted semantically -- the current linear helper for count actually assumes that, though I guess that should change maybe? -- but indexed makes no sense to me

13:59 dnolen: in fact, why is (nth nil 5) nil rather than an error?

13:59 dnolen: (but that's what happens in Clojure too)

14:00 dnolen: mmarczyk: yeah we shouldn't stray from Clojure behavior.

14:01 mmarczyk: re: transmitting satisfies? information. If we're going to handle that I think it should be more deeply integrated in the compiler.

14:01 mmarczyk: dnolen: oh, definitely

14:01 dnolen: mmarczyk: but before we do that we should see if inlining results in any perf win at all.

14:02 mmarczyk: but yes basically with in the true branch we can tag the symbol with whatever protocol it satisfies, and call the protocol method directly.

14:03 mmarczyk: dnolen: would be nice if that information got propagated as far as possible

14:03 rmac: Hi guys, is there a library for handling the security implications of using Clojure as a configuration format, or guides to help out if I want to go down that route ?

14:04 dnolen: mmarczyk: that information could flow in the usual way across binding forms.

14:04 TimMc: rmac: I think just binding *read-eval* to false is sufficient.

14:05 rmac: Or are you looking to have scripting available?

14:05 mmarczyk: dnolen: right

14:05 dnolen: mmarczyk: so 255 ready to go?

14:05 mmarczyk: dnolen: yes

14:05 rmac: TimMc: no, I don't need scripting… to start just read only config

14:05 mmarczyk: dnolen: btw, I don't suppose you'll be going to EuroClojure?

14:06 rmac: TimMc: are there any good examples you would point to ?

14:06 dnolen: mmarczyk: don't think so

14:06 TimMc: rmac: Leiningen's project.clj, sort of.

14:07 mmarczyk: dnolen: ah, that's a shame

14:07 TimMc: defproject is a macro, but you could just allow a map of stuff.

14:07 mmarczyk: dnolen: some other time.

14:08 rmac: TimMc: I saw a presentation recently, about Clojure being used in a bank, they ended up using RDF for config instead due to security worries about the eval possibilities with Clojure config

14:08 eggsby: lol

14:09 hyPiRion: Harr. Is there a lazy equivalent of group-by in Clojure?

14:09 TimMc: rmac: Did they have concerns other than *read-eval*?

14:09 hyPiRion: Turns out that creating two lazy seqs out from a single one is not only messy, but rather hard without looping through the sequence twice.

14:10 ;(

14:10 rmac: TimMc: unsure of the specifics… just a fear generally of 'Turing-complete' protocols and file formats being used for config

14:10 TimMc: ,```````````foo will error out, but that's all I can think of

14:10 dnolen: mmarczyk: sounds like a lot of fun!

14:10 mmarczyk: 255 fixed

14:10 clojurebot: Execution Timed Out

14:10 mmarczyk: dnolen: yes, I'm really looking forward to it :-)

14:11 dnolen: writing commit message for 256 now

14:12 TimMc: hyPiRion: The outer data structure is a map, so you'd have to use a lazy map...

14:14 amalloy: hyperboreean: it's not really possible to do lazily in an eager, immutable language

14:15 mmarczyk: dnolen: patch posted on 256

14:19 dnolen: mmarczyk: applied

14:20 mmarczyk: dnolen: cool

14:29 neotyk: hello everyone!

14:29 hyPiRion: Hello

14:32 neotyk: dnolen: could you look at https://github.com/happyhacking-nl/clojurescript/commit/77521c6a431c1857fc1882b897858b7e48e5ac49 in context of CLJS-204 ?

14:34 dnolen: neotyk: -compareTo -> -compare

14:34 neotyk: also don't use list comprehension

14:34 neotyk: comparison is performance sensitive

14:35 neotyk: if you do that feel free to attach a patch to 204

14:35 neotyk: dnolen: what should I use there then?

14:35 dnolen: neotyk: loop/recur probably

14:35 neotyk: dnolen: ack

14:35 dnolen: neotyk: lazy sequences are insanely slow in CLJS - even when get to chunked seqs they aren't going to beat loop/recur

14:35 neotyk: dnolen: also, should I add all collections to participate in IComparable?

14:36 dnolen: neotyk: I don't know, I haven't look closely at 204, what does Clojure do?

14:36 neotyk: dnolen: it relies on Comparable of Java

14:37 dnolen: neotyk: but for which collections? all of them?

14:37 amalloy: neotyk: i don't think you should; ISeqs aren't comparable in clojure

14:37 mmarczyk: IComparable, great :-)

14:37 amalloy: &(compare (range 3) (range 3))

14:37 lazybot: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Comparable

14:38 mmarczyk: neotyk: maps and sets are not comparable in Clojure

14:38 neotyk: &(compare [1 2] [1 1])

14:38 lazybot: ⇒ 1

14:38 dnolen: &(compare (int-array [1 2]) (int-array [1 1]))

14:38 lazybot: java.lang.ClassCastException: [I cannot be cast to java.lang.Comparable

14:38 neotyk: mmarczyk: so it is vectors only?

14:39 mmarczyk: well, PersistentVectors :-)

14:39 mmarczyk: neotyk: well, symbols and keywords seem to have impls

14:40 amalloy: neotyk: the clojure classes which implement Comparable are: vector, keyword, ref (really?), ratio, and symbol

14:40 mmarczyk: neotyk: so you might want to have a look at those and maybe do sth special for them in the string impl

14:40 neotyk: ref

14:40 amalloy: mmarczyk: nah, string compare will just work in js, won't it?

14:41 neotyk: string is part of IComparable now

14:41 mmarczyk: amalloy: well, not necessarily

14:41 amalloy: neotyk: syms/keys might deal with the namespace part and the name part separately

14:41 dnolen: mmarczyk: we already do garray/defaultCompare

14:41 mmarczyk: so I think all we need is the (satisfies? IComparable ...) test to come before that.

14:42 neotyk: dnolen: it is implemented exactly like that

14:43 mmarczyk: dnolen: sure

14:43 amalloy: mmarczyk: i suppose it could, but (a) the natural string compare is going to do what you probably want anyway, and (b) i think all you really need is any consistent ordering; it doesn't matter much what that ordering is

14:43 dnolen: neotyk: so does garray/defaultCompare do the wrong thing with bool, string, etc?

14:43 mmarczyk: neotyk: looking at your patch now -- did you teach cljs.core/compare to use -compare when possible? I might be missing it

14:43 neotyk: dnolen: not sure, didn't test

14:44 dnolen: neotyk: you should test and possibly remove - garrya/defaultCompare probably has a lot less indirection.

14:44 neotyk: mmarczyk: yes: https://github.com/happyhacking-nl/clojurescript/commit/77521c6a431c1857fc1882b897858b7e48e5ac49#L0R917

14:44 mmarczyk: &(compare 'foo/quux 'foobar/quux)

14:44 lazybot: ⇒ -3

14:45 mmarczyk: -1 in cljs currently

14:45 neotyk: ok, thx!

14:46 amalloy: yeah, I guess so

14:46 amalloy: neotyk: have you thought about the possibility of asymmetric comparisons across types? like (compare true 0) returning 1 and (compare 0 true) also returning something positive?

14:46 neotyk: amalloy: not at all

14:46 mmarczyk: amalloy: unless there's any need for compare to be consistent across platforms, but that's probably impossible anyway (would clash with native compare some places probably?)

14:46 dnolen: amalloy: that's not allowed in CLJS anyway

14:46 amalloy: types must match

14:46 amalloy: dnolen: great

14:47 dnolen: do you happen to know where the code that enforces that is? i'd be interested to take a peek

14:48 dnolen: amalloy: http://github.com/happyhacking-nl/clojurescript/commit/77521c6a431c1857fc1882b897858b7e48e5ac49#L0R919

14:48 goodieboy: what is the cleanest way to turn a map into a list?

14:48 amalloy: &(seq {1 2 3 4})

14:48 lazybot: ⇒ ([1 2] [3 4])

14:48 goodieboy: amalloy: ahh ok, sorry i meant, flattened?

14:49 amalloy: &(apply concat {1 2 3 4})

14:49 lazybot: ⇒ (1 2 3 4)

14:49 neotyk: why in cljs there are cljs and clojure ns?

14:49 goodieboy: amalloy: damn, that's pretty clean. thanks!

14:49 dnolen: neotyk: probably because of namespace masking problem.

14:49 neotyk: top level ns segments can be shadowed by locals.

14:50 mmarczyk: speaking of which, I like my latest idea for a solution to that.

14:51 neotyk: dnolen: I don't quite understand it, is there a gist that exposes this problem?

14:51 amalloy: neotyk: the cond in (defn compare ...) should probably be an if now that you've added that first clause, to avoid calling type twice on each arg

14:52 dnolen: neotyk: it's simple. (ns foo.bar) (defn baz [foo] ... everything in foo now shadowed ...)

14:52 mmarczyk: dnolen: indeed, very clean solution for locals

14:53 dnolen: there's still the issue of top-level names clashing with ns names though

14:53 neotyk: amalloy: (if (types ..) (if (satisfies? ..) .. ()) (cond ..))

14:53 amalloy: ?

14:54 amalloy: yeah, that's what i was aiming for

14:54 dnolen: mmarczyk: ?

14:54 goodieboy: what's the cleanest way to check if something is either true or false?

14:54 mmarczyk: dnolen: that's cljs-180, right?

14:55 jtoy: is this the recommended way to do opts for functions?

14:55 (defn foo

14:55 ([] (foo "bar"))

14:55 ([s] (........)))

14:55 dnolen: mmarczyk: the locals issue yes.

14:55 mmarczyk: not sure I follow about the top-level names clashing with ns names.

14:55 hyPiRion: goodieboy: I think (or (true? a) (false? b)) is okay?

14:55 mmarczyk: dnolen: so yeah, I like the locals solution

14:56 dnolen: I'd also like to prevent foo.bar/quux from clashing with foo.bar.quux

14:56 dnolen: ideally

14:56 hyPiRion: You could eventually do some sort of hackish way, like (some? #(% a) [true? false?])

14:56 *some

14:57 mmarczyk: dnolen: but that is a totally different problem (in particular because it has interop implications)

14:57 goodieboy: hyPiRion: ahh yeah, some works

14:57 dnolen: mmarczyk: not sure I follow, what is foo.bar.quux?

14:57 mmarczyk: dnolen: a namespace

14:57 neotyk: goodieboy: something is always true? or false?

14:57 dnolen: mmarczyk: ah right.

14:58 goodieboy: neotyk: yes, and well, sometimes nil

14:58 but i only care about true or false

14:58 neotyk: $(if nil :a :b)

14:58 #(if nil :a :b)

14:58 amalloy: &(if nil :a :b)

14:58 lazybot: ⇒ :b

14:59 neotyk: goodieboy: like booleans?

14:59 goodieboy: neotyk: exactly

14:59 i guess i was hoping to find bool? or something in core

15:00 neotyk: &(map boolean [nil 1 '() true false])

15:00 lazybot: ⇒ (false true true true false)

15:00 neotyk: nah

15:02 hyPiRion: goodieboy: Actually, more idiomatic would be ##(#{true false} 'foo)

15:02 lazybot: ⇒ nil

15:02 amalloy: hyPiRion: cute, but broken

15:02 hyPiRion: er, nevermind, it will return true or false ;(

15:04 goodieboy: hyPiRion: exactly! using a set was my first thought too

15:05 gfredericks: &(contains? #{true false} 'foo)

15:05 lazybot: ⇒ false

15:05 gfredericks: &(contains? #{true false} false)

15:05 lazybot: ⇒ true

15:05 hyPiRion: gfredericks: good one.

15:05 gfredericks: (def bool? (partial contains? #{true false}))

15:06 goodieboy: gfredericks: contains? thanks!

15:07 mmarczyk: dnolen: do we know top-level names coming from the JS side? "goog", say?

15:12 gfredericks: alse (def bool? (some-fn true? false?))

15:16 dnolen: mmarczyk: we don't, solving real JS problems is a non-goal I think.

15:18 dwierenga: is there a a way to tell lein to load the mysql jdbc driver too? it loads clojure.java.jdbc fine but not the mysql driver

15:19 duck1123: dwierenga: add it to your dependencies

15:19 mmarczyk: dnolen: actually why not just gensym all params? let-bound locals are all gensym'd now and (let [cljs :foo] cljs.core/reduce) works fine

15:20 dnolen: mmarczyk: yucky

15:20 mmarczyk: dnolen: how come?

15:20 dnolen: mmarczyk: I'm only interested in solving inter CLJS clashes

15:20 mmarczyk: we don't care about external libs - users can figure that out for themselves.

15:21 mmarczyk: dnolen: well, caring about them won't make things more complicated here

15:21 dnolen: anyway, fn params are the only type of locals with no gensymming currently

15:21 dwierenga: duck1123: thanks but i'm not sure how. i only got clojure.java.jdbc loaded because of the instructions on the github page

15:21 mmarczyk: dnolen: only munge

15:22 dnolen: mmarczyk: only partly true

15:22 mmarczyk: let doesn't gensym unless you reuse a binding.

15:23 mmarczyk: if we get some robust source mapping support this may be worth pursuing - but not until then.

15:23 mmarczyk: dnolen: actually I just said #(let [asdfasdf :foo] 123) in Rhino

15:23 zakwilson: So from what I'm seeing in this clojure.core blog post, reducers.map is supposed to be parallel. That doesn't seem to be the behavior I observe when I use it on a vector.

15:23 mmarczyk: dnolen: asdfasdf is gensym'd

15:24 xeqi: dwierenga: [mysql/mysql-connector-java "5.1.6"] should work

15:24 amalloy: zakwilson: you need to use a large vector and make sure to call fold

15:24 eg, (fold + (reducers/map inc (vec (range 1e6)))) should start up a bunch of threads

15:25 dwierenga: xeqi: just what i needed, thanks!

15:26 zakwilson: Oh, it only works if you call fold on it? I must admit to some lack of understanding.

15:27 dnolen: mmarczyk: oh yeah, you are right about let.

15:29 zakwilson: How large a collection do I need to see this?

15:29 dnolen: mmarczyk: still I think it wasn't done for a reason - to support existing JS tooling

15:30 amalloy: zakwilson: by default fold splits up into chunks of 512

15:30 (ish)

15:30 so a couple thousand elements would be enough to start a few threads

15:30 zakwilson: I just tried it with 5000 elements and saw only one CPU busy and no speedup over reduce/map

15:30 mmarczyk: dnolen: ?

15:30 dnolen: mmarczyk: if someone decides to use CLJS as a regular old JS lib - they get cljs.core.first(coll_4857) as the signature which is gross.

15:31 mmarczyk: dnolen: well, that someone should use mori :-)

15:31 dnolen: mmarczyk: they'll still get that signature.

15:31 zakwilson: And I do see both cores busy and a speedup using useful/pcollect.

15:31 mmarczyk: dnolen: ah, yeah, I guess

15:32 dnolen: mmarczyk: also any other target will suffer from this problem as well.

15:32 amalloy: zakwilson: i haven't seen any code yet, so i can't really help with "something doesn't work and i don't know why"

15:33 mmarczyk: dnolen: it does work though, it only looks weird

15:33 dnolen: but then

15:33 dnolen: mmarczyk: in Scheme, I'm not sure anyone will want to see (nth coll-4867 i-187 not-found-101)

15:34 mmarczyk: dnolen: I guess the simple answer to my question re: our knowing about goog etc.

15:34 dnolen: is that if someone intends to use a JS lib, they still need a :require

15:34 dnolen: so no reason at all to be worried

15:35 dnolen: or make things ugly

15:35 dnolen: mmarczyk: oh yes that too.

15:36 mmarczyk: dnolen: which means your approach is absolutely the one to take

15:36 dnolen: since we don't even have to gather new info

15:37 zakwilson: amalloy: http://pastebin.com/bw4VgE1t

15:37 amalloy: well uh...repeat and take produce lazy sequences, not reducibles

15:37 seriously, try it on a vector

15:38 zakwilson: Oh. Yes, that's a little better.

15:38 amalloy: (repeat and take *can* produce reducibles, but that's not implemented yet)

15:39 hiredman: "could"

15:39 amalloy: a better word choice, indeed

15:41 (although, reducers/take does exist, and there's already a patch adding repeat)

15:42 mebaran151: hey #clojure, how do I add tool.jar to the classpath in lein2?

15:42 something that I can add to my profile.clj?

15:44 BAWKING: Luyt mabes fmeyer_ duck1123 Lajla mebaran151 inmist mrSpec jimduey tmciver halgari jcromartie wilkes ordnungswidrig1 Wild_Cat mye_ zx80 zxcxzc hanDerPeder daviddpark jwpalmer ystael cafesofie mbriggs dajac elliottw jcrossley3 Licenser h0bbit BeLucid_ jtoy meisterluk bradfordw hiredman aaelony arohner neotyk mprentice zane ilteris_ ambroff devth zamaterian bryancp OlegYch|h sytch thearthur chewbranca phi

15:44 rsch_ iwillig Eldariof-ru rmac rodrigovieira

15:44 * Users on #clojure: jasonbray mishok13 c0rn S11001001 gridaphobe tensorpudding tibbe dreish carllerche perezd Borkdude gtrak` gozala juhu_chapa OwenOu scriptor AimHere jappy123 kumarshantanu brandonz aperiodic dryman cataska_ lazybot lstoll etherdev metajack rmarianski Speed` nrichards mritz jsabeaudry_ ieure ernst strmpnk_ jweiss_ Bronsa rlb cacodaemon zodiak mengu dan`b prip lopex jlf christi

15:44 anberg silven lobotomy rodnaph ggreg ppppaul rhc worrelsik1 cesario__ jodaro

15:44 * Users on #clojure: JorgeB thorwil tbatchelli djue2012 tuubow_ dnolen sorenmacbeth uvtc zuzkins mefesto gsav wkmanire ejackson xeqi jimt artefon DuoSRX jbomo goodieboy achin kovasb kschrader pcavs apwalk gtrak ssedano octagon jayunit100 ConstantineXVI Tristam pandeiro olauzon hhutch dgrnbrg ldopa pelleb nighty- ChiralSym kcin jonaskoelker enebo _KY_ luigy tscheibl jmolet dakrone gary_poster Chi

15:45 ron beffbernard bruges mmarczyk technomancy jhulten cola_zero Sigma Zolrath

15:45 * Users on #clojure: fliebel wookiehangover PeregrinePDX xmux baoist seancorfield hoeck1 timonv konr yacin jamiei puchacz rippy thickey septomin philr vsayer ejlo saint_cypher helgikrs jmatt joegallo bhenry krunaldo Ash WuTangTan ktsuji Killeroid jappinen_ ssideris clojurebot apoc alvis midrangio arnihermann__ creidiki_ dotemacs trescenzi srid_ SeanTAllen tfnico_ si14 Scorchin Crowb4r reiddraper

15:45 zodiak: that's one annoying bot

15:45 BAWKING: voodootikigod beawesomeinstead xrl jltrim_ fukushima FDFlock mikem kingtim

15:45 * Users on #clojure: ipostelnik tncardoso mel0on Blazeix bderooms_ ache Madsy edw wwitb kaoD terom hyPiRion gravity oskarth matessim JoshAshby

15:45 gtrak: BAWKING: what are you doing...

15:45 jtoy: a shitty bot

15:45 enebo: I bawk at bawking!

15:45 zodiak: can you verb his name like that ?

15:45 Bronsa: cool, i'm on #clojure

15:45 BAWKING: * Users on #clojure: ipostelnik tncardoso mel0on Blazeix bderooms_ ache Madsy edw wwitb kaoD terom hyPiRion gravity oskarth matessim JoshAshby calvados EzeQL broquaint nsxt nighty^ ahihi2 TDJACR jetlag dan64 LeNsTR reprisal TakeV cbad jave hyko fooc bobry TimMc jdp_ amro al-ol_ scottj karnowski gfredericks sattvik pushp0p hcastro pipeline ryland winkywooster locojay zaphar_ps LoganLK acagle augu

15:45 stl alek_b algernon rafl scgilardi dnm bweaver EToS wyan anekos xian zaargy

15:45 * Users on #clojure: _ulises muhoo almaisan-away metellus rbranson wink srcerer spjt _janne frankvilhelmsen Gonzih lucian espeed rcj_ serpent213 shajith jeremyheiler bradwright LauJensen brainproxy cmbntr aniero danlarkin mrb_bk mccraig raph_amiard TristamWrk kraft_ tos9 blakesmith joshbohde sramsay ericthorsen henrygarner eno dsantiago yonkeltron pbuckley Yamazaki-kun chouser TheDudeKnows joste

15:45 TimMc: Griefer or n00b, just .ignore it.

15:45 BAWKING: ink altivec drewr progo tvaalen_ katratxo pyykkis Iceland_jack Chousuke

15:45 * Users on #clojure: grim_radical omni5cience austinh hugod groundnuty marmae_ Guest35406 DerGuteMoritz jedi magnars Munksgaard dwierenga ninjudd lancepantz krig ozzloy rcs robink adamspgh @ChanServ geoffeg Raynes brixen djahandarie nlogax maio sjl loomcore_ tcrawley mjhan_ nuba rossabaker nDuff the-kenny boyscared TheBusby webben groot seanm tauntaun gf3 rkz helino zyfo_ nuclearsandwich chipdud

15:45 dreish: Give it a rest, bawking!

15:45 matessim: Wat

15:45 BAWKING: e yason erewhon leathekd beepboop devn mrowe thheller- tlockney zerokarmaleft

15:45 * Users on #clojure: ibdknox Derander_ aravind_ kral|off cfa ivan` _ato amalloy zakwilson Dyresen brweber2_ johnkpaul aking_ replaca_ rdd anthracite wdouglas hive-mind tmarble nickmbailey sirn gmcabrita vandemar hyperboreean ivan\ pyrtsa SHODAN eggsby rmunn dleja bioc tolja kanru pjstadig TheMoonMaster rowth twem2 marchdown jeffrubic raek leafw derrida _tca andrewclegg flashingpumpkin rotty_ noi

15:45 matessim: Who dares ping me

15:45 BAWKING: di_ ajsharp_zz mtd_ ernestas jeekl Anusko jimi_hendrix wtetzner Miko2 fhd

15:45 oskarth: whats up

15:45 BAWKING: * Users on #clojure: geoffeg_c rahcola ivan fmu Cr8 arkx JStoker dougs87 Harbinger jszakmeister AWizzArd rmrfchik Le

15:45 enebo: zodiak: I believe I have license to verb all names! :)

15:45 oskarth: damn it

15:46 :p

15:46 matessim: you just pinged 1,000 angry ronin.

15:46 TheMoonMaster: The fuck is this shit?

15:46 gf3: That was exciting

15:46 Cr8: =/

15:46 uvtc: what's the command to ignore that?

15:46 BAWKING: matessim, 477.

15:46 gf3: /quit

15:46 Bronsa: /ignore BAWKING

15:46 matessim: what the fuck was that shit.

15:46 Luyt: uvtc: Depends on your IRC client.

15:46 enebo: Everyone stop typing he may list all users again :)

15:46 oskarth: he should prolly get a ban unless he has a really good reason for doing that

15:46 TheMoonMaster: I totally couldn't tell who was in this channel

15:46 uvtc: Bronsa. Thanks. Luyt: xchat

15:46 gf3: I think we should give him ops, he clearly knows what he's doing

15:46 amalloy: oskarth: if we had any ops, we could do that

15:47 oskarth: ah, there are no ops at all?

15:47 or just not just available right now

15:47 TimMc: Well, any ops in the channel have now been pinged.

15:47 oskarth: idd

15:47 amalloy: but i think it's basically chouser and rich, who are both not often here and not very active as ops

15:47 oskarth: so, what's the usual routine to deal with annoying people?

15:48 TimMc: oskarth: /ignore, don't talk about them, get ops

15:48 hiredman: /ignore

15:48 /ignore is great

15:48 oskarth: fair enough

15:49 TimMc: mebaran151: Not sure... in Maven, I've seen scope=provided, indicating that it ends up on the classpath somehow...

15:49 oskarth: yeah, but not very efficient for 477 people

15:49 omni5cience: lol, I like how angry that made people

15:49 I just came to see what was up and there was a lot of ranting

15:49 Blazeix: sounds like omni5cience is the creator of the bot :)

15:49 oskarth: omni5cience: a lot of people have ping alerts

15:49 pandeiro: anyone tried to rip the ring handler that compiles cljs to js out of himera and use it?

15:50 omni5cience: oskarth: as do I, I just got all sorts of notifications

15:50 JorgeB: whenever someone pings me I kick a puppy. Don't ping me.

15:50 omni5cience: is it a cute puppy?

15:50 JorgeB: no, ugly puppuy

15:50 puppy*

15:50 Raynes: Any puppy is a cute puppy.

15:50 fliebel: I'm surprised noone is getting pings by SMS

15:50 TimMc: JorgeB: That's an interesting approach, JorgeB.

15:50 the-kenny: I really thought someone wanted to talk to me :-(

15:51 * hiredman gets irc messages over sqs

15:51 * omni5cience gets push notifications

15:51 fliebel: sqs?

15:51 Raynes: the-kenny: http://i3.kym-cdn.com/entries/icons/original/000/003/619/Untitled-1.jpg

15:51 mebaran151: I'm just thinking of setting up swank-cdt

15:51 omni5cience: short query service

15:51 oskarth: I have it hooked up to a huge car horn which wakes me up in case of an emergency

15:51 hiredman: simple queue service

15:51 TimMc: hiredman: Do you also get a few lines of context?

15:51 hiredman: yes

15:51 the-kenny: Raynes: haha :D

15:51 hiredman: I mean, I have the irc log piped in to sqs

15:52 and then a little clojure app that pulls and growls them

15:52 dnolen: source maps are available in Chrome today

15:52 TimMc: dnolen: :-D

15:52 fliebel: hiredman: ... my client just growls them directly. Why the detour?

15:52 the-kenny: dnolen: For Clojurescript? Awesome

15:52 dnolen: TimMc: I don't mean for CLJS :)

15:52 the-kenny: sorry to confuse

15:52 TimMc: D-:

15:52 hiredman: fliebel: I don't run irc locally

15:52 oskarth: hiredman: that's a neat solution, assuming you are sshing into IRC?

15:52 Raynes: halgari: Ohai

15:52 dnolen: I mean we need to get on the ball

15:52 Chrome has source map support now

15:52 hiredman: oskarth: yes

15:53 oskarth: that's a good idea, should try that

15:53 Raynes: halgari: Excellent work on clojure-py. I was playing with it last night. It's super straightforward to get going and use. I'm not very familiar with Python, but I managed to call out to a Python library in just under 30 seconds.

15:53 oskarth: could build in delay and send mail if the message hasn't been received/sent for 24h

15:53 geoffeg_c: has anyone looked into using Web Workers with ClojureScript? I've started playing around with the idea.

15:53 fliebel: Lots of people online now, suddenly.

15:54 omni5cience: fliebel: it happens when you ping everybody in the channel

15:54 fliebel: yea

15:54 hyPiRion: heh.

15:54 * omni5cience thinks maybe this should happen periodically when the channel is quiet

15:54 the-kenny: We should do that more often

15:54 fliebel: How do you un-ignore a bot? :P

15:54 pandeiro: this happened in #Node.js few months ago, same thing happened

15:56 oskarth: ha

15:56 fliebel: Maybe it should be smarter, so that it ping selectively, based on some NLP baysian blabla.

15:56 oskarth: some channels have a not-talking-for-x-period-of-time filter, then you get kicked out

15:57 pandeiro: fliebel: i think that would be over-optimization

15:57 oskarth: I imagine a lot of people in here have a irssi client running on some server somewhere

15:57 the-kenny: dnolen: I like this approach for notifications. Is the little Clojure application open source?

15:57 dnolen: ew sorry.

15:57 hiredman: I like this approach for notifications. Is the little Clojure application open source?

15:58 notNicolas: Any recommended style guides? I'm not used to lisp style syntax

15:59 amalloy: $google scheme mumble style guide

15:59 lazybot: [lisp style guide - It works!] http://mumble.net/~campbell/scheme/style.txt

15:59 notNicolas: hmm kind of long but alright. Thanks!

15:59 omni5cience: oskarth: I have ZNC running on a server and irssi running locally :P

16:00 oskarth: :p

16:04 Raynes: notNicolas: Not all of it is entirely relevant, but it is generally sound. You could also get by with looking at popular well written code.

16:05 nDuff: Hmm; I'm doing something wrong with destructuring. ((fn [{:keys [foo bar]} & args] [foo bar]) :foo 1 :bar 2) is returning [nil nil], where I'd expect [1 2]

16:06 Raynes: You're destructuring the first argument to the function.

16:06 Not the whole input.

16:06 You want to destructure & args or pass an actual map.

16:07 nDuff: Ahh.

16:07 * nDuff moves the & to the beginning of the list, and all is well

16:07 nDuff: graci

16:07 Raynes: &((fn [& {:keys [foo bar]}] [foo bar]) :foo 1 :bar 2)

16:07 lazybot: ⇒ [1 2]

16:08 pandeiro: is there a simple way i could see a diff between cljs-1211 cljs-1011?

16:10 hiredman: git diff?

16:10 michaelr`: hey

16:11 dnolen: pandeiro: http://github.com/clojure/clojurescript/compare/r1011...r1211

16:11 pandeiro: pretty massive set of changes.

16:11 pandeiro: dnolen: himera breaks between the two, trying to debug

16:12 dnolen: pandeiro: any specific error you're seeing?

16:12 pandeiro: cljs.compiler/emits isn't emitting anything

16:13 dnolen: pandeiro: oh Himera probably does some custom emission - the old what doesn't work anymore

16:14 pandeiro: has a custom expander, that could be it?

16:14 dnolen: pandeiro: you need to use emit-str now

16:14 cljs.compiler/emit-str

16:15 pandeiro: it takes an analyzed expression

16:15 pandeiro: cool i will swap them out and see, thanks

16:23 michaelr`: is there a way to make clojure more verbose about what it's doing right now? I removed (:class-gen) and the :main reference in project.clj and now I use (use :reload-all 'paz.server) from the repl and it's still taking minutes to load (5-7), it seems just wrong

16:24 amalloy: ,(apropos "verbose")

16:24 clojurebot: (*verbose-defrecords*)

16:24 hiredman: ^- heh

16:24 amalloy: i thought there was a verbose-loading flag or something. is that private to clojure.core, maybe?

16:24 hiredman: there is :verbose flag you can pass to require and use

16:25 amalloy: it is not, just not documented

16:25 michaelr`: but I imagine the problem is sloppiness on your part

16:28 michaelr`: hiredman: probably it's on my side i'm just looking for the right path to debug it

16:30 pandeiro: how does the cljs repl eval more than one form at a time?

16:30 i notice that read-string does not work with a string of more than one form

16:33 dnolen: pandeiro: cljs repl uses Clojure reader not the CLJS one

16:41 mccraig: what's the canonical way of ensuring that a (atom | vector) is/becomes a vector ?

16:41 * mccraig is suffering brain fail

16:42 rlb: mccraig: you mean you have something that might be an atom or a vector?

16:42 ivan: nDuff: you can open a file with a share mode that includes FILE_SHARE_DELETE and you'll be able to delete it; too bad most things don't support it/do it

16:43 I don't think you can reach it through the POSIX open() that everyone likes to use

16:44 mccraig: rlb: yeah, and if it's an atom, i want to make it into a vector

16:45 rlb: (if (vector? x) x (atom x))

16:45 pandeiro: i would do (or (and (atom? atom-or-vec) @atom-or-vec) atom-or-vec)

16:45 rlb: of if you need to test for atom (may be a better way): (instance? java.lang.Atom x)

16:45 pandeiro: didn't see atom?

16:46 pandeiro: i'm assuming there's an atom? function :)

16:46 there's not?

16:46 rlb: pandeiro: not by default, at least not here.

16:46 pandeiro: yeah, not here either

16:47 but it can't be too hard to create a predicate like that, right?

16:47 rlb: mccraig: ignore what I said first -- by "make it a vector", make what a vector?

16:47 mccraig: the atom, or the content of the atom?

16:47 yoklov: like (if (vector? x) (vector x) x) ?

16:48 rlb: i.e. if the latter -- (if (vector? x) x [@x])

16:48 yoklov: oh right

16:48 michaelr`: haha

16:48 mccraig: agh. i don't mean atom. more brainfail :)

16:48 yoklov: that was totally backwards

16:48 michaelr`: problem solved!

16:48 i just upgraded noir to the latest version

16:48 was beta 3 not beta 7

16:49 it got lost somewhere while loading my views

16:49 s/not/now

16:50 mccraig: rlb: i was meaning atom in the cl sense, i.e. not a sequential?

16:50 what i want is the equivalent of the ruby: [*scalar_or_vector]

16:52 rlb: would (if (coll? x) x [x]) do something suitable?

16:52 i.e. does it have to result in a vector?

16:52 mccraig: yeah, that would work.. i was looking for something more elegant :)

16:52 rlb: that will put anything that's not a collection into a vector...

16:52 (which might or might not be OK)

16:53 mccraig: just curious -- what's the use case (wondering what that's normally used for in ruby, for example)?

16:54 mccraig: in this case, incanter gives me a scalar when i select a single column from a row of a matrix, but a vector when i select a range of columns… what i actually want is a vector in both cases

16:54 S11001001: mccraig: and having special language-level syntax just for that operation is particularly elegant?

16:56 mccraig: S11001001: that same syntax is used for apply in ruby, which is pretty general-purpose, so yeah it is quite elegant

16:57 S11001001: tho ruby has many counter-examples of ugliness

16:58 S11001001: the division between scalar and non-scalar is not clear enough in either language to fix one definition at the language level

16:58 it just happens that ruby did it anyway

16:59 muhoo: happy :-) https://www.refheap.com/paste/2739

16:59 yoklov: it's a fairly common lisp idiom afaik, i'm actually surprised clojure doesn't give you something like that

16:59 S11001001: among your choices are seq?, coll?, sequential?, and seqable? from core.incubator

17:00 ordnungswidrig1: muhoo: nice

17:00 S11001001: and if ruby's apply just interprets a scalar as a list of one element, for some arbitrary meaning of scalar among the several that make sense in ruby, that's not good design

17:01 yoklov: something like (defn ensure-seq [x] (if (seq? x) x (list x))) has been somewhat common in my scheme code, and I've heard of lispers using it

17:02 S11001001: aye

17:04 pandeiro: does lein cljsbuild know by default to look for cljs libs in lib/ if a specific :source-path is defined, or would lib/ have to be included there too?

17:05 srid``: avout seems quite buggy. sometimes the refs/atoms get reset to nil. tried with the mongo adapter, made no difference.

17:05 dnolen: pandeiro: cljsbuild looks for files on the classpath

17:08 pandeiro: surprised that the himera repl.cljs 75-line file is taking 65 seconds to compile with lein cljsbuild

17:13 muhoo: ordnungswidrig1: thanks. that little function took me 8+ hours to write. clojure makes me work very, very hard, but i strangely enjoy it.

17:13 wkmanire: muhoo: one function 8 hours?

17:13 WHat am I getting myself into.

17:15 dnolen: pandeiro: sounds suspect

17:15 Raynes: wkmanire: You can do in 8 hours in one function in Clojure what you can do in 8 hours and 47 classes, 50 files, and 1800 compile -> run cycles in Java.

17:16 muhoo: wkmanire: what Raynes said :-)

17:16 wkmanire: I'm assuming that functon ended up terse as well right?

17:16 From the little bit of clojure I've written I'm just shocked by how terse it is.

17:16 So much implied functionality.

17:17 muhoo: i'm addicted to the damn thing. i suspect it may ruin me, but i don't care.

17:18 TimMc: muhoo: It won't ruin you so much as it will ruin other languages for you.

17:19 muhoo: wkmanire: actually, here is what i'm coming to realize. i'm getting old. i have carpal tunnel issues and vision issues. i simply CANNOT sit here typing 47 classes 50 files and 1800 compiles. i have to be able to do more with less typing, and more thinking. it's almost a health imperative.

17:19 TimMc: Might be the same thing, employability-wise.

17:21 muhoo: TimMc: so far, i've been pretty lucky. just completed a nice sized web app job in clojure for a customer, he didn't care what it was written in. and, looks like there are plenty of clojure jobs for those interested in FT work too.

17:27 zoldar: muhoo: can you tell the url of that web app? :)

17:28 TimMc: muhoo: "FT" == full-time?

17:29 muhoo: zoldar: it's an intranet thing, nothing to see without login

17:29 TimMc: ya.

17:29 tmciver: muhoo: FT work?

17:30 muhoo: tmciver: FT => full time, PT => part time, etc

17:30 wkmanire: muhoo: I know what you mean about having to deal with mountains of seperate class files.

17:30 After spending a while working in Python I find the one file one class paradigm to be laughable.

17:31 muhoo: actually that was raynes's witticism about the explosion of class files in oop languages. and it's true :-)

17:31 tmciver: muhoo: ha! I was thinking Functional something.

17:31 muhoo: FT FP

17:32 TimMc: the dream

17:33 muhoo: dream? i dunno, i saw quite a few booths at clojurewest that said "we're hiring".

17:33 TimMc: Dreams can be achievable. :-P

17:42 alex_baranosky: FT FP :)

17:42 the reality :)

17:43 muhoo: alex_baranosky: runa was one of those, yes.

17:52 jimt: virsh uri

18:04 yoklov: has anybody ported propagators network to clojure? the amount of state that seems necessary is… daunting.

18:04 (http://groups.csail.mit.edu/mac/users/gjs/propagators/)

18:07 dnolen: yoklov: I messed around with it in Scheme a bit, their approach seemed very slow.

18:08 yoklov: at the least constraint portion is better done via cKanren approach as far as I can tell.

18:08 yoklov: dnolen: yeah, i part of the speed issues come from using lists for sets/associations

18:09 *i think

18:09 dnolen: yoklov: I know cemerick tried something with atoms - also was not particularly fast - but not sure what the bottleneck was there.

18:09 yoklov: Hm, that's interesting

18:09 dnolen: yoklov: maybe, it creates a network of propagators - there's a lot of overhead pushing changes around.

18:10 yoklov: yeah, maybe it's just not a particularly fast model of computation.

18:10 dnolen: yoklov: cKanren is lazier in it's approach to updating constraints

18:10 yoklov: not until it's extremely parallel

18:10 until/unless

18:10 dnolen: yoklov: yeah probably.

18:11 yoklov: in any case The Art of Propagator rocks - nice approachable intro to this stuff.

18:11 kind of like a SICP Chapter 4.5

18:13 yoklov: Right, I've read through that and Alexey's dissertation on the subject, and started trying to port some of the code to clojure when I became a bit overwhelmed with it

18:13 any object having an arbitrary number of stateful fields determined at runtime is… daunting

18:14 It's fascinating stuff though, not sure if it's strictly useful but it's really neat.

18:17 Hadn't ever thought of it like sicp chapter 4.5, but it does sort of read like that now that you mention it.

18:17 dnolen: yoklov: again I recommend reading the William Byrd Dissertation + cKanren paper for very, very functional approach to constraint programming.

18:18 similar results - not stateful.

18:18 yoklov: Interesting, will do.

18:28 gtrak: is there a way I can get lein to ignore the ~/.m2/settings.xml?

18:30 amalloy: rm ~/.m2/settings.xml

18:34 jaen: Hey, could you please kindly tell me what shall I do if I wanted to expose a defrecorded record for Java to use?

18:36 brehaut: jaen: i'm guessing here, but i think you need to do AOT export if you want it accessible from a jar without calling clojure at all

18:36 s/export/compile/

18:36 technomancy: gtrak: upgrade to lein2 =)

18:36 brehaut: jaen: you can probably also call in via the clojure runtime and require the namespace that defines the record

18:37 gtrak: technomancy: can i use two versions of lein concurrently?

18:38 technomancy: gtrak: definitely

18:38 clojurebot: leiningen upgrade guide

18:38 clojurebot: leiningen is always the easiest way

18:38 technomancy: well yes, but

18:38 clojurebot: google: leiningen upgrade guide

18:38 clojurebot: upgrading to leiningen 2 is easy with this handy upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading

18:38 jaen: brehaut: mhmm

18:38 gtrak: would I just use 2 different lein scripts?

18:39 i have some projects that require an older version

18:39 technomancy: gtrak: sure; lein and lein2 if you like

18:39 gtrak: awesome

18:40 testclj: gtrak

18:40 is testing irc from clojure

19:03 srid``: why would anyone use `atom` in clojurescript?

19:05 nDuff: Ahh! Someone was asking the other day about a non-JNI-based mechanism for getting notifications about external files changing? That's a JDK 7 thing, java.nio.file.WatchService

19:06 technomancy: nDuff: cool

19:06 pipeline: so the inevitable question

19:06 how is that service implemented on your target platform

19:07 is it gonna sit and spin if you don't have inotify on linux or what

19:07 nDuff: pipeline: hasn't been a Linux without inotify or dnotify or FAM for ages

19:07 pipeline: well that is a perfect example

19:07 a lot of shit you would use inotify for would be poison with dnotify or fam

19:07 and what happens e.g. on windows, sosx

19:08 nDuff: both of those have equivalents

19:08 pipeline: having a non-jni solution makes it easier but it is not the end of the line

19:08 nDuff: it'd only be older *nix systems where I'd expect having an efficient API to be in question at all.

19:12 pipeline: ...that said, the API allows a FileSystem to simply assert that it doesn't have the interface available by throwing an UnsupportedOperationException, so it doesn't look like it'll fall back to polling under any circumstances.

19:13 pipeline: nDuff: that is an awesome api

19:13 * nDuff 's sarcasm detector doesn't work over text-only channels.

19:28 pipeline: nDuff: I was not being sarcastic

19:28 nDuff: it is way better to barf an exception than to have performance vary by 3 orders of magnitude and just not work right

19:32 technomancy: still you should be able to fall back to polling if you explicitly want it

19:34 frozenlock: Is there ways to use clojure Noir with ssl? (Sandbar perhaps?)

19:44 startling: hi, does clojure have something like haskell's "init"? I want everything but the last element of a list; basically the opposite of "last"

19:44 hyPiRion: butlast?

19:45 ,(butlast [1 2 3])

19:45 clojurebot: (1 2)

19:45 startling: that's it. thanks!

19:45 hyPiRion: you're welcome :)

19:46 nDuff: startling: ...that said, efficiency on that depends on what type you're using it with

19:46 startling: nDuff, yep. it's bad for linked lists, good for vectors

19:47 nDuff, just looking for a nice way to write `reverse` in the clojure koans

19:47 * nDuff wonders about the benefits of (butlast [1 2 3]) over (pop [1 2 3])

19:47 hyPiRion: butlast works for lists, pop works for vectors.

19:47 brehaut: i suspect its basically identical for vectors and lists

19:47 nDuff: pop also works for lists or queues

19:48 ...but returns an object of the same type, as opposed to a sequence

19:48 brehaut: pop works for anything that implements IPersistentStack

19:48 hyPiRion: Well, pop != butlast in a sense, as popping a list removes the first element, while popping a vector removes the last.

19:49 kaoD: hyPiRion: is right

19:49 I had quite a headache with that :P

19:49 nDuff: ...right; pop being more of an inverse to conj

19:50 brehaut: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L626-630

19:50 * nDuff is a little surprised that (let [start [1 2 3]] (identical? start (pop (conj start 4)))) returns false

19:51 startling: hm, you can't recur modulo cons?

19:51 hyPiRion: startling: What do you mean?

19:51 brehaut: nDuff: pop isnt necessarily the inverser of conj. on a queue for instances they work at opposite ends

19:53 nDuff: identical? != equal

19:53 nDuff: brehaut: *nod*, but being persistent structures...

19:53 brehaut: nDuff: identical? tests if two references are to the same _object_. ie its areference test, not a value test

19:53 nDuff: brehaut: yes, I know that. I expected structural sharing to result in it being actually the same object in that case.

19:53 startling: hyPiRion: in some languages, there's a thing called "tail call modulo cons", which lets you what would be (defn x [seq] (cons (1) (recur (rest seq)))) in clojure

19:54 (efficiently)

19:54 brehaut: nDuff: it doesnt go back and look at the historical, discarded structures and pull it back, it builds a new one preserving as much as it can of the old

19:55 startling: but clojure tells me "Can only recur from tail position"

19:55 hyPiRion: startling: Ah. I just wrap a loop around such cases.

19:55 frozenlock: ibdknox: I'm sure you are already over your head with light-table, but do you have any ssl example for Noir you could point me to?

19:55 brehaut: nDuff: removing and reattaching the same object from an (internally) tree shaped collection can result in a different internal shape with the same value

19:56 nDuff: brehaut: Didn't expect it to look at historical structures. Was thinking of something more akin to a list implementation wherein the prior version would be included in the new one. On thinking it about it a bit more, I should have known that vectors didn't work that way.

19:56 *nod*.

19:56 startling: hyPiRion, sure.

19:56 hyPiRion: It's not pretty, but it gets the job done.

19:56 startling: I'm doing the clojure koans, though, and it wants me to write a recursive reverse. :/

19:57 hyPiRion: recursive != tail-call optimized ;)

19:57 brehaut: nDuff: if doesnt work for lists either

19:57 ,(let [s (list 1 2 3)] (identical? (cons 1 (rest s)) s))

19:57 clojurebot: false

19:57 startling: hyPiRion, I get a stack overflow if i do it naively. :S

19:58 hyPiRion: hm.

19:58 brehaut: oh, wrong expression

19:58 nDuff: ,(let [start '(1 2 3)] (identical? start (pop (conj start 4))))

19:58 clojurebot: true

19:58 brehaut: ,(let [s (list 1 2 3)] (identical? (conj (rest s) 1) s)) ; pedantic clarification

19:58 clojurebot: false

19:58 startling: is there a thing like haskell's "flip"? takes a function and returns a function that takes the arguments in the opposite order

19:59 kaoD: nDuff: I was going to point that out

19:59 brehaut: obviously the tail remains identical, but thats not the same thing as getting an identical list when you conj the same value onto the front of it

20:00 kaoD: startling: probably you can do it with #(reverse %&)

20:00 &( #(reverse %&) 1 2 3 4 )

20:00 lazybot: ⇒ (4 3 2 1)

20:00 startling: kaoD: heh, the point is to write a recursive reverse function, though

20:00 ah well, i'll just ignore it

20:00 kaoD: startling: if you're talking about 4clojure... it has no point

20:01 startling: kaoD: clojure koans, actually

20:01 kaoD: still, I like abusing the rules :P

20:01 startling: kaoD, yeah, there are quite a few (= "Hello world" "Hello world")s in my solutions

20:02 hyPiRion: startling: (defn rev [c] (if (nil? c) nil (concat (rev (next c)) [(first c)])))

20:02 brehaut: my favorite recursive reverse is (partial reduce conj ())

20:02 startling: ooh, that works

20:02 I was going to do (reduce (flip (partial cons)) '()) but clojure doesn't have flip. :(

20:02 PeregrinePDX: That is I believe the implementation of reverse in clojure.core

20:03 brehaut: hah it is too

20:03 kaoD: brehaut: how is that recursive?

20:03 brehaut: kaoD: reduce is the primative recursive operation

20:03 kaoD: ah

20:03 hyPiRion: kaoD: reduce is recursive?

20:03 brehaut: kaoD: its not _explicitly recursive_

20:03 kaoD: I thought it wasn't recursive

20:03 I thought reduce used loop under the hood

20:03 brehaut: it doesnt matter how its implemented, its mathematically a recursive operation

20:03 startling: kaoD, doesn't clojure use a stack machine under the hood?

20:04 kaoD, if so, *nothing* in clojure would be recursive

20:04 kaoD: brehaut: oh, mathematically

20:04 startling: stack machine = has recursion

20:04 I mean

20:05 ok, I get your point

20:05 btw, my personal favorite is

20:05 &(into () '(1 2 3 4 5 6))

20:05 lazybot: ⇒ (6 5 4 3 2 1)

20:05 brehaut: thats quite a nice variant

20:05 startling: what does into do?

20:06 kaoD: I think it basically does (partial reduce conj ())

20:06 brehaut: it calls conj on the initial argument for all the values in the seq

20:06 kaoD: under the hood

20:06 startling: ah

20:06 brehaut: kaoD: yes. the only detail is that it uses transients for performance

20:06 startling: conj is cons flipped?

20:06 brehaut: (when it can)

20:07 kaoD: startling: nope, conj is... conj

20:07 brehaut: conj is polymorphic cons with the arguments flipped

20:07 startling: brehaut: got it, thanks

20:07 brehaut: its also a varargs cons

20:07 startling: huh, how does that work?

20:07 brehaut: ,(conj [] 1 2 3)

20:07 clojurebot: [1 2 3]

20:08 startling: oh, neat

20:08 brehaut: ,((partial apply conj ()) [1 2 3 4])

20:08 clojurebot: (4 3 2 1)

20:08 startling: heh

20:09 brehaut: (its short for 'conjoin' incidentally)

20:09 startling: is (reduce (partial +) ...) the best way to do that?

20:09 kaoD: startling: bear in mind this

20:09 brehaut: (apply + …)

20:09 kaoD: ,(conj () 1 2 3)

20:09 clojurebot: (3 2 1)

20:09 startling: kaoD, yeah?

20:09 brehaut: oooh

20:09 brehaut: startling: where functions provide a vararg form that would do what a reduce with the binary form would do (eg, +) its better to use the vararg version

20:10 kaoD: ,(= (conj [] 1 2 3) (conj () 1 2 3))

20:10 clojurebot: false

20:10 startling: brehaut: yeah, i'm used to haskell

20:10 kaoD: startling: you don't need partial +

20:10 hyPiRion: I like to think of conj as the fastest way of adding an element to a collection. For a vector, that is naturally at the end, and for a (linked) list, that is naturally at the beginning.

20:10 startling: brehaut: so varargs in functional languages are weird for me

20:10 hyPiRion: cons is just at the front, no matter what.

20:10 brehaut: startling: there are varargs in haskell (sort of)

20:10 kaoD: you only need partial if you're partially applying it

20:10 startling: brehaut: yeah, sort of. but not for (+)

20:11 brehaut: no, not for plus

20:11 kaoD: it's not about plus

20:11 it's about partially applying

20:11 brehaut: startling: + is also convenient here because it has a nice identity

20:11 ,(+)

20:11 clojurebot: 0

20:11 kaoD: ,(map (partial + 2) [1 2 3 4])

20:11 clojurebot: (3 4 5 6)

20:11 startling: kaoD, okay?

20:11 kaoD: ,(map + [1 2 3 4])

20:11 clojurebot: (1 2 3 4)

20:11 kaoD: see what I mean?

20:11 brehaut: my god, didn't know about + identity

20:12 startling: yeah, that's pretty cool

20:12 brehaut: * has it too, but not - or /

20:12 kaoD: for / makes sense

20:12 but for - ?

20:12 ,(-)

20:12 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$->

20:13 brehaut: i saw the argument for why somewhere on the internet the other day, but i cant recall where

20:13 perhaps rhickey's reducers blog post?

20:13 yes http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html

20:14 hmm or maybe not

20:14 kaoD: btw, I had some trouble implementing chain of responsibility while trying not to reinvent the wheel

20:14 it ended up looking a lot like monads

20:14 am I doing it wrong or should I just use monads?

20:14 startling: hm, clojure has pattern-matching for variable arguments but not for values?

20:14 kaoD: chain of responsibility with event consuming

20:15 startling: it has no pattern matching

20:15 brehaut: clojure doesnt have pattern matching in core, it only has destructuring

20:15 pattern matching is in core.match and last i heard (a while ago) not quite ready for prime time

20:15 kaoD: which makes me sad :(

20:16 startling: kaoD, (defn length ([] 0) ([a] 1)) is what i meant by "pattern matching for variable arguments", i guess

20:16 brehaut: ,(destructure ['[a b] [1 2 3]])

20:16 clojurebot: [vec__237 [1 2 3] a (clojure.core/nth vec__237 0 nil) b ...]

20:16 kaoD: startling: then it's overloading by arity

20:16 not pattern matching

20:16 brehaut: destructuring doesnt take the value into account at all, its just convenient access

20:16 startling: kaoD: ah

20:17 brehaut: (destructure ['[a b] 1])

20:17 ,(destructure ['[a b] 1])

20:17 clojurebot: [vec__264 1 a (clojure.core/nth vec__264 0 nil) b ...]

20:17 brehaut: you can see that that is going to fail, but it will generate the code for you anyway

20:17 kaoD: that's quite an ugly representation

20:17 brehaut: thats just internals with gensym for use in macros

20:18 xeqi: kaoD: chain of responsability sounds alot like ring middleware

20:18 when I read it on wikipedia

20:18 brehaut: if you want to see what pattern matching currently looks like in clojure: https://github.com/clojure/core.match/

20:19 kaoD: xeqi: yup, it's pretty much it

20:19 in fact I want it for a middleware-like thing

20:21 xeqi: in fact I want something like that but I also want stop conditions

20:21 i.e. consuming events

20:21 (which IIRC ring's middleware cant)

20:22 that's where complexity begins and my conde starts looking like ugly-monads

20:22 *code

20:22 brehaut: kaoD: what do you mean by stop conditions?

20:22 you want to be able to block the next handler in the chain?

20:23 kaoD: and therefore, blocking all the rest

20:23 consuming the event, that is

20:24 xeqi: you can block the next handler by just not passing it down

20:25 which is basically what the last handler, usually the app does

20:25 kaoD: xeqi: it's probably done using reduce

20:25 or equivalent

20:25 which I shouldn't use because I might want to consume it BEFORE the end

20:25 so I ended up using loop-recur + stop condition

20:26 but it's not very extensible without heavy tweaking of code and added complexity

20:26 which made my code look very similar to monads

20:26 brehaut: well then, go use monads :P

20:26 kaoD: I heard clojure.monads is very inefficent

20:27 brehaut: yes and no

20:27 it does a lot of static compilation to minimise the function call overhead

20:27 its definately not going to be as efficient as hand optimised code (eg core.logic vs a logic monad)

20:28 but its the same amount of overhead as a monad in haskell that doesnt have the advantage of fusion or other rewriting rules

20:28 kaoD: I see

20:28 I should give it a try then, thanks

20:28 brehaut: its also clojure.algo.monads btw

20:29 kaoD: yup

20:31 brehaut: kaoD: its worth having a look at the imp of algo.monads and tools.macro to see how symbol-macros are used to eliminate some of the indirection and dynamic lookups you might expect to be there

20:32 kaoD: I'm afraid I'm just another victim of premature optimization

20:32 brehaut: haha probably

20:32 kaoD: I'd better leave it like it is until I really need to tweak :P

20:33 hyPiRion: While talking about monads, does anyone have a good clojure-introduction to monads for complete beginners on the topic?

20:34 brehaut: hyPiRion: clojure.net

20:34 all of it

20:34 kaoD: hyPiRion: I learn them in clojure.algo.monads git repo

20:35 it has several links

20:35 (one to onclojure IIRC)

20:36 it can get very technical but I found it amusing

20:36 and the technical chitty-chat is actually justified

20:38 hyPiRion: kaoD: Ah, thank you.

20:43 * gfredericks is battling a password creation form

20:44 kaoD: gfredericks: what do you mean password creation?

20:44 gfredericks: choosing a password when creating an account on a site

20:44 kaoD: and what are you battling with?

20:44 gfredericks: the validation rules

20:45 kaoD: just warn, no matter how long or convoluted the password is

20:45 gfredericks: kaoD: no this is not my site

20:45 I'm trying to create an account and it doesn't like my password

20:45 kaoD: oh

20:45 I see

20:45 then they applied the method I described

20:46 it's pretty common

20:46 gfredericks: just warning?

20:46 kaoD: it depends

20:46 if they really want to annoy you

20:46 it's like sites which need usernames length >5

20:46 I'm fucking kaoD

20:46 mittchel: Hm guys

20:46 kaoD: 4 characters

20:46 why would you make me be something else!?!?

20:46 mittchel: ,((fn [x y] (nil?(get y x nil))){:a nil :b 2} :c)

20:46 clojurebot: true

20:47 mittchel: Why does that give true? It shouldn't find C so give back nil

20:47 Nevermind

20:47 dumbest question ever.

20:47 kaoD: ,(get :c {:a nil :b 2} nil)

20:47 clojurebot: nil

20:47 mittchel: I know what happends

20:47 kaoD: ,(nil? nil)

20:47 clojurebot: true

20:47 kaoD: :P

20:47 mittchel: it doesn't find C so it replaces it with nil. and (nil? nil) returns true

20:47 lol:D

20:48 gfredericks: ,(-> nil nil? true? false? false?)

20:48 clojurebot: true

20:48 PeregrinePDX: This is why I save those kind of questions for a pm

20:48 then only 1 person knows I'm an idiot

20:48 mittchel: haha

20:49 technomancy: has anyone tried JDK7 and had to stick with JDK6 for whatever reason?

20:49 kaoD: technomancy: yes I did

20:49 technomancy: kaoD: oh? what happened?

20:49 kaoD: well, actually hacked my way around JDK7

20:49 Android -> key generation went wrong

20:49 apparently the algorithm changed so my keys were rejected when installing

20:49 also Google AppEngine + GWT

20:49 technomancy: huh.

20:50 kaoD: refused to work

20:50 because...

20:50 something

20:50 :P

20:50 technomancy: what about in a deployed production environment?

20:50 kaoD: no idea there

20:51 gfredericks: usernames can have curly braces but passwords have to be alphanumeric??

20:51 lazybot: gfredericks: What are you, crazy? Of course not!

20:51 gfredericks: and tildes

20:51 kaoD: hahaha

20:51 lazybot: is always right no matter what

20:51 right, lazybot ???

20:51 lazybot: kaoD: Yes, 100% for sure.

20:56 mittchel: Guys

20:56 rem takes 2 numbers and returns the difference between them right

20:56 so lets say

20:56 10 9 = 1

20:57 tmciver: mittchel: nope, remainder

20:57 after division

20:57 mittchel: ah

20:57 kaoD: not to be confused with modulo

20:57 startling: ,(rem 20 9(

20:57 ,(rem 20 9)

20:57 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

20:57 2

20:57 kaoD: &(mod -10 3)

20:57 mittchel: aAlright:D

20:58 kaoD: &(rem -10 3)

20:58 okay, lazybot is having a nap

20:58 ,(mod -10 3)

20:58 clojurebot: 2

20:58 kaoD: ,(rem -10 3)

20:58 clojurebot: -1

21:00 mittchel: Hm

21:00 but could you explain 1 thing for me

21:00 (for [x (range 40)

21:00 :when (= 1 (rem x 4))]

21:00 x))

21:00 this result sin: 1 5 9 13 17 etc.

21:00 but when x = 1, it does: (rem 1 4)

21:00 which is 1

21:00 so thats ok, but when x = 2 you have

21:00 2

21:01 so why isn't 2 displayed?

21:01 kaoD: lol nope

21:01 gfredericks: because 2 is not 1

21:01 kaoD: :when

21:01 :when = 1

21:01 when remainder is 1

21:01 mittchel: oh my god

21:01 kaoD: ,(rem 1 4)

21:01 clojurebot: 1

21:01 kaoD: ,(rem 5 4)

21:01 clojurebot: 1

21:01 gfredericks: &(for [x (range 40)] (rem x 4))

21:01 lazybot: ⇒ (0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3)

21:01 kaoD: ,(rem 9 4)

21:01 clojurebot: 1

21:01 mittchel: oh my gosh

21:01 I got it lol

21:02 ,(rem 37 4)

21:02 clojurebot: 1

21:02 mittchel: So every remainder that is 1 for x, x will be shown

21:02 lol

21:02 It's late for me so excuse me haha

21:03 gfredericks: &(-> 50000 range count)

21:03 lazybot: ⇒ 50000

21:03 * gfredericks likes making lazybot run laps

21:04 hyPiRion: That's mean.

21:04 gfredericks: &(->> 50000 range reverse count range (reduce +))

21:04 lazybot: ⇒ 1249975000

21:04 hyPiRion: &(-> 1e7 range count)

21:04 mittchel: haha

21:04 lazybot: ⇒ 10000000

21:04 mittchel: ,(if 0 1 0)

21:04 clojurebot: 1

21:04 mittchel: why does that give me 1

21:05 gfredericks: 0 is truthy

21:05 mittchel: cause if 0 is always true?

21:05 metellus: only alse and nil are true

21:05 gfredericks: false

21:05 mittchel: oh ok:D

21:05 metellus: yeah, that

21:05 both times I wanted to say "false" I messed up

21:05 gfredericks: double meaning. I was correcting your typo and contradicting you

21:06 septomin: false: false is false

21:06 mittchel: haha

21:06 gfredericks: only alse and fil are trouble

21:07 hyPiRion: septomin: Well, that's confusing. ##(-> false false? false?)

21:07 lazybot: ⇒ false

21:07 septomin: malkovich

21:08 gfredericks: (-> false false? (= (false? false)))

21:08 &(-> false false? (= (false? false)))

21:08 lazybot: ⇒ true

21:14 amalloy: kaoD: lazybot would pay more attention to you if you stopped putting spaces before his &s

21:15 alex_baranosky: just have to say that clojure.string/split behaves weirdly when splitting ""

21:16 I'd expect an empty seq to be returned, not [""]

21:17 kaoD: amalloy: lol, I copypasted and didn't even notice

21:19 alex_baranosky: anyone else see that behavior in clojure.string/split, and think it was odd?

21:21 * hiredman only ever uses clojure.string/join

21:23 amalloy: that behavior is never gonna change, since split is just a wrapper around String/split

21:34 brehaut: /away

21:34 kaoD: /near

21:36 brehaut: bah /me fails at irc

21:41 * talios laughs at brehaut

21:41 brehaut: hi talios

21:41 talios: so much for being away!

21:41 brehaut: i was trying to be unaway

21:41 talios: :)

21:42 brehaut: see: i fail bad

21:48 muhoo: alex_baranosky: ##(seq (.split "" "."))

21:48 lazybot: ⇒ ("")

21:49 muhoo: seems to be a java thang

21:49 alex_baranosky: still sucks ;)

21:49 it is very JAva-ey in that way I guess :D

21:49 I kiiddd I kidddd

21:50 brehaut: ,(re-seq #"^[,]" "") ;; nothing says overkill like a regexp

21:50 clojurebot: nil

22:01 devn: alex_baranosky: why would you expect empty seq? I mean, I know why, but I'm forcing self-reflection on you. Why do you think empty seq?

22:02 alex_baranosky: I find it pretty easy to imagine splitting an empty string on that which it does not contain would produce the original empty string.

22:02 alex_baranosky: dev: dammit you're making me reflect

22:02 devn: I guess I am more surprised it is a sequence and not an empty string.

22:02 alex_baranosky: and it makes sense

22:03 devn: but even still, sort of normal depending on your version of normal

22:03 gfredericks: the return value in any other case is a sequence of strings

22:03 devn: *nod*

22:03 alex_baranosky: well if you split "abc" on "," you get back "abc"

22:03 which makes total sense

22:03 devn: in a sequence, right?

22:03 ["abc"]

22:03 alex_baranosky: yeah

22:03 devn: err coll

22:03 alex_baranosky: sorry

22:03 gfredericks: &(.split "abc" ",")

22:03 lazybot: ⇒ #<String[] [Ljava.lang.String;@17d4a14>

22:03 gfredericks: &(seq (.split "abc" ","))

22:03 lazybot: ⇒ ("abc")

22:04 * devn shrugs

22:05 devn: at least it's NaN

22:05 it's *not NaN

22:05 gfredericks: so it _is_ a number?

22:06 muhoo: heh, NaN, watman.

22:07 devn: wat?

22:07 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

22:08 devn: who knows their noir here?

22:08 im failing on some forms stuff

22:08 https://gist.github.com/2706731

22:09 how do I get the path to look like /search-by-input/myquery

22:10 ibdknox: i bet you know the answer 3:)

22:12 i want to type something into the form field as a string, and for it to be the query ive made against a fn. what i have currently returns ":query" examples

22:12 i want :query to be "myquery"

22:13 xeqi: devn: don't think you can post to a dynamic url like that without javascript

22:14 devn: xeqi: that's what i thought :(

22:14 xeqi: usually its just get/post to /search-by-input and then grab the value out of the query

22:14 could make that page do a redirect if you really wanted to

22:14 devn: that's too bad

22:14 meh, might as well involve JS at this point I suppose

22:14 xeqi: *grab the query value out of the params

22:15 devn: someone told me that and I was willing to fight because it seemed like i might be able to do it

22:20 arohner: hiredman: https://github.com/arohner/clj-wallhack

22:24 devn: arohner: heh

22:24 hmmm.... clojure.pprint/code-dispatch

22:24 im not sure im using it right still

22:27 jweiss_: is there some trick to getting stdout in the either the repl or the console in CCW? most of my stdout seems to not be *anywhere*. this works fine in emacs/slime.

22:27 seems like println is all that works.

22:29 devn: jweiss_: that's vague. specific case where you want to capture out?

22:30 &(with-out-str (println "foo"))

22:30 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

22:30 devn: ,(with-out-str (println "foo"))

22:30 clojurebot: "foo\n"

22:31 devn: jweiss_: like that?

22:32 jweiss_: devn: i'm not quite sure what's going on, that is what i was hoping the stdout might tell me. i thought it might be a known CCW thing, i'll dig deeper and see if i can determine where it's going. there are definitely cases where the same code prints stdout in emacs, but not in CCW

22:32 not a 1-liner though, unfortunately

22:33 devn: jweiss_: godspeed

22:36 jweiss_: devn, another q for you - (assuming you're a ccw user). i notice that highlighting a defn form in an unsaved file and hitting ctrl-enter, doesn't seem to update the function. works different than slime? am i missing something?

22:36 devn: im not a ccw user

22:37 but maybe i can help

22:37 jweiss_: i usually use emacs but i want to demo using eclipse for my co-workers

22:37 devn: :)

22:37 that makes me feel fuzzy inside

22:38 jweiss_: this is slightly off the beaten path

22:38 but perhaps you shouldnt be demoing in terms of editors

22:38 if you can avoid it

22:38 kaoD: devn: I'm sure he's trying not to scare off his co-workers

22:38 which emacs is very good at

22:38 jweiss_: devn: they are actually going to be using eclipse.

22:38 kaoD: (at scaring, I mean)

22:39 devn: kaoD: it is, but for some it is a nice challenge

22:39 jweiss_: i'm lucky they're using clojure at all, making them learn emacs was asking too much :)

22:39 devn: challenges inspire some people

22:39 and discourage others

22:40 jweiss_: devn, yup that is true

22:40 fil512: why does this give me an error:

22:40 (defn records-by-host [records]

22:40 (index records [:host]))

22:40 jweiss: if i coulda forced them into emacs, i would have :)

22:40 devn: jweiss: i guess what im suggesting (only as a suggestion, a thought) is that maybe the people you're showing clojure to should find their own editor

22:40 and you should try to be as agnostic as possible

22:41 let that happen naturally maybe?

22:41 jweiss: devn: yeah some of them might want to use vim, but i can't help them with that. none of them already know emacs.

22:41 devn: jweiss: vimclojure-easy makes it...easy

22:41 jweiss: so i want to start with something where they're not totally on their own.

22:41 devn: i was vimclojuring with the best of them in about 4 hours

22:41 jweiss: devn: will you come work for us :)

22:41 devn: jweiss: sure!

22:42 :)

22:42 err

22:42 "with"

22:42 maybe not "for" :)

22:42 fil512: hello

22:42 jweiss: yeah that is what i meant

22:42 "us" being the company (red hat)

22:42 devn: oh, cool!

22:42 fil512: could someone help a clojure noob?

22:42 I'm getting an error I dont understand.

22:42 devn: fil512: that's what we're here for :)

22:42 fil512: (defn records-by-host [records]

22:42 (index records [:host]))

22:42 Unable to resolve symbol: index in this context

22:43 devn: fil512: that means index is not defined in the context you're trying to use it

22:43 where is "index" in your project?

22:43 fil512: I figured that. :-)

22:44 http://clojuredocs.org/clojure_core/clojure.set/index

22:44 devn: jweiss: no foolin', I'd be happy to come hang out for a week at some point if that works with your team

22:44 fil512: I want to use this

22:44 isn't it built-in?

22:44 devn: fil512: no, it needs requiring or using

22:44 fil512: oh...

22:44 so I need clojure.set?

22:44 devn: (ns mynamespace.foo (:require [clojure.set :as set]))

22:44 jweiss: devn: are you in the raleigh area? i know we met at last year's conj but don't remember where you're from

22:44 devn: *nod*

22:44 fil512: sweet

22:44 thanks

22:45 xeqi: with that require use (set/index ..)

22:45 devn: fil512: (set/index #{'fun 'stuff} [:host])

22:45 jweiss: why not talk to relevance? their training is fantastic

22:46 fil512: when should i use "use" vs. "require"?

22:46 xeqi: fil512: what version of clojure are you using?

22:46 jweiss: devn, yeah, they're doing a 4-day thing in durham next month, $1800 a pop though

22:46 fil512: 1.4

22:46 devn: fil512: when you're eating a big enchilada, err on the side of (:require foo :as bar)]

22:46 jweiss: don't think my manager is ready for that

22:47 devn: fil512: when you're using :use, think: (:use foo :only (x y))

22:47 fil512: what about when I'm bringing in my stuff vs. external stuff?

22:47 devn: fil512: the goal is to always limit your exposure to other namespaces

22:47 brehaut: do you mean (:use [foo :only [x y]]) ?

22:47 jweiss: i am happy to train my co-workers, up to a point. i mean, i got pretty far on my own without any training. just some help from the friendly folks in this channel.

22:48 devn: brehaut: yeah

22:48 jweiss: it's hard.

22:48 jweiss: i know this sounds nutty, but i think 1800/person is worth it.

22:49 jweiss: granted you need to have smart enough people to absorb it

22:49 s/smart/dedicated

22:49 fil512: anyone here use eclipse?

22:49 jweiss: devn: yeah, i think they are still at the stage where they are pretty skeptical that the effort is worth it.

22:49 devn: jweiss: so you gotta prove it, eh?

22:50 jweiss: find someone awesome in your crew and inspire them to rewrite an ugly project you have internally in clojure

22:50 jweiss: devn, yup. it's been pretty exhausting fighting off the haters

22:51 devn: show people side-by-side clojure vs X

22:51 that changes minds *fast*

22:51 dont be arrogant, just show them

22:51 fil512: what if they say the code is unmaintainable

22:52 devn: fil512: Ask them what they mean.

22:52 fil512: if an intermediate developer walks up to a big pile of java code, they can understand what's going on pretty quickly. can the same be said for a big clojure program?

22:52 devn: "This code is unmaintainable!" -- Person looking for an argument

22:52 fil512: moreso

22:52 jweiss: devn - i think we're heading in the right direction, people are interested. i think i showed off the speed of interactive development that other languages struggle to match

22:53 devn: fil512: if someone can handle a big java program they should run 100 circles around clojure

22:53 the codepaths are simple, less deep, obvious

22:53 the only thing it might hurt is their ego if they're known for being mr. smarty pants

22:53 fil512: how do i get the type of a var? e.g. set vs. map

22:54 i'd like my test to assert on type

22:54 devn: ,(type {:a 1 :b 2})

22:54 clojurebot: clojure.lang.PersistentArrayMap

22:54 devn: ,(type #{:a :b :c})

22:54 clojurebot: clojure.lang.PersistentHashSet

22:55 tmciver: fil512: or use set?, map?

22:55 devn: or those ;)

22:55 fil512: i like set? better!

22:55 thanks!

22:55 devn: damned tmciver skipping the pain of learning

22:55 :D

22:55 fil512: any1 know if eclipse plug-in does auto-indent--unindented code is driving me crazy!

22:56 * devn wishes lpetit was in here

22:56 kaoD: fil512: it does

22:56 fil512: ctrl-shift-F doesn't work

22:56 devn: ccw re-implemented paredit

22:57 fil512: which is the usual binding

22:57 how do i do it?

22:57 devn: lpetit is a crazy sonofabitch

22:57 i find it hard to believe he missed things

22:57 kaoD: fil512: not sure, but IIRC there's a "autoindent code" button somewhere

22:57 fil512: iirc?

22:58 metellus: if I remember correctly

22:58 kaoD: if I recall correctly

22:58 or remember, I'm never sure of the meaning of remember/recall

22:58 fil512: try right clicking on the file.clj

22:58 metellus: ...I was in the middle of typing "or recall"

22:58 fil512: there is something called "indent-line" but it does nothing

22:58 kaoD: lol

22:58 clojurebot: No entiendo

22:58 kaoD: yo tampoco entiendo, clojurebot

22:59 fil512: i find it so hard to code without auto-indenting! yarrg!

23:01 found it. it's the tab key! :-/

23:06 is there a version of clojure.set.index that doesn't lose my ordering?

23:07 right now it's giving me back a set which loses the ordering

23:07 (I started with a vector of ordered records)

23:09 tmciver: fil512: I'm not sure what you're trying to do but have you looked at group-by?

23:09 ,(doc group-by)

23:09 clojurebot: "([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."

23:10 xeqi: fil512: clojure's sets don't have an order

23:10 you might look at https://github.com/flatland/ordered if you really need them

23:10 fil512: you are a clojure god. group-by is exactly what i need

23:10 if it's clojure.core do i need a require?

23:11 tmciver: ha! he doesn't know me very well. :/

23:11 gfredericks: no

23:11 every morning the newbs got up early and gathered parens for the afternoon sacrifice to the clojure gods

23:12 fil512: lol

23:16 I need a function that does something like this: [["a" 1] ["b" 5] ["c" 7]] => [["a" "b"] 4] [["b" "c"] 2]

23:16 i.e. report on successive deltas

23:17 gfredericks: partition will be a good start

23:18 &((fn [coll] (->> coll (partition 2 1) (map (fn [[[a x] [b y]]] [[a b] (- y x)])))) [["a" 1] ["b" 5] ["c" 7]])

23:18 lazybot: ⇒ ([["a" "b"] 4] [["b" "c"] 2])

23:19 tmciver: (inc gfredericks)

23:19 lazybot: ⇒ 5

23:19 fil512: is there a REPL listening in on this conversation?

23:20 ache: two bots

23:20 which can evaluate

23:20 fil512: so damn cool

23:21 gfredericks: ,(println "I am clojurebot, and this is lazybot. Say ##(println \"hi, lazybot\")")

23:21 clojurebot: I am clojurebot, and this is lazybot. Say ##(println "hi, lazybot")

23:21 lazybot: ⇒ hi, lazybot nil

23:21 gfredericks: eh. you can only animate them so much.

23:21 fil512: lol

23:22 creese: I need to profile my code. Can someone point me to a page or doc that describes current best practices?

23:22 fil512: thanks folks you were a big help to a noob.

23:31 chouser: enlive is failing me

23:31 it held such promise. I had such hope!

23:31 Raynes: chouser: I've been where you are. We should form a support group.

23:32 brehaut: lol

23:32 are you still bitter raynes?

23:32 Raynes: At least he fixed my bug.

23:32 >_>

23:33 chouser: I'm trying to insert unparsed html and I can't get it to do what I want.

23:33 brehaut: (html-content …) not working?

23:36 chouser: no it's not, although it may be tagsoup's fault

23:36 brehaut: are you using html5 elements by chance?

23:37 chouser: The html I'm providing appears to be well-formed, but by the time enlive emits it, it's been rearranged incorrectly.

23:37 nope. ul, li

23:38 brehaut: if you do (emit* (html-snippet html-str)) does it garble it?

23:38 chouser: just did that.

23:38 yes it does

23:39 (apply str (#'enlive/emit (first (enlive/html-snippet "<div><ul><li>a</li><ul><li>b</li></ul></ul></div>")) nil))

23:39 "<div><ul><li>a</li></ul><ul><li>b</li></ul></div>"

23:39 that is, b is meant to be indented more deeply than a, but they come out siblings in two separate ul's

23:40 So I guess I'll try to either get it to emit the raw text directly, or find a better parser

23:40 brehaut: try <div><ul><li>a</li><li><ul><li>b</li></ul></li></ul></div>

23:40 chouser: I wonder if tagsoup has options I can control here.

23:40 brehaut: (wrapping the inner ul in an li)

23:40 (and im just guessing there)

23:41 chouser: leaving out the </li> closers seems to help, but that's not an acceptable option for this

23:41 I've got a lot of content flowing in this way and shouldn't be tweaking it

23:41 xeqi: I don't think <ul><ul> is valid

23:42 brehaut: i think the validity or not of the ul without a wrapping li is very doctype dependant

23:42 devn: enlive...

23:42 xeqi: true, I was jumping to html5

23:42 * devn facepalm

23:43 * devn takes this opportunity to complain about enlive as some kind of clojurian standard for templating and scraping

23:44 devn: chouser: look into nekohtml

23:45 chouser: meh. I didn't really want to be parsing this html.

23:45 I wonder if I can convince enlive to just emit the string without parsing it or escaping it.

23:45 devn: dont use enlive

23:45 brehaut: yeah it would. ive wanted that more than once

23:45 devn: square peg, round hole

23:46 it's a clojure 1.1.0 project turned quasi-idiomatic

23:46 gfredericks: chouser: come on man, just use a regex. what could go wrong?

23:46 devn: it scared the living daylights out of me

23:46 scares*

23:47 chouser: ok, all I really want is way to use plain html as a template

23:47 devn: chouser: can you post the document and the intended result?

23:47 brehaut: chouser: i havent used it myself, but dsantiago's tinsel might work?

23:48 although its possible also tagsoup based

23:48 devn: chouser: are you tied to plain html?

23:48 so many questions...

23:49 chouser: plain html so that the template can be viewed correctly in a browser

23:50 then I have content I'd like to place into that template -- the content is coming from an atom feed, so there are some plain strings but several chunks of html as cdata

23:50 devn: must you always have complicated questions? ;)

23:51 so unfortunately, or fortunately, enlive as a tool seems to fit that bill

23:51 and yet, i've never had anything but headaches with enlive

23:51 maybe (likely) im dense

23:52 chouser: I wish I hadn't screwed up data.zip for rewriting, or I could use that throughout

23:52 devn: but i just dont enjoy using it

23:52 chouser: hm, actually ...

23:53 brehaut: just use enlive to suck in the template, and do al lthe transformations with data.zip ?

23:54 chouser: I'm parsing the atom feed find with data.zip, and parsing the template fine with enlive. But plopping unparsed html from the feed into the template is apparently outside enlives capabilities.

23:54 muhoo: i've had a pleasant experience with mustache for templatting

23:55 specifically, stencil: http://www.google.com/url?q=https://github.com/davidsantiago/stencil&sa=U&ei=xySzT4yhHIiJiALZybT4AQ&ved=0CBEQFjAA&usg=AFQjCNGveEdvH3zgetwhvsTnrssteX3S7g

23:55 gah

23:55 https://github.com/davidsantiago/stencil

23:55 brehaut: chouser: the format that enlive uses for html is compatible with the data.zip xml format though right?

23:56 wkmanire1: :( I ran out of internet for a few minutes.

23:56 muhoo: wkmanire1: you got to keep putting quarters into it, man.

23:57 * wkmanire doesn't have any quarters.

23:58 chouser: brehaut: I'm not sure that matters. I'm getting html that was cdata in the feed, so an unparsed string of html.

23:58 brehaut: if I use html-content to insert it in the template, tagsoup misinterprets it

23:59 brehaut: chouser: right sorry, i mean just use enlive to suck in your template html, and then use data.zip to stick the text into place ?

23:59 (without processing that text)

Logging service provided by n01se.net