From: Peter Seibel
Subject: When did FIRST/REST come into the language?
Date: 
Message-ID: <m3he9vsyh2.fsf@localhost.localdomain>
I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
Programmers Manual (1961). Anyone here know what dialect introduced
them? For bonus points point my to any primary sources (sources in the
historical, not programming, sense) explaining why?

-Peter


-- 
Peter Seibel                                      ·····@javamonkey.com

  The intellectual level needed   for  system design is  in  general
  grossly  underestimated. I am  convinced  more than ever that this
  type of work is very difficult and that every effort to do it with
  other than the best people is doomed to either failure or moderate
  success at enormous expense. --Edsger Dijkstra

From: Peter Seibel
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <m3d6kjsyak.fsf@localhost.localdomain>
Peter Seibel <·····@javamonkey.com> writes:

> I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
> Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
> Programmers Manual (1961). Anyone here know what dialect introduced
> them? For bonus points point my to any primary sources (sources in the
> historical, not programming, sense) explaining why?

Related question: anyone know who actually came up with the names CAR
and CDR? I know the etymology, I'm just wondering if it McCarthy
himself or someone else. Or is it lost in the mists of time?

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

  The intellectual level needed   for  system design is  in  general
  grossly  underestimated. I am  convinced  more than ever that this
  type of work is very difficult and that every effort to do it with
  other than the best people is doomed to either failure or moderate
  success at enormous expense. --Edsger Dijkstra
From: Barry Margolin
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <y3Ffa.3$qi4.179@paloalto-snr1.gtei.net>
In article <··············@localhost.localdomain>,
Peter Seibel  <·····@javamonkey.com> wrote:
>Peter Seibel <·····@javamonkey.com> writes:
>
>> I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
>> Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
>> Programmers Manual (1961). Anyone here know what dialect introduced
>> them? For bonus points point my to any primary sources (sources in the
>> historical, not programming, sense) explaining why?
>
>Related question: anyone know who actually came up with the names CAR
>and CDR? I know the etymology, I'm just wondering if it McCarthy
>himself or someone else. Or is it lost in the mists of time?

They were assembly language mnemonics for machine that Lisp was originally
implemented on, so it probably wasn't anyone Lisp-related.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Peter Seibel
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <m3he9spp4g.fsf@localhost.localdomain>
Barry Margolin <··············@level3.com> writes:

> In article <··············@localhost.localdomain>,
> Peter Seibel  <·····@javamonkey.com> wrote:
> >Peter Seibel <·····@javamonkey.com> writes:
> >
> >> I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
> >> Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
> >> Programmers Manual (1961). Anyone here know what dialect introduced
> >> them? For bonus points point my to any primary sources (sources in the
> >> historical, not programming, sense) explaining why?
> >
> >Related question: anyone know who actually came up with the names CAR
> >and CDR? I know the etymology, I'm just wondering if it McCarthy
> >himself or someone else. Or is it lost in the mists of time?
> 
> They were assembly language mnemonics for machine that Lisp was
> originally implemented on, so it probably wasn't anyone
> Lisp-related.

Actually, when I said I knew the etymology that was the bit I meant. I
was wondering whether it was actually McCarthy himself who decided to
*use* the assembly language mnemonics in Lisp or someone else (like on
of his students.)

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

  The intellectual level needed   for  system design is  in  general
  grossly  underestimated. I am  convinced  more than ever that this
  type of work is very difficult and that every effort to do it with
  other than the best people is doomed to either failure or moderate
  success at enormous expense. --Edsger Dijkstra
From: Lars Brinkhoff
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <85y933wwp7.fsf@junk.nocrew.org>
Peter Seibel <·····@javamonkey.com> writes:
> Peter Seibel <·····@javamonkey.com> writes:
> > I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
> > Zetalisp had them. However no such functions in McCarthy's Lisp
> > 1.5 Programmers Manual (1961). Anyone here know what dialect
> > introduced them? For bonus points point my to any primary sources
> > (sources in the historical, not programming, sense) explaining why?
> Related question: anyone know who actually came up with the names
> CAR and CDR? I know the etymology, I'm just wondering if it McCarthy
> himself or someone else. Or is it lost in the mists of time?

The paper at

  http://www8.informatik.uni-erlangen.de/html/lisp/mcc91.html

talks about both FIRST/REST:

  McCarthy felt uneasy with the machine dependent names of the
  selector functions (additionally, cons was not regarded as good
  enough) and he tried to change[*] that. Programmers and students
  were surprised by McCarthy's new language, but nobody took up his
  proposal and after some days he dropped it.

  [*] first instead of car, rest instead of cdr, combine instead of
  cons.

and CAR/CDR:

  With his FLPL experience, he [McCarthy] invented a series of basic
  functions for list processing, including car, cdr [...]

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, PDP-10, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/
From: Peter Seibel
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <m38yv3l1ly.fsf@localhost.localdomain>
Lars Brinkhoff <·········@nocrew.org> writes:

> Peter Seibel <·····@javamonkey.com> writes:
> > Peter Seibel <·····@javamonkey.com> writes:
> > > I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
> > > Zetalisp had them. However no such functions in McCarthy's Lisp
> > > 1.5 Programmers Manual (1961). Anyone here know what dialect
> > > introduced them? For bonus points point my to any primary sources
> > > (sources in the historical, not programming, sense) explaining why?
> > Related question: anyone know who actually came up with the names
> > CAR and CDR? I know the etymology, I'm just wondering if it McCarthy
> > himself or someone else. Or is it lost in the mists of time?
> 
> The paper at
> 
>   http://www8.informatik.uni-erlangen.de/html/lisp/mcc91.html
> 
> talks about both FIRST/REST:

Great link. Thanks!

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

  The intellectual level needed   for  system design is  in  general
  grossly  underestimated. I am  convinced  more than ever that this
  type of work is very difficult and that every effort to do it with
  other than the best people is doomed to either failure or moderate
  success at enormous expense. --Edsger Dijkstra
From: Kent M Pitman
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <sfw4r5sznbb.fsf@shell01.TheWorld.com>
Peter Seibel <·····@javamonkey.com> writes:

> I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
> Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
> Programmers Manual (1961). Anyone here know what dialect introduced
> them? For bonus points point my to any primary sources (sources in the
> historical, not programming, sense) explaining why?

A few scattered thoughts as much about this odd question itself
as about its answer...

I read once, in the kind of book you read about relativity when you're
in junior high school, that some Native American tribes had no concept
of 'simultaneity at a distance'.  That is, that there was no way to
report when you did something at the time you did it when you were far
away, because you had to travel (and hence take more time) to report
the deed.  (I believe this was supposed to say that these ideas had
proper foundation in relativity.)

There were a large number of dialects of Lisp back then.  A great many
of the are probably not documented.  I'm pretty sure that if you found
the earliest printed one, you'd still not have any idea who came up
with the idea first.  Moreover, if you came up with the idea first, it
doesn't seem very meaningful.  There were numerous uncoordinated
timelines at various sites at which this probably arose.  Unless you're
trying to make a point about the number of seconds it takes to recognize
the importance, I don't think it's materially interesting that the discoery
happened in one uncoordinated timeline before or after another; the
potentially interesting question is who relied on who for thinking this up,
and I can't imagine it required huge amounts of prior study or advice or
help to come up with this.

Moreover, a lot of people had personal libraries that had first/rest in
them, sometimes as macros, sometimes as functions.  Some people thought
of them as synonyms for CAR/CDR while others of us use car/cdr for the cons
abstraction and FIRST/REST for the list abstraction [just as NOT/NULL
accomplish the same thing but are used for different abstractions].

Consider you're the patent office and someone tries to patent it.  You
say (a) great idea, no one's going to think of that, it will revolutionize
thinking on the subject; or (b) obvious idea, probably 17 people did it at
once, I'm not giving you a patent on something where there's no real meaning
to your arriving here first.

I think one reason the LispM had them was that they were showing off
"substs" (later called "inline functions").  Almost surely (I'm out of
town so can't check on my lispm right this sec), first and rest are
defined using zl:defsubst [which is the approximate equivalent of a
defun with an inline declaration in cl, except that you're also
generally able to setf such things in zetalisp where the body of the
defsubst is a setfable expression].
From: Peter Seibel
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <m34r5so2p0.fsf@localhost.localdomain>
Kent M Pitman <······@world.std.com> writes:

> Peter Seibel <·····@javamonkey.com> writes:
> 
> > I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
> > Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
> > Programmers Manual (1961). Anyone here know what dialect introduced
> > them? For bonus points point my to any primary sources (sources in the
> > historical, not programming, sense) explaining why?
> 
> A few scattered thoughts as much about this odd question itself as
> about its answer...

[...]

> There were a large number of dialects of Lisp back then. A great
> many of the are probably not documented. I'm pretty sure that if you
> found the earliest printed one, you'd still not have any idea who
> came up with the idea first.

Well, it would put a lower-bound the age of the construct. Which is
really what I'm looking for. Heck if someone here wants to say, "I had
FIRST and REST in my personal library in 19XX and everybody at my lab
at the University of Foo had a copy" that'd be a citation. I'm not
trying to establish who invented it; I'm just trying to find the
earliest known usage.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

  The intellectual level needed   for  system design is  in  general
  grossly  underestimated. I am  convinced  more than ever that this
  type of work is very difficult and that every effort to do it with
  other than the best people is doomed to either failure or moderate
  success at enormous expense. --Edsger Dijkstra
From: Barry Margolin
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <TdMfa.22$qi4.742@paloalto-snr1.gtei.net>
In article <··············@localhost.localdomain>,
Peter Seibel  <·····@javamonkey.com> wrote:
>Well, it would put a lower-bound the age of the construct. Which is
>really what I'm looking for. Heck if someone here wants to say, "I had
>FIRST and REST in my personal library in 19XX and everybody at my lab
>at the University of Foo had a copy" that'd be a citation. I'm not
>trying to establish who invented it; I'm just trying to find the
>earliest known usage.

I think MDL, a Lisp dialect from the 70's, had it (I don't think it even
had CAR and CDR).

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Peter Seibel
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <m3el4wmeef.fsf@localhost.localdomain>
Barry Margolin <··············@level3.com> writes:

> In article <··············@localhost.localdomain>,
> Peter Seibel  <·····@javamonkey.com> wrote:
> >Well, it would put a lower-bound the age of the construct. Which is
> >really what I'm looking for. Heck if someone here wants to say, "I had
> >FIRST and REST in my personal library in 19XX and everybody at my lab
> >at the University of Foo had a copy" that'd be a citation. I'm not
> >trying to establish who invented it; I'm just trying to find the
> >earliest known usage.
> 
> I think MDL, a Lisp dialect from the 70's, had it (I don't think it
> even had CAR and CDR).

Interesting. Apparently Infocom used MDL to write Zork.[1] And, also
according to FOLDOC, MDL gave us &optional, &rest, and &aux. Does that
sound right?

-Peter

[1] <http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?MDL>


-- 
Peter Seibel                                      ·····@javamonkey.com

  The intellectual level needed   for  system design is  in  general
  grossly  underestimated. I am  convinced  more than ever that this
  type of work is very difficult and that every effort to do it with
  other than the best people is doomed to either failure or moderate
  success at enormous expense. --Edsger Dijkstra
From: Christopher C. Stacy
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <uy933n4o2.fsf@dtpq.com>
>>>>> On Tue, 25 Mar 2003 01:21:19 GMT, Peter Seibel ("Peter") writes:

 Barry>> I think MDL, a Lisp dialect from the 70's, had it 
 Barry>> (I don't think it even had CAR and CDR).

 Peter> Interesting. Apparently Infocom used MDL to write Zork.[1]
 Peter> And, also according to FOLDOC, MDL gave us &optional, &rest,
 Peter> and &aux. Does that sound right?

Zork was written at MIT on the PDP-10 (running ITS), and the guys 
who wrote it later went off and formed Infocom.  Zork was indeed
written in MDL.  By the way, MDL predates Scheme, which also directly
owes some heritage to it, and whether MDL was a "dialect of Lisp" or 
not would be an argument very similar to the same question for Scheme.

Actually, the first Lisp program I wrote was in MDL.
It was a system administration utility that I used to help me
kick people off the computer wasting machine cycles playing Zork.

There's a little more to the story about the language used to write
the version of Zork that came from Infocom, which ran the PC. 
Full-blown MDL was far too large a language to implement on the 
little PCs of the mid 1980s.  Zork was ported to a language called
ZIL (Zork Implementation Language. I think ZIL was essentially a
scaled-down version of MDL, optimized for writing Zork-like programs,
with the execution environment being a byte-code interpreter.

I was never a MDL wizard by any stretch, but I could tell you
a little more about it; I don't know anything about ZIL at all.

MDL was created in 1970 by Sussman, Hewitt, Reeve, Cressey and Daniels.
Later on, the Zork guys (Lebling, Galley, and Blank) and others were
the main MDL developers and users.  MDL was the preferred language
for one of the main research groups at the Laboratory for Computer Science,
and was used for many other things besides writing Zork.

MDL called symbols "ATOM"s.  You could associate a value with
an ATOM by means of the SET function.  But EVAL of an atom just
returns the atom.  To get the value, you needed to call the special
form LVAL ("local value").  The reader macro for LVAL is "."
so to get the value of FOO, you would write:

  .FOO

I only wanted to tell you that so that you would be able to read
the example code below, but since I mentioned "local" values...
MDL was dynamically scoped like MACLISP, but it also had support 
for multiprocessing, and ATOMs could have a process-"global" value.
The reader macro for GVAL was ",".  Also, there was a special form
called BLOCK for fiddling with the read-table in such a way as to
write code in lexical block scoping style.

MDL did not have CAR and CDR, and did not even really have CONS cells.
It did have a generalized "structure" data type, including among others,
LISTs and VECTORs.  It did have CONS, whose second argument must be 
a LIST, and which returned a LIST.

Some functions that worked on structured data types include LENGTH,
NTH, MAPF ("map first") and MAPR ("map rest"), and REST.
There was no FIRST.

REST took an argument that said how many elements off the front to
skip (default 1), and could also be used to pick apart a struct.

Ready for the really weird part?
The opposite of REST is BACK (which also takes the number
of things: to put back on the front, default 1).

 <SET FOO '![A B C D]>
=> ![A B C D!]               ;"FOO is a vector"
 <SET BAR <REST FOO 2>>
=> ![C D!]
 <BACK .BAR>
=> ![B C D!]

The function TOP puts them all back.

 <TOP .BAR>
=> ![A B C D!]

MDL had argument list manipulation features for doing the &OPTIONAL
&AUX, and &REST things, and more.  MDL is where Lisp got them from.
These were called OPTIONAL (aka OPT), AUX (aka EXTRA); &REST was
either ARGS or TUPLE, depending on whether you wanted the rest args
to be evaluated or not.  There was also BIND (caller's environment)
and NAME (activation record), and CALL (name of your caller).
If you used ARGS, you would then generally use the BIND variable 
for when you wanted to EVAL those args.

As for the FIRST and REST we know in more familiar Lisp dialects:
MACLISP did not have them in July 1978, but the Lisp Machine had FIRST
by November of that year.  The LispM did not have REST until much later,
but in 1978 it did have the CA/DR macros SECOND...FOURTH (actually out
to SEVENTH) and the corresponding CD/DR macros REST1...REST4, 
with REST1 meaning what we today call REST.  
REST1 was a implemented as a DEFSUBST of NTHCDR.

Maybe REST was a Common Lisp thing. I am not sure when the Lisp
Machine got it, but it was not yet part of the language there 
(on either architecture) in 1985.  In the low-level L-machine 
sources, it's only referred to as CL:REST, suggestive that 
REST was never part of ZetaLisp.

Chris
From: Christopher C. Stacy
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <uptofn414.fsf@dtpq.com>
>>>>> On Tue, 25 Mar 2003 10:04:13 GMT, Christopher C Stacy ("CS") writes:
 CS> process-"global" value.

I mean global across all the processes, as opposed to your
local stack group ("local"-ly dynamically bound value).
From: Rob Warnock
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <ORmcnWuzJeeAPR2jXTWc-g@speakeasy.net>
Christopher C. Stacy <······@dtpq.com> wrote:
+---------------
| MDL called symbols "ATOM"s.  You could associate a value with
| an ATOM by means of the SET function.  But EVAL of an atom just
| returns the atom.  To get the value, you needed to call the special
| form LVAL ("local value").  The reader macro for LVAL is "."
| so to get the value of FOO, you would write:
|   .FOO
+---------------

Hey, shades of BLISS!  ;-}  ;-}

In BLISS, names meant the same thing everywhere (no "L-value"/"R-value"
distinction), and variable names were bound to machine addresses (well,
actually, byte pointers, but the default pointer was to a full word),
with "." as the "contents of" operator. So "x := x + 1" stored the
*address* of the word following "x" into "x" (which in C would be
"x = &x + 1", I suppose), while "x := .x + 1" incremented "x" using
integer arithmetic. (And "x := .x fadr 1.0" incremented "x" using
floating-point arithmetic!)


-Rob

p.s. For readability, I used ":=" as assignment above, but BLISS actually
used the old Teletype (ASCII-1963) back-arrow, which when ASCII morphed
into ANSCII a.k.a. USASCII (ASCII-1965 and later) became the underscore,
making all that old BLISS code look decidedly weird!! E.g.: "X_.X+1" or
"X_Y_Z_-2" (that is, in C, "x = y = z = -2;").

-----
Rob Warnock, PP-ASEL-IA		<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Christopher C. Stacy
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <uy933w6aa.fsf@dtpq.com>
>>>>> On Tue, 25 Mar 2003 10:04:13 GMT, Christopher C Stacy writes:

 > As for the FIRST and REST we know in more familiar Lisp dialects:
 > MACLISP did not have them in July 1978, but the Lisp Machine had FIRST
 > by November of that year.  The LispM did not have REST until much later,
 > but in 1978 it did have the CA/DR macros SECOND...FOURTH (actually out

I meant FIRST-FOURTH in case that wasn't an obvious sleepy-o.

 > to SEVENTH) and the corresponding CD/DR macros REST1...REST4, 
 > with REST1 meaning what we today call REST.  
 > REST1 was a implemented as a DEFSUBST of NTHCDR.

 > Maybe REST was a Common Lisp thing. I am not sure when the Lisp
 > Machine got it, but it was not yet part of the language there 
 > (on either architecture) in 1985.  In the low-level L-machine 
 > sources, it's only referred to as CL:REST, suggestive that 
 > REST was never part of ZetaLisp.
From: Gabe Garza
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <87vfy85jaq.fsf@ix.netcom.com>
Kent M Pitman <······@world.std.com> writes:

> Almost surely (I'm out of town so can't check on my lispm right this
> sec), first and rest are defined using zl:defsubst

FIRST is implemented with DEFSUBST, but REST is implemented by a macro
called CLI:MAKE-CL-FUNCTION which looks like an alias function that
respects the compiler and development environment.  It uses a function
called SI:LINK-SYMBOL-FUNCTION-CELLS, which starts to go into internals
I can't understand.  

Was "linking" one of the Lisp Machine hardware optimizations?

Gabe Garza
From: Joe Marshall
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <of3z4jwr.fsf@ccs.neu.edu>
Gabe Garza <·······@ix.netcom.com> writes:

> Was "linking" one of the Lisp Machine hardware optimizations?

Not in the way you are thinking.

The Lisp Machine supported forwarding pointers that you could use to
alias things, but a function call always indirected through the
function cell.

On the K-machine we re-invented uuo-links.  The function call site had
the literal address of the callee.  When the callee was changed, the
old code was marked with a trap bit.  The hardware would catch
references to the old code and invoke the linker to fix up the
reference.

In MIT-Scheme, they do the same sort of thing with an indirection
table at the end of a function.  But because there is no hardware
assist, when you redefine a function linked this way you have to
grovel around and patch up all the links.
From: Barry Margolin
Subject: Re: When did FIRST/REST come into the language?
Date: 
Message-ID: <g2Ffa.2$qi4.201@paloalto-snr1.gtei.net>
In article <··············@localhost.localdomain>,
Peter Seibel  <·····@javamonkey.com> wrote:
>
>I see in my copy of the Lisp Machine Manual, 4th ed. (1981) that
>Zetalisp had them. However no such functions in McCarthy's Lisp 1.5
>Programmers Manual (1961). Anyone here know what dialect introduced
>them? For bonus points point my to any primary sources (sources in the
>historical, not programming, sense) explaining why?

I think they were popular synonyms for CAR/CDR in Maclisp.  I don't recall
whether they were actually in the language itself, or just the popular init
files (along with things like DEFMACRO and LOOP).

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.