-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Description
Currently, the sicp
module exports amb
but not amb-fail
, which seems inconsistent. Since amb-fail
is an essential part of handling failures in the amb evaluator, it makes sense for it to be exported as well.
Steps to Reproduce
16:13 $ racket
Welcome to Racket v8.15 [cs].
> (require sicp)
> (amb 1 2 3)
1
> amb-fail
amb-fail: undefined;
cannot reference an identifier before its definition
in module: top-level
[,bt for context]
>
This results in an error because amb-fail
is not available in the module's public interface.
Proposed Fix
Export amb-fail
alongside amb
by updating sicp/main.rkt
:
16:15 $ git diff
diff --git a/sicp/main.rkt b/sicp/main.rkt
index 5548679..0453050 100644
--- a/sicp/main.rkt
+++ b/sicp/main.rkt
@@ -41,7 +41,7 @@
(provide amb)
-(define (amb-fail) (error "amb tree exhausted"))
+(define+provide (amb-fail) (error "amb tree exhausted"))
(define (set-amb-fail! x) (set! amb-fail x))
(define-syntax-rule (explore +prev-amb-fail +sk alt)
Would love to hear any thoughts on this!
Metadata
Metadata
Assignees
Labels
No labels