Subject: Re: At the heart of Lisp and Prolog
From: Erik Naggum <erik@naggum.net>
Date: Mon, 24 Dec 2001 06:26:32 GMT
Newsgroups: comp.lang.prolog,comp.lang.lisp
Message-ID: <3218163989125367@naggum.net>

* "Thorsten Seelend" <seelend@gmx.de>
| In Lisp the base data structure isn't a list but a so called Structured
| Expression (SEXpression).  Every non atomic data internally is
| represented as a "dotted pair".

  That was an amazing number of errors in so little space!  Are you coming
  from the Scheme camp with this "insight" into Lisp?  Since you have
  managed to believe this stuff despite a huge amount of corrections every
  time someone says something equally wrong, all textbooks on Lisp correct
  these misconceptions, and and no textbook on Lisp reinforce these strange
  ideas, I presume that they are taken out of nowhere, you believe it very
  strongly (or you would not be unafraid to post this nonsense in public
  view of thousands of Lisp experts), and that you will not listen to
  anyone who corrects you this time, either, this is for the people who
  could mistake your article for containing information:
  
  There is no _one_ basic data structure in Lisp.  First, "basic" depends
  on what you are looking at, and how you are looking at it.  _If_ you are
  looking at the symbolic (note: not "structured") expression, well, then
  the list implemented with the cons cell has some interesting properties,
  and atom/non-atom is a valid distinction.  Not otherwise.  Second, Lisp,
  like every other language, has arrays.  Lisp 1.5 had arrays.  (In LISP
  1.5 Programmer's Manual, 4.4 The Array Feature starts "Provision is made
  in LISP 1.5 for allocating blocks of storage for data.")  Even Scheme has
  arrays, so they must be among the _truly_ basic types.  Third, while it
  is true that a cons cell is not an atom, the incompetent wording "every
  non-atomic data" implies that there are more than one type of non-atomic
  data.  There is only _one_ non-atomic data type, the cons cell.  The cons
  cell _is_ a dotted pair, so the statement you made is really incompetent.
  Oh, and the adjective "base" has a different meaning than you think --
  look it up in a dictionary.

  The Symbolic Expression is abbreviated "S-expression".  The way you have
  written it, the function sexp would always return true.  <-- joke.

  An S-expression is a list of S-expressions _or_ an atom, so "atom" covers
  the whole rest of the type hierarchy.  Now, it really did look like you
  said that all _atoms_ are represented as a dotted pair, because the way
  you wrote about the cons cell is so incompetent.

| Historically based on the machine language of the IBM computer on that
| Lisp first was implemented, these to parts (pointers) are called CAR
| (Contents of Address Register) and CDR (Contents of Displacement
| Register) respectively.

  Sigh.  It was DECREMENT, OK?  What _is_ your source for all this crap?

  These operators referred to halves of a machine word because memory was
  usually less than half of what machine words could address.  A common way
  to implement a push-down list (now called a stack) was with a machine
  word that contained a pointer to the top of the stack in one half and the
  negative of the size of the allocated area in the other half.  Then you
  would add 1 to each half when you pushed something on the push-down list
  (which grew upward) and when the decrement half overflowed to (positive)
  zero, you had a stack overflow condition.  Checking for this condition
  was part of the push and pop instructions.  All pretty clever.  Using the
  two halves of a machine word for a cons cell actually required the cdr to
  be negative, which is all documented in the Lisp 1.5 Programmer's Manual,
  which you should acquire and read before the next time you wish to shoot
  your mouth off in a Lisp experts forum.

| So internally, Prolog and Lisp represents all structured data the
| same way; even the "operator" is the same: The dot.

  This is Just Plain Wrong.

  I think you need to actually _read_ the LISP 1.5 Programmer's Manual¹
  before you talk any more about it, but more than that, read some of the
  stuff that has been done in Lisp over the past 40 years since the first
  article in the CACM.  Incidentally, I have not been able to acquire a
  copy of the LISP 1 Programmer's Manual.

  I _really_ hope you know more about Prolog than you know about Lisp.

///
¹ ISBN 0-262-13011-4
  <URL:http://www.amazon.com/exec/obidos/ASIN/0262130114>
-- 
  The past is not more important than the future, despite what your culture
  has taught you.  Your future observations, conclusions, and beliefs are
  more important to you than those in your past ever will be.  The world is
  changing so fast the balance between the past and the future has shifted.