Re: Code generation at runtime

2009-06-23 Thread Daniel Lyons
Nicolas, Perhaps a rules engine could be of use to you? I have to put in a small plug for Jess: Jess is a rules engine designed for integration with Java, especially for writing expert systems and other situations in which you might want forward- chaining reason

Re: Code generation at runtime

2009-06-23 Thread Chris Dean
Nicolas Oury 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 t

Re: Code generation at runtime

2009-06-23 Thread chris
You could generate a file and call 'load-file'. Then if it didn't work the way you expect you have an artifact you can debug with. I think eval is really making your life a bit more difficult and I am not following your eval'd code very well. Chris On Jun 23, 4:12 am, Nicolas Oury wrote: > He

Re: Code generation at runtime

2009-06-23 Thread Nicolas Oury
Hello, Thank you very much for your answers. I know generating code at runtime (evaling) is not something very common, but that's something I need to do. I am writing a simulation software for a rule-based modelisation language. Typically, this kind of thing does millions of time the same loop

Re: Code generation at runtime

2009-06-22 Thread Mike Hinchey
I think the best way for me to approach this is to ask what you want to do. This is a generalization, but most code doesn't need to call eval - the REPL does, and some advanced uses of generating code at runtime based on data. The normal Lisp approach for code that generates code is macros (defma

Re: Code generation at runtime

2009-06-22 Thread Chouser
On Mon, Jun 22, 2009 at 5:11 PM, Nicolas Oury wrote: > > Of course, there is eval, but eval is not very competent in manipulating > namespace and bindings at runtinme. eval is exactly what the REPL uses, one call to eval per top-level form. In several examples you put an 'ns' form and others int

Code generation at runtime

2009-06-22 Thread Nicolas Oury
Dear all, I am quite new to clojure, and I can't find any good way to generate code at runtime. Of course, there is eval, but eval is not very competent in manipulating namespace and bindings at runtinme. For example, this: - (binding [*ns* *ns*] (eval '(do (ns Blop (:gen-class))