#clojure log - May 01 2009

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

0:29 apeiron: ah, so there is a channel.

0:30 durka42: apeiron: there is indeed

0:39 hiredman: ~#clojure

0:39 clojurebot: this is not IRC, this is #clojure. We aspire to better than that.

0:40 apeiron: That's nice, but at the end of the day we're still a bunch of geeks huddled over our computers.

1:59 unlink1: When compiling classes to disk, how do you create a static method callable from java? Here is what I was trying:

2:00 http://paste.pocoo.org/show/115232/

2:01 cads: how do I create a random var that re-evaluates randomly each time its bound in a new context?

2:02 so for example (+ random random random) would add a list of 3 random numbers

2:04 I've been defining a lazy sequence of random objects like (def rand-body (repeatedly #(body 1 (randvec 3) (randvec 3)))))

2:07 actually I mean (def rand-body #(repeatedly #(body 1 (randvec 3) (randvec 3)))))

2:07 unlink1: I can do (import 'statictest) from the repl, but (statictest/testmethod) fails.

2:08 cads: this way rand-body evaluates a new lazy sequence each time it's called.. but now it has to be called each time it's used

2:26 Cark: unlink1 : maybe you need to first compile then import it ?

2:26 unlink1: I did compile it.

2:26 $ ls classes/

2:26 statictest.class statictest__init.class statictest$_testmethod__11.class

2:27 Cark: and it worked with a single segment namespace ?

2:27 unlink1: yes, user=> (compile 'statictest)

2:27 statictest

2:27 Cark: obviously it did work =P

2:28 why the - in friont of your method name ?

2:30 my understanding is that every function in a clojure namespace translates in java land to a static method on the namespace object

2:30 unlink1: "Each method delegates to a function of the same name, prefixed with a hyphen (-)."

2:31 Cark: ah maybe declare it in your ns form then

2:32 i'm questioning the metadata actually

2:36 unlink1: asdf.java:3: cannot find symbol method testmethod()

2:36 (so it can find statictest)

2:36 The java file has statictest.testmethod();

2:36 clojurebot: ?

2:37 unlink1: thank you, clojurebot

11:13 rhickey: anyone going to Java One?

11:31 drewr: rhickey: I wrote a wrapper around javamail. Could this go on the libraries page? http://github.com/drewr/postal/tree/master

11:33 rhickey: drewr: sure, could you please add to http://groups.google.com/group/clojure/browse_frm/thread/affb08d66c048c7f thread?

11:33 drewr: Yep!

11:39 AWizzArd: Hallo

11:42 cemerick: ping

12:18 cp2: drewr: looks nice

12:19 drewr: cp2: Thanks!

12:25 rhickey: drewr: you're in: http://clojure.org/libraries

12:26 technomancy: drewr: any plans for a mail reading library, or are you just interested in sending?

12:27 AWizzArd: I personally would find the reading part also interesting. In my company we currently use a mail module from Apache, but that can only send it seems.

12:27 Holcxjo: technomancy: "reading" as in? IMAP? POP? mbox?

12:28 technomancy: Holcxjo: yeah, javax.mail supports imap and pop

12:29 drewr: technomancy: Just sending for the moment, but inbound will likely come.

12:30 technomancy: cool

12:33 drewr: rhickey: Thanks!

12:45 replaca: rhickey: I wasn't planning on attending Java One, but I work about two blocks away and would be happy to provide any help/support that would be useful

12:46 rhickey: also, still thinking that we'll do a SF Clojure get-together in conjunction (planning to start organizing it next week)

12:46 clojurebot: he works hard so you don't have to

12:46 rhickey: replaca: cool

13:07 replaca: rhickey: Looking at the JavaOne schedule, I was thinking that Tuesday night (after your talks) would be the best time for a get together. Does that seem right to you?

13:08 cp2: ugh, *palmface*

13:08 The World Health Organization will no longer refer to Virus A(H1N1) as 'Swine Flu,' citing ethnic reactions to 'swine,' for example among middle-eastern cultures who feel that swine are unclean.

13:08 * rsynnott wonders will avian (but not owls or eagles) flu follow

13:09 rsynnott: (owls and eagles and a few others being non-kosher)

13:53 eyeris: What is the syntax for sql joins in ClojureQL?

14:02 kotarak: eyeris: there no joins yet in ClojureQL. Note to myself: Have to work on that...

14:02 eyeris: Oh. Ok.

14:03 kotarak: ClojureQL is still work in progress...

14:23 dnolen: anyone know how to get a single back slash in a Java String?

14:23 ,(str "\\")

14:23 clojurebot: "\\"

14:32 hiredman: erm

14:33 dnolen: actually figured it out

14:33 hiredman: \\ is a single blackslash escaped

14:33 dnolen: just confused

14:33 hiredman: ,(str "\n")

14:33 clojurebot: "\n"

14:33 dnolen: ,(println (str "\\"))

14:33 hiredman: it is confusing

14:33 clojurebot: \

14:33 dnolen: ,(str "\\")

14:33 clojurebot: "\\"

14:33 dnolen: was trying to output some data from a webserver and needed a \

14:34 turns out you have to make a string that looks like this "\\\\"

14:34 hiredman: heh

14:34 ,\\\\

14:34 clojurebot: \\

14:34 hiredman: ,\\

14:34 clojurebot: \\

14:34 dnolen: ridiculous

14:34 hiredman: yeah

14:45 Chousuke: ,(str \\)

14:45 clojurebot: "\\"

14:45 Chousuke: ,(str \)

14:45 clojurebot: EOF while reading

14:45 Chousuke: hm :/

18:04 arohner: I'm running a sub-process, and I'd like to blocking read from the process's pipe in a separate thread. Are there any clojure tools to help with that now, or do I have to go to Javaland?

18:07 hiredman: (doc locking)

18:08 clojurebot: Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances.; arglists ([x & body])

18:08 kotarak: j.u.concurrent has also some queues for this kind of thing...

18:08 hiredman: actually, I had something similar recently and I just used a blocking queue of size 1

18:14 arohner: hiredman: thanks

18:17 hiredman: jdk7 comes something called a transferqueue for this purpose

19:17 technomancy: does it bother anyone else to fail to capitalize the first letter of a sentence in a docstring when it's a parameter name?

19:18 AWizzArd: You could alternatively always write parameters in uppercase in doc strings.

19:18 technomancy: AWizzArd: this isn't CL. =)

19:18 kotarak: AWizzArd: bleh ...

19:19 AWizzArd: That way the parameters stand out and can be easier parsed by humans

19:19 Would be nice if parameters could be underlined in the doc string

19:20 technomancy: AWizzArd: ... which isn't possible if they're capitalized

19:20 since identifiers are case-sensitive

19:20 AWizzArd: Inside a string it doesn't matter.

19:21 technomancy: you couldn't recognize identifiers inside a string accurately without being case-sensitive

19:22 kind of nit-picky though

19:26 * technomancy wonders... is (get my-map my-key other-val) really more readable than (or (my-map my-key) other-val) ?

19:26 AWizzArd: Good would be an intelligent IDE which colorizes and/or underlines names of parameters in doc strings. Intelligent in such a sense that if the name of a parameter happens to be a word that is used and not meaning the parameter, it should be recognized.

19:27 kotarak: technomancy: IMHO, the first is clearer for its intention. I never understand why people always use boolean operations to return non-boolean values....

19:28 AWizzArd: The first version documents the code.

19:29 kotarak: Also: the second breaks down on (or ({:foo nil} :foo) :not-found)

19:29 (or false instead of nil...)

19:30 AWizzArd: Right. And it is more complex code (looking at the tree levels)

19:30 technomancy: AWizzArd: to me the two levels in the second correspond more closely with what's really going on.

19:31 kotarak: which doesn't fix it...

19:31 technomancy: what I actually saw was (get my-map my-val nil) which doesn't make any sense at all.

19:32 I guess if you specifically care about nil and false then get is handy.

19:32 kotarak: That of course is only for documentation. It makes explicit, that nil is the default value.

19:33 And it doesn't live by assumption that get returns nil. Theoretically it could return :clojure.core/not-found... (But that's now really far-fetched....)

19:33 Maybe more realistic: get could throw an exception, instead of returning nil...

19:34 technomancy: I just want to be able to name my function "get" without using :refer-clojure. =)

19:34 (not really)

19:35 kotarak: Hmm.. Ok. Either refer-clojure or another name, retrieve?, fetch?, pick?

19:36 AWizzArd: (raushol hashmap key default) :)

19:36 kotarak: :)

19:38 technomancy: mostly kidding

19:41 AWizzArd: And I thought there was a function that throws an exception if a hashmap key wasn't found

19:42 But that was probably nth vs get for vectors

19:50 technomancy: danlarkin: what do you think? http://github.com/technomancy/clojure-http-client/commit/f56556945768da6f00d506131a5b3bcffe532e22

19:50 this should allow posting to forms etc

19:50 chessguy: 'evening gents

20:01 AWizzArd: technomancy: I use htmlunit for that.

20:01 htmlunit is easy to use and can also post when (possibly complex) JavaScript is involved.

20:07 technomancy: AWizzArd: cool; does it leverage Rhino then?

20:11 if it can run JS it must have some kind of built-in DOM emulator?

20:41 enderoute: anyone know how to do the equivalent of "SourceDataLine.class" in clojure?

23:42 cemerick: whoa, nothing in the channel on a Friday night? Where's the geeks? :-D

23:52 zakwilson: Some of them might have lives, cemerick. I, on the other hand am home sick.

23:52 (that is, at home because I am sick, not homesick)

23:53 cemerick: I don't buy that theory. This place was hopping last Friday :-)

23:54 replaca: it seemed to be a pretty quiet day here overall

23:54 danlarkin: ah yes, but this friday the weather was fannnnnnnntastic

23:54 replaca: danlarkin: speak for yourself. Cold and rainy in SF

23:54 danlarkin: here in NY it was a really perfect spring evening

23:55 replaca: that's great! Hope you got to enjiy it.

23:55 *enjoy

23:57 danlarkin: I did! not to rub it in

Logging service provided by n01se.net