Python syntax in Lisp and Scheme

Terry Reedy tjreedy at udel.edu
Sun Oct 5 11:33:30 EDT 2003


"Steve VanDevender" <stevev at hexadecimal.uoregon.edu> wrote in message
news:874qyodvc7.fsf at localhost.efn.org...
> "Terry Reedy" <tjreedy at udel.edu> writes:
>
> > Lisp (and possibly other languages I am not familiar with) adds
the
> > alternative of *not* evaluating arguments but instead passing them
as
> > unevaluated expressions.  In other words, arguments may be
> > *implicitly* quoted.  Since, unlike as in Python, there is no
> > alternate syntax to flag the alternate argument protocol, one
must, as
> > far as I know, memorize/learn the behavior for each function.  The
> > syntactic unification masks but does not lessen the semantic
> > divergence.  For me, it made learning Lisp (as far as I have
gotten)
> > more complicated, not less, especially before I  'got' what going
on.
>
> What you're talking about are called "special forms"

Perhaps by you and by Schemers generally, and perhaps even by modern
Common Lispers (I have no idea) but not by Winston and Horn in LISP
(1st edition, now into 3rd):  "Appendix 2: Basic Lisp Functions ... A
FSUBR takes a variable number of arguments which may not be
evaluated.", which goes on to list AND, COND, DEFUN, PROG, etcetera,
along with normal SUBR and LSUBR (variable arg number) arg-evaluating
functions.

> and are definitely not functions,

That is *just* what I thought, though I mentally used the word
'psuedofunction'.

> and are used when it is semantically necessary to leave
> something in an argument position unevaluated (such as in 'cond' or
> 'if', Lisp 'defun' or 'setq', or Scheme 'define' or 'set!').

Once I understood this, I noticed that the special forms mostly
correspond to Python statements or special operators, which have the
same necessity.

...
> Lisp-family languages have traditionally held to the notion that
Lisp
> programs should be easily representable using the list data
structure,
> making it easy to manipulate programs as data.

This is definitely a plus.  One of my current interests is in
meta-algorithms that convert between recursive and iterative forms of
expressing 'repetition with variation' (and not just tail recursion).
Better understanding Lisp has help my thinking about this.

Terry J. Reedy






More information about the Python-list mailing list