Created
July 18, 2012 17:05
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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