Re: Lisp history: IF, etc.

Liste des GroupesRevenir à cl lisp 
Sujet : Re: Lisp history: IF, etc.
De : alan (at) *nospam* csail.mit.edu (Alan Bawden)
Groupes : comp.lang.lisp
Date : 03. Apr 2024, 20:15:14
Autres entêtes
Organisation : ITS Preservation Society
Message-ID : <86cyr6pb2l.fsf@williamsburg.bawden.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Madhu <enometh@meer.net> writes:

   * Alan Bawden <86h6gjpq3i.fsf_-_@williamsburg.bawden.org> :
   Wrote on Tue, 02 Apr 2024 14:38:25 -0400:
   > ...
   > But I'd love to see evidence that McCarthy arrived at ternary IF before
   > anyone else.  He certainly invented COND, where the interesting thing
   > about COND was that it was an _expression_ rather than a statement, so
   > we often say that "McCarthy invented the conditional expression".  And
   > sometimes that gets shortened to "McCarthy invented the if-expression".
   > But I don't think that he ever literally wrote "(IF ...)" rather than
   > "(COND ...)".

   I've forgotten the distinction between a statement and an expression in
   lisp.  Maybe someone can remind me.  is it that IF is a special operator
   but COND is a macro?  From the point of view of surface syntax, aren't
   they the same sort of beast?  Both evaluate to a result which can be
   uses elsewhere, so they can't be "statements" in the sense of other
   programming languages.

Lisp doesn't really have statements _because_ McCarthy invented the
conditional expression.  That's kind of the point.  Other programming
languages at the time (e.g. FORTRAN and ALGOL) only had conditional
statements.  McCarthy invented the conditional expression and thus
created the first expression-only programming language.

   > I'm not even sure that McCarthy would have seen the advantage of IF over
   > COND given that what he originally wanted us all to write was actually
   > "[expr -> expr; expr]"!

   CLHS has

    (if test-form then-form else-form)
    ==  (cond (test-form then-form) (t else-form))

   so by inventing COND he had already invented IF, and probably felt
   secure enough and not compelled publish another result

The original claim I was responding to was that McCarthy had invented IF
"as a shorthand for a one clause COND".  That certainly wouldn't have
been worth publishing as a result in itself.  But it would certainly be
possible for him to have introduced an IF shorthand _in passing_ in the
course of doing something else -- like in some Lisp code he wrote to do
something of real interest.  But there seems to be no evidence for that.

To summarize:

(1) McCarthy invented the conditional expression, written in his
    M-expression language as:
       [expr -> expr; expr -> expr; T -> expr]

(2) McCarthy also invented the S-expression representation for that as:
       (COND (expr expr) (expr expr) (T expr))

(3) But there is no evidence that McCarthy ever, for _any_ reason, ever
    wrote:
       (IF expr expr expr)

People sometimes sloppily say that "McCarthy invented the
if-expression", by which they really mean just (1).  It is also true
that McCarthy invented (2) the COND S-expression, but there is nothing
particularly interesting about that, it was just part of the encoding he
invented for representing M-expressions as S-expressions.  (For which he
also invented the LAMBDA, QUOTE and LABEL S-expressions.)  But there
seems to be no evidence that McCarthy ever invented (3) an "IF
S-expression" for any reason whatsoever.

- Alan

Date Sujet#  Auteur
2 Apr 24 * Lisp history: IF, etc.56Alan Bawden
2 Apr 24 +- Re: Lisp history: IF, etc.1Kaz Kylheku
3 Apr 24 +- Re: Lisp history: IF, etc.1Gijs Hillenius
3 Apr 24 +- Re: Lisp history: IF, etc.1Gijs Hillenius
3 Apr 24 +* Re: Lisp history: IF, etc.49Madhu
3 Apr 24 i`* Re: Lisp history: IF, etc.48Alan Bawden
3 Apr 24 i +* Re: Lisp history: IF, etc.35Paul Rubin
3 Apr 24 i i`* Re: Lisp history: IF, etc.34Alan Bawden
4 Apr 24 i i +* Re: Lisp history: IF, etc.32Paul Rubin
4 Apr 24 i i i+* Re: Lisp history: IF, etc.5Lawrence D'Oliveiro
4 Apr 24 i i ii+* Re: Lisp history: IF, etc.3Axel Reichert
4 Apr 24 i i iii+- Re: Lisp history: IF, etc.1Lawrence D'Oliveiro
4 Apr 24 i i iii`- Re: Lisp history: IF, etc.1Paul Rubin
4 Apr 24 i i ii`- Re: Lisp history: IF, etc.1Kaz Kylheku
4 Apr 24 i i i`* Re: Lisp history: IF, etc.26Alan Bawden
5 Apr 24 i i i `* Re: Lisp history: IF, etc.25Paul Rubin
5 Apr 24 i i i  `* Re: Lisp history: IF, etc.24Julieta Shem
5 Apr 24 i i i   +- Re: Lisp history: IF, etc.1Julieta Shem
6 Apr 24 i i i   +- Re: Lisp history: IF, etc.1Lawrence D'Oliveiro
15 Apr 24 i i i   `* Re: Lisp history: IF, etc.21Paul Rubin
16 Apr 24 i i i    `* Re: Lisp history: IF, etc.20Jeff Barnett
16 Apr 24 i i i     +* Re: Lisp history: IF, etc.2Lawrence D'Oliveiro
16 Apr 24 i i i     i`- Re: Lisp history: IF, etc.1Jeff Barnett
16 Apr 24 i i i     +* Re: Lisp history: IF, etc.16Paul Rubin
16 Apr 24 i i i     i`* Re: Lisp history: IF, etc.15Jeff Barnett
16 Apr 24 i i i     i `* Re: Lisp history: IF, etc.14Lawrence D'Oliveiro
16 Apr 24 i i i     i  +* Re: Lisp history: IF, etc.12Paul Rubin
17 Apr 24 i i i     i  i`* Re: Lisp history: IF, etc.11Lawrence D'Oliveiro
17 Apr 24 i i i     i  i `* Re: Lisp history: IF, etc.10Paul Rubin
17 Apr 24 i i i     i  i  `* Re: Lisp history: IF, etc.9Jeff Barnett
17 Apr 24 i i i     i  i   `* Re: Lisp history: IF, etc.8Lawrence D'Oliveiro
17 Apr 24 i i i     i  i    `* Re: Lisp history: IF, etc.7Paul Rubin
17 Apr 24 i i i     i  i     +* Re: Lisp history: IF, etc.3Madhu
18 Apr 24 i i i     i  i     i`* Re: Lisp history: IF, etc.2Lawrence D'Oliveiro
18 Apr 24 i i i     i  i     i `- Re: Lisp history: IF, etc.1Paul Rubin
17 Apr 24 i i i     i  i     `* Re: Lisp history: IF, etc.3Ben Bacarisse
18 Apr 24 i i i     i  i      `* Re: Lisp history: IF, etc.2Lawrence D'Oliveiro
18 Apr 24 i i i     i  i       `- Re: Lisp history: IF, etc.1Stefan Monnier
17 Apr 24 i i i     i  `- Re: Lisp history: IF, etc.1Jeff Barnett
17 Apr 24 i i i     `- Re: Lisp history: IF, etc.1Stefan Ram
4 Apr 24 i i `- Re: Lisp history: IF, etc.1Ben Bacarisse
3 Apr 24 i +* Re: Lisp history: IF, etc.7Kaz Kylheku
4 Apr 24 i i+* Re: Lisp history: IF, etc.5Alan Bawden
4 Apr 24 i ii+* Re: Lisp history: IF, etc.3Kaz Kylheku
4 Apr 24 i iii`* Re: Lisp history: IF, etc.2Kaz Kylheku
4 Apr 24 i iii `- on levels of disappointment (Was: Re: Lisp history: IF, etc.)1Julieta Shem
4 Apr 24 i ii`- Re: Lisp history: IF, etc.1Julieta Shem
5 Apr 24 i i`- Re: Lisp history: IF, etc.1Spiros Bousbouras
4 Apr 24 i +* Re: Lisp history: IF, etc.3Lawrence D'Oliveiro
4 Apr 24 i i`* Re: Lisp history: IF, etc.2Alan Bawden
4 Apr 24 i i `- Re: Lisp history: IF, etc.1Kaz Kylheku
12 Apr 24 i `* Re: Lisp history: IF, etc.2Alan Bawden
12 Apr 24 i  `- Re: Lisp history: IF, etc.1Lawrence D'Oliveiro
4 Apr 24 `* Re: Lisp history: IF, etc.3Kaz Kylheku
4 Apr 24  `* Re: Lisp history: IF, etc.2Alan Bawden
4 Apr 24   `- Re: Lisp history: IF, etc.1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal