How do i invoke Scheme number functions from SICP -
In SICP, (2.6 pre-2.6) the following functions are described as 'received without number' I'm trying to As a starting point, how do these functions apply? Can I really implement them in some way where output will be 1? (Or any other number?)
(define zero (lambda (f) (lambda x))) (define (ad-1n) (lambda (f) My initial attempts have not been successful:
In Your Dr Sachem Welcome, version 4.1 .5 [3M] Language: Just plan; Memory Limit: 128 MB & Gt; (Add -1 (zero)). . Process zero: 1 argument is expected, 0> (Ad -1 zero) # & lt; Process & gt; & Gt; (Add -1) # & lt; Process & gt; & Gt; ((AD-1)). # & Lt; Process & gt;: 1 argument is expected, 0 & gt;
These functions that represent numbers church numbers (As SICP) their existence means that you can define a system of calculation (like Lambda calculus) without first class items - you use the function as primitive objects instead This fact can be the main form of theoretical interest; Church points are not a good option for practical calculations.
You can see the correctness of your definitions of church points with other objects as arguments. When you apply a function to represent a function n, you get another function that n equals its logic n times, for example f (f (f (x)) is.
& gt; (Defined (double x) (* 2x)) gt; (Zero double) # & lt; Process & gt; & Gt; ((Zero double) 1) 1> ((Zero double) 100) 100 & gt; (Define one (ad -1 zero)) gt; ((One Double) 1) 2 & gt; ((One double) 100) 200 & gt; (Define (cons-a x) (opposition 'one x)) & gt; ((Zero bracket-A) '()) ()> ((AD-1A) Op- a) '(1 2 3)) (a 1 2 3)
Comments
Post a Comment