From: Bill Coderre
Subject: Isn't "s-expression" short for "special expression" in Scheme?
Date: 
Message-ID: <bc-0201981732040001@17.127.10.148>
Perhaps the Scheme phrase "s-expression" is an overloaded term of a
previous Lisp, but I was under the impression that "s-expression" stood
for "special expression" in Scheme.

The "special" part comes from the fact that s-expressions are not
evaluated the "usual" way, but are treated specially, which effectively
means that they have a different syntax than the rest of Lisp. 

To elaborate: The USUAL method of evaluating an expression (which looks
like this: "(a b c ...)"), is something like this:

(apply
   (eval (car expr))
   (mapcar #'eval (cdr expr))) ;; warning: author may be suffering 
                               ;; insufficient memory syndrome.

which means:
1) Take the first item in the expression, and evaluate it, getting the
function object referred to it.
2) Take the rest of the items, and evaluate them, 
3) Run the function (from 1) on the items (from 2).

Note that in the usual case, "b", "c", etc., are all evaluated, which
means that they all get a chance to produce side-effects, cause recursion,
etc, etc. 

NOW, with an s-expression, the evaluation is more like this:

1) Take the first item in the expression, evaluate it, getting the
function object referred to it.
1A) IF the result is one of the special "s-expression" operators, THEN
evaluate the entire expression based on the special syntactic rules for
that particular s-operator. OTHERWISE, continue as in 2 and 3 above.

Note that in the case of an s-expression, "b", "c", etc., are NOT
necessarily evaluated.

In the case of an "if" s-expression, this "specialness" turns out to be
ridiculously important. Why? That's an Exercise For The Reader To Consider
(especially considering that it is a standard college text question).

But as a hint, consider the definition:
(defun (fact x)
   (if (< x 1) 
       1
       (* x (fact (- x 1)))))

Does fact work correctly if you follow the "usual" rules of evaluation?
Why not? Are s-expressions needed in Scheme?

bc
Note to students: I wouldn't mind doing your homework, if you still learnt
the material. And of course, as long as you paid me to do it.

From: Michael Tuchman
Subject: Re: Isn't "s-expression" short for "special expression" in Scheme?
Date: 
Message-ID: <34ada00b.12983824@news.mindspring.com>
I was under the impression that s-expression stood for syntactically
balanced expression, or something like that - but the etymology is
likely that s is not derived from special.

correct me if I'm wrong.  My sources aren't any more specific than
something vague I read and cannot put my hands on.


··@wetware.com (Bill Coderre) wrote:

>Perhaps the Scheme phrase "s-expression" is an overloaded term of a
>previous Lisp, but I was under the impression that "s-expression" stood
>for "special expression" in Scheme.
>
>The "special" part comes from the fact that s-expressions are not
>evaluated the "usual" way, but are treated specially, which effectively
>means that they have a different syntax than the rest of Lisp. 
>
>To elaborate: The USUAL method of evaluating an expression (which looks
>like this: "(a b c ...)"), is something like this:
>
>(apply
>   (eval (car expr))
>   (mapcar #'eval (cdr expr))) ;; warning: author may be suffering 
>                               ;; insufficient memory syndrome.
>
>which means:
>1) Take the first item in the expression, and evaluate it, getting the
>function object referred to it.
>2) Take the rest of the items, and evaluate them, 
>3) Run the function (from 1) on the items (from 2).
>
>Note that in the usual case, "b", "c", etc., are all evaluated, which
>means that they all get a chance to produce side-effects, cause recursion,
>etc, etc. 
>
>NOW, with an s-expression, the evaluation is more like this:
>
>1) Take the first item in the expression, evaluate it, getting the
>function object referred to it.
>1A) IF the result is one of the special "s-expression" operators, THEN
>evaluate the entire expression based on the special syntactic rules for
>that particular s-operator. OTHERWISE, continue as in 2 and 3 above.
>
>Note that in the case of an s-expression, "b", "c", etc., are NOT
>necessarily evaluated.
>
>In the case of an "if" s-expression, this "specialness" turns out to be
>ridiculously important. Why? That's an Exercise For The Reader To Consider
>(especially considering that it is a standard college text question).
>
>But as a hint, consider the definition:
>(defun (fact x)
>   (if (< x 1) 
>       1
>       (* x (fact (- x 1)))))
>
>Does fact work correctly if you follow the "usual" rules of evaluation?
>Why not? Are s-expressions needed in Scheme?
>
>bc
>Note to students: I wouldn't mind doing your homework, if you still learnt
>the material. And of course, as long as you paid me to do it.
From: Tim Olson
Subject: Re: Isn't "s-expression" short for "special expression" in Scheme?
Date: 
Message-ID: <tim-0201982246160001@jump-k56flex-0135.jumpnet.com>
In article <·················@news.mindspring.com>,
···@no_spam.mindspring.com wrote:

| I was under the impression that s-expression stood for syntactically
| balanced expression, or something like that - but the etymology is
| likely that s is not derived from special.
| 
| correct me if I'm wrong.  My sources aren't any more specific than
| something vague I read and cannot put my hands on.


From the LISP 1.5 Programmer's Manual (ca. 1965):

"In the LISP Language, all data are in the form of SYMBOLIC expressions
usually referred to as S-expressions." (emphasis mine).

-- 

     -- Tim Olson