diff --git a/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl b/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl index c70f20112c..5433fa4db5 100644 --- a/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl +++ b/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl @@ -1869,9 +1869,9 @@ Generates terms in a number of different ways: (for/list ([i (in-range 20)]) (generate-term L any #:i-th i))] - In addition, all other pattern types are supported except for mismatch @racket[_!_] - patterns, mismatch repeat @racket[..._!_] patterns and @racket[side-condition] - patterns. + In addition, all other pattern types are supported + except for mismatch repeat @racket[..._!_] patterns + and @racket[side-condition] patterns. The enumerators do not repeat terms unless the given pattern is ambiguous. Roughly speaking, the enumerator generates all possible ways that a pattern @@ -1898,7 +1898,17 @@ Generates terms in a number of different ways: (overlap ::= natural integer)) (for/list ([i (in-range 10)]) (generate-term L overlap #:i-th i))] - + + For similar reasons, enumerations for mismatch + patterns @racket[_!_] are unsound in the presence of + ambiguity, but work as expected for unambiguous + grammars. + + @examples[#:eval + redex-eval + (define-language Bad + (ambig ::= (x ... x ...))) + (generate-term Bad (ambig_!_1 ambig_!_1 #:i-th 4))] } @item{@racket[from-judgment-form]: Randomly picks a term that satisfies diff --git a/pkgs/redex-pkgs/redex-test/redex/tests/enum-test.rkt b/pkgs/redex-pkgs/redex-test/redex/tests/enum-test.rkt index 11843be174..b0e300b9f9 100644 --- a/pkgs/redex-pkgs/redex-test/redex/tests/enum-test.rkt +++ b/pkgs/redex-pkgs/redex-test/redex/tests/enum-test.rkt @@ -105,13 +105,13 @@ (x number) ;; Example of poorly behaved mismatch - (ambig (x ... x ...))) + (ambig (y ... y ...))) (try-it 100 M m) (try-it 100 M n) (try-it 100 M p) ;; Ambiguity kills us here -;; (try-it 5 M (ambig_!_1 ambig_!_1)) +;; (try-it 2 M (ambig_!_1 ambig_!_1)) ;; test variable filtering (define-language Vars