[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs

John Boyle scripsit:

> Can you explain further, perhaps give code that works?  I've used let,
> flet, and macrolet to rebind cl:if, and tried to run defmacro under that
> binding, and none of them worked (in CLisp or SBCL).

IF is a symbol in the CL package, and attempts to rebind or redefine symbols
in that package don't work.  So you need to create a symbol in some other
package by saying (shadow 'if), which forces the current package to contain
a separate IF symbol unrelated to CL:IF.  You can then define that
however you want.

In standard Scheme there are no packages, so there is only one symbol
named "if".  However, you can rebind or redefine it as you will.  In R6RS
and R7RS, you need to exclude it when you import the base library.

John Cowan            http://www.ccil.org/~cowan     cowan@x
Uneasy lies the head that wears the Editor's hat! --Eddie Foirbeis Climo

Scheme-reports mailing list