Adrian Kubala <adrian@sixfingeredman.net> wrote:
+---------------
| Rob Warnock <rpw3@rpw3.org> schrieb:
| > You can even do away with IF (or COND) if you have a primitive function,
| > say, TRUTH-NUMBER, that takes a Lisp value and returns [a fixnum]...
|
| It looks to me like the key part here isn't truth-number, but using
| lambda to delay evaluation. I think that's how smalltalk does it in
| fact: "if" is a function which takes a boolean and two thunks.
+---------------
*D'oh!!* Of course, thanks! Since we were allowing more-or-less arbitrary
primitive functions in the implementation in this game in the first place,
the above could/should be simply this [with the TRUTH-NUMBER functionality
buried inside SYSTEM::%IF].
(defmacro if (boolean consequent alternate)
`(system::%if ,boolean (lambda () ,consequent) (lambda () ,alternate)))
Thanks!
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607