#clojure log - Dec 13 2008

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

0:01 gp: why is he callling max in his function though? seems liek a mistake

0:02 Chouser: good point. I'm sure it's a typo

0:43 gp: why arent tags and metadata between functionname and argslist?

0:46 Chouser: functions can take multiple arglists, but the metadata goes is for all of them and attached to the var.

0:48 (defn #^Integer foo "returns int" ([x] (Integer. x)) ([x y] (+ x y)))

0:53 gp: user=> (= '(1 2) [1 2])

0:53 true

0:53 does that really make sense?

0:54 Chouser: but that doesnt change the fact that you cpuld put the meata data between f-name and argslist

0:54 is there a program to run unittests on all functions ina file?

0:55 Chouser: hm, that is a bit surprising: (= '(1 2) [1 2] (first {1 2}))

0:56 gp: I suppose you could, but between which fn-name and which arglist?

0:58 gp: (clojure.contrib.test-is/test-ns 'my-ns)

0:59 test-ns runs all tests in a namespace.

1:11 gp: hmm having tests inside a function is pretty ugly though, is there unittesting framework too?

1:12 Chouser: test-is provides deftest and some helpful functions.

1:13 There are other frameworks as well, such as "fact": http://groups.google.com/group/clojure/browse_thread/thread/193023afbf87698d

1:21 danlarkin: I am liking just using deftest

6:55 ben1: how can I output the current time in clojure?

7:00 StartsWithK: ben1: http://www.rgagnon.com/javadetails/java-0106.html

9:54 fanda: hello all!

9:54 could you help me please a little?

9:54 i am trying to write a function which transforms

9:54 (def data '("a" "b" 1 2 "c" 3 "d" "e" "f" 4 5))

9:54 into

9:54 => [["a"] ["b" 1 2] ["c" 3] ["d"] ["e"] ["f" 4 5]]

9:54 it generally groups strings and numbers together

9:55 i tried loop/recur, but not there yet :-(

9:57 this goes well with iteration idioms: http://groups.google.com/group/clojure/browse_thread/thread/fa9859614535f634

9:57 :-)

10:06 alphazero: hi all, need some help with newb questions.

10:08 rhickey: fanda: http://paste.lisp.org/display/72092

10:09 RSchulz: Is there a built-in fn that simply returns true unconditionally?

10:10 rhickey: (doc constantly)

10:10 clojurebot: Returns a function that takes any number of arguments and returns x.; arglists ([x])

10:10 rhickey: so, (constantly true)

10:10 fanda: rhickey: thanks for the help!

10:11 rhickey: fanda: sure

10:11 no one's done partition-when yet?

10:12 alphazero: one is regarding import. Don't understand what is happening in REPL but why does it seem to need full java class name after an import?

10:12 RSchulz: rhickey: Thanks.

10:12 alphazero: (import '(import java.util.HashMap))

10:12 (new HashMap) => java.lang.IllegalArgumentException: Unable to resolve classname: HashMap (NO_SOURCE_FILE:9)

10:12 rhickey: (import '(java,util HashMap)) note space before HashMap

10:13 alphazero: rhichey: Oh! thanks.

10:13 pjb3: I'm trying to learn how to use zippers

10:13 given this xml doc: http://paste.lisp.org/display/72095

10:13 I can get the name of each bucket with the XPath query '/ListAllMyBucketsResult/Buckets/Bucket/Name'

10:13 With a zipper, how do you do something like that?

10:14 Seems to have only the direction methods, not ones for looking for children with certain names

10:14 alphazero: Next question is given:

10:14 (def jmap (new HashMap))

10:14 (.put jmap :key :value)

10:16 is there any way to specify the 'put' method reflectively?

10:16 rhickey: pjb3: did you look at Chouser's zip-filter?

10:17 pjb3: no, is that in clojure-contrib?

10:17 rhickey: pjb3: zip is pretty much just nav, zip-filter adds search

10:17 http://clojure-contrib.svn.sourceforge.net/viewvc/clojure-contrib/trunk/src/clojure/contrib/zip_filter.clj?revision=239&view=markup

10:18 and: http://clojure-contrib.svn.sourceforge.net/viewvc/clojure-contrib/trunk/src/clojure/contrib/zip_filter/xml.clj?revision=256&view=markup

10:20 Zephtar: I saw that there was a discussion of Xronos yesterday, but I was away from my computer at the time.

10:20 I maintain the project and would be glad to answer any questions.

10:47 pjb3: Nice, the answer to the aforementioned question of how do I do the Xpath Query:

10:48 /ListAllMyBucketsResult/Buckets/Bucket/Name

10:48 in clojure, is:

10:48 (xml-> ex :Buckets :Bucket :Name text)

10:49 where ex is the xml-zip

12:05 csf: Is there a problem in the Slime REPL when getting user input - specifially (read-line)? It never returns

12:56 arohner: has anyone tried running htmlunit from clojure?

12:56 I'm getting some kind of classloader issue

13:22 danlarkin: this is amusing, http://jonex.info/dump/yolisp.jpg

13:24 arohner: gah. Why is it that code can break when switching class loaders?

13:25 * Chouser is amused

13:42 Chouser: Should .clj files in clojure-contrib be more explicit about being part of the Clojure project, such that the CAs are enforcable?

14:14 rhickey: Chouser: sure

14:14 Zephtar: I saw that there was a discussion of Xronos yesterday, but I was away from my computer at the time.

14:15 I maintain the project and would be glad to answer any questions.

14:27 drewr: What do you guys like for doing SOAP?

14:33 clojurebot: svn rev 1159; proxy perf tweaks Note breaking change if you are using the proxy interface other than the proxy macro itself - proxy maps are now maps of (preferably interned) strings to fns, not symbols to fns, and if you construct a proxy manually you must establish initial map with init-proxy

14:57 RSchulz: rhickey_: Possible trouble in SVN 1159:

14:57 Sorry. Here it is:

14:57 java.lang.AbstractMethodError: clojure.proxy.java.util.concurrent.atomic.AtomicReference$IRef.__initClojureFnMappings(Lclojure/lang/IPersistentMap;)V (repl_ln.clj:65)

14:57 Happens upon start-up

14:59 drewr: He warned that there might be a breaking change.

14:59 RSchulz: Caused by: java.lang.AbstractMethodError: clojure.proxy.java.util.concurrent.atomic.AtomicReference$IRef.__initClojureFnMappings(Lclojure/lang/IPersistentMap;)V

14:59 OK. Just reporting.

15:00 rhickey_: RSchulz: startup of what?

15:00 RSchulz: Clojure REPL

15:00 rhickey_: ant clean?

15:00 RSchulz: No. Just default build. Hang on...

15:01 OK. False alarm. Sorry.

15:32 Lau_of_DK: Evenings gents

15:33 danm_: hello

15:37 Zephtar: lau: good evening

15:37 damn_: hello

15:40 danm_: what's up?

15:44 mfredrickson: i seem to have consistent issues with doto

15:44 I'm following along with http://clojure.org/jvm_hosted

15:45 RSchulz: Lau_of_DK: You seem confused. It's early afternoon.

15:45 Lau_of_DK: Oh, right... Im besides myself, sorry

15:48 mfredrickson: but I always get "java.lang.Exception: Unable to resolve symbol: setSize in this context (NO_SOURCE_FILE:50)

15:48 Or whatever the first action in the (doto f ...) call is

15:48 RSchulz: mfredrickson: Odd. I was just seeing something similar with (new FileWriter ...)

15:49 I assumed it was my problem, but I haven't figured it out yet.

15:49 Lau_of_DK: Schulzy, you still use the new keyword?

15:49 RSchulz: I do have an import for (java.io FileWriter)

15:49 I was right now.

15:50 Lau_of_DK: Cute

15:50 RSchulz: Same thing if I do (FileWriter. file-name)

15:50 That's the new syntax, right?

15:51 Lau_of_DK: I wouldnt say 'new' anymore, but yea, its more recent

15:51 Zephtar: What is the official #clojure timezone?

15:52 RSchulz: Earth Standard Time

15:52 mfredrickson: RSchulz: For mine I needed (doto pojo (.method args))

15:52 Zephtar: So GMT, which means it is evening :D

15:52 Lau_of_DK: clojurebot: rev 1121

15:52 clojurebot: Titim gan �ir� ort.

15:52 Lau_of_DK: clojurebot: svn rev 1121

15:52 clojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/

15:55 durka: it does work if you change all the setSize to .setSize

15:55 mfredrickson: durka: yup. just got that

15:56 RSchulz: How does Clojure choose the right overload when there are multiple methods of a given name and arity?

15:56 mfredrickson: to submit a bug report/patch for the code on website, should I diff clojure.markdown?

15:57 AWizzArd: RSchulz: first multimethod for which the dispatch fired the equal result

15:57 RSchulz: Multimethod?

15:57 I'm asking about calling methods of Java classes. Or, in this case, a constructor, if that matters.

15:57 AWizzArd: well, you said "multiple methods"

15:57 mfredrickson: hmm. it's not in there

15:57 RSchulz: Yes. I _didn't_ say multimethod...

15:57 AWizzArd: but multiple methods

15:58 anyway, the constructors in Java dispatch on type

15:58 and arity

15:58 RSchulz: So Clojure uses reflection to choose?

15:58 AWizzArd: in as few cases as possible

15:59 RSchulz: So take java.io.File. I have two cases in my code, (string?) and (isa? ... java.io.File), which correspond to two of hte constructors in java.io.FileWriter

16:00 (I should have said "...take java.io.FileWriter...")

16:01 rhickey_: mfredrickson: the web site generally documents the release, with the exception of the API page - the body docs will get updated next release, hopefully soon

16:02 mfredrickson: rhickey_: good stuff. thanks.

16:03 AWizzArd: Chouser: did you have some successful runs with your applet tests yesterday?

16:07 RSchulz: rhickey_: What are possible causes for "Unable to resolve classname" when I know the class name is valid and imported?

16:08 rhickey_: RSchulz: you know how? Did you check ns-imports?

16:08 RSchulz: (ns rrs.io-helpers

16:08 (:import (java.io

16:08 File

16:08 BufferedWriter

16:08 FileWriter))

16:08 )

16:08 java.lang.IllegalArgumentException: Unable to resolve classname: (new FileWriter file-spec) (io_helpers.clj:21)

16:09 I tried tagging file-spec with #^String, too, to no avail.

16:10 rhickey_: What's on line 21?

16:10 RSchulz: Here's everything non-blank on 21: (-> (new FileWriter #^File file-spec) (new BufferedWriter))

16:11 (That's the (isa? file-spec File) case)

16:13 rhickey_: user=> (macroexpand-1 '(-> (new FileWriter #^File file-spec) (new BufferedWriter)))

16:13 (new (new FileWriter file-spec) BufferedWriter)

16:13 AWizzArd: that makes it clear

16:13 RSchulz: Is the chaing / thread thing wrong? Or just a poor choice?

16:13 Do you recomment the explicit (new ...) syntax?

16:14 rhickey_: RSchulz: it works better without new IMO, I use (Classname. ...)

16:14 RSchulz: OK.

16:14 kotarak: (-> file-spec FileWriter. BufferedWriter.)

16:14 rhickey_: right

16:15 RSchulz: I had it all mangled is what you all are saying. Not a surprise...

16:15 Do the type tags matter? Do they help? (In a case like this?)

16:16 AWizzArd: I think they should never help for calling the right constructor, but instead they help to reduce runtime overhead in some cases.

16:19 RSchulz: Now I have this: ((#^File file-spec FileWriter.) BufferedWriter.) ... and it's producing: java.lang.ClassNotFoundException: FileWriter. (io_helpers.clj:21)

16:19 AWizzArd: shouldn't the list begin with a dot and a space?

16:20 RSchulz: It even does it if I fully qualify java.io.FileWriter!

16:20 kotarak: Shouldn't it be (reverse)d? (BufferedWriter. (FileWriter. file-spec))?

16:20 danlarkin: clojurebot: todo

16:20 clojurebot: todo is http://richhickey.backpackit.com/pub/1597914

16:21 RSchulz: kotarak: I don't think so. I want to wrapp the BufferedWriter around the FileWriter.

16:22 kotarak: ??? So you pass the BufferedWriter into the FileWriter or the other way around? (I would suspect the "other way around")

16:23 RSchulz: No. In Java it would be new BufferedWriter(new FileWriter("file-name"));

16:24 kotarak: So in Clojure it's (BufferedWriter. (FileWriter. "file-name"))

16:25 RSchulz: Well, I have a lot of trouble getting things write, but one thing remains constant: java.lang.ClassNotFoundException: FileWriter. (io_helpers.clj:21)

16:25 Again, even if I fully qualify the name: java.io.FileWriter.

16:25 This has got to be something else really stupid I'm doing (wrong).

16:25 AWizzArd: Are you allowed to post the first 25 LOC in the lisp paste?

16:26 rhickey_: RSchulz: this is how to say it manually: (new BufferedWriter (new FileWriter file-spec))

16:26 RSchulz: Me? Sure. It's my code. And nothing sensitive or proprietary or anything like that. The whol method is exactly 25 lines long. Is that the past site's limit?

16:27 rhickey_: both news can become Classname. : (BufferedWriter. (FileWriter. file-spec))

16:28 RSchulz: That's what I've got, but it still fails. What's the URL for that (one of those) paste site(s)?

16:28 rhickey_: -> can thread inside out

16:29 http://paste.lisp.org/new/

16:30 AWizzArd: RSchulz: the paste limit is much higher, but it makes sense to only show small parts of the code, so one could concentrate on the challenging part.

16:31 RSchulz: OK. I'm doing it now.

16:31 kotarak: RSchulz: choose the clojure channel. Then a link is posted by a bot.

16:32 RSchulz: I tried once, but something went wrong. It never showed up in the list.

16:32 rhickey_: bot is not logged in, don't choose a channel, just enter the url is gives you here

16:33 RSchulz: I just get a blank page after I click Submit and it's not in the list.

16:33 AWizzArd: works for me

16:33 RSchulz: Is registration required?

16:33 kotarak: no

16:33 AWizzArd: well, maybe you can paste it here then http://pastebin.com/

16:34 danlarkin: lisppaste wasn't working for me yesterday

16:34 rhickey_: paste.lisp works, choose no channel

16:34 AWizzArd: Well, for me it does work (right now).

16:36 RSchulz: Oy. http://paste.lisp.org/display/72108

16:41 I got that paste through, but paste.lisp.org seems to be having problems.

16:46 So does anybody see why that function causes an error when I (use 'rrs.io-helpers)?

16:47 rhickey_: RSchulz: I get and error for @ (are you trying to write a macro?):

16:47 java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.LispReader$UnquoteSplicing@1396ec

16:48 AWizzArd: RSchulz: what means (file-spec java.io.FileWriter.)? Is file-spec a function?

16:48 RSchulz: Oh. That's left over from a macro attempt, yes. But the error comes on the FileWriter constructor calls.

16:48 rhickey_: (isa? file-spec File) should be (instance? File file-spec)

16:48 No error there for me

16:48 RSchulz: It should be clear. It's either a String or a File

16:48 OK. So it may never take those paths, but I get the error when I (use ...) that file.

16:50 So the (new form works) when I fix the macro left-overs. But the commented lines still give the ClassNotFoundException

16:50 kotarak: RSchulz: (FileWriter. ...) expands to (new FileWriter ...), but only if FileWriter. is the first argument. Otherwise Clojure tries to resolve it as class name. Hence you get a FileWriter. not found error.

16:51 rhickey_: kotarak: that's in comments now, RSchulz are you talking about the comments not working?

16:51 RSchulz: Yes. The lines that are commented fail. Rich's form works. The macro junk was causing a separate error and that was confusing me further.

16:52 I've probably been "diagnosing" several problems at once, which is my bad, of course.

16:52 kotarak: RSchulz: the correct form is (FileWriter. file-spec)

16:52 And not (file-spec FileWriter.)

16:52 RSchulz: OK. I was sure someone suggested the form I had (and I thought I copied and pasted from IRC), but I'm not entirely sure any more.

16:53 danm_: http://paste.lisp.org/display/72062#1

16:53 can anyone tell me if that's how alter is intended to be used?

16:53 rhickey_: Might be worth rereading: http://clojure.org/java_interop

16:54 danm_: I feel as though I've improved the function over my earlier paste, but now it won't work (haha)

16:55 RSchulz: rhickey_: I assume that's to me. I thought I had but ...

16:55 rhickey_: danm: no - the idea behind alter/commute is that they manipulate the state, you wouldn't use the var in the altering fn

16:55 danm_: what's in *quote-db* ?

16:55 danm_: *quote-db* is intended to be a hash of sorted-maps

16:55 so, financial quotes from yahoo

16:56 where the key in the map is the symbol, and then it's a list of quotes sorted by their date

16:56 rhickey_: danm_: we don't call maps hashes in Clojure as some of them are trees - so it's a map?

16:56 danm_: sorry, yeah

16:56 AWizzArd: One thing that I really suggest to all the people who never did Lisp before is http://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf

16:57 it also covers indentation

16:57 danm_: I assumed hash-map was a has, and sorted-map was a tree

16:57 but alas

16:57 AWizzArd: rhickey_: aren't they both tries under the hood?

16:58 rhickey_: danm_: so your alter fn should take that map as it's first argument, and should return a new map

16:59 danm_: ok

16:59 rhickey_: (alter *quote-db* (fn [qmap] (assoc qmap sym sorted-map-from-dq)))

16:59 danm_: thanks, that would explain the runtime error

17:00 rhickey_: AWizzArd: no hash-maps are tries and sorted-maps are red/black trees

17:02 RSchulz: Is it possible to (binding *out* ...) in a macro expansion?

17:03 rhickey_: RSchulz: you should put your with-open outside the binding, and don't use *out* in with-open

17:04 RSchulz: How do you get a contextual redirection of input or output? I'm working towards a kind of shell-like environment.

17:06 rhickey_: RSchulz: binding *out* is the right way, (with-open [a-local (open file)] (binding [*out* a-local] ...))

17:06 RSchulz: Ah. OK.

17:06 That's for bearing with my ineptitude.

17:07 Duh. _Thanks_ for ...

17:07 rhickey_: RSchulz: np

17:26 arohner: If I set a var to contain a class, how do I create a new instance of it?

17:26 (def myvar java.util.map)

17:26 (new myvar) doesn't work

17:27 rhickey_: arohner: ick - are you sure you want to do that?

17:28 arohner: not really, but I'm not sure how else to do it

17:28 AWizzArd: arohner: new is a special form, not a function

17:28 arohner: I guess I could create a factory function

17:28 AWizzArd: it treats it's arguments special and does not necessarily evaluate them

17:29 rhickey_: with only the class you'll have to use reflection:

17:29 (def myvar java.util.HashMap)

17:29 (.newInstance myvar)

17:30 but you could instead store a constructing fn:

17:30 (def myvar #(java.util.HashMap.))

17:30 (myvar)

17:30 arohner: thanks

17:31 rhickey_: the latter could be extended to take args, newInstance can't

17:31 the latter will be much faster

17:32 arohner: I'm writing tests for a webapp. Webdriver (a java tool) has several different implementations, firefoxDriver, safariDriver, etc. I was hoping to store the desired implementation in a var so I could re-run the tests with the driver bound to a different implementation

17:32 a constructing fn is a good solution though

17:32 i can just (binding) that

17:33 thanks

18:16 AWizzArd: What is the easiest way to shuffle a list/vector? (sort-by rand col) does only rarely randomly enough.

18:16 RSchulz: I finally sorted out my >> macro (it's macro again, as it must be), but the imports seem not to work. Would someone look at http://paste.lisp.org/display/72108#1 an suggest why that might be?

18:18 AWizzArd: You could interleave the random numbers with the collection and then sort the pairs on the random integer element.

18:18 And project out the original collection elements of each pair.

18:21 Chouser: clojurebot: shuffle is http://groups.google.com/group/clojure/msg/a2816f1b51d99b79

18:21 clojurebot: Alles klar

18:22 Chouser: ^^ AWizzArd

18:23 AWizzArd: thanks Chouser

18:25 RSchulz: Chouser: Did you have any ideas about the DOT problem I was seeing?

18:36 danm_: Chouser: can you point me at a starting point for spit/slurp with objects the reader doesn't understand?

18:36 for instance, I have a j.u.Date in a structmap that I'd like to read/write

18:37 I'm not sure where to look in the docs :|

18:39 danlarkin: arbitrary java objects don't get reader support

18:41 danm_: danlarkin: ok, thanks

18:41 kotarak: RSchulz: http://paste.lisp.org/display/72108#2, this works for me.

18:42 danlarkin: you'll have to use a serialization format, perhaps clojure-json :)

18:42 RSchulz: Well, that's good, but do you have any explanation why the imports don't seem to work and why I have to use fully qualified names there?

18:42 danm_: danlarkin: is that a project you're responsible for? :)

18:42 rhickey_: danm_: user=> (read-string "#=(java.util.Date. \"Sat Dec 13 18:38:53 EST 2008\")")

18:42 #<Date Sat Dec 13 18:38:53 EST 2008>

18:43 danm_: google tells me yes

18:43 danlarkin: d'oh there I got opening my big mouth too quickly

18:43 kotarak: RSchulz: as you may note, my annotation doesn't use qualified names and it works for me.

18:43 danm_: rhickey_: neato

18:43 rhickey_: you can define a print-dup method for any type and print with *print-dup* on to get print/read serialization of anything

18:43 RSchulz: Yes, I see that. But still...

18:44 kotarak: RSchulz: then I don't the your problem...

18:44 I don't see

18:44 rhickey_: danm_: http://groups.google.com/group/clojure/msg/e21bf475b45bd2d5

18:46 RSchulz: Are you saying you can't replicate the "Unable to resolve classname" error in my code if you remove the java.io. qualification on FileWriter and BufferedWriter?

18:47 By the way, I see the not about multiple evaluations of file-spec, and I'll fix that, but all my testing has been with simple constants like "file-name" or (new File "file-name").

18:48 kotarak: RSchulz: works fine for me

18:48 RSchulz: also your version w/o qualified names.

18:48 RSchulz: So there's something idiosyncratic about my set-up...

18:48 I wonder what it could be.

18:48 I'm using Sun JDK 1.6.0_11 on x86 Linux.

18:49 danm_: rhickey_: thanks, that's perfect.

18:49 kotarak: 1.5 on Mac

18:50 RSchulz: about the multiple eval: this is just a general remark.

18:50 RSchulz: Sure. And I'm glad you pointed it out.

18:51 Even my generic Lisp is very (_very_) rusty, let alone Clojure's uniquenesses.

18:51 danlarkin: danm_: sorry about that :-o

18:51 danm_: danlarkin: meh, no problem :)

18:54 RSchulz: What's available in the way of a pretty-printer for Clojure forms?

18:56 danlarkin: Chouser has a nice one in the mailing list

18:56 rhickey_: RSchulz: emacs clojure-mode

18:56 :)

18:56 RSchulz: Apart from Emacs!

18:56 kotarak: RSchulz: vimclojure

18:56 ;)

18:56 RSchulz: Oh?

18:56 I didn't know vimclojure had pretty-printing.

18:57 Does that require the Ruby thing?

18:57 kotarak: Not really. You have to add the linebreaks and then just ggGV= for the indeting.

18:57 RSchulz: But apart from external dependencies or IDE (-like) tools, is there any Clojure code for pretty-printing Clojure forms?

18:58 kotarak: No Ruby. Pure VIm.

18:58 ggVG= actually...

18:58 RSchulz: Ah. OK. I'll have to try that.

18:58 What's the V part?

18:58 (I'm pretty much stuck on the original Vi subset of Vim!)

18:58 kotarak: visual mode

18:58 RSchulz: ('Cause I'm so old...)

18:59 Still, when people need a "pure Clojure" solution to something other than "blob-mode" printing, what do they do?

19:01 danlarkin: RSchulz: there's a nice pretty printing thread on the group, with (at least) 2 implementations, once of which (Chouser's) I am using successfully

19:02 RSchulz: OK. I thought I saw something somewhere.

19:02 I'll search the archives.

19:05 hiredman: kotarak: as long as you are here, I have a vim theme I like, but it doesn't give any special color to :keywords , any idea how I could fix this?

19:06 RSchulz: Ah. That's nice. That will make comprehending (macroexpand ...) output _much_ easier!

19:08 kotarak: hiredman: just a sec

19:11 hiredman: make sure it assigns a color to the Operator syntax group

19:13 hiredman: hah

19:13 it assigns "white"

19:13 wipewindows: any good clojure benchmarks?

19:13 how much faster is clojure than Python?

19:14 hiredman: if I add a line like that to my ~/.vimrc will it override the theme?

19:15 zakwilson: How much faster at what calculation? With what optimizations?

19:16 hiredman: nm

19:16 I figured it out

19:16 thanks a bunch

19:16 kotarak: hiredman: depends on the quality of your color scheme developer

19:16 hiredman: oH.

19:18 kotarak: hiredman: if the colorscheme uses highlight default ...., it will work.

19:18 w/o default it won't

19:19 hiredman: hmmm

19:26 csf: how is the clojure vim support....i'm no fan of emacs, but it's got slime.

19:29 hiredman: clojurebot: contrib?

19:29 clojurebot: I don't understand.

19:30 RSchulz: clojurebot: Be more generous!

19:30 clojurebot: No entiendo

19:30 danlarkin: clojurebot: you have no sense of humor

19:30 clojurebot: Gabh mo leithsc�al?

19:30 hiredman: clojurebot: clojure.contrib?

19:30 clojurebot: clojure is the bestest programming language available.

19:31 hiredman: useless

19:31 clojurebot: contrib is http://sourceforge.net/projects/clojure-contrib/

19:31 clojurebot: 'Sea, mhuise.

19:32 RSchulz: How many languages does ClojureBot speak?

19:32 hiredman: none, but it can type a few

19:33 RSchulz: Right... How many (which) languages are represented in its response database?

19:34 hiredman: 4?

19:34 I think I had to delete the russian one because something somewhere was mangling it

19:34 RSchulz: Sure. Four. What language is "'Sea, mhuise."?

19:35 hiredman: irish

19:43 RSchulz: Is that so?

20:17 gp: how is clojure for imagemanipulation? anyone tried fjui or fiji ir what its name is? is it fast? does it take advantage of multiple cores?

20:55 francois_: Hi all!

20:56 I have an imperative question :)

20:56 Regarding this code (it doesn't work at the moment): http://gist.github.com/35596

20:57 This is the main processing loop for receiving forms on stdin (a socket, but who cares :)) and building an RPN calculator

20:57 So, anyway, the forms are received, and I can reliably process them

20:57 Except, how do I recurse with the new stack sequence?

20:59 hiredman: (recur (conj stack new-thing))

20:59 francois_: But, can't I do that only from the end of the loop?

20:59 I can't do it on line 8, where I detect that I found a number

21:00 I thought of introducing a local that I'd modify, and I would then recurse on that

21:00 I'm thinking that I should abstract the processing into a new function, and let the return value of that function be the new stack

21:00 I would then detect quit and syntax errors using exceptions

21:00 What do you think?

21:01 hiredman: I would move everything into the (cond ...) form

21:01 francois_: Let me try that

21:01 hiredman: and if it is a number (recur ...)

21:01 if not do other sutff

21:03 gnuvince_: francois_: you from Montreal (or around)?

21:03 francois_: @hiredman: it works!

21:04 Here's the new version: http://gist.github.com/35596

21:04 @gnuvince_ I'm from Sherbrooke

21:04 I visit Montreal pretty regularly

21:04 gnuvince_: And you?

21:04 gnuvince_: francois_: one hour west of Montreal; small village in Soulanges

21:05 francois_: Can't say I ever heard of it :)

21:05 gnuvince_: Highway 20W, exit 9.

21:06 francois_: I'm 2 hours east of Montreal

21:06 gnuvince_: Nice to see fellow Quebecers

21:06 francois_: Yeah

21:07 BTW, why do I often see messages like this? Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: println for class java.io.PrintWriter (rpn.clj:0)

21:07 I guess this is found at compile time, rather than execution time

21:07 That's why the line number would be 0?

21:08 gnuvince_: francois_: what do you do?

21:09 francois_: I'm a Ruby on Rails developer by trade

21:09 I work with GiraffeSoft, a Montreal-based company

21:09 gnuvince_: Never heard of them...

21:09 francois_: We consult, but we plan on building our own applications soon enough

21:09 Sell products instead of consulting gigs

21:09 I'm the lead developer on http://xlsuite.com/

21:10 gnuvince_: Cool; I do Django development

21:10 francois_: Great! A Python developer!

21:10 gnuvince_: Yeah :)

21:10 francois_: Do you know about Montreal Python?

21:10 gnuvince_: No; is that a user group?

21:10 francois_: Yes

21:11 gnuvince_: ok

21:11 francois_: They meet in the same room the Montreal on Rails (now Montreal.rb) group meets in

21:11 I'd have to ask when's the next meeting

21:11 gnuvince_: I did some Ruby and Rails a few years ago.

21:11 Even wrote a tutorial for Rails 0.7 and 0.8

21:11 francois_: Wow!

21:12 You started even earlier than I did

21:12 gnuvince_: http://wiki.rubyonrails.org/rails/pages/TodoListTutorial

21:12 That was a long time ago though

21:12 francois_: I deployed http://weputuplights.com/ (what eventually became XLsuite) on Rails 0.12

21:12 Last time I did Python was when I was active in the Subversion dev community

21:13 gnuvince_: These days, I'm more into Haskell and Clojure.

21:13 francois_: Just fell in the Clojure soup

21:13 gnuvince_: (In my free times I mean)

21:13 francois_: I rather like what I'm seeing

21:13 gnuvince_: Clojure is awesome.

21:13 francois_: I made an REPL through a socket in about 45 minutes

21:14 I was pretty impressed

21:14 gnuvince_: All the goodness of Lisp plus the immutability stuff of Haskell without all the restrictions with the gigantic library of Java.

21:14 francois_: :)

21:14 Yes, I like that

21:14 I'm also discovering JRuby at the same time, so it looks like the JVM's winning me back

21:15 I did a lot of Java coding a couple of years ago, before I met Ruby

21:15 gnuvince_: I never did any Java

21:15 Thankfully :)

21:15 francois_: Ah!

21:15 Syntax is verbose, but the JVM itself is very good

21:16 bradbev: should there be any real difference between these functions? (defn spawn [f]

21:16 (. (Thread. f) start))

21:16 (defn spawn [f]

21:16 (send-off (agent nil) (fn[a] f)))

21:16 (lisppaste still broken?)

21:16 gnuvince_: francois_: that's pretty much the philosophy of Clojure; good platform, bad language

21:18 francois_: K, gotta run

21:18 @hiredman: thanks again for your help

21:19 bradbev: If it makes a difference, spawn is being called from an agent that was started with send-off. I expect no difference, but the function using send-off doesn't appear to actually get started properly

21:23 hiredman: uh

21:24 you may want to (f)

21:24 if f is a func

21:25 bradbev: no, it's not a syntax problem. I have an agent that listens on a socket for data, and it gets a lot of data. I want another thread to draw the gui periodically

21:26 I use spawn for the gui-redraw - but the send-off version doesn't actually ever get a chance to run because the socket thread is practically a busy spin loop

21:26 hiredman: uh, if you are passing a function to that function it is a syntax problem

21:27 it wi;; never run

21:27 bradbev: sorry, you're right

21:27 but my problem remains - I'd just written that now to illustrate

21:28 when socket data stops arriving the send-off version will actually update

21:29 so is there some difference between creating a new thread & using one from a thread pool like send-off does?

21:29 hiredman: dunno

21:29 bradbev: me either :(

21:29 hiredman: is your socket thread also doing send-offs like that?

21:31 bradbev: no. There is a server socket that send-offs the socket handler. When the socket handler gets an "init" command it spawns the render loop.

21:33 hiredman: send-offs from within a running agent are held until the agent completes

21:33 maybe that has something to do with it?

21:39 bradbev: oh

21:39 that very well could be the problem

21:39 I did not know that

22:35 gnuvince_: Anyone knows how to have timeouts in Java for sockets? My comics script tries to access PBF Comics, but the site is down. I'm trying to figure out how to skip over a site after a certain amount of time.

22:37 Found it

22:38 (System/setProperty "sun.net.client.defaultConnectTimeout", "5000")

22:42 dmiles: (System/setProperty "sun.net.client.defaultConnectTimeout", "5000") == (.setProperty System "sun.net.client.defaultConnectTimeout", "5000") ?

22:43 Chouser: no, the latter won't work anymore.

22:44 hiredman: clojurebot: latest?

22:44 clojurebot: latest is 1159

22:44 hiredman: clojurebot: svn rev 1159

22:44 clojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/

22:44 Chouser: svn rev 1159

22:44 hiredman: svn rev 1159

22:44 clojurebot: svn rev 1159; proxy perf tweaks Note breaking change if you are using the proxy interface other than the proxy macro itself - proxy maps are now maps of (preferably interned) strings to fns, not symbols to fns, and if you construct a proxy manually you must establish initial map with init-proxy

22:44 svn rev 1159; proxy perf tweaks Note breaking change if you are using the proxy interface other than the proxy macro itself - proxy maps are now maps of (preferably interned) strings to fns, not symbols to fns, and if you construct a proxy manually you must establish initial map with init-proxy

22:45 hiredman: whoops

22:45 Chouser: :-)

22:45 dmiles: oops ;P .. i am trying to make a lisp dispatch reader macro that can convert Clojure forms to jcall/jstatic/jclass/jfield forms.. someone have one laying around?

22:47 this is still suposed to work? (.. System (getProperties) (get "os.name"))

22:47 Chouser: not anymore

22:47 svn rev 1158

22:47 clojurebot: svn rev 1158; force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works

22:48 Chouser: hm, anyway, you need Classname/staticMethod now

22:49 dmiles: and (Classname/instanceMethod instancevar arg1 arg2) ?

22:49 Chouser: no, (.instanceMethod instance arg1 arg2)

22:49 dmiles: oh so its just for statics.. right on.. i like that partial disabiguaty

22:52 (. instance-expr member-symbol) for instance fields?

22:52 Chouser: I think that still works, but (.member instance) is still preferred.

22:54 mmcgrana: i have some NaN

22:55 popping up in some numerical Clojure code I have, but I have no idea from where: are there any ops besides eg (Math/sqrt -2) that would return NaN?

23:03 durka: 0/0?

23:04 mmcgrana: raises ArithmeticException

23:04 at least in repl

23:04 durka: with ints yes

23:05 but apparently the behavior is different for floats

23:05 mmcgrana: user=> (/ (float 0) (float 0)) NaN

23:05 hmmm

23:08 as it happens i don't have any calls to / in my program (or (float x) for that matter); i guess i'll keep poking around

23:11 asbjxrn: Anyone using slime and jswat?

23:12 I'd like to get exceptions trapped in jswat, but it looks like slime grabs them first.

23:22 rhickey: Chouser: (.. System (getProperties) (get "os.name")) still works, only (.instanceMethod classname ...) was changed to force class instance

23:25 dmiles: rhickey: ah.

23:28 how do i change the search thru packages for System/getProperties Math/PI .. assuming it first search in java.lang.*;

23:33 not (import '(java.util ) ) ?

23:33 hiredman: what?

23:34 you have to import specific classes

23:34 (import '(java.util someclass))

23:34 dmiles: did i have to import java.lang.Math and java.lang.System .. or did those come for free?

23:35 hiredman: you have to import everything other then stuff in java.lang

23:36 java.lang.Math and java.lang.System are sperate packages from javalang

23:36 dmiles: ok makes sense

23:48 Chouser: rhickey: I keep findind more opportunities to use PersistentQueue (legitimitely, I think)

23:49 finding

23:51 gnuvince_: Any idea why when I add a Java lib with add-classpath in SLIME and then I C-c C-c a source file, I get a message that the lib I just included isn't found?

23:51 hiredman: add-classpath is lame

23:52 gnuvince_: What's the alternative?

23:52 hiredman: at start up slime adds all jars in ~/.clojure to the cp

23:53 gnuvince_: There's no temporary way?

23:54 hiredman: not that I am aware of

23:54 gnuvince_: So what does it look like the ~/.clojure?

23:54 hiredman: its a directory where you put jars

23:54 gnuvince_: plain old /home/foo/baz.jar?

23:55 oh

23:55 it's a directory

23:55 fuck

Logging service provided by n01se.net