can I make this faster (and leaner) ?

2009-10-30 Thread Chick Corea
How do I make this code faster? And leaner, i.e., use less memory ? It's a simple function to generate NUMKEYS strings of length KEYLENGTH, store them in a Java array then store them in a HashMap hash-map. [it doesn't store them in the hash-map yet; but it allocates it] (set! *warn-on-reflecti

Re: Is running a script without leaving Clojure?

2009-10-30 Thread Chick Corea
On Oct 30, 1:37 pm, Chouser wrote: > On Fri, Oct 30, 2009 at 10:23 AM, Arie van Wingerden > wrote: > > > Hi, > > > when I run a Clojure script Clojure ends directly when the script is > > finished. > > > java -cp ~/build/clojure/clojure.jar clojure.main -i some_script.clj -r > Where are thos

idiom questions

2009-10-30 Thread Chick Corea
Is everything in Clojure immutable? For example, w/ this code-snippet (let [x nil] ;; do something and modify 'x' ) how does one modify the value of 'x' ? (let [x nil] (def x true)) this doesn't work. the "def' interns and defines a (dynamic) root- b

Re: cannot cast error java char-array to java string

2009-10-29 Thread Chick Corea
quot; CHICKEE On Oct 28, 10:31 pm, ataggart wrote: > Also you can substitute #^"[C" with the more legible #^chars. > > On Oct 28, 7:27 pm, Alex Osborne wrote: > > > Chick Corea wrote: > > > What is wrong with this code?  I want to instantiate a Java String &

cannot cast error java char-array to java string

2009-10-28 Thread Chick Corea
What is wrong with this code? I want to instantiate a Java String from a Java character-array. But I want it to be fast, hence the need to cast per the "warn on reflection" message. user=> (set! *warn-on-reflection* true) true user=> (new String #^"[C" (make-array Character/TYPE 3 \