Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (20 sloc) 540 Bytes
(define (require p)
(if (not p) (amb)))
(define (an-element-of items)
(require (not (null? items)))
(amb (car items) (an-element-of (cdr items))))
(define (analyze-if-fail exp)
(let ((pproc (analyze (if-predicate exp)))
(cproc (analyze (if-consequent exp))))
(lambda (env succeed fail)
(pproc
env
succeed
(lambda ()
(cproc env succeed fail))))))
(define (if-fail? exp) (tagged-list? exp 'if-fail))
(define (analyze exp)
...
...
((if-fail? exp) (analyze-if-fail exp))
...)