This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling procedures questions


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]