Deutsch   English   Français   Italiano  
<86h6gjpq3i.fsf_-_@williamsburg.bawden.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bawden.eternal-september.org!.POSTED!not-for-mail
From: Alan Bawden <alan@csail.mit.edu>
Newsgroups: comp.lang.misc,comp.lang.lisp
Subject: Lisp history: IF, etc.
Followup-To: comp.lang.lisp
Date: Tue, 02 Apr 2024 14:38:25 -0400
Organization: ITS Preservation Society
Lines: 44
Message-ID: <86h6gjpq3i.fsf_-_@williamsburg.bawden.org>
References: <uu54la$3su5b$6@dont-email.me> <uu636l$7haj$1@dont-email.me>
	<20240329084454.0000090f@gmail.com> <uu6om5$cmv8$1@dont-email.me>
	<20240329101248.556@kylheku.com> <uu6t9h$dq4d$1@dont-email.me>
	<20240329104716.777@kylheku.com> <uu8p02$uebm$1@dont-email.me>
	<20240330112105.553@kylheku.com> <uudrfg$2cskm$1@dont-email.me>
	<87r0fp8lab.fsf@tudado.org> <uuehdj$2hshe$1@dont-email.me>
	<87wmpg7gpg.fsf@tudado.org>
	<LISP-20240402085115@ram.dialup.fu-berlin.de>
	<20240402084057.881@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Tue, 02 Apr 2024 18:39:17 +0200 (CEST)
Injection-Info: bawden.eternal-september.org; posting-host="df04b508c9e026fad8da017ca6ea5645";
	logging-data="3548728"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18sMJQlrfH30MTXdGFPb/FH"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock: sha1:tn+ngqMlDdeBtBnuN3LsSmr4LsY=
	sha1:q5M3IMvi1yFSedYJf/X63HDKByk=
Bytes: 3819

Kaz Kylheku <643-408-1753@kylheku.com> writes:

   ...  The code is from just before MacCarthy invented the ternary IF,
   as a shorthand for a one clause cond: ...

I don't think that McCarthy invented IF as an abbreviation for COND, but
I could be wrong.  He certainly _could_ have invented it, but if he did,
it was forgotten by the mid 1970s.  Defining IF as a _personal_ macro was
common practice for 1970s Lisp programmers, and I don't think IF was
provided as standard by _any_ major Lisp implementation at that time.
(Maybe InterLisp did?  I don't recall, and I no longer have an InterLisp
manual on my bookshelf.)  Scheme had IF _instead_ of COND, but nobody
was using Scheme for anything serious yet.  And I don't think the T
project had started at that point.

In fact, when the Lisp Machine group decided to introduce a standard IF
macro into Lisp Machine Lisp, we were a bit worried that another
significant body of Lisp code was already using a slightly different
syntax for IF than the one we wanted to use.  Multics Emacs (written in
Multics MacLisp) had popularized an IF macro that used an ELSE keyword
somehow.  We negotiated a deal with the Multics guys (Bernie Greenberg)
where they agreed to change their IF to guarantee that an IF with no
ELSE keyword would work exactly the same way ours did.

This was perhaps the very beginning of the road that eventually led us
to Common Lisp.  A bunch of Lisp implementations (Lisp Machine Lisp, NIL
and both branches of MacLisp) all introduced a bunch of new syntax (IF,
LET, DEFSTRUCT, SETF, backquote, sharpsign, etc.) into their standard
environment so that individual programmers and programs no longer had to
define them themselves.

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'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]"!

- Alan