On Aug 12, 10:25 pm, daly <d...@axiom-developer.org> wrote:

> Consing up a new function and using eval is certainly possible but
> then you are essentially just working with an interpreter on the data.

This is the same in CL. When you have a GP system that constructs new
program trees then inside your fitness function you will eval it.
Clojure does not come with an interpreter, so eval results in a
compiled program that gets executed.
You can of course use recombination and mutation of programs and/or
subprograms and thus create a new generation that is now modified,
which then gets its fitness measured.


> How does function invocation actually work in Clojure?

Lisp-1.
This is much better suited for a (predominantly) functional
programming
style. Also see this paper by Kent Pitman:
http://www.nhplace.com/kent/Papers/Technical-Issues.html
(“Probably a programmer who frequently passes functions as arguments
or who uses passed arguments functionally finds Lisp1 syntax easier to
read than Lisp2 syntax;”)


> In Common Lisp you fetch the function slot of the symbol and execute it.
> To modify a function you can (compile (modify-the-source fn)).
> This will change the function slot of the symbol so it will execute the
> new version of itself next time.
>
> Does anyone know the equivalent in Clojure? Would you have to invoke
> javac on a file and reload it? The Clojure compile function only seems
> to know about files, not in-memory objects.

In Clojure it is: (eval (modify-the-source fn)).

-- 
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