next up previous contents index
Next: Initializing the A++ Interpreter Up: Initializing the A++ Interpreter Previous: Initializing the A++ Interpreter   Contents   Start

Initializing the A++ Interpreter part 1



;;;; Basic A++ abstractions.
;
(define true   (lambda (x y) 
                 x))
(define false  (lambda (x y) 
                 y))
(define if     (lambda (b t f) 
                 (b t f)))
(define not    (lambda (b) 
                 (b false true )))
(define and    (lambda (x y) 
                 (if x y x)))
(define or     (lambda (x y) 
                 (if x x y)))
(define zero   (lambda (f) 
                 (lambda (x) 
                   x)))
(define zerop  (lambda (n)
                 ((n (lambda(x) false)) true)))
(define one    (lambda (f) 
                 (lambda (x) 
                   (f x))))
(define two    (lambda (f) 
                 (lambda (x) 
                   (f (f x)))))
(define three  (lambda (f) 
                 (lambda (x) 
                   (f (f (f x))))))



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz