You can probably boost n-body on 1.2 by replacing arrays with deftypes.
(definterface BodyIsh
(^double getMass [])
(setMass [^double x])
(^double getPosX [])
.....)
(deftype Body [^double ^{:unsynchronized-mutable true} mass ^double
^{:unsynchronized-mutable true} posX .....]
BodyIsh
(getMass [x] mass)
(setMass [x m] (set! mass m)
.....)
And then rewriting the program using Body (and a type annotation on
bodies, of course)
I used interfaces and not protocols here because I am not sure 1.2
supports protocols with primitives.
Best,
Nicolas.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en