If you are doing GP, another approach to avoid using eval would be
using a tree of closures.
http://xach.livejournal.com/131456.html is an example of the technique
used in Common Lisp (should be similar enough).
--
You received this message because you are subscribed to the Google
Groups "Clojur
I haven't touched it in a while, but I'm going to pick it back up soon.
--
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 wi
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 wrote:
> Here's the macro I used when I dabbled in Genetic Programming:
>
> user> (time (dotimes [_ 1000]
On Mon, Dec 21, 2009 at 6:07 PM, Gabi wrote:
> The problem with is that I need to execute the same function with
> different bindings each time. So caching won't help me
> For example I need to do something like:
>
> (dotimes [_ 1000]
> (intern 'user 'x (rand))
> (eval '(prn (+(* x x) 5
So
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
#'use
The problem with is that I need to execute the same function with
different bindings each time. So caching won't help me
For example I need to do something like:
(dotimes [_ 1000]
(intern 'user 'x (rand))
(eval '(prn (+(* x x) 5
On Dec 21, 11:53 pm, AlexK wrote:
> What eval does, is wra
Hi,
Am 21.12.2009 um 22:53 schrieb AlexK:
> (defn form->fn [list-to-eval]
> (eval (list 'fn [] list-to-eval))) ;this returns a fn
Please, make it a habit of writing even such simple code as `(fn []
list-to-eval) (or `(fn [] ~...@list-to-eval) if list-to-eval is a Var or a
local). If you make
Experimenting with GeneticProgramming with Clojure..
On Dec 21, 11:23 pm, rob wrote:
> Sorry, I somehow accidentally sent it before I was done typing. The
> rest of my sentence was "what are you trying to do thar requires the
> use of evals in that way".
>
> On Dec 21, 4:22 pm, rob wrote:
>
> >
What eval does, is wrapping (fn* [] ) around its
arguments, compiling that, and calling the resulting function object
(except if your list starts with a 'do or a 'def).
While Clojure's compiler is pretty fast, you should try not to use
eval. If you want to pass code around you should try something
Sorry, I somehow accidentally sent it before I was done typing. The
rest of my sentence was "what are you trying to do thar requires the
use of evals in that way".
On Dec 21, 4:22 pm, rob wrote:
> It sounds like your use of evals might be something that could be done
> better using a more idioma
It sounds like your use of evals might be something that could be done
better using a more idiomatic clojure approach. What are you trying
to do that re
On Dec 21, 2:32 pm, Gabi wrote:
> Hi
> I have this program that needs to do many eval's to same expression
> (eval '(some-list-to-execut..))
>
It sounds like your use of evals might be something that could be done
better using a more idiomatic clojure approach. What are you trying
to do that re
On Dec 21, 2:32 pm, Gabi wrote:
> Hi
> I have this program that needs to do many eval's to same expression
> (eval '(some-list-to-execut..))
>
Hi
I have this program that needs to do many eval's to same expression
(eval '(some-list-to-execut..))
My question is how can this be optimized ? Does eval compile the
evaled expression ? Does it re-compile the evaluated expression again
and again? Maybe I could compile the evaled expression once
13 matches
Mail list logo