[Haskell-cafe] Language simplicity

Steve Schafer steve at fenestra.com
Thu Jan 14 09:53:33 EST 2010


On Thu, 14 Jan 2010 14:42:06 +0000, you wrote:

>> All Lisps have "special forms" which are evaluated uniquely and differently from function application and are therefore reserved words by another name. For example, Clojure has def, if, do, let, var, quote, fn, loop, recur, throw, try, monitor-enter, monitor-exit, dot, new and set!.
>
>Yes, but the special forms are not distinguishable from user defined
>macros --- and some Lisp-implemantations special forms are another
>implementations macros.  E.g. you can choose to make `if' a macro that
>expands to `cond' or vice versa.  I do not know whether you are
>allowed to shadow the name of special-forms.

You can in Scheme; syntactic-keyword bindings can shadow variable
bindings, and vice versa:

The following is given as an example in R5RS:

 (let-syntax ((when (syntax-rules ()
                      ((when test stmt1 stmt2 ...)
                       (if test
                           (begin stmt1
                                  stmt2 ...))))))

   (let ((if #t))
     (when if (set! if 'now))
     if))

Evaluating the above returns "now."

Steve Schafer
Fenestra Technologies Corp.
http://www.fenestra.com/


More information about the Haskell-Cafe mailing list