Paper 1 in the list below states:
Numbers were originally implemented in Lisp I as a list of atoms.
and the Lisp 1.5 manual states: Arithmetic in Lisp 1.5 is new....

Could you give an example how the number 3 was implemented in Lisp-1 and how 2+1?

So far I have found only this remarks but not programming examples. It would be much more instructive for my article if I could quote these examples.

Chrilly

----- Original Message ----- From: "Ron Goldman" <[EMAIL PROTECTED]>
To: "computer-go" <computer-go@computer-go.org>
Cc: "Chrilly" <[EMAIL PROTECTED]>
Sent: Sunday, April 08, 2007 2:23 AM
Subject: Re: [computer-go] LISP question (littlle bit off topic)


Crilly,

I used to program in LISP and had never heard of this, so I did some checking. I think this is a misconception from the fact that numbers were considered atoms and hence stored on the list of atoms. Instead of just being a numeric value they consisted of an association list (e.g. a list of atoms) containing a tag to indicate the value was a number and another word with the value. The LISP I Programmers Manual [1] gives an example:

    -1 => (MINUS . (ASSOC NUMB FLO (1.0)))

(In fact LISP I (1960) only supported floating-point numbers, LISP 1.5 (1961) supported both integers & floats. [2])

As a result of storing values in an association list arithmetic routines had to do several memory references to obtain the numeric value.

In a paper on the "History of Lisp" John McCarthy [3] discussed this writing that "Numbers were originally implemented in LISP I as lists of atoms, and this proved too slow for all but the simplest computations. A reasonably efficient implementation of numbers as atoms in S-expressions as made in LISP 1.5, but in all the early LISPs, numerical computations were still 10 to 100 times slower than in FORTRAN."

Later versions of LISP [4] used better tagging schemes for numbers and were able to produce compiled code that was as fast (or faster) then C or FORTRAN.

Finally LISP early on had bignums to compute using arbitrary- precision integers (similar to Java's BigInteger). Useful if you needed to compute factorial of 1000 exactly.

-- Ron --

1. http://community.computerhistory.org/scc/projects/LISP/book/LISP% 20I%20Programmers%20Manual.pdf

2. ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-024.pdf

3. http://www-formal.stanford.edu/jmc/history/lisp.ps

4. http://doi.acm.org/10.1145/1086803.1086804

On Apr 7, 2007, at 12:54 PM, Chrilly wrote:
Up to my knowledge the first Lisp Versions had no number system. The number n was represented as the list of numbers from 1 to n (which is also the mathematical/axiomatic definition of the natural numbers). But its not very practical. Can anyone provide me with a link how this was done. I am speaking some computer languages, but Lisp is not among them. I want to present the code in an article for the Austrian AI- Journal (as an example that mathematical elegance and practically usefull are 2 different things).

Chrilly


_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to