Skip to content

Instantly share code, notes, and snippets.

Created Nov 16, 2019
What would you like to do?
amb procedures
(define (amb? sexp)
(and (pair? sexp) (eq? (car sexp) 'amb)))
(define (amb-choices sexp) (cdr sexp))
(define (seval-amb sexp succeed fail env)
(define (try-next choices)
(if (null? choices)
(seval (car choices) succeed
(lambda () (try-next (cdr choices))) env)
(try-next (amb-choices sexp))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment