Results 1 to 1 of 1
Thread: Church numerals
- 05-13-2011, 07:49 AM #1
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Church numerals
I'm looking for some help in understanding this question in sicp, 2.6:
If zero is
And add-1 isJava Code:(define zero(lambda(f)(lambda(x)x)))
I'm having a hard time understanding these things.Java Code:(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
Please tell me this is correct, I think I'm understanding it, it's a bit straining to realize what you are trying to calculate.Java Code:(define one (lambda(f) (lambda(x) (f x))))
Java Code:(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.
Similar Threads
-
Convert the number to Roman numerals
By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 9Last Post: 11-29-2012, 10:44 PM -
Convert roman numerals
By matzahboy in forum New To JavaReplies: 4Last Post: 02-21-2010, 10:06 PM -
convert from roman numerals to integers and vice versa
By number1cynic in forum New To JavaReplies: 10Last Post: 01-18-2010, 11:54 PM -
Convert roman numerals to integers
By Felissa in forum Advanced JavaReplies: 2Last Post: 07-01-2007, 11:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks