Delay and Force: Streams Implementing Delay and Force: Expr Expr
Delay and Force: Streams Implementing Delay and Force: Expr Expr
Delay and Force: Streams Implementing Delay and Force: Expr Expr
(define test(my-delay
(lambda () (horrible 1))))
(my-force test) ; or just (test)
CSE 505
Alan Borning
Ada:
CSE 505
and then
(define (my-and x y
(if x y #f)
Alan Borning
CSE 505
Alan Borning
CSE 505
Continuations
Continuations continued
We could also do arithmetic this way.
(define (cplus j k f)
(f (+ j k)))
(define (cminus j k f)
(f (- j k)))
(define (ctimes j k f)
(f (* j k)))
(define (cexpt j k f)
(f (expt j k)))
CSE 505
Alan Borning
CSE 505
Continuations (3)
Continuations (4)
However ...
(cexpt b 2
(lambda (x) (ctimes 4 a
(lambda (y)(ctimes y c
(lambda (z)(cminus x z
the-continuation)))))))
Alan Borning
CSE 505
Alan Borning
CSE 505
Alan Borning
CSE 505