Re: A syntax feature request: splitting literal strings

2009-04-03 Thread William D. Lipe
Implementing the multi-line strings with the backslash is simple enough (see my earlier post; I got the line number wrong, by the way, it's around 421) but causing them to ignore following whitespace is probably a bit harder. It seems to me that this is a typical problem in many programming langu

Re: A syntax feature request: splitting literal strings

2009-04-03 Thread William D. Lipe
This is how java strings work (including their workaround involving StringBuilder objects), so I guess it's no worse than that. But I tried adding it, and it seems like this can be implemented by adding a single case statement to LispReader.java with no other problems. Something like case '\n': c

Re: The Game Loop ... the Clojure way?

2009-04-03 Thread William D. Lipe
If anything's idiomatic clojure, it's probably this (I think this is how the ants worked in the ant demo, for example), whether it's lightweight enough is another story, and probably hard to tell at this point. You could always send-off an infinitely-looping function to an agent, then look at a r

Re: speed question

2009-04-01 Thread William D. Lipe
I did this: (defn draw [#^Canvas canvas] (let [#^BufferStrategy buffer (. canvas getBufferStrategy) #^Graphics g (. buffer getDrawGraphics)] (doseq [y (range 0 *height*)] (let [dy (- 1.5 (* 2.5 (/ y *height*)))] (doseq [x (range 0 *width*)] (let [dx (-

Re: Blow up

2009-03-28 Thread William D. Lipe
Your analysis is correct. Note that adding a doall fixes the problem user=> (def tl (reduce #(doall (concat %1 [%2])) [] (range 4000))) #'user/tl user=> (last tl) 3999 efficiency notwithstanding. On Mar 28, 8:59 am, jim wrote: > Hey Rich, > > I found an interesting way to blow up the stack. >

Re: Using method names in macros

2009-03-28 Thread William D. Lipe
Another way to handle it would be to use the alternate syntax for static methods: (defmacro foo [x] `(Character/isWhitespace ~x)) which would expand properly. Using the dot form for instance methods, i.e. (.method obj) should also keep syntax quote from expanding it improperly. On Mar 28, 12:5