Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of jjore (6662)

Friday December 08, 2006
04:32 PM

OT: Going "huh?!" at Reasoned Schemer

[ #31859 ]

In chapter 1, part 54 I don't understand why the return value is ((split pea) (navy bean)). CONDE returns that but the return value is r unified with (list x y) and it appears the book is trying to say ... uh... that x and y are *both* values now?

Huh?

;; Beware, I speak scheme with a Common Lisp accent
(run* (r)
  (fresh (x y)
    (conde ;; -> ((split pea) (navy bean))
      ((== 'split x) (== 'pea y)) ;; -> (split pea)
      ((== 'navy x) (== 'bean y)) ;; -> (navy bean)
      (else #u))
 
    ;; I discarded those bindings, right?
    (== (list x y) r)))

I'm reading this book so I can understand better how to do logic programming and because it'd be good to learn some scheme along the way as well.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.