We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
You gave the following solution : (define one (lambda (f) (lambda (x) (f (f x)))))
(define one (lambda (f) (lambda (x) (f (f x)))))
But this is infact 2 in Church numerals. You can check the correct solution from the cummunity-scheme-wiki : http://community.schemewiki.org/?sicp-ex-2.6
The text was updated successfully, but these errors were encountered:
Hi @pritesh-shrivastava Thanks for pointing this out! I look into it soon.
Sorry, something went wrong.
I agree with @pritesh-shrivastava . I've tried twice and got the same answer (see below). Besides, this source agrees with us.
(define zero (lambda (f) (lambda (x) x))); a constant function, independent of f (define (add-1 n) (lambda (f) (lambda (x) (f ((n f) x)))))
Define one directly:
one
(add-1 zero); proceed by substitution (lambda (f) (lambda (x) (f ((zero f) x)))); zero will take f as argument (lambda (f) (lambda (x) (f ((lambda (f) (lambda (x) x) f) x)))); (substituting) (lambda (f) (lambda (x) (f ((lambda (x) x) x)))); zero returned (lambda (x) x) (lambda (f) (lambda (x) (f x))); (lambda (x) x) is the identity function
Successfully merging a pull request may close this issue.
You gave the following solution :
(define one (lambda (f) (lambda (x) (f (f x)))))
But this is infact 2 in Church numerals.
You can check the correct solution from the cummunity-scheme-wiki : http://community.schemewiki.org/?sicp-ex-2.6
The text was updated successfully, but these errors were encountered: