Skip to content

Instantly share code, notes, and snippets.

@bdaniels
Created July 18, 2012 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdaniels/3137485 to your computer and use it in GitHub Desktop.
Save bdaniels/3137485 to your computer and use it in GitHub Desktop.
Two examples from Reasonable Schemer that I translated to Clojure and am seeing different results.
;; This is #58 from page 14.
(run* [r]
(fresh [x y z]
(conde
[(== y x)(fresh [x] (== z x))]
[(fresh [x] (== y x) (== z x))]
[fail])
(== (cons y (cons z ())) r)))
; expected: ((_.0 _.1) (_.0 _.1))
; actual: ((_.0 _.1) (_.0 _.0))
;; This is #59 from page 15.
(run* [r]
(fresh [x y z]
(conde
[(== y x)(fresh [x] (== z x))]
[(fresh [x] (== y x) (== z x))]
[fail])
(== false x)
(== (cons y (cons z ())) r)))
; expected: ((false _.0) (_.0 false))
; actual: ((false _.0) (_.0 _.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment