[SOLVED] CS ;(define (delay exp)

$25

File Name: CS_;(define_(delay_exp).zip
File Size: 216.66 KB

5/5 - (1 vote)

;(define (delay exp)
;(lambda () exp)) ;error b/c applicative order
;(define (force delayed-exp)
;(delayed-exp))

(define-syntax delay
(syntax-rules ()
((delay exp) (lambda() exp))))
(define-syntax force
(syntax-rules ()
((force exp)(exp))))

(define (foo x y)
(if (= x 0) x (force y)))
(foo (* 3 0) (delay (/ 3 0)))

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS ;(define (delay exp)
$25