Subject: Re: special forms.
From: Erik Naggum <erik@naggum.net>
Date: Tue, 17 Jul 2001 12:06:46 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3204360405280869@naggum.net>

* Frode Vatvedt Fjeld <frodef@acm.org>
> Notice also that both OR and AND are also special forms.

  Not so.  Both are defined as macros in Common Lisp.  That they expand
  into an if is probably more of a problem, although many functions can be
  defined like this if the compiler knows how to deal with the function:

(defun car (x)
  (car x))

  (Hint: car needs to be an exported function, not just available to
  compiled code.)

  Essentially, therefore, the use of or and and reduce to this:

(defun my-if (cond cons alt)
  (if cond cons alt))

  Which illustrates another point with special forms: The are _not_
  function-callable.  A special form is known to the evaluator, which does
  something unique (special) with it.  Note that how the compiler and the
  evaluator deal with special forms may differ _wildly_, but the results
  are specified to be identical.  This is actually no small accomplishment.

  Besides, the modern term is "special operator".  (if foo bar zot) is a
  special form, while if (in the functional position) is a special operator.

  There is a huge insurance company in Scandinavia called "if".  They also
  return your values conditionally, is quite a special operator, and do not
  follow normal evaluation rules.  This is probably all a coincidende.

#:Erik
-- 
  Travel is a meat thing.