In Scheme:
(define ncons (λ (a b) (λ(z)((z a)b)))) (define ncar (λ(a) (a (λ(a)(λ(b)a))))) (define ncdr (λ(a)(a(λ(a)(λ(b)b))))) car: (λa(a(λa(λba)))) cdr: (λa(a(λa(λbb)))) cons: (λa(λb (λz((za)b))))For λ, the Jig:
((λa((λd((λc 42 ; place for app )(λa(λb(λz((za)b))))) ; c cons )(λa(a(λa(λbb))))) ; d cdr )(λa(a(λa(λba))))) ; a caror in new speak:
((λadc. (d(c 3 6)) ) (λa.(a(λa.(λb.a)))) ; a car (λa.(a(λa.(λb.b)))) ; d cdr (λabz.(zab)) ; c cons )The following two lines may be substituted for the app line above:
(a((c 3) 6)) -> 3 (d((c 3) 6)) -> 6This is not yet servicable for lack of a matching null? function The Mairson list suite goes much father.