home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.scheme
- Path: sparky!uunet!gatech!bloom-beacon!INTERNET!dont-send-mail-to-path-lines
- From: vanMeule@cup.portal.COM
- Subject: going back to church
- Message-ID: <9208130615.1.11214@cup.portal.com>
- Sender: daemon@athena.mit.edu (Mr Background)
- Organization: The Internet
- Date: Thu, 13 Aug 1992 13:15:15 GMT
- Lines: 83
-
- (Just call me Andre van Winkle...) Just got caught up on my mail.
-
- On the church numeral question, though it has been answered I
- wanted to interject my own vantage point.
-
- First, I would reference my two articles on church math in May
- and June MacTutor 1991. I want to write another article on them
- but I have to be careful as I'm pushing the limits for theoretical
- type stuff as it is, and I can't seem to find another publisher for
- my churchy stuff...
-
- To summarize some of my thoughts:
- 1) The only interesting thing you can do with a church numeral
- is to unravel it. If you unravel with 1+ and 0 you convert to
- regular numbers. If you unravel with other church numerals you
- get church math (that's how mul and expt is defined). Church
- numerals are like pre-initialized for loops.
- 2) You don't want to unravel with 1+ and 0 in the church math
- functions themselves--you want to be lazy and general and do
- that only as needs be (since you might unravel with many other
- things in other situations).
- 3) There is a way to define mul in more easy to understand
- terms. THe classical way is powerful fireworks, but a mind
- bender. You can define it in terms of add, just as in
- primitive recursion. I will show how to do this by uploading
- a pre-prepared file...I hope this works--I'm on a paid system
- that is quite crude. BTW, my phone is (818) 884-9610 should
- anyone want to discuss further off-line. (Sorry for the length
- of this!)...
- ;
- (define project-2nd-of-2
- (lambda (x)
- identity))
- ;
- (define identity ; project-1st-of-1
- (lambda (x) x))
- ;
- (define unravel
- (lambda (n)
- (lambda (f)
- (lambda (x)
- ((n f) x)))))
- ;
- (define church->number ; dechurchify-numeral
- (lambda (church-numeral)
- (((unravel church-numeral) 1+) 0)))
- ;
- (define number->church ; make-church-numeral
- (lambda (n)
- (if (zero? n)
- com-zero
- (com-succ
- (number->church (- n 1))))))
- ;
- (define com-zero ; The Mother of all Church numerals.
- project-2nd-of-2)
- ;
- (define com-succ
- (lambda (n)
- (lambda (f)
- (lambda (x)
- (f (((unravel n) f) x))))))
- ;
- (define lay-add
- (lambda (addend)
- (lambda (augend)
- (((unravel augend) com-succ) addend))))
- ;
- (define lay-mul
- (lambda (multiplicand)
- (lambda (multiplier)
- (((unravel multiplicand)
- (lay-add multiplier))
- com-zero))))
- ;
- (define foo
- ((lay-mul (number->church 5))
- (number->church 3)))
- ;
- (church->number foo)
-
- ;BTW I ran this code in MacScheme, so I KNOW it works!!!! At
- ;least it did before I sent it!!!!
-