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 was made in LISP 1.5, but in all the early LISPs,
numerical computations were still 10 to 100 times slower than in
FORTRAN. Efficient numerical computation requires some form of typing
in the source language and a distinction between numbers treated by themselves and as elements of S-expressions. Some recent versions of
LISP allow distinguishing types, but at the time, this seemed
incompatible with other features.
McCarthy wrote this in ``History of Lisp''.
Numbers were originally implemented in LISP I as lists of atoms, and
this proved too slow for all but the simplest computations.
Was that Church numerals? Does anyone have examples of code from back
then? I'm picturing things such as
(defconstant zero nil)
(defconstant one (cons nil zero))
(defun zero? (x) (eq zero x))
(defun add1 (x) (cons nil x))
(defun sub1 (x) (cdr x))
(defun add (x y)
(cond ((zero? x) y)
(t (add (sub1 x) (add1 y)))))
CL-USER> (add one one)
(NIL NIL)
The paragraph continued:
A reasonably efficient implementation of numbers as atoms in
S-expressions was made in LISP 1.5, but in all the early LISPs,
numerical computations were still 10 to 100 times slower than in
FORTRAN. Efficient numerical computation requires some form of typing
in the source language and a distinction between numbers treated by
themselves and as elements of S-expressions. Some recent versions of
LISP allow distinguishing types, but at the time, this seemed
incompatible with other features.
Julieta Shem <jshem@yaxenu.org> writes:
McCarthy wrote this in ``History of Lisp''.
> Numbers were originally implemented in LISP I as lists of atoms, and
> this proved too slow for all but the simplest computations.
Was that Church numerals?
Certainly not.
The "atoms" is question were probably machine words containing the
digits of the number in some suitable base. I would guess base 2^36 or
2^35, depending on how they chose to represent negative numbers --
similar to the way GMP still works today. But I don't know for sure.
I've never seen this documented anywhere.
check turning machine.
“The police raid of the check-turning operation arrested a dozen people
and seized half a dozen check-turning machines.”
“You are on trial for 350 counts of check-turning. How do you plead?”
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 328 |
Nodes: | 16 (2 / 14) |
Uptime: | 15:27:19 |
Calls: | 7,287 |
Calls today: | 15 |
Files: | 12,605 |
Messages: | 5,567,331 |