Subject: Re: ANDF, ORF functions instead of macros
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 02 Dec 2007 03:28:30 -0600
Newsgroups: comp.lang.lisp
Message-ID: <VrmdnZ7UsZMj58_anZ2dnUVZ_rignZ2d@speakeasy.net>
Kent M Pitman  <pitman@nhplace.com> wrote:
+---------------
| ...you probably want to introduce your own
| SAME-BOOLEAN-VALUE predicate so you can do 
|  (same-boolean-value (...some-predicate...) (...some-other-predicate...))
| or else you want a coercer from generalized boolean values to 
| boolean values, such as a BOOLEAN or TRUE? function that returns only a
| strict boolean, so you can do:
|  (eq (true? (...some-predicate...)) (true? (...some-other-predicate...)))
+---------------

I call such a coercion simply TRUTH, e.g.:

   (eq (truth (...some-predicate...)) (truth (...some-other-predicate...)))

One relatively cheap definition:

   (define truth (generalized-boolean)
     (not (not generalized-boolean)))

Another:

   (define truth (generalized-boolean)
     (if generalized-boolean t nil))

Which is cheaper may depend on your compiler and/or the amount of
work you put into writing an associated compiler macro for it...  ;-}


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607