#clojure log - May 08 2012

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

0:01 brehaut: im guessing long-predicate-name?

0:05 felideon: i guess. we could ask a schemer i would think

0:17 tomoj: hyphen motion?

0:20 ibdknox: it's long-predicate-name?

0:20 in everything I've ever seen

0:38 ynniv: echo-area: I'm just getting started with aleph. how bad is memory usage?

0:57 emezeske: ynniv: I think echo-area was talking about how much memory the compiler used when compiling code that used aleph

0:58 ynniv: oh, ok. that doesn't bother me

1:09 ivan: echo-area: aleph takes 21 seconds to load and start an HTTP server here

1:09 is that unusual for a large amount of Clojure code?

1:09 I think aleph imports a lot of stuff

1:12 felideon: ibdknox: still here?

1:33 fliebel: $mail

1:40 wei_: how do I change an agent's value in an error handler function defined by "set-error-handler!"?

1:47 muhoo: is there some trick to pass a form to a macro that refuses to accept anything other than a string?

1:47 i.e. defpage in noir

1:47 ibdknox: what are you trying to do?

1:48 muhoo: (defpage (str compose an url "/" like this) {...)

1:48 it'll work if i do, (def temp-hack (str compose an url)) (defpage temp-hack ...)

1:49 maybe i need a ` or something

1:49 macros are still somewhat mysterious to me

1:49 ibdknox: the latter is the only way to really do it in noir

1:49 though I'm curious why you're dynamically creating urls?

1:50 muhoo: trying to eliminate the pages of boilerplate :-)

1:50 ibdknox: can you not just do it with route segments?

1:50 muhoo: some of it

1:51 Roxxi: Does anyone know of an example of setting up a resources directory using lein-ring ?

1:51 muhoo: i can combine things like (str stuff "/:id/:action") and then switch on {:keys [id action]}

1:52 but that (str stuff) bit is what's making noir unhappy

1:52 Roxxi: I specified the :resources-path key, as well as a route for resources and files... but whenever I try to get index.html at my :resources-path it keeps returning not found

1:52 muhoo: i have like 5 models, all have identical form machinery (crud stuff), so i'm experimenting with ways to eliminate the boilerplate.

1:58 felideon: ibdknox: hey, I sent another pull request that improves the last one you merged. would be great if you could check it out. https://github.com/ibdknox/Korma/pull/61

2:12 muhoo: ibdknox: to give you some idea of where i'm trying to go: https://www.refheap.com/paste/2646

2:13 that's like half the code of each view, which is duplicated in each.

2:13 so i'm trying to abstract it out somehow

2:15 ibdknox: you could do it with a macro

2:16 or do it as a compojure route set

2:22 muhoo: compojure route set inside of noir?

2:26 custom-handler, looks like

2:26 custom-handler*, sorry

2:29 Raynes: ibdknox: Did you seeth my comments on those noir pull requests?

2:29 ibdknox: Raynes: I did

2:29 it shouldn't be 307

2:29 it should be 302

2:29 as some bots still only accept http 1.0

2:30 Raynes: ibdknox: Should I accept the request and change the status code?

2:31 ibdknox: sounds reasonable

2:31 Raynes: thank you much for helping out there

2:34 felideon: ibdknox: anyone helping you out with korma?

2:35 now or in the near-future

2:35 ibdknox: not currently, though I would especially love that one. I'm not in need of SQL anytime in the near future, which means I can't afford to spend tons of time on it

2:36 Raynes: He is in dire need of a table of light, however.

2:36 ibdknox: so someone who has more vested interest will probably do a better job than I currently would

2:36 dude, who would not want a table made out of light

2:36 that sounds awesome

2:36 Raynes: can haz plz?

2:36 Raynes: nowai

2:37 felideon: you mean something like http://www.microsoft.com/surface/en/us/default.aspx ?

2:37 <grin>

2:37 hiredman: I thought it was just really light, you know, made at of aluminum or something

2:37 ibdknox: hiredman: lol

2:37 Raynes: I had a dream that hiredman and I had a brief conversation on IRC.

2:37 ibdknox: felideon: my goal is to get microsoft to give me one of those at some point ;)

2:38 felideon: though that website is *awful*

2:39 amalloy: still time to pledge, now that you know it's a table made of light (or take back your pledge if you were really excited about the aluminum, i guess)

2:40 ibdknox: speaking of awesome: Tim O'Reilly emailed me back :)

2:41 Raynes: ibdknox: What did he say!?

2:41 ibdknox: He invited me to Foo camp to come talk about it :D

2:43 hiredman: amalloy: I thought I was getting a really good price on that al

2:48 fliebel: Whoa, a few Clojury features python has that I was unaware of: http://python3porting.com/improving.html

2:50 clojure-py does seem to use Python fractions, but they are a bit broken..

2:52 ivan: hm, what's wrong with them?

3:07 fliebel: ivan: CompilerException: Compiler Exception don't know how to compile <class 'fractions.Fraction'>

3:08 https://gist.github.com/650e02b154d2ebde1202

3:09 The just don't work at all

3:09 emcken: I wrote a lazy parsing of a big csv file and now I would like to insert the data into a database without opening and closing the db connection for every row - just can't figure out how to do it

3:11 fliebel: emcken: Could you explain why you can't reuse a connection?

3:13 emcken: fliebel: because I don't have enough experience with Clojure *heh*

3:13 fliebel: I can loop parse the csv file -> open the db connection -> write row to db

3:14 fliebel: emcken: So the goal is to move the connection up a level? define it as a top level var, or pass it around

3:14 emcken: fliebel: but can't figure out how to do something along the lines: open db -> parse csv file (1 line at the time lazy) -> write it to the database

3:15 fliebel: (let [con (open db)] (map (partial parse con) (line-seq csv)))

3:17 emcken: fliebel: yeah my problem is I can't figure out how to seperate the functions "with-connection" and "insert-record"... I'm pretty new to clojure

3:18 fliebel: emcken: separate?

3:19 inside parse you could just do (with-connection con (insert-record blah)). You could bind the connection above that, but then you need to force the lazy seq.

3:20 Why do you want a lazy seq, if you just insert everything into the DB anyway?

3:21 (with-connection (open db) (doseq [line (line-seq csv)] (insert-record (parse line)))

3:21 emcken: fliebel: I though doing (with-connection con (insert-record blah)) opens and closes the connection to the db everytime "with-connection" is called

3:22 fliebel: emcken: no, it just binds the given connection.

3:22 try (macroexpand-1 '(with-connection blah)) in a repl.

3:23 emcken: fliebel: ahh well I guess its working the way it should already... thanks a lot

3:23 fliebel: I bet it gives you something like (binding [*connection* blah])

3:32 emcken: fliebel: (macroexpand-1 '(sql/with-connection db (sql/insert-record "bbr" (parse-row test)))) gives...

3:32 fliebel: (clojure.java.jdbc.internal/with-connection* db (clojure.core/fn [] (sql/insert-record "bbr" (parse-row test))))

3:33 fliebel: ok, remove the -1, see where it goes

3:33 emcken: fliebel: (doc with-connection) says: Evaluates body in the context of a new connection to a database then closes the connection.

3:33 fliebel: uh? oh... really? hrm...

3:34 Ok, then you'll need to skip the lazyness. From what I can tell, you don't really need it.

3:37 emcken: Why are you using a lazy seq?

3:38 emcken: becasue if I don't the size of the csv file will make my machine run out of memory

3:39 amalloy: so it occurred to me this evening that you can't pass functions to macros. this seems like something that is rarely (but not never) useful, and not fundamentally impossible

3:39 for example, you might have https://gist.github.com/2633304 and want (locals-map keyword [a b]) to expand to {:a a :b b}. currently that can't really work, because the macro receives the symbol keyword, not the function keyword

3:39 but this also seems kinda like a crazy thing to want. does anyone have opinions/feedback on it?

3:43 fliebel: amalloy: Hold on, I'm forming one...

3:43 emcken: fliebel: I've just looked at you example again... I think I misread it before... it suddenly makes sense :)

3:46 fliebel: amalloy: I don;t know enough about fexprs to form the opinion I wanted, so I'll try to form another one.

3:46 amalloy: haha

3:48 kral: namaste

3:49 fliebel: amalloy: (defmacro foo [f] ((resolve f) 2 2))

3:50 amalloy: fliebel: sure, but then you can't pass, for example, (comp name first)

3:50 fliebel: amalloy: No... eval? :-\

3:51 clj_guest002: String is automatically defined to be java.lang.String in my *.clj files. I don't want this to happen. How do I hide java.lang.String ?

3:53 fliebel: amalloy: I would say passing a function to run at macro expansion time is an optimization in any case I can think of.

3:54 amalloy: fliebel: no way, not even in the example i gave

3:55 i mean, i guess you could expand to {(keyword 'a) a, (keyword 'b) b}, so maybe you're right

3:55 fliebel: yea

3:56 clj_guest002: argh, help me :-)

3:56 how do I prevent String from being auto defined to java.lang.String :-)

3:56 fliebel: clj_guest002: Why would you want that?

3:56 amalloy: clj_guest002: adding smiley faces doesn't make it less rude to repeat your plaintive cries after just five minutes of nobody being able to answer you at midnight

3:57 al-maisan: I wrote a small program that uses pmap (http://tinyurl.com/ctvx4l5) and it takes a minute to terminate after doing the actual "work" .. is this be design or am I doing something wrong?

3:57 fliebel: amalloy: When I started with Clojure, I wanted to write a template language at acroexpansion time, so it would be fast.

3:57 amalloy: al-maisan: some of both. it's an undesirable consequence of a design decision

3:58 clj_guest002: I need to defrecord String to be a [s x y], to be something that I can call drawString on

3:58 al-maisan: amalloy: aha, what is that design decision?

3:58 amalloy: when you're done you can call (shutdown-agents) to kill the pool threads

3:58 al-maisan: interesting..

3:59 amalloy: thanks for the hint! Will try that.

3:59 fliebel: clj_guest002: The easiest way is not to do that. You always get java.lang imported, and I don;t thik you can exlude it.

4:00 clj_guest002: http://stackoverflow.com/questions/9758279/exclude-java-lang-in-clojure-namespace

4:01 clj_guest002: fliebel: alright, looks like I really shouldn't' do this

4:01 thanks :-)

4:03 amalloy: hah, i was gonna upvote the second answer to that question before i found out it was just meeee

4:06 echo-area: I have a list of files, and I want to read all of them, one by one. I want to reify clojure.lang.ISeq, such that I can read them this way: (doseq [line (reification-of-ISeq-through-the-files)] (do-this line) (do-that line)). But this is not functional: the reified object can't be consumed twice, since as it is used the first time it is changed in place. This seems to contrast with Clojure's philosophy, is there any better design?

4:07 What do you suggest?

4:13 fliebel: echo-area: So you want a seq of the lines of every file, so that you can repeatedly iterate them?

4:13 amalloy: i don't see any reason to have this like crazy custom reification, instead of just using for/doseq to iterate over the files, and then the lines within each file

4:14 (doseq [f (file-seq ...)] (with-open [r (reader f)] (doseq [line (line-seq r)] ...)))

4:15 Borkdude: ass

4:15 undo

4:16 technomancy: I just updated heroku, but when I type heroku it sprinkles errors on my screen

4:18 technomancy: ah, re-installing the "toolbelt" worked

4:19 echo-area: fliebel: Yes, I want to wrap around a list of files, internally it uses line-seq/file-seq, of course

4:20 fliebel: echo-area: So why not do what amalloy suggested? I don't see the need for the reify either.

4:21 echo-area: amalloy: But the reading is inside a call-back, and it is not a contiguous process

4:21 fliebel: That is, I will need to save the current process inside an atom, and resume later

4:22 * fliebel puzzeled

4:23 fliebel: echo-area: What if you put the internal seq in a cycle, so that you can just keep on reding.

4:23 &(take 10 (cycle [1 2 3]))

4:23 lazybot: ⇒ (1 2 3 1 2 3 1 2 3 1)

4:24 echo-area: I can't, as there can be a long time between two reads

4:24 Some else code calls my code to read.

4:26 fliebel: echo-area: I don't know, because I don't really understad your problem

4:27 amalloy: echo-area: you might be interested in http://stackoverflow.com/questions/7134733/tree-search-saving-execution-state as an alternative approach to atoms

4:43 michaelr525: hey

4:45 how to implement unescape for string content?

4:45 it's probably something really simple

4:46 echo-area: amalloy_: That looks like continuation. Let me see..

4:46 Thanks

4:51 michaelr525: haha

4:51 (read-string) worked for me

4:59 emcken: Is it possible to abort/break an evaluation in slime-repl (Emacs) without closing it down entirely?

5:01 clgv: emcken: do you know the rbeak macro which gives you a repl in its call context?

5:01 *break

5:03 emcken: clgv: no sorry :( looking for something which would work similar to Ctrl+c when running scripts from a terminal

5:03 robertstuttaford: how do i get ccw to use my lein project.clj when starting a repl? i'm targetting clj 1.4 in my project.clj but my repl always starts with clj 1.3

5:03 clgv: emcken: oh ok

5:04 robertstuttaford: not yet, I guess. or did they release the leiningen support plugin yet?

5:05 robertstuttaford: to get clojure 1.4 you just have to remove 1.3 from buildpath and add the 1.4 jar

5:05 emcken: clgv: I found something I think I can use: C-c C-b

5:12 robertstuttaford: clgv: thank you

5:12 after following cemerick's video, i have a lein plugin installed

5:13 clgv: oh ok. so there is a release of that plugin? laurent talked about it some weeks ago

5:13 robertstuttaford: i think it's still in beta

5:17 clgv: but it didnt replace the 1.3 jar by the 1.4 one specified in project.clj?

5:26 Borkdude: hmm how I could save the gamestate per session, without making the model dependent on noir… https://github.com/Borkdude/tictactoe

5:26 it's now hosted here http://webtictactoe.herokuapp.com/

5:27 I could just save the gamestate in the view

5:27 and give it to the model

5:31 DukePatience: Quick question. Why Clojure and not CL?

5:33 vijaykiran: Quick answer. JVM

5:33 DukePatience: Other than easy cross-platformism, what does JVM have that CL doesn't?

5:35 Borkdude: DukePatience: for me the initial reason was: I can't change my environment (JVM/.NET), so how can I use Lisp in this environment

5:44 _KY_: If I call (eval), which namespace will it use, and how can I change it?

5:45 (Sorry brb...)

6:10 clgv: DukePatience: an existing library for almost every problem ;)

6:39 _KY_: I want to set the namespace for a jar... I checked that it's set to "clojure.core"

6:39 I mean, that's the namespace it uses for "eval"

6:40 When I run java -jar, it doesn't allow me to (eval (ands different.namespace)),

6:40 Saying "Can't change/establish root binding of: *ands* with set"

6:41 Saying "Can't change/establish root binding of: *ns* with set"

6:41 I want to do (eval (ns different.namespace))

6:42 clgv: &(eval '(let [n *ns*] (println n)))

6:42 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

6:42 clgv: ah right

6:42 _KY_: &*ands*

6:42 lazybot: java.lang.RuntimeException: Unable to resolve symbol: *ands* in this context

6:42 _KY_: &*ns*

6:42 lazybot: ⇒ #<Namespace sandbox3826>

6:42 _KY_: &(ns clojure.core)

6:42 lazybot: java.lang.ClassNotFoundException: clojure.core

6:42 clgv: _KY_: using eval like that shows that the namespace is the current namespace

6:43 _KY_: Well... let's say the namespace I want is genifer.core

6:43 clgv: but you can use (in-ns 'bla) to switch to a namespace

6:43 _KY_: When java -jar starts, it's set to "clojure.core"

6:43 Oh I see...

6:43 That's cool

6:44 clgv: but you may have to require it upfront

6:45 muhoo: sleep is a theoretical construct

6:46 Borkdude: I was wondering, will session information always remain in memory until the app is restarted? https://github.com/ibdknox/noir/blob/master/src/noir/session.clj

6:47 _KY_: Where should I put (in-ns ...)?

6:48 clgv: _KY_: within the eval

6:48 _KY_: Doesn't seem to have an effect

6:48 Like (eval (in-ns ...) something)?

6:48 clgv: Borkdude: I think noir uses ring for it - you can check there whether the session has a timeout

6:49 _KY_: (eval '(do (in-ns 'my.ns) (do-sth ...)))

6:49 _KY_: I see...

6:49 clgv: the second quote is likely not needed ^^

6:49 _KY_: The quote before "do" is needed?

6:49 Ahh I see...

6:49 Yes it's needed

6:49 clgv: yes. otherwise it's executed there.

6:50 ,(doc eval)

6:50 clojurebot: "([form]); Evaluates the form data structure (not text!) and returns the result."

6:52 _KY_: That doesn't work...

6:52 Perhaps, in-ands wraps the eval?

6:52 Perhaps, in-ns wraps the eval?

6:54 Nah... that doesn't work either =(

6:54 clgv: _KY_: paste an example with description

6:55 _KY_: I have a function, say (help), that I want to invoke within the namespace genifer.core

6:55 But the user inputs it via (read)

6:56 So I have to (eval (read))

6:56 But the namespace isn't right

6:56 I found out the namespace is clojure.core

6:56 clgv: _KY_: ah. try (binding [*ns* 'genifer.core] (eval (read)))

6:57 or better (let [input (read)] (binding [*ns* 'genifer.core] (eval input))

6:58 _KY_: That doesn't change the ns

6:58 clgv: it should

6:58 _KY_: In fact, I tried to change the ns within the input to (read)

6:59 Came out with error: "Can't change/establish root binding of: *ns* with set"

6:59 Maybe it's fixed in some way

6:59 &(eval (read))

6:59 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

7:00 _KY_: &(eval *ands*)

7:00 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

7:00 _KY_: &(eval *ns*)

7:00 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

7:00 clgv: that prints the namespace 'bla provided that it exists: (binding [*ns* (the-ns 'bla)] (eval '(let [n *ns*] (println n))))

7:01 _KY_: I see...

7:01 Perhaps it's the jar

7:01 Yeah... it's because of the jar

7:01 clgv: _KY_: you can have a look at clojail - it always executes code in different namespaces ;)

7:17 xumingmingv: i am trying composure 0.6.4

7:17 when i use request in defroutes

7:17 it tells me that request can not be resolved, why?

7:18 request is dynamically bounded magic variable in composure, right?

7:19 antares_: xumingmingv: it's not magic but it is only available when you are handling a request. By the time routes are defined, there is no request to use.

7:20 xumingmingv: plus, please paste your code if you want help on any specifics

7:21 xumingmingv: ok

7:21 https://gist.github.com/2634328

7:21 code is here

7:26 antares_, any suggestions?

7:26 I have seen this kind of usage: http://zef.me/2650/on-language-design-magic-variables-in-compojure

7:35 antares_: xumingmingv: that blog post is from 2 years ago

7:38 xumingmingv: oh...

7:39 antares_: compojure tests do not seem to use request anywhere, only specific parts of it

7:44 xumingmingv: i get my answer here: https://groups.google.com/forum/?fromgroups#!topic/clojure-web-dev/mEGlCmESxxY

7:50 jweiss: is there a way to stop pr from printing namespaces? I see pprint offers that, but I want to print as a single line.

8:09 hyPiRion: jweiss: Are you only pr-ing vars?

8:09 if so, you could potentially do an ugly hack

8:09 ,(print (second (re-find #"(?:\/)([^/]+)" (str #'concat))))

8:09 jweiss: hyPiRion: in this case, i'm pr-ing quoted code

8:10 clojurebot: concat

8:10 hyPiRion: Ah.

8:10 jweiss: i'm guessing the fix is some multimethod for print-method for symbols?

8:11 the only problem is i think changing that would be system-wide, which i don't want.

8:12 hyPiRion: Is it possible to dynamically bind the multimethod? I would guess no, but that could've been a solution.

8:26 echo-area: amalloy_: Finally I decide to use atom. That call-back function is from Java, which requires states, and I can't find anywhere to store state information unless using reference types

8:26 s/That call-back function is from Java/That functions is called back from Java/

8:30 _KY_: I still can't change the namespace of (eval) in a jar, but I can do that in repl...

8:41 I tried 3 methods, they all work in REPL, but no longer in the jar

8:42 The methods are: binding, push-thread-bindings, and alter-var-root

8:42 jonaskoelker: Is the meaning of #_ something like "the reader consumes and ignores the next s-expr"?

8:42 gfredericks: jonaskoelker: yep

8:43 jonaskoelker: yay, I ar smart, I can interpolaetz

8:43 clgv: _KY_: build a minimal example with the binding method. best if I only have to "git clone" it

8:54 _KY_: https://www.refheap.com/paste/2652

8:55 ^^ the flower is just a test function...

8:55 Try type (help) when prompted for input...

8:55 It works in REPL, but not when made into a jar

8:57 (In the 2 other methods please delete "pushback-stream" as well)

9:01 clgv: _KY_: there is no help function. how should calling 'help do anything?

9:01 _KY_: Oh I mean (flower)

9:06 clgv: _KY_: erm, what is your exact error?

9:06 I should have asked that earlier ^^

9:07 _KY_: When run as a jar... it fails to resolve symbol "flower"

9:07 But it works when in REPL

9:07 When run as a jar the namespace is "clojure.core"

9:08 And it resists being changed

9:08 fliebel: What I did is walking the read datastructure, and resolving the symbols myself before I eval them.

9:09 clgv: _KY_: I can't reproduce your error.

9:11 _KY_: You compiled it into a jar?

9:11 clgv: yes. now it works^^

9:12 _KY_: That's strange... let me check...

9:12 I was using lein

9:12 How do you compile a single clj file?

9:13 clgv: _KY_ check here: https://www.refheap.com/paste/2653

9:16 _KY_: Still doesn't work here... =(

9:18 clgv: _KY_: I can upload you the whole project. where shall I?

9:18 _KY_: Maybe I'll just start one

9:18 Using lein new?

9:19 clgv: you know any uploader and I put it there for you^^

9:20 _KY_: http://www.sendspace.com/file/rg1udl

9:21 _KY_: Ok I get it...

9:23 Ok I can run yours, and it works...

9:23 Even as a jar

9:24 But in my project with the exact same code, it doesn't work...

9:24 clgv: _KY_: then you are probably doing something strange in there

9:25 _KY_: you know that you can also start are real repl in your -main method via clojure.main/repl?

9:25 _KY_: Can you try (print *ands*) in your program?

9:25 Can you try (print *ns*) in your program?

9:26 clgv: you have the program ;)

9:26 _KY_: I tried that, it prints nothing...

9:27 Oh I see... I have to use println

9:28 In your program, I'm allowed to change the namespace... but not in my jar

9:29 clgv: _KY_: so you can rule out the 'binding form as the reason for that behavior ;)

9:32 _KY_: Could it be you're doing this in the -main function?

9:39 I moved your code to my -main and now it works also...

9:40 clgv: well you have to bind the correct ns there that contains the function you are calling

9:41 _KY_: do you want to have a real repl in your jar?

9:41 jwr7: Ahh, thanks to reduce-kv and some hinting my sparse-vector-normalizing code is now 30% faster. Nice!

9:42 _KY_: clgv: not exactly a REPL, but a more enhanced one... =)

9:42 clgv: _KY_: well, then I would start with clojure.main/repl and its parameters

9:46 _KY_: But I want to intercept the REPL

9:46 clgv: _KY_: have a look at its parameters and how they are used^^

9:50 _KY_: I see... it seems better than what I'm doing...

9:50 clgv: ,(doc clojure.main/repl)

9:50 clojurebot: excusez-moi

9:50 clgv: &(doc clojure.main/repl)

9:50 lazybot: ⇒ "([& options]); Generic, reusable, read-eval-print loop. By default, reads from *in*, writes to *out*, and prints exception summaries to *err*. If you use the default :read hook, *in* must either be an instance of LineNumberingPushbackReader or duplicate its beh... https://www.refheap.com/paste/2654

9:52 jwr7: Are all unhinted function arguments boxed?

9:53 clgv: jwr7: only numbers. everything else is already an object

9:54 jwr7: clgv: well, yes, I meant numbers. I just wanted to know if clojure 1.4 does any auto-unboxing.

9:55 Also, can map keys be unboxed, or are they always objects?

9:56 clgv: well, you would have to look that up in the source. but afaik there is no special map for that

9:59 _KY_: What is meant by boxed?

10:02 clgv: _KY_: primitive int -> Integer object

10:07 pandeiro: is there a function like filter/remove but that only filters/removes the first match and returns the rest of the seq untouched?

10:19 rhc: if anyone is interested, a wrote a clojure program ants.clj for a little clojure presentation: http://github.com/matthavener/banksim

10:19 a wrote -> i wrote

10:22 dnolen: CLJS apply now much faster in master.

10:24 drewr: dnolen: how do you hack on compiler.clj? there's no project.clj

10:24 just with a bare repl?

10:24 dnolen: drewr: I just work from the repo, making changing, making sure all tests pass.

10:25 drewr: for performance work I make a lein + lein-cljsbuild + checkouts project

10:25 drewr: yeah cljsbuild makes nice workflow out of cljs code

10:25 I wanted to fix that js-reserved compiler bug though

10:25 dnolen: drewr: cljsbuild does wonders.

10:26 drewr: code generation stuff like that I just test with my eyes :)

10:26 drewr: turn off optimizations in script/test

10:26 drewr: look at the output of out/core-advanced-test.js

10:28 drewr: for some simple stuff, also testing by loading the cljs.compiler at the repl also work. (c/emit (c/analyze {} '(some-form ...)))

10:47 clgv: rhc: you forgot to add :main to project.clj so (start) cant be resolved ;)

10:51 rhc: clgv: ahh, thank you, thanks for checking it out too

10:53 _KY_: Trying to call clojure.main/repl in a jar gives run-time error:

10:53 "Attempting to call unbound fn: #'clojure.main/repl"

10:54 clgv: _KY_: you have to use or require the namespace as usual

10:56 _KY_: Works now... thanks =)

11:19 tuxella: Hello

11:19 wkmanire: Good morning.

11:20 tuxella: I have a question about java interop, could someone help me?

11:20 clgv: ~anyone

11:20 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

11:20 tuxella: ok

11:21 I'd need to call a method of a java object with the method name. But I only know this method name at runtime

11:21 clgv: tuxella: then you have to use reflection

11:22 tuxella: As far as i have understood, the dot notation being a special form, this is not possible this way, and I haven't found any other way to call a method of a java object ..

11:22 robertstuttaford: is it possible to assoc a value into a map with a symbol as the key, but somehow use a string to create that symbol first?

11:22 nDuff: ...well, there is evil^Weval :)

11:22 S11001001: tuxella: check clojure.lang java namespace for convenient utilities for calling reflectively while maintaining sanity (conflating integer types and such)

11:23 robertstuttaford: i guess the assoc part is easy. how do i make a symbol from a string?

11:23 S11001001: ~(doc symbol)

11:23 clojurebot: defmulti doc is ugly

11:23 S11001001: oh come on

11:23 ,(doc symbol)

11:23 clojurebot: "([name] [ns name]); Returns a Symbol with the given namespace and name."

11:23 clgv: tuxella: there is 'clojure.reflect

11:24 rhickey: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html

11:24 tuxella: clgv: and i guess from this I can get my method by its name and call it afterward ?

11:24 clgv: tuxella: yes. but ask yourself, if you really need to do it like that

11:25 tuxella: clgv: it looks (looked ?) like an easy way to expose methods of the tree I am walking in the configuration of the walker

11:30 wkmanire: ,(doc partition)

11:30 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

11:30 tuxella: clgv: thank you for your help, I will try this way even if I agree that it may not be the best way

11:31 jedmtnman: is there a specific channel for for the midje library?

11:33 TimMc: jedmtnman: There appear to be a few people in #midje, but I don't know if the core maintainers show up there.

11:33 robertstuttaford: clojure rocks. just sayin'

11:33 i'm about 10 days in, only really starting to write code now, and i'm loving it

11:33 jedmtnman: TimMc: logged on there and there was no welcome message, so wasnt sure if it was the right context :)

11:34 TimMc: robertstuttaford: \o/

11:34 robertstuttaford: i love what it's doing to my brain. nice challenge

11:36 rhickey: any questions on reducers?

11:37 TimMc: rhickey: I'm a little lost on reduers/map. It tells the reducible thing to layer in a map operation?

11:38 clgv: rhickey: only bookmarked it for later reading this evening ;)

11:38 Borkdude: rhickey: will read it later, tnx

11:38 TimMc: My language parser fails somewhere around "return something reducible via transformation of the reducing function, reducers."

11:39 rhickey: TimMc: map takes something reducible (e.g. a collection)

11:39 robertstuttaford: rhickey: no. but let me take this opportunity to thank you for your awesome language and talks that you've given!

11:39 rhickey: and returns something reducible (by implementing the coll-reduce protocol)

11:40 so return value of map etends coll-reduce

11:40 when you call reduce on it , it modifies the function you give it (adding the mapping logic) and then passes that to the coll

11:40 TimMc: So you're building a pipeline of operations that will occur once an actual reduce operation is called?

11:40 rhickey: TimMc: right

11:41 essentially a new function, like a russian doll

11:41 not really like a pipe of connections and flowing streams

11:41 fliebel: rhickey: This is basically an optimization to get rid of the intermediate objects, right?

11:41 rhickey: one key point is that there are no streams/seqs

11:42 fliebel: getting rid of intermediate objects would be a) keeping the seq model, and then b) getting rid of its overheads

11:42 this instead gets rid of the seq model

11:42 the new model doesn't have intermediate objects

11:42 kzar: I've build my javascript file using lein-cljsbuild OK but when I try to use it the thing is trying to include /deps.js . No idea where that's come from but it doesn't exist and I can't figure out what to do. Any ideas?

11:43 rhickey: but it additionally has the property that the fundamental functions are not defined in terms of seqs

11:43 and thus can be parallelized

11:44 it's not stream fusion, there are no streams in the semantics anymore

11:44 fliebel: rhickey: When would I use it?

11:45 TimMc: I'm curious what happens when you use this with the naive Sieve of Eratosthenes.

11:45 rhickey: fliebel: when you are going to process the entire collection (i.e. don't need laziness) and you'd like to take advantage of your hardware to do that as fast as possible

11:46 TimMc: (which usually causes Stack Overflow due to nested filters)

11:46 rhickey: lazy/parallel is the fundamental tradeoff

11:46 tuxella: rhickey: I understand it as something similar to coroutines, at least their python implementation, is that what you intend with this reducers ?

11:47 rhickey: It also forces you into a less item-at-a-time model

11:47 hyPiRion: rhickey: Just a question after reading the source code: Any specific reason why 512 is the initial partition group for fold?

11:47 rhickey: tuxella: not really

11:47 ieure: Soooooo. There's no code coverage tool for Clojure?

11:48 rhickey: hyPiRion: has to be something, that's somewhat empirical will not much data :)

11:48 hyPiRion: Ahh, I see :)

11:48 HCumberdale: Hello from Gibraltar :)

11:48 TimMc: ieure: I've heard of a coverage tool that was described as relatively naive... can't recall the name right now.

11:49 ieure: TimMc, Radagast?

11:49 It's the only one I've found. Insufficient.

11:51 * fliebel needs to do more reading to ask interesting questions about reducers.

11:52 fliebel: rhickey: What happened to the pv* forkjoin map/reduce/filter etc? Is this it?

11:52 rhickey: fliebel: this replaces that

11:52 much better

11:53 fliebel: cool :)

11:53 rhickey: i.e. you won't need pmapthis, pmapthat

11:53 map/filter etc are independent of parallelism

11:54 HCumberdale: So pvmap becomes the new map ?

11:54 rhickey: HCumberdale: no, map has nothing to do with p, nor v

11:54 in this model

11:55 TimMc: "a combining function, a reducing function, and a collection" <- the combining function is something associative like +, but what is the reducing function?

11:55 HCumberdale: Sorry I meant pvmap becomes the new pmap?

11:55 rhickey: HCumberdale: pmap will always have a place as a hybrid lazy+parallel options

11:56 mmarczyk: rhickey: so a reducible IO source would close the resource once done -- in particular, if (reduced ...) was used to stop the reduction, perhaps in an outer layer of the transformation?

11:56 rhickey: TimMc: it can be any reducing fn, could reduce to scalar like +, or build collection subresults

11:56 mmarczyk: yes

11:57 HCumberdale: Is pvmap getting part of clojure 1.4 or are there no plans to merge it from clojure par branch?

11:57 dnolen: HCumberdale: sounds like stuff is now superseded by the new reducers work.

11:57 rhickey: HCumberdale: pvmap is not needed given reducers/fold

11:58 dnolen: like that stuff

11:58 fliebel: It seems the reducers/map takes one one coll, or is that part of the defcurried magic?

11:58 HCumberdale: Ahhh found a post about it from today

11:59 drewr: dnolen: how do I tell script/test where goog lives?

11:59 rhickey: fliebel: it does take only one, my todo list mentioned a multi-reducer

11:59 dnolen: drewr: compile w/ :whitespace or :simple optimizations

11:59 drewr: I get "out/core-advanced-test.js:1: ReferenceError: goog is not defined"

11:59 fliebel: ah, great

11:59 drewr: dnolen: ah

11:59 mmarczyk: rhickey: a ClojureScript-related question -- is fold relevant at all? just making sure before I dive into porting the namespace (not much porting work at all in this case, though... :-))

12:00 dnolen: I'm loving your apply patches, great stuff :-)

12:00 rhickey: mmarczyk: it can never be parallel, but just implement using the Object fallback - turns into reduce

12:00 mmarczyk: gives code compatibility

12:00 mmarczyk: rhickey: sure, will do

12:00 dnolen: mmarczyk: yes, huge speedups for apply.

12:00 rhickey: unti lwe can figure out how to get webworkers to help

12:00 :)

12:00 mmarczyk: hah! :-)

12:01 brainproxy: or node child_processes

12:01 :)

12:04 * fliebel is trying to trace the parallel magic

12:04 jlongster: dnolen: looks like we'll be able to create native browser-based debuggers after all: https://www.youtube.com/watch?v=TQxQr1H0iZ0

12:05 dnolen: jlongster: !

12:06 jlongster: I guess I won't create a web VM :)

12:09 mmarczyk: rhickey: can this be used to fuse layers of lazy seq transformations? I'm thinking e.g. if I have a bunch of transformations and I layer them appropriately, so they get "fused", can I just wrap it in a function returning (reduced (lazy-seq (cons x (somehow-get-"rest"-reducible)))) to get a lazy seq? or sth similar

12:11 rhickey: mmarczyk: this is not stream fusion, nor about it, but there are benefits to using these reducers instead of seq versions even on lazy source if you are going to end up reducing

12:12 also note the composability bit

12:13 fliebel: rhickey: Still trying to understand the code. Is just reduce parallel, or map and filter too(without reducing)?

12:13 rhickey: the only thing that is parallel is fold

12:14 that is enabled by the rest of the library being reduce-based

12:14 map, and filter don't do any work on collection when called

12:16 fliebel: Right, so if I want to have a better pmap(i.e. pvmap), this is not it. This map and filter just compose untill you call reduce on them, if I understand it correctly.

12:16 HCumberdale: is a "for" List Comprehension faster then a "map" ?

12:16 technomancy: HCumberdale: they compile to the same thing

12:16 HCumberdale: thx technomancy

12:19 rhickey: do you use emacs ?

12:22 kzar: What makes the /repl route work for browser repls? Looking at examples I don't see it in the defroutes with everything else

12:25 technomancy: ieure: radagast is pretty rudimentary, but there's another one that's quite new; check out guzheng

12:25 kzar: in my drawbridge article?

12:25 dnolen: CLJS breaking change for how browser REPL works but folks can finally stay abreast of latest GClosure instead of being a year behind - http://dev.clojure.org/jira/browse/CLJS-35

12:26 kzar: technomancy: Well for example https://github.com/emezeske/lein-cljsbuild/blob/0.1.8/example-projects/advanced/src-cljs/example/repl.cljs

12:26 dnolen: thoughts welcome, basically for the simple case you now have to open your CJLS file at localhost:9000/file.html instead of directly via file://

12:26 ieure: technomancy, Thanks, I'll take a look.

12:26 technomancy: kzar: oh, ok; never mind.

12:26 mmarczyk: dnolen: that actually seems more convenient :-)

12:26 dnolen: mmarczyk: yeah :) I don't really see many problems with it.

12:27 but worth getting some feedback

12:32 ibdknox: dnolen: would you consider a patch that remove the atom specific nature of swap! and reset! and made a IReset or some such protocol?

12:32 dnolen: for CLJS

12:32 bhenry: ping korma users and/or ibdknox… what if i need to check more than one constraint on the same key. i.e. "WHERE user.id IN list1-derived-from-locations AND user.id IN list2-derived-from-permission-groups"

12:33 kzar: Weird, I noticed the script tags for the example are inside the body. When I changed my code to do that it started working, surely script tags normally live up in the head though?

12:33 ibdknox: bhenry: instead of using a map use the functions directly

12:33 fliebel: ibdknox: I once submitted a patch for exactly that to Clojure.

12:33 bhenry: ibdknox will two where's work?

12:34 ibdknox: bhenry: actually, that probably would

12:34 fliebel: ibdknox: http://dev.clojure.org/jira/browse/CLJ-803

12:34 bhenry: ibdknox: good because i don't know how to do an (in) call the other way

12:34 ibdknox: bhenry: I was thinking (where (and (in :x [2 3]) (in :x [4 5]))

12:35 bhenry: aha

12:35 ibdknox: fliebel: huh

12:35 fliebel: so there were no objections then

12:35 dnolen: ibdknox: hmm probably should think about that. atom is the goto for state management, protocols add some overhead.

12:36 fliebel: ibdknox: Not really, but noone really cared either, it seems. What did you think of in cljs that needs this?

12:37 ibdknox: dnolen: fliebel: in order to do any realistic form of databinding I needed to create subatoms

12:37 hiredman: ibdknox: I objected on clj-803

12:37 ibdknox: hiredman: whoops, should've read that one

12:38 fliebel: oh, true

12:38 mmarczyk: dnolen: as far as convenience is concerned, me CLJS-35 is a clear win for me, given the option to pass in :serve-static false

12:40 ibdknox: dnolen: fliebel: basically the problem is that in clojure we usually use a single atom to represent a collection of things. This makes it virtually impossible for you to delegate the updating of those to happen at a more granular level - all changes have to be made to the root atom. My little subatom basically keeps a reference to the path within the atom, notifies of changes specific to that path and allows you to update the root atom

12:40 transparently

12:40 dnolen: fliebel: subatom certainly does not belong in core, but it *is* technically the atom and it seems dumb that I can't use the built-in swap! and reset! with it

12:42 dnolen: ibdknox: sounds like something that needs to get written up and pondered :)

12:42 fliebel: dnolen: ibdknox: IIRC, Avout uses swap!! and reset!!, they could also benefit, I would think.

12:43 dnolen: ibdknox: if atoms don't work for you - what you're asking for as the ability to use the same interface on a custom type right?

12:44 ibdknox: dnolen: more or less

12:44 dnolen: ibdknox: it could probably be zippy w/ IAtom marker protocol + ICompareAndSwap protocol

12:45 fliebel: hiredman: What do you think about avout, in respect to your comment on 803?

12:46 lynaghk: ibdknox: have you seen Dave Sann's port of Knockout.js to CLJS? He's doing something similar with paths-within-atoms

12:47 ibdknox: lynaghk: I haven't

12:47 lynaghk: with this subatom stuff my databinding implementation is wonderfully simple now

12:47 lynaghk: ibdknox: https://github.com/davesann/closeout

12:48 fliebel: ibdknox: databinding?

12:48 lynaghk: ibdknox: yeah? I'll check it out when it hits crate. I did a few hours of hammock time on Sunday thinking about this stuff, have some ideas I'll be implementing over the next week or so

12:50 hiredman: fliebel: avout doesn't pretend to be local, it has it's own transactions and references

12:50 lynaghk: you might want to checkout the Knockout.js documentation, it's very good. I'll probably do a hybrid of your approach (joining atoms with individual DOM element properties) and the DOM-walking that's in c2 now.

12:50 hiredman: (or at least it did last time I checked)

12:51 ibdknox: fliebel: lynaghk: https://github.com/ibdknox/crate/blob/fd3508e121516d122638e67176c6b8ecce72c8b9/src/crate/binding.cljs

12:51 fliebel: hiredman: CouchDB doesn;t pretend to be local either, I think it would just be convenient to use the same interface. an avout atom uses swap!!, but does the same thing.

12:52 hiredman: fliebel: right, but swap!! is not clojure.core/swap!

12:52 lynaghk: ibdknox: do you have an example of calling code?

12:52 hiredman: so when swap!! is used you know it is different from clojure.core/swap!

12:52 if he wants a couchdb atom, use swap!!

12:53 (in fact, doesn't avout support exactly that?)

12:53 oh, avout has a mongo plugin, not couch

12:53 ibdknox: lynaghk: https://www.refheap.com/paste/2658

12:54 fliebel: hiredman: he is me. I agree a distinction between distinct things is good, but they do use the same compare-and-set concept.

12:54 ibdknox: hiredman: in my case it's not any different it does exactly what swap! does, it just does it on a subpart of the atom automatically as opposed to needing to do update-in ...

12:56 hiredman: ibdknox: I think there are other arguments that could be made there: A looks like an Atom, and you can swap! it like an atom, but swap! does something different? is that good?

12:57 lynaghk: ibdknox: why a new type instead of just wrapping the update-in swap call (similar to how you implemented Waltz)

12:57 ibdknox: lynaghk: because I need the events, the derefs, etc to be local to the path as well

12:58 nDuff: If I want to generate a Java servlet from a Noir application, should I be using ring.util.servlet directly?

13:00 lynaghk: ibdknox; ah, I see. Are you integrating this into any public projects once you have it tidied up, or is it for Light Table?

13:01 ibdknox: hiredman: It's a fair argument. In this case, it behaves exactly as if that bit of data were its own atom and retains exactly the semantics of other atoms. While technically different, it's mostly a transparent convenience - it really is still the underlying atom.

13:02 lynaghk: I'm sure it'll end up in things :) Databinding is wonderful and now that it can be used with idiomatic atom usage, I'll reach for it a lot. Right now, though, it was mostly for light table

13:04 lynaghk: ibdknox: cool. I look forward to seeing what you do with it.

13:07 technomancy: ibdknox: ISTR reading an essay from Rich in early days where he says he explicitly rejected Erlang's transparently-distributed approach for built-in stuff

13:08 8 fallacies of network computing and all that

13:08 ibdknox: technomancy: I'm not talking about distributed at all

13:08 technomancy: it's just a reference to a subpart of an atom

13:09 technomancy: oh, ok; getting my threads crossed here I guess

13:09 fliebel: technomancy: I'm the one talking about distributed stuff.

13:09 technomancy: http://bc.tech.coop/blog/081201.html <- grep for "transparent distribution isn't transparent"

13:13 TimMc: technomancy: Oh god, the title of that article -- I hope not!

13:15 technomancy: TimMc: yeah, taken a certain way it's kinda loper-os-ish

13:24 TimMc: ?

13:27 hiredman: technomancy: the full thing is on clojure.org somewhere

13:30 ah it's in http://clojure.org/state

13:37 technomancy: cool

13:39 y3di: "Your 'thin sliver' idea is intriguing. Maybe we can call slivers "simple components" and build bigger things out of them. I wonder if there would be any benefit to that?" -- haha

13:55 antoineB: hello, i am looking for a function that do: (fun (fn [a b] (+ a b)) [1 2 3]) => [3 5]

13:55 dan_b: given a project created with "lein2 new foo", what (if anything) in its src/ directory should I expect to have been loaded when I run clojure-jack-in

13:55 antoineB: it don't work with apply

13:56 dan_b: because right now, nothing whatsoever and I can't tell if it's my error or if my expectations are wrong

13:57 duck1123: dan_b: lein swank (what jack-in uses) doesn't require any namespaces, you'll have to require your namespace first

13:58 tmciver_: antoineB: I think you should take a look at 'reductions'

13:58 hmm, perhaps no. something involving partition-all . . .

14:01 Borkdude: antoineB: reductions

14:01 ,(reductions + [1 2 3])

14:01 clojurebot: (1 3 6)

14:01 Borkdude: ow wait ;-)

14:02 antoineB: from [1 2 3] i want [3 5]

14:03 so do 1 + 2 and 2 + 3

14:03 tmciver_: ,(map (fn [ [a b] ] (+ a b)) (partition 2 1 [1 2 3 4 5))

14:03 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

14:03 hiredman: always use partition-all

14:03 tmciver_: ,(map (fn [ [a b] ] (+ a b)) (partition 2 1 [1 2 3 4 5)))

14:03 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

14:03 tmciver_: agh

14:03 ,(map (fn [ [a b] ] (+ a b)) (partition 2 1 [1 2 3 4 5]))

14:03 clojurebot: (3 5 7 9)

14:04 tmciver_: I suspect there's a slightly less verbose way to do that.

14:05 hiredman: always use partition-all

14:05 antoineB: i am not used to extra syntax form of clojure

14:07 hiredman: in this case (if i understand partition-all well) we din't need partition-all because we use a length of 2 and a pace of 1

14:07 TimMc: &(let [x [1 2 3 4]] (map + x (drop 1 x)))

14:07 lazybot: ⇒ (3 5 7)

14:09 antoineB: tmciver_: TimMc: thank you, i will use the tmciver solution, because i don't understand TimMc's

14:12 TimMc: ...

14:13 antoineB: ok i get it

14:14 Borkdude: (doc macrolet)

14:14 clojurebot: Titim gan éirí ort.

14:14 Borkdude: ,(doc macrolet)

14:14 clojurebot: It's greek to me.

14:14 Borkdude: ,(resolve 'macrolet)

14:14 ,(+ 1 2 3)

14:15 Licenser: great you broke it!

14:15 ,(+ 1 1)

14:15 totally did

14:15 Scriptor: &(+ 1 1)

14:15 lazybot: ⇒ 2

14:15 clojurebot: nil

14:15 6

14:15 2

14:15 Scriptor: hah

14:15 Licenser: slooow

14:15 Scriptor: ,(+ 1 1)

14:15 clojurebot: 2

14:15 Borkdude: ,(resolve 'macrolet)

14:15 clojurebot: nil

14:15 Borkdude: ah

14:15 Scriptor: there we go

14:16 Borkdude: ,(defmacro foo [] nil)

14:16 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

14:16 Borkdude: ah

14:17 I used to program in common lisp and I remember having written this kind of macro: http://cljbin.com/paste/4fa962ffe4b0871973ed1888

14:19 so (with-window w 2 [1 2 3] (apply + w)) would return [3 5] ;-)

14:20 HCumberdale: what is your clojure setup?

14:20 Chousuke: I suspect LOOP in common lisp can do that for you :p

14:20 HCumberdale: Anyone tried JLine ?

14:20 Borkdude: chousuke I used loop inside the macro probably

14:21 technomancy: HCumberdale: jline1 is awful; jline2 is pretty good

14:21 HCumberdale: technomancy: your emacs starter kit does not use it, right?

14:21 it is emacs & slime ?!

14:22 technomancy: jline doesn't have anything to do with emacs, no

14:23 hyPiRion: Just excuse me for a moment

14:23 ,(remove #{2 5} (into #{} [(denominator 1/2)]))

14:23 clojurebot: ()

14:23 dnolen: mmarczyk: at some point we might want to back out the prototype protocol tag trick for inline protocol defs.

14:24 Borkdude: chousuke, found it: https://gist.github.com/2638228

14:25 HCumberdale: technomancy: here is a setup with emacs (modded for macosx as aquamacs) http://paulbarry.com/articles/2008/07/02/getting-started-with-clojure-and-aquamacs

14:25 zakwilson: My initial look at reducers seems to suggest reducers/map isn't as parallel as the likes of useful/pcollect

14:25 dnolen: mmarczyk: my benchmarks from yesterday seem to show that it will trigger deoptimization in V8.

14:25 technomancy: clojurebot: blogs?

14:25 clojurebot: make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive

14:25 technomancy: crap

14:26 clojurebot: blogs |are| never to be trusted

14:26 clojurebot: You don't have to tell me twice.

14:26 technomancy: HCumberdale: ^^

14:26 that blog post is painfully outdated =\

14:26 hyPiRion: crap.

14:26 HCumberdale: oh...

14:27 zakwilson: Of course, I tried reducers on 1.4, which may not be a good idea.

14:29 nDuff: Hmm.

14:29 hyPiRion: Anyone encountered this bug before? http://i.imgur.com/bXeF5.png

14:29 HCumberdale: The vimclojure repl drives my crazy

14:30 hyPiRion: When checking for equality on (denominator 1/2) and 2, it returns true.

14:32 fliebel: hyPiRion: Weird, but why on earth did you make an image of that?

14:33 nDuff: Is current noir known to work (or not) on Clojure 1.4.0? I'm getting a compile-time error (NoSuchMethodError) with 1.3.0-beta4, perhaps on account of the clj-stacktrace dependency: https://gist.github.com/5bef5eb161394e66cd58

14:33 hyPiRion: fliebel: Good question...

14:36 fliebel: hyPiRion: really weird...

14:36 Borkdude: I'm reading some CL code of 7 years ago, the parens must have driven me crazy in let*… https://gist.github.com/2638319

14:37 fliebel: aha!

14:37 &(class (denominator 1/2))

14:37 lazybot: ⇒ java.math.BigInteger

14:38 fliebel: hyPiRion: ^

14:38 hyPiRion: fliebel: Ah

14:39 fliebel: Thank you. Still weird though.

14:39 fliebel: similarly: ##(= #{2.0} #{2})

14:39 lazybot: ⇒ false

14:40 hyPiRion: &(remove #{2 5} (vec (into #{} [(denominator 1/2)])))

14:40 lazybot: ⇒ ()

14:40 fliebel: But then I would think ##(= #{[]} #{()}) would also return false

14:40 lazybot: ⇒ true

14:40 hyPiRion: So that's weird.

14:40 Bronsa: ,(= [] ())

14:41 clojurebot: true

14:41 fliebel: Bronsa: Clojure normally does equality by interface, so that ##(= 2.0 2)

14:41 lazybot: ⇒ false

14:41 fliebel: ... that worked in my repl.

14:42 Borkdude: ,(= 2 2.0)

14:42 clojurebot: false

14:42 hyPiRion: Yeah, repl and the bots aren't equivalent.

14:42 ,(== 2 (denominator 2))

14:42 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Ratio>

14:42 Borkdude: in my repl false

14:42 hyPiRion: whoops

14:42 fliebel: &(= 1 1/1)

14:42 lazybot: ⇒ true

14:42 hyPiRion: ,(== 2 (denominator 2))

14:42 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Ratio>

14:43 hyPiRion: Gah, sorry.

14:43 ,(== 2 (denominator 1/2))

14:43 clojurebot: true

14:43 fliebel: yea, so my point was that normally 2 different number types or 2 different collection types can be equal.

14:44 Wild_Cat: &(= (.intValue 2.0) 2)

14:44 lazybot: ⇒ true

14:44 fliebel: even ##(= [1] [1.0]) is true in my repl.

14:44 lazybot: ⇒ false

14:45 fliebel: But then, I'm on 1.2.1

14:45 hyPiRion: &(identity? 2 (denominator 1/2))

14:45 lazybot: java.lang.RuntimeException: Unable to resolve symbol: identity? in this context

14:45 fliebel: yea, something changed in 1.3

14:46 hyPiRion: &(identical? 2 (denominator 1/2))

14:46 lazybot: ⇒ false

14:46 hyPiRion: There we go - I suppose they check whether they're identical or not.

14:46 fliebel: It'd be great if someone more knowingly about clojure equality could jump in.

14:48 hyPiRion: ,(doc =)

14:48 clojurebot: "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."

14:48 hyPiRion: It's probably not more complicated than that.

14:49 fliebel: " and compares numbers and collections in a type-independent manner"

14:49 That is what it does for 1.2... most of the time, but it seems this does not hold for 1.3+ anymore

14:50 hyPiRion: Kind of weird that ##(= 2.0 2) isn't equal then, but maybe there's some floating point magic behind the scenes.

14:50 lazybot: ⇒ false

14:50 S11001001: no, = is no longer numeric equality at all

14:51 fliebel: ah! ##(doc ==)

14:51 lazybot: ⇒ "([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false"

14:51 fliebel: &(== 2.0 2)

14:51 lazybot: ⇒ true

14:51 hyPiRion: S11001001: Is the doc outdated then, or is my comprehension of the doc wrong?

14:52 "compares numbers and collections in a type-independent manner.

14:52 S11001001: hyPiRion: probably it shouldn't say numbers anymore, though I think it still applies in some cases

14:52 hyPiRion: Ah, okay.

14:53 S11001001: ,(= (Long/fromValue 42) (Integer/fromValue 42))

14:53 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: fromValue, compiling:(NO_SOURCE_PATH:0)>

14:53 S11001001: well, one of those

14:54 hyPiRion: ,(= (Long. 42) (Integer. 42) (denominator 1/2))

14:54 clojurebot: false

14:54 S11001001: er

14:54 ,(= (Long. 42) (Integer. 42))

14:54 clojurebot: true

14:54 S11001001: 1/2?

14:55 hyPiRion: Lost a 4 there.

14:55 ,(= (Long. 42) (Integer. 42) (denominator 1/42))

14:55 clojurebot: true

14:55 S11001001: hmm, I did not know about denominator

14:56 fliebel: there's.. the other as well

14:56 hyPiRion: BigInteger, Short and friends?

14:56 S11001001: enumbriator

14:56 fliebel: $findfn 1/2 1

14:56 lazybot: [clojure.core/unchecked-inc-int clojure.core/numerator]

14:56 hyPiRion: numberator

15:04 * nDuff grumbles at clj-stacktrace being distributed AOT-compiled, and thus incompatible with other Clojure versions

15:05 nDuff: ...actually, no...

15:06 * nDuff wonders if it's something being imported from clj_stacktrace? One way or another, he's getting a dependency on an old signature for clojure.lang.RT.keyword into his stack...

15:08 nDuff: s/stack/classpath/

15:14 Borkdude: $findfn [1 2 3] [3 5]

15:14 lazybot: []

15:14 Borkdude: ;-)

15:16 raek: $findfn 3 1

15:16 lazybot: []

15:17 raek: $findfn 3 1

15:17 lazybot: []

15:17 raek: $findfn 3 1

15:17 lazybot: []

15:17 * raek hoped for rand-int

15:18 gfredericks: $findfn 3 1

15:18 lazybot: []

15:19 gfredericks: pff. randomness.

15:19 Bronsa: $findfn 3 2

15:19 lazybot: [clojure.core/unchecked-dec clojure.core/unchecked-dec-int clojure.core/dec' clojure.core/dec]

15:19 Bronsa: no luck.

15:19 gfredericks: Bronsa: bet it returned 1 that time

15:19 Bronsa: what about

15:19 $findfn 3 0

15:19 lazybot: []

15:20 amalloy: $findfn 1 0

15:20 lazybot: [clojure.core/unchecked-dec clojure.core/rand-int clojure.core/unchecked-dec-int clojure.core/dec' clojure.core/dec]

15:20 Bronsa: that's cheating

15:20 amalloy: $findfn [4] 4

15:20 lazybot: [clojure.core/last clojure.core/peek clojure.core/first clojure.core/rand-nth]

15:42 neotyk: Hello everyone!

15:42 fliebel: neotyk: Hi

15:44 dnolen: neotyk: if I don't hear from any dissenters, I'll probably apply your patch later this evening or sometime tomorrow.

15:45 Borkdude: &findarg map % [1 2 3] [3 4 5]

15:45 lazybot: java.lang.RuntimeException: Unable to resolve symbol: findarg in this context

15:45 Borkdude: $findarg map % [1 2 3] [3 4 5]

15:45 neotyk: dnolen: great :)

15:45 lazybot: []

15:45 Borkdude: $findarg map % [1 2 3] [2 3 4]

15:45 lazybot: [clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']

15:47 jwr7: rhickey: Finished reading the reducers blog post. Great thinking. It will become *really* useful for me with multiple sources and primitive-transmitting reducer function pipelines, though.

15:47 beffbernard: Anybody using Jenkins for CI? I'd like to include the GIT_COMMIT in the generated war but not sure which approach to take. Suggestions?

15:48 Borkdude: … I wonder what funcall in Clojure is … ;-)

15:48 $findarg map % [- + *] [1 2 3] [1 2 3] [1 2 3] [-1 6 27]

15:48 lazybot: [clojure.core/trampoline]

15:48 Borkdude: :P

15:48 rhickey_: jwr7: yeah, primitives will be huge, I wanted to ship something before getting into that :)

15:49 jwr7: rhickey_: I wonder about the expected useful granularity of work when using fork/join though.

15:50 rhickey_: jwr7: you can control that with an argument to fold

15:50 not discussed in post

15:51 jwr7: rhickey_: you should do a BOF session about reducers at EuroClojure :-)

15:51 rhickey_: fold n combinef reducef coll is the full sig

15:51 fliebel: neotyk: Are you going to give your presentation at amsclj tomorrow?

15:51 rhickey_: n being the partition size hint

15:51 neotyk: fliebel: yes, working on it )

15:52 Borkdude: neotyk: I'm also coming, taking a student with me

15:52 jwr7: Now that I think about it, I'd really love to see a session where people complain about what they found problematic in Clojure and Rich answers.

15:52 fliebel: neotyk: I'm in amsterdam tomorrow, but in the wrong place, so I'll see it at euroclojure.

15:53 S11001001: I wouldn't, see Bruce's First Law of Lisp

15:53 neotyk: fliebel: too bad, would appreciate your feedback

15:54 fliebel: $google Bruce's First Law of Lisp

15:54 lazybot: [Scott's Space - Programming Quotes] http://www.stgray.com/quotes/programmingquotes.html

15:54 jwr7: rhickey_: funny how your blog post fits right into what I've been thinking over the last week or so. I wrote a lot of code that operates on sets (of integers, mostly). I kept thinking that there must be better abstractions than just map and reduce.

15:54 fliebel: S11001001: What is the law?

15:55 (and does first imply there is a rest law of lisp?)

15:57 S11001001: If it does not do exactly what you expect with zero hours consideration or experience, it is a bug in Lisp that should be fixed.

15:57 from http://web.archive.org/web/20070712062323/http://brucio.blogspot.com/

15:57 TimMc: nice

16:02 furth: ?

16:12 felideon: oh brucio

16:12 nDuff: Ahh; I'll hazard it's clojure being listed in dependencies rather than dev-dependencies for noir that's messing me up.

16:13 Raynes: nDuff: Noir itself doesn't have any code AOT compiled against any version of Clojure. Perhaps one of its dependencies does.

16:14 hiredman: reducers needs partition with

16:14 nDuff: Raynes: yup, noticed that looking inside the jar

16:14 Raynes: nDuff: I'm pretty sure that none of them do.

16:15 nDuff: Raynes: ...the other thing I'm suspicious of -- something in the chain is pulling in clojure-1.2.1.jar; I don't expect that having it in the classpath with clojure-1.4.0 is such a great idea.

16:15 hiredman: partition-by I guess

16:15 * nDuff is in the process of figuring out just what that is.

16:15 Raynes: nDuff: In fact, I'd expect that to be the problem.

16:15 nDuff: Do you have a version of Clojure specified in your project?

16:15 nDuff: Yes.

16:16 Raynes: It should override everything else unless somebody used a version range somewhere.

16:17 nDuff: Is that true even when using Maven rather than Leiningen?

16:17 Raynes: Leiningen uses maven for dependency resolution, so the rules apply to both.

16:17 nDuff: Ahh.

16:17 LauJensen: Good evening gents

16:19 S11001001: it may not override if someone used a hard version constraint (hopefully they didn't, they are bad)

16:20 fortunately the default is soft constraint

16:20 and no doubt the whole maven dependency tree would have fallen apart long ago were that not the case

16:23 jwr7: Is anybody working on a library for manipulating sets of integers in Clojure with good performance?

16:27 jonaskoelker: jwr7: you can use the java primitives?

16:27 (that's not a question, that's a statement; the question is: is that what you were asking about / is that useful knowledge to you?)

16:28 aaelony: is anyone using Apache Mahout via Clojure? is java-interop the only way to go?

16:40 nDuff: Hmm. Something was just very odd with my environment; rebuilt from a completely clean tree, and all's well.

16:46 Raynes: nDuff: `lein deps :tree` is helpful for finding out where jars are coming from btw.

16:49 TimMc: nDuff: mvn clean; rm -r ~/.mvn/repository/; mvn

16:49 Oh wait, you're using lein. :-P

16:53 nDuff: TimMc: ...no, I am indeed using Maven.

16:53 HCumberdale: ;)

16:54 nDuff: (some of the dependencies use lein, but my code is a JIRA plugin, and Atlassian's build system bits are all built as Maven plugins)

16:54 TimMc: I call that the Maven three-finger salute.

16:55 Raynes: nDuff: Your software is broken. Use leiningen. Assimilate. ASSIMILATE.

16:56 Oh, Atlassian crap.

17:13 jodaro: i'd talk shit too but i'm stuck with perforce and bugzilla right now

17:16 oh and sharepoint

17:17 Raynes: jodaro: Perforce is the awesome.

17:18 TimMc: We switched from perforce to svn.

17:18 Borkdude: sharepoint…

17:18 TimMc: I think there's some regret from that decision.

17:18 Borkdude: don't get me started

17:19 jodaro: i haven't been able to get into it, really

17:19 TimMc: I'm agitating for git. Might get it, too.

17:19 jodaro: yeah i'm missing github a lot

17:19 having everything in one place is nice

17:20 lancepantz: aaelony: hey dude

17:20 aaelony: so you're playing around with mahout?

17:29 aaelony: lancepantz: I'm about to. Do you have a nice clojars link for me?

17:30 lancepantz: aaelony: nope, wish i did

17:30 aaelony: lancepantz: i guess java-interop then

17:30 lancepantz: i messed around with mahout when it was young, really cool stuff

17:31 aaelony: yeah, I think its matured a lot in the past year or two

17:31 Raynes: $google mahout

17:31 lazybot: [Apache Mahout: Scalable machine learning and data mining] http://mahout.apache.org/

17:31 Raynes: Man, stop making my machine learn things. It already knows far too much.

17:32 aaelony: hehe, svm-clj looks interesting too

17:33 in any case, I'm dreaming of a cascalog-mahout package... that'd be pretty cool

17:42 Roxxi``: What is the clojure idiom for iterative function invocation (like map but with no return value)

17:43 dnolen: Roxxi``: perhaps you want doseq?

17:43 Roxxi``: Yup, thanks.

17:45 muhoo: heh, tangle of circular require's

17:45 time to refactor :-/

17:46 i'm surprised the compiler doesn't puke on that, actually

17:46 technomancy: it will, once you restart your process

17:49 dan_b: I'm sure this has been asked before, but maybe the answer's changed recently: after adding a dependency in project.clj, is there any way to make a running session (started with clojure-jack-in) find the new jar(s)?

17:49 nDuff: dan_b: pomegranate can dynamically download and load new dependencies

17:49 dan_b: https://github.com/cemerick/pomegranate

17:51 dan_b: ooh, looks cool. thx

17:54 * muhoo runs lein2 check :-)

17:54 jtoy: how do you print out current time in clojure?

17:55 Raynes: &(str (java.util.Date.))

17:55 lazybot: ⇒ "Tue May 08 14:55:07 PDT 2012"

17:55 devn: jtoy: you may want to look into joda time

17:55 Raynes: Unless he really only wants to print out the time.

17:56 devn: unless you really only want to print out the time

17:56 S11001001: what's time, anyway

17:56 technomancy: it should be a syntax error to use j.u.Date for anything else

17:56 jtoy: devn: Raynes way is fine i guess, I don't use java at all, but i guess clojure doesn't have a 'native' way

17:56 S11001001: what's native, anyway

17:56 Raynes: Clojure doesn't have a 'native' way to do much of anything.

17:56 There is a reason it is hosted on the JVM. ;)

17:57 devn: S11001001: id like to raise you a mustache

17:57 Raynes: Unless we're defining native as 'a clojure function'.

17:57 I'm defining it as 'a clojure function that does not call a Java method or something'

17:57 S11001001: I fold, no mustachioed shenanigans for me

17:57 Raynes: But they always do somewhere down the line.

17:58 zakwilson: Didn't somebody propose an LLVM port?

17:58 TimMc: Of course. :-P

17:58 antares_: jtoy: if you won't manipulate time in any way, (java.util.Date.) is good enough

17:59 jtoy: Clojure 1.4 reader even has literal support for dates/instances

17:59 zakwilson: Otherwise java.util.Date is a nightmare you don't want anything to do with.

18:00 nDuff: ...that reminds me -- what ever happened to pods?

18:15 ynniv: antares_: what does the 1.4 reader do when it sees a date?

18:16 Raynes: It sprays breath freshener in its mouth and pulls the flowers out from behind its back.

18:16 ynniv: that would be better than instantiating a j.u.Date

18:17 antares_: ynniv: it prints them out using instant literals, for example: {:date #inst "2012-05-08T22:16:26.560-00:00"}

18:19 ynniv: Google sent me to http://dev.clojure.org/pages/viewpage.action?pageId=950382 . That looks like a good idea.

18:20 you get j.u.Dates unless you specify otherwise

18:20 dabd: is there anyway to do (defn foo [..] ... (map recur ... )) ?

18:21 brehaut: dabd: do you want map to recur into foo ?

18:21 hyPiRion: dabd: No, it's not tail-callable.

18:22 dabd: yes

18:22 ibdknox: just call foo again then

18:22 dabd: within foo i want to call foo with each element of a list

18:22 hyPiRion: but map foo should be good enough.

18:22 ynniv: it appears that you're trying to reference the current function using 'recur', which sounds reasonable but doesn't make sense for what 'recur' does

18:23 dabd: isn't recur used to reference the current function?

18:23 ynniv: no, it's part of loop/recur

18:24 recur as a reference to the current function is a scheme thing

18:24 dabd: (map foo ...) works

18:24 emezeske: ynniv: I'm pretty sure the function itself can be used as a recur point

18:24 ynniv: But recur has to be in the tail position, that's the restriction

18:24 * nDuff nods -- current function is used if no loop is present

18:24 amalloy: really? recur points to the current function in scheme? i've never heard of that

18:25 ynniv: emezeske: yes, but it's a syntax, not a first class function

18:25 dabd: so the factorial here http://clojuredocs.org/clojure_core/clojure.core/recur could be written by replacing recur->factorial ?

18:26 gtrak: is there an 'into' with a filter function? I want to do some extra checks if there are duplicate keys

18:26 emezeske: dabd: No. In that case it's recurring to the (loop ...)

18:26 ynniv: dabd: referencing a function by name in its definition only works with defn

18:27 dabd: ok

18:27 ynniv: hmm, my repl suggests otherwise

18:27 gtrak: I want access the the accumulator during the reduce I suppose

18:28 I should just use reduce

18:30 ynniv: ,((defn factorial [cnt acc] (if (zero? cnt) acc (recur (dec cnt) (* acc cnt)))) 4 1)

18:30 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

18:30 ynniv: hmm

18:30 guess you aren't going to see that

18:30 but its the same as

18:30 ((defn factorial [cnt acc] (if (zero? cnt) acc (factorial (dec cnt) (* acc cnt)))) 4 1)

18:39 gtrak: hmmmm......

18:40 ,(+)

18:40 clojurebot: 0

18:40 gtrak: ,(-)

18:40 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$->

18:40 gtrak: why?

18:40 clojurebot: http://clojure.org/rationale

18:41 xeqi: ,(- 1)

18:41 clojurebot: -1

18:45 AimHere: The why is probably because '-' has to have some special case code going on with less than 2 arguments

18:46 gtrak: a buddy told me - isn't associative

18:46 was just thinking about it in context of the reducers news

18:47 amalloy: gtrak: right. - and / don't form monoids over the integers (or reals), in the way that + and * do. i'm not sure if that's really relevant, since they do still have an identity value, which the zero-arg versions could return

18:47 gtrak: right

18:48 amalloy: i think it's more relevant that like...there's a meaning of (*) and (+) that "makes sense", whereas for (-) to return 0 is not very obvious, and why should (/) return 1?

18:49 gtrak: ,[(reduce - 1) (reduce / 2)]

18:49 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

18:49 dreish: I would imagine it's a more-or-less stylistic decision driven by the one-arg special cases.

18:49 gtrak: ,[(reduce - [1]) (reduce / [2])]

18:49 clojurebot: [1 2]

18:50 dreish: + and * have a consistent meaning regardless of how many args they are called with.

18:50 gtrak: clearly the identity is at play for reduce to work

18:50 S11001001: iow + and * are consistent with concat for the sum and product monoids

18:50 jtoy: how do you get a unix time from a date in clojure? it seem like in normal java you do: Date date = new Date (); date.setTime((long)unix_time*1000);

18:50 dreish: ,(reduce str [1])

18:50 gtrak: how do you guys know this stuff? haskell?

18:50 clojurebot: 1

18:51 dreish: fn never gets called if coll only has one element

18:51 technomancy: jtoy: if you just want a number you can do System/getCurrentTimeMillis

18:51 gtrak: ah, actually, my example was worthless

18:51 technomancy: and divide by 1000 if you want secondsn

18:51 amalloy: gtrak: well, a little haskell. but i was introduced to monoids when i watched chouser's video on finger trees

18:51 S11001001: gtrak: consider: can you write an id such that for all nums i, (+ id i) yields i?

18:52 numerically speaking, discounting weird type conversions & such

18:53 jtoy: technomancy: that is all i want, (System/getCurrentTimeMillis) isn't found?

18:53 gtrak: S11001001, ah, yea, that works for minus only if you put id on the right :-)

18:53 dreish: ,(System/currentTimeMillis)

18:53 clojurebot: 1336517597611

18:53 S11001001: gtrak: the point of the id is that it has no effect; you can put as many in as you want, wherever you want, and the ids won't change the result

18:54 hiredman: jtoy: that example code goes in the opposite direction of your question

18:54 gtrak: right

18:54 jtoy: hiredman: why?

18:54 hiredman: your question reads like you want to get the unix timestamp of a java.util.Date, but that example code turns a unix timestamp in to a java.util.Date

18:55 dreish: ,(System/getenv "USER")

18:55 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USER)>

18:55 S11001001: gtrak: you can also find an id for *, and hell, for concat as well

18:55 jtoy: I just want current time, (System/currentTimeMillis) seems to work

18:55 dreish: _Nice_.

18:56 S11001001: gtrak: there are very many other identities, in fact exactly one for each monoid, but what you won't find is one for - or / :)

18:57 gtrak: fun :-)

19:01 S11001001: gtrak: I think the list of clojure data structures that don't imply monoids is shorter than the list of those that do. Since monoidal identities are quite useful in ordinary generic programming, I suggest keeping them all in mind

19:02 gtrak: is this covered in category theory texts a bit?

19:03 amalloy: yeah, monoids are one of the most useful/common categories in terms of CS

19:04 gtrak: I will prioritize this book in my queue

19:05 still trying to slog through reasoned schemer :-)

19:08 ynniv: dreish: you answered my question before I even asked it. awesome

19:09 two bits up. 3!

19:24 zii-prime: argh. How do I test if a thing has been def'd yet?

19:24 S11001001: ,(doc ns-publics)

19:24 clojurebot: "([ns]); Returns a map of the public intern mappings for the namespace."

19:24 technomancy: ,(doc resolve)

19:24 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

19:24 S11001001: &such

19:24 lazybot: java.lang.RuntimeException: Unable to resolve symbol: such in this context

19:24 S11001001: :)

19:26 zii-prime: ooh thanks :)

19:30 better question: is there an easy way to test for a var being unbound?

19:31 brehaut: ,(doc bound?)

19:31 clojurebot: "([& vars]); Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided."

19:31 nDuff: zii-prime: what's the context? If your goal is to avoid redefinitions, you might want to use defonce

19:36 zii-prime: nDuff: eh, i'm prolly just micro-optimizing the syntax... context: only want one instance of the app open; if main is called again it should close the previous window

19:36 defonce is good enough

20:46 XPherior: Can someone explain why this require call doesn't work? https://gist.github.com/2640779

20:48 emezeske: XPherior: Care to elaborate on what you mean by "doesn't work"?

20:48 XPherior: emezeske: Yeah, my fault. Let me add the stack trace to the gist.

20:48 emezeske: ^_^

20:48 XPherior: emezeske: It's there now. :)

20:49 LuminousMonkey: main: core in project.clj

20:50 Isn't it supposed to be main: deps-sandbox.core

20:50 And do you need (gen-class) in the namespace declaration?

20:51 XPherior: LuminousMonkey: I don't see that.

20:51 LuminousMonkey: That fixed it, thanks :)

20:51 I'm still getting used to Clojure project structure. Little things keep throwing me off.

20:52 LuminousMonkey: I'm the same. :)

20:52 XPherior: Also, if I try to evalulate a form in Emacs, it obviously can't find the packages I'm using in the file. Is this a common problem, or am I going about it wrong?

20:53 hiredman: you need to restart the jvm when you add a dependency like that

20:53 gfredericks: rhickey's recent post makes me think of functors

20:54 XPherior: hiredman: That seems really.. Extreme?

20:54 cshell: I just saw that post, didn't quite understand it the first time through - any good pointers to books/blogs that would help?

20:55 gfredericks: cshell: pff; I only know about functors from reading about monads. Probably that means you should just learn haskell :)

20:55 LuminousMonkey: XPherior: Can you explain what you mean in another way?

20:55 XPherior: I think I might know what you mean, but I'm not sure.

20:56 XPherior: LuminousMonkey: Hm, I'll try. So I'm trying to play around with Hiccup, and I want to just write some code and evalulate the form inside Emacs. When I try that though, Emacs doesn't know where Hiccup is.

20:56 hiredman: XPherior: there are various mechanisms for loading code in to a jvm without using the classpath (which is fixed and static) none of which have really taken off

20:56 mebaran151: gfredericks: more technically monoids I think :)

20:56 hiredman: so M-x clojure-jack-in again

20:56 gfredericks: mebaran151: eh?

20:57 XPherior: hiredman: Got'cha.

20:57 LuminousMonkey: Have you (require '[hiccup.core :as hic]) in SLIME?

20:57 XPherior: hiredman: Odd. I don't have that function. Let me go figure that out.

20:57 hiredman: XPherior: get a newer clojure-mode

20:57 LuminousMonkey: Or evaled the ns declaration then switched to that ns in SLIME?

20:57 XPherior: LuminousMonkey: It blew up

20:58 Same trace

20:58 hiredman: Okay, I'll do that now

20:58 hiredman: I recommend running from the clojure-mode git, but the in one in marmalade should be fairly up to date

20:59 cshell: gfredericks: thanks, i'm still trying to learn clojure though :)

20:59 gfredericks: cshell: don't worry, several paragraphs later it is bogging me down too

21:02 cshell: gfredericks: yeah, I guess I'll have to read it several times more

21:02 mebaran151: gfredericks: he's talking about folds in terms of monoid operations, as opposed to just mapping a function (i.e. instead of mapping into collections of the same type (list -> list), which I think is a requirement of functors, he's building a more general framework where you have two functions, one to get the item of the first collection and another to combine with composite result, that you can then pipe somewhere else

21:05 cshell: mebaran151: man, i've been stuck in simple java land for way too long

21:05 mebaran151: cshell: Haskell is a good way to stretch your brain this way :)

21:06 cshell: mebaran151: better thank clojure?

21:07 gfredericks: mebaran151: I will rapidly alternate between reading the post and your paragraph and see what happens

21:07 cshell: gfredericks: maybe i should try that too

21:08 mebaran151: cshell: you can actually get stuff done in clojure; the type discipline in Haskell makes you deal with the concepts a little more directly, which can be burdensome in the beginning of a project (sometimes I just want to throw something on a web page, heh)

21:09 gfredericks: Haskell on a Horse?

21:11 mebaran151: gfredericks: I played with Yesod a little bit, which seemed well designed but getting non-trivial stuff up and running in Haskell can be a little tricky

21:11 * gfredericks doesn't doubt it

21:12 mebaran151: you look at these type signatures Handler a b c q f g and just wonder how you'll get your humble little string where you actually want it

21:13 gfredericks: these reducers are rather interesting

21:14 mebaran151: I only just now got to the fold part

21:33 TimMc: weavejester: Thoughts on adding an "initialize" feature to the ragtime migrations protocol? Could really help with DBs. I'd be willing to do the impl.

21:34 weavejester: TimMc: Could you explain what you mean?

21:36 TimMc: weavejester: Well, ragtime's sql support currently looks pretty good once you have a DB with a schema and a migrations table. But how do you handle the initial condition, where the DB is empty and there isn't a migrations table yet?

21:37 weavejester: TimMc: The SQL database type checks to see if there's a migrations table and if none exists, it creates one.

21:37 gfredericks: supposedly elastic beanstalk lets you deploy ring apps. Does anyone know if that totally precludes using aleph asynchronously instead?

21:38 TimMc: weavejester: (I'm having trouble with my windowing system at the moment, so I won't be able to look at the code for a few minutes.)

21:38 weavejester: gfredericks: Unless things have changed, elastic beanstalk deploys via war to a Tomcat 6 server. No Netty, no async.

21:39 gfredericks: weavejester: okay, thanks

21:43 gozala: Can anyone explain what exactly rfn does https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L125

21:43 TimMc: weavejester: So the implied setup code would be: 1) Create JDBC spec, 2) connect and create schema if probes indicate certain tables don't exist, 3) create a SQL Migrations record, 4) migrate-all ?

21:45 weavejester: TimMc: Currently each time a migration is applied or removed for an SqlDatabase, the migrations table is created if it doesn't exist.

21:45 TimMc: I guess it could be more efficient with a setup/teardown

21:46 I need to get to sleep though :)

21:47 TimMc: weavejester: Wasn't thinking about efficiency, just simplicity of program initialization.

21:47 OK, g'night. Thanks for setting me straight, I think I understand it now.

21:48 weavejester: Night

21:51 TimMc: I guess it doesn't make sense for ragtime to be responsible for detecting blank schemas.

22:05 muhoo: i remember there being some neat lein thing that'll automatically reload files in repl when they change? but i forgot its name

22:40 gah, illegal access error. i have a "global" foo.core/*bar*, i'm importing it to other ns's, and at times it seems the ns'es which use that *bar* sometimes catch it when it is unbound. or something. weird.

22:40 this is on a noir app, so there is some dynamic recompilation going on in the background iirc

22:49 * cshell slaps cshell around a bit with a large trout

22:50 * gfredericks gawks

22:55 muhoo: recursive slappage

22:57 (defn smoke-two-joints [] (smoke-two-joints) (recur))

22:57 gfredericks: I don't think that recur ever gets reached

23:00 cshell: hehe

23:04 gfredericks: muhoo: (#(% %) #(% %))

23:07 muhoo: gfredericks: that's my problem with the song!

23:08 it drove me nuts. i thought, "well, if you smoke 2 joints before you smoke 2 joints, and THEN you smoke 2 more, you'll never get to that last smoke 2 joints. it's unreachable!"

23:08 gfredericks: ^ that's like an unDRYable expression

23:08 echo-area: amalloy: I finally end up with this function, dropping-transform: http://pastebin.com/rsbDev0d What do you think?

23:08 muhoo: then i realize, the dude was so stoned, obviously he wasn't thinking about that.

23:09 echo-area: amalloy: The final `loop' form is just an example, not the actual use of inputs.

23:09 muhoo: also, that (#(% %) #(% %)) is great, a clojure fork bomb

23:10 &(#(% %) #(% %))

23:10 lazybot: java.lang.StackOverflowError

23:10 muhoo: ya

23:10 gfredericks: just a stack bomb

23:10 muhoo: try refactoring out the repetition

23:10 muhoo: in the stack bomb, or in that song?

23:10 gfredericks: the stack bomb

23:11 muhoo: &#(% %)

23:11 lazybot: ⇒ #<sandbox3826$eval11950$fn__11951 sandbox3826$eval11950$fn__11951@1f7480>

23:11 muhoo: huh

23:11 &(#(% %))

23:11 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox3826$eval11960$fn

23:11 muhoo: interesting

23:11 gfredericks: &(#(% %) partial)

23:11 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$partial

23:12 gfredericks: boo

23:12 &(#(% %) complement)

23:12 lazybot: ⇒ #<core$complement$fn__3929 clojure.core$complement$fn__3929@1aa4afc>

23:12 muhoo: &(#(% %) identity)

23:12 uh-oh

23:12 &(#(% %) identity)

23:12 lazybot: ⇒ #<core$identity clojure.core$identity@481e6a>

23:13 muhoo: &(#(identity %))

23:13 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox3826$eval12000$fn

23:13 gfredericks: muhoo: the % makes it an arity-1 function

23:13 you can't call it with no args

23:15 muhoo: fun though. maybe i'll play with it later

Logging service provided by n01se.net