Results 1 to 1 of 1
Thread: Church numerals
- 05-13-2011, 07:49 AM #1
- Join Date
- Jan 2011
- Richmond, Virginia
- Blog Entries
- Rep Power
I'm looking for some help in understanding this question in sicp, 2.6:
If zero is
(define(add-1 n) (lambda(f)(lambda(x)(f((n f)x)))))
Zero takes an argument and returns a procedure which simple produces the identity of an argument, is this correct thinking? If so, how is this zero? Wouldn't it be dependent on the input argument?
I'm wondering, is there a way to formulate this with less use of lambda? I'm trying to but I am having a hard time. I'm thinking if I see it without the lbda it may make more sense.
I'm just looking for a bit of help in really understanding it.
Edit: I read up on church numerals and believe I understand it more, basically zero isn't representing the numerical 0, instead an abstraction of the idea of zero. In this case it applies the passed in argument 0 times, correct?
So add 1 will simply increase the amount of times the procedure will be applied to x, in the case of zero, add1 will change zero to one, or
(define one (lambda(f) (lambda(x) (f x))))
(define three (lambda(f) (lambda(x) (f(f(f x)))))) (three inc 0) would be 3 right? (define(inc x) (+ x 1))
Last edited by sunde887; 05-13-2011 at 08:19 AM.
- By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 9Last Post: 11-29-2012, 10:44 PM
- By matzahboy in forum New To JavaReplies: 4Last Post: 02-21-2010, 10:06 PM
- By number1cynic in forum New To JavaReplies: 10Last Post: 01-18-2010, 11:54 PM
- By Felissa in forum Advanced JavaReplies: 2Last Post: 07-01-2007, 11:27 PM