In miniKanren, succeed
can be defined as (define succeed (== #t #t))
, and fail
can be defined as (define fail (=== #t #f))
. But what about #s
and #u
as short forms of succeed
and fail
, as they appear in The Reasoned Schemer?
(define #s succeed)
produces an error in Racket:
Welcome to Racket v7.2.
> (require Racket-miniKanren/miniKanren/mk)
> (define #s succeed)
; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt
; for context]
#<procedure:...iniKanren/mk.rkt:337:4>
; readline-input:2:18: read-syntax: unexpected `)` [,bt for context]
I have the feeling that this has something to do with reader macros.
How can I define #s
for succeed
and #u
for fail
in Scheme and also in Racket?
I am using the canonical miniKanren implementation for Scheme and the canonical miniKanren implementation for Racket.