Subject: Re: Special forms vs. Macros
From: (Rob Warnock)
Date: Fri, 07 Jan 2005 23:42:04 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Adrian Kubala  <> wrote:
| Rob Warnock <> 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)))



Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607