Nicolas Oury <nicolas.o...@gmail.com> writes:
> So I need, to compile some expressions before I run the loop that keeps
> evaluating these expressions. So there are a few solutions:

Here are solutions I have used in the past on other Lisps for this sort
of problem.  They may (or may not) fit your situation:

1.  Write the code out to an external file and load it.  Not really much
    different that calling eval.  Each file has a unique namespace that
    I use to keep the bookkeeping straight.

2.  Create a parser that generates a series of closures.  One can call
    this parser at run time to create a tree of functions and then call
    the function at the root of the tree to execute your code.  Hmm,
    that wasn't a very clear explanation.  SICP talks about this
    technique if you're interested.

I prefer technique #2, but I've success with both.

> (It's better to compile and run than to interpret, isn't it? Especially
> in a tight loop executed millions of time.)

BTW, Clojure doesn't have an interpreter - all the code is compiled.
You could, of course write your own interpreter if that's what you mean.

Cheers,
Chris Dean


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