;;;; amb-pythagorean.scm ;;;; From "Continuations by example" ..." by Matt Might (import scheme) (import (chicken base)) (import amb) (import amb-extras) (define (pythagorean) ; (let ((a (amb 1 2 3 4 5 6 7)) (b (amb 1 2 3 4 5 6 7)) (c (amb 1 2 3 4 5 6 7)) ) ; ; We're looking for dimensions of a legal right ; triangle using the Pythagorean theorem: ; (amb-assert (= (* c c) (+ (* a a) (* b b)))) ; ; And, we want the second side to be the shorter one: ; (amb-assert (< b a)) ; ; the answer: ; (list a b c) ) )