#clojure logs

2009-05-01

00:29apeironah, so there is a channel.
00:30durka42apeiron: there is indeed
00:39hiredman~#clojure
00:39clojurebotthis is not IRC, this is #clojure. We aspire to better than that.
00:40apeironThat's nice, but at the end of the day we're still a bunch of geeks huddled over our computers.
01:59unlink1When compiling classes to disk, how do you create a static method callable from java? Here is what I was trying:
02:00unlink1http://paste.pocoo.org/show/115232/
02:01cadshow do I create a random var that re-evaluates randomly each time its bound in a new context?
02:02cadsso for example (+ random random random) would add a list of 3 random numbers
02:04cadsI've been defining a lazy sequence of random objects like (def rand-body (repeatedly #(body 1 (randvec 3) (randvec 3)))))
02:07cadsactually I mean (def rand-body #(repeatedly #(body 1 (randvec 3) (randvec 3)))))
02:07unlink1I can do (import 'statictest) from the repl, but (statictest/testmethod) fails.
02:08cadsthis 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
02:26Carkunlink1 : maybe you need to first compile then import it ?
02:26unlink1I did compile it.
02:26unlink1$ ls classes/
02:26unlink1statictest.class statictest__init.class statictest$_testmethod__11.class
02:27Carkand it worked with a single segment namespace ?
02:27unlink1yes, user=> (compile 'statictest)
02:27unlink1statictest
02:27Carkobviously it did work =P
02:28Carkwhy the - in friont of your method name ?
02:30Carkmy understanding is that every function in a clojure namespace translates in java land to a static method on the namespace object
02:30unlink1"Each method delegates to a function of the same name, prefixed with a hyphen (-)."
02:31Carkah maybe declare it in your ns form then
02:32Carki'm questioning the metadata actually
02:36unlink1asdf.java:3: cannot find symbol method testmethod()
02:36unlink1(so it can find statictest)
02:36unlink1The java file has statictest.testmethod();
02:36clojurebot?
02:37unlink1thank you, clojurebot
11:13rhickeyanyone going to Java One?
11:31drewrrhickey: I wrote a wrapper around javamail. Could this go on the libraries page? http://github.com/drewr/postal/tree/master
11:33rhickeydrewr: sure, could you please add to http://groups.google.com/group/clojure/browse_frm/thread/affb08d66c048c7f thread?
11:33drewrYep!
11:39AWizzArdHallo
11:42AWizzArdcemerick: ping
12:18cp2drewr: looks nice
12:19drewrcp2: Thanks!
12:25rhickeydrewr: you're in: http://clojure.org/libraries
12:26technomancydrewr: any plans for a mail reading library, or are you just interested in sending?
12:27AWizzArdI 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:27Holcxjotechnomancy: "reading" as in? IMAP? POP? mbox?
12:28technomancyHolcxjo: yeah, javax.mail supports imap and pop
12:29drewrtechnomancy: Just sending for the moment, but inbound will likely come.
12:30technomancycool
12:33drewrrhickey: Thanks!
12:45replacarhickey: 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:46replacarhickey: also, still thinking that we'll do a SF Clojure get-together in conjunction (planning to start organizing it next week)
12:46clojurebothe works hard so you don't have to
12:46rhickeyreplaca: cool
13:07replacarhickey: 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:08cp2ugh, *palmface*
13:08cp2The 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:09rsynnott(owls and eagles and a few others being non-kosher)
13:53eyerisWhat is the syntax for sql joins in ClojureQL?
14:02kotarakeyeris: there no joins yet in ClojureQL. Note to myself: Have to work on that...
14:02eyerisOh. Ok.
14:03kotarakClojureQL is still work in progress...
14:23dnolenanyone know how to get a single back slash in a Java String?
14:23dnolen,(str "\\")
14:23clojurebot"\\"
14:32hiredmanerm
14:33dnolenactually figured it out
14:33hiredman\\ is a single blackslash escaped
14:33dnolenjust confused
14:33hiredman,(str "\n")
14:33clojurebot"\n"
14:33dnolen,(println (str "\\"))
14:33hiredmanit is confusing
14:33clojurebot\
14:33dnolen,(str "\\")
14:33clojurebot"\\"
14:33dnolenwas trying to output some data from a webserver and needed a \
14:34dnolenturns out you have to make a string that looks like this "\\\\"
14:34hiredmanheh
14:34hiredman,\\\\
14:34clojurebot\\
14:34hiredman,\\
14:34clojurebot\\
14:34dnolenridiculous
14:34hiredmanyeah
14:45Chousuke,(str \\)
14:45clojurebot"\\"
14:45Chousuke,(str \)
14:45clojurebotEOF while reading
14:45Chousukehm :/
18:04arohnerI'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:07hiredman(doc locking)
18:08clojurebotExecutes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances.; arglists ([x & body])
18:08kotarakj.u.concurrent has also some queues for this kind of thing...
18:08hiredmanactually, I had something similar recently and I just used a blocking queue of size 1
18:14arohnerhiredman: thanks
18:17hiredmanjdk7 comes something called a transferqueue for this purpose
19:17technomancydoes it bother anyone else to fail to capitalize the first letter of a sentence in a docstring when it's a parameter name?
19:18AWizzArdYou could alternatively always write parameters in uppercase in doc strings.
19:18technomancyAWizzArd: this isn't CL. =)
19:18kotarakAWizzArd: bleh ...
19:19AWizzArdThat way the parameters stand out and can be easier parsed by humans
19:19AWizzArdWould be nice if parameters could be underlined in the doc string
19:20technomancyAWizzArd: ... which isn't possible if they're capitalized
19:20technomancysince identifiers are case-sensitive
19:20AWizzArdInside a string it doesn't matter.
19:21technomancyyou couldn't recognize identifiers inside a string accurately without being case-sensitive
19:22technomancykind of nit-picky though
19:26AWizzArdGood 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:27kotaraktechnomancy: IMHO, the first is clearer for its intention. I never understand why people always use boolean operations to return non-boolean values....
19:28AWizzArdThe first version documents the code.
19:29kotarakAlso: the second breaks down on (or ({:foo nil} :foo) :not-found)
19:29kotarak(or false instead of nil...)
19:30AWizzArdRight. And it is more complex code (looking at the tree levels)
19:30technomancyAWizzArd: to me the two levels in the second correspond more closely with what's really going on.
19:31kotarakwhich doesn't fix it...
19:31technomancywhat I actually saw was (get my-map my-val nil) which doesn't make any sense at all.
19:32technomancyI guess if you specifically care about nil and false then get is handy.
19:32kotarakThat of course is only for documentation. It makes explicit, that nil is the default value.
19:33kotarakAnd 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:33kotarakMaybe more realistic: get could throw an exception, instead of returning nil...
19:34technomancyI just want to be able to name my function "get" without using :refer-clojure. =)
19:34technomancy(not really)
19:35kotarakHmm.. Ok. Either refer-clojure or another name, retrieve?, fetch?, pick?
19:36AWizzArd(raushol hashmap key default) :)
19:36kotarak:)
19:38technomancymostly kidding
19:41AWizzArdAnd I thought there was a function that throws an exception if a hashmap key wasn't found
19:42AWizzArdBut that was probably nth vs get for vectors
19:50technomancydanlarkin: what do you think? http://github.com/technomancy/clojure-http-client/commit/f56556945768da6f00d506131a5b3bcffe532e22
19:50technomancythis should allow posting to forms etc
19:50chessguy'evening gents
20:01AWizzArdtechnomancy: I use htmlunit for that.
20:01AWizzArdhtmlunit is easy to use and can also post when (possibly complex) JavaScript is involved.
20:07technomancyAWizzArd: cool; does it leverage Rhino then?
20:11technomancyif it can run JS it must have some kind of built-in DOM emulator?
20:41enderouteanyone know how to do the equivalent of "SourceDataLine.class" in clojure?
23:42cemerickwhoa, nothing in the channel on a Friday night? Where's the geeks? :-D
23:52zakwilsonSome of them might have lives, cemerick. I, on the other hand am home sick.
23:52zakwilson(that is, at home because I am sick, not homesick)
23:53cemerickI don't buy that theory. This place was hopping last Friday :-)
23:54replacait seemed to be a pretty quiet day here overall
23:54danlarkinah yes, but this friday the weather was fannnnnnnntastic
23:54replacadanlarkin: speak for yourself. Cold and rainy in SF
23:54danlarkinhere in NY it was a really perfect spring evening
23:55replacathat's great! Hope you got to enjiy it.
23:55replaca*enjoy
23:57danlarkinI did! not to rub it in