Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-16 Thread John Harrop
On Sun, Nov 15, 2009 at 8:28 PM, Rich Hickey wrote: > On Sun, Nov 15, 2009 at 4:49 AM, ajuc wrote: > > On 15 Lis, 00:21, John Harrop wrote: > >> On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > >> > I have to install java one more time, when I try to start java - > >> > server, I get: > >> > Err

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-16 Thread Rich Hickey
On Sun, Nov 15, 2009 at 4:49 AM, ajuc wrote: > > > On 15 Lis, 00:21, John Harrop wrote: >> On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: >> > I have to install java one more time, when I try to start java - >> > server, I get: >> > Error: no `server' JVM at `F:\Program Files\Java\jre6\bin\server

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread ajuc
On 16 Lis, 01:32, Alex Osborne wrote: > Clojure's name gives a hint as to how do this: use a closure. :-)  Just > pull the let outside the defn: > > (let [hilbert-map {...}] >    (defn point-to-hilbert [...] >      ...)) Now it seems so obvious :). I guess I don't think functional yet. Thank yo

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread Alex Osborne
John Harrop wrote: > On Sun, Nov 15, 2009 at 7:32 PM, Alex Osborne > wrote: > > ajuc wrote: > > I would like to somehow hide the global hilbert-map into my function, > > but I can't see how to do that. > > Clojure's name gives a hint as to how do this: us

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread John Harrop
On Sun, Nov 15, 2009 at 7:32 PM, Alex Osborne wrote: > ajuc wrote: > > I would like to somehow hide the global hilbert-map into my function, > > but I can't see how to do that. > > > > Is this possible? I know that I can just inert literal into my let, > > but that degrades performance, when func

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread Alex Osborne
ajuc wrote: > I would like to somehow hide the global hilbert-map into my function, > but I can't see how to do that. > > Is this possible? I know that I can just inert literal into my let, > but that degrades performance, when function is called many times. > > I would like to have something lik

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread John Harrop
Interesting. It looks like Clojure's missing a few obvious optimizations, and is reconstructing the literal structure each time the function is called, or each time the value is used if the literal is directly at point of use. On the other hand, deref of a global is not exactly blindingly fast eit

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread Michael Wood
2009/11/15 ajuc : > >> That's very odd. >> >> Rich needs to take a look at this. Letting a constant shouldn't have a >> performance hit, IMO. >> >> Could you test whether it's faster to use your complex data structure >> directly in the function, anonymously at the point of use, or to yank it >> fr

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread ajuc
> That's very odd. > > Rich needs to take a look at this. Letting a constant shouldn't have a > performance hit, IMO. > > Could you test whether it's faster to use your complex data structure > directly in the function, anonymously at the point of use, or to yank it > from a global var? Code (can

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread John Harrop
On Sun, Nov 15, 2009 at 4:49 AM, ajuc wrote: > On 15 Lis, 00:21, John Harrop wrote: > > On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > > > I have to install java one more time, when I try to start java - > > > server, I get: > > > Error: no `server' JVM at `F:\Program Files\Java\jre6\bin\server

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread ajuc
On 15 Lis, 00:21, John Harrop wrote: > On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > > I have to install java one more time, when I try to start java - > > server, I get: > > Error: no `server' JVM at `F:\Program Files\Java\jre6\bin\server > > \jvm.dll > > You need to use the one in F:\Program

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > I have to install java one more time, when I try to start java - > server, I get: > Error: no `server' JVM at `F:\Program Files\Java\jre6\bin\server > \jvm.dll > You need to use the one in F:\Program Files\Java\jdk6 instead. I'm surprised your IDE

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread ajuc
> Eeeuw. > > Was this with a Clojure literal in the let, or with a non-trivial > calculation using constants? The only difference is literal map of maps in let form. Full code here: http://clojure.pastebin.com/m17b8d69 I have to install java one more time, when I try to start java - server, I ge

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 6:19 AM, ajuc wrote: > > > I would like to somehow hide the global hilbert-map into my function, > > > but I can't see how to do that. > > > > Just put the literal directly into the function. > > > > > Is this possible? I know that I can just inert literal into my let, > >

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread Wilson MacGyver
The server VM is part of the standard JDK. To use it you can either do java -server or set environment variable JAVA_OPS like this on linux/OSX export JAVA_OPTS="-server" On Sat, Nov 14, 2009 at 6:19 AM, ajuc wrote: >> > I would like to somehow hide the global hilbert-map into my function, >

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread ajuc
> > I would like to somehow hide the global hilbert-map into my function, > > but I can't see how to do that. > > Just put the literal directly into the function. > > > Is this possible? I know that I can just inert literal into my let, > > but that degrades performance, when function is called man

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-13 Thread John Harrop
On Fri, Nov 13, 2009 at 6:48 PM, ajuc wrote: > Hello. > > I've tried to translate nice Hilbert-curve-index calculating function > to clojure (http://blog.notdot.net/2009/11/Damn-Cool-Algorithms- > Spatial-indexing-with-Quadtrees-and-Hilbert-Curves). > > I've got sth like that: > > (def hilbert-ma

local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-13 Thread ajuc
Hello. I've tried to translate nice Hilbert-curve-index calculating function to clojure (http://blog.notdot.net/2009/11/Damn-Cool-Algorithms- Spatial-indexing-with-Quadtrees-and-Hilbert-Curves). I've got sth like that: (def hilbert-map { :a {[0 0] [0 :d], [0 1] [1 :a], [1 0] [3 :b], [1 1] [2 :