
Basically, Racklog (and all versions of schelog) implement ! by causing the failure continuation of the entire relation being returned. They did not also cause the unification caused by the relation to be un-done. However, it is not easy to separate un-doing the local changes because the unification just returns a failure continuation too. I had to call that fail continuation but use state to communicate to its target that the next clause should not be visited. I don't know if this is correct. My test suite contains a lot of cut tests that still pass. Erik's test passes too. But I'm not confident that this really works.
20 lines
226 B
Racket
20 lines
226 B
Racket
#lang racket
|
|
(require racklog)
|
|
|
|
(define %a
|
|
(%rel (x)
|
|
((x) (%b x))
|
|
((x) (%c x))
|
|
))
|
|
|
|
(define %b
|
|
(%rel ()
|
|
((1) !)
|
|
((2))))
|
|
|
|
(define %c
|
|
(%rel ()
|
|
((2))))
|
|
|
|
(%find-all (x) (%a x))
|