My trouble starts in Chapter 1, Frame 50, where conj2 is used. conj2 is not defined in the installed files, so I typed in the definition of conj2 and everything that it depends on, using the definitions provided in Chapter 10. The error that I get says:
car: contract violation
expected: pair?
given: '()
pointing to the (g (car s-inf)) call in append-map-inf.
Hopefully, by the time I finish the book, I'll be able to debug this myself, but I am not there yet. Here is my code:
#lang racket
(require Racket-miniKanren/miniKanren/mk)
(define succeed (== #t #t))
(define fail (== #t #f))
(define else succeed)
; Frame 10:55 in Reasoned Schemer, 2nd ed
(define (append-inf s-inf t-inf)
(cond
((null? s-inf) t-inf)
((pair? s-inf)
(cons (car s-inf)
(append-inf (cdr s-inf) t-inf)))
(else (lambda()
(append-inf t-inf (s-inf))))))
; Frame 10:84 in Reasoned Schemer, 2nd ed
(define (append-map-inf g s-inf)
(cond
((null? s-inf) '())
((pair? s-inf)
(append-inf (g (car s-inf))
(append-map-inf g (cdr s-inf))))
(else (lambda ()
(append-map-inf g (s-inf))))))
; Frame 10:81 in Reasoned Schemer, 2nd ed
(define (conj2 g1 g2)
(lambda (s)
(append-map-inf g2 (g1 s))))
; Frame 1:50 in Reasoned Schemer, 2nd ed
(run* (q)
(conj2 succeed succeed)) ; runtime error
; Frame 1:51
(run* (q)
(conj2 succeed (== 'corn q))) ; runtime error
; Frame 1:52
(run* (q)
(conj2 fail (== 'corn q))) ; runtime error
In your queries, are those quotes supposed to be quotes (') or are they supposed to be quasiquotes (`)?