Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created Nov 16, 2019
Embed
What would you like to do?
Order in Amb Evaluator
(try '(define (a-number-between low-number high-number)
(if (= low-number high-number)
low-number
(amb low-number (a-number-between (+ low-number 1) high-number))
)
) env)
(try '(a-number-between 1 9) env) ; --> 1
(try '(a-number-between 1 9) env) ; --> 1
(try '(a-number-between 1 9) env) ; --> 1
(try '(define (a-number-betwixt low-number high-number)
(if (= low-number high-number)
low-number
(amb (a-number-betwixt (+ low-number 1) high-number) low-number)
)
) env)
(try '(a-number-betwixt 1 9) env) ; --> 9
(try '(a-number-betwixt 1 9) env) ; --> 9
(try '(a-number-betwixt 1 9) env) ; --> 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment