Re: Church numerals in early lisp implementations?

Liste des GroupesRevenir à cl lisp 
Sujet : Re: Church numerals in early lisp implementations?
De : sgonedes1977 (at) *nospam* gmail.com (steve)
Groupes : comp.lang.lisp
Date : 16. May 2024, 22:28:01
Autres entêtes
Message-ID : <87zfspy01a.fsf@gmail.com>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13)
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?  Does anyone have examples of code from back
then?  I'm picturing things such as
>

I doubt it. check turning machine.

in original lambda-calc numbers where represented as applications of
lambda. check the wiki, it has mostly math since his science would not
fit well with these machines.


  (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.


yes, church made the math and the original concepts I believe. Turning
machines were actually usefull if you could find your way into one.

Date Sujet#  Auteur
11 May 24 * Church numerals in early lisp implementations?8Julieta Shem
11 May 24 +- Re: Church numerals in early lisp implementations?1Daniel Cerqueira
12 May 24 +* Re: Church numerals in early lisp implementations?3Alan Bawden
12 May 24 i`* Re: Church numerals in early lisp implementations?2Julieta Shem
18 May 24 i `- Re: Church numerals in early lisp implementations?1steve
16 May 24 `* Re: Church numerals in early lisp implementations?3steve
17 May 24  `* Re: Church numerals in early lisp implementations?2Lawrence D'Oliveiro
21 May 24   `- Re: Church numerals in early lisp implementations?1Stefan Monnier

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal