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

Initializing the A++ Interpreter part 7



(define ndisp! (lambda (n)
                 (print ((n incr) vmzero))))
;
(define bdisp! (lambda (b)
                 (print (b vmtrue vmfalse))))
;
(define ldisp! (lambda (l)
                 (if (nullp l) 
                     nil
                     ((lambda()
                        (ndisp! (car l))
                        (ldisp! (cdr l)))))))
;;;;;;;; extensions and applications
;;;;;;;;
;;;;;
(define four   (succ three))
(define five   (succ four))
(define six    (mult two three))
(define seven  (add three four))
(define eight  (add four four))
(define nine   (add four five))
(define ten    (add five five))
;
(define while  (lambda(c body)
                 (define loop
                   (lambda()
                     (if c
                         ((lambda()
                            (body)
                            (loop)))
                         false)))
                 (loop)))
;
(define faculty (lambda(n)
                  (if (equaln n one)
                      one
                      (mult n (faculty (sub n one))))))
;



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz