Path: Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 16 May 2024 20:28:01 +0000 From: steve Newsgroups: comp.lang.lisp Subject: Re: Church numerals in early lisp implementations? References: <875xvkmta1.fsf@yaxenu.org> Date: Thu, 16 May 2024 16:28:01 -0400 Message-ID: <87zfspy01a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:SBhh4kQy3vtamU7Y2hlT/4MRk2U= MIME-Version: 1.0 Content-Type: text/plain Lines: 46 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-LsiKYamRFGcoW9tc3V9M7WzJDmIpMjTGNEg+eMS1TK/DlpUW/Q1MhX4siU6FtD2wTywON5z+Z9ri4CM!NcIlZzPKlRjC2ZqxsARvHlOWPNcLHprnYmxyvztfMJrX1A== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Bytes: 2572 Julieta Shem 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.