This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Compiling procedures questions
- From: Per Bothner <per at bothner dot com>
- To: "Crystal, Mayer" <mayer dot crystal at gs dot com>
- Cc: "'kawa at sources dot redhat dot com'" <kawa at sources dot redhat dot com>
- Date: Mon, 27 Sep 2004 22:51:25 -0700
- Subject: Re: Compiling procedures questions
- References: <7F7603A85B0C674D9834EC479BE4F884067712D8@gsnmp27es.ny.fw.gs.com>
Crystal, Mayer wrote:
In other words, my code looks something like:
1. String rule = "(or proc1? (or proc2? proc3?))";
I'd recommend wrapping the rule in a function.
Scheme doesn't have the concept of evaluating a module -
e.g. "load" returns an undefined result. Yes, there are
ways in Kawa, but they're a bit more tricky, as the default
behavior is to ignore the values of top-level expressions.
String body = "(define (rule) (or ...))";
2. Procedure moduleBody = compileRule( rule );
3. return ((Boolean)moduleBody.apply0()).booleanValue();
;; Get the "rule" function in the Scheme global environment:
Procedure rule = scheme.eval("rule");
(Boolean) rule.apply0()
--
--Per Bothner
per@bothner.com http://per.bothner.com/