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:


When I run the main of KawaTest the output of the println statement is:


Procedure value = #<procedure proc1?>

What I was trying to do though was to get the result as true or false.

It is. #<procedure proc1?> is a true value.


R5RS says:

library syntax: (or <test1> ...)

The <test> expressions are evaluated from left to right, and the value of the first expression that evaluates to a true value (see section 6.3.1) is returned.

and:

The standard boolean objects for true and false are written as #t and #f. What really matters, though, are the objects that the Scheme conditional expressions (if, cond, and, or, do) treat as true or false. The phrase ``a true value'' (or sometimes just ``true'') means any object treated as true by the conditional expressions, and the phrase ``a false value'' (or ``false'') means any object treated as false by the conditional expressions.

Of all the standard Scheme values, only #f counts as false in conditional expressions. Except for #f, all standard Scheme values, including #t, pairs, the empty list, symbols, numbers, strings, vectors, and ***procedures***, count as true.

You probably meant:

private static final String TEST_RULE = "(or (proc1?) (or (proc2?) (proc3?)))";

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