Superb!
This is exactly what I needed.. A way to get rid of the awkward intern
and boost performance.
Have you progressed far with your GP experimenting ?






On Dec 22, 4:17 am, kyle smith <the1physic...@gmail.com> wrote:
> Here's the macro I used when I dabbled in Genetic Programming:
>
> user> (time (dotimes [_ 1000]
>               (intern  'user 'x (rand))
>               (eval '(+ (* x x) 5))))
> "Elapsed time: 425.754877 msecs"
>
> user> (defmacro capture-vars [vars expr]
>         `(fn [...@vars] ~(first (next expr))))
> #'user/capture-vars
> user> (time (let [f (eval (capture-vars [x] '(+ (* x x) 5)))]
>               (dotimes [_ 1000000];note the iterations!
>                 (f (rand)))))
> "Elapsed time: 73.936157 msecs"

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to