- ambeval-n exp env nprocedure
Amb-evaluates the expression, invoking the success-continuation n times or until failure.
- exp
- The expression to evaluate
- env
- The environment to evaluate it in
- n
- The maximum number of times to invoke the success continuation
(define (ambeval-n exp env n) (ambeval exp env (lambda (val next-alternative) (set! n (- n 1)) (if (zero? n) val (next-alternative))) (lambda () failure)))