(def getcc () ccc.idfn) (= amb-stack* (thread-local)) (= (amb-stack*) nil) (def fail () (aif (amb-stack*) ((pop (amb-stack*)) nil) (err "no more choices left"))) (mac amb vals ; use w/uniq !! (w/uniq return `(point ,return ,@(map [idfn `(aif (getcc) (do (push it (amb-stack*)) (,return ,_))) ] vals) (fail))))