Use finer-grained projections inside trie comprehensions
Fixes HEAD~2
This commit is contained in:
parent
438151f092
commit
5d2cb21d29
|
@ -19,14 +19,14 @@
|
||||||
(match-define (list temp1 temp2) (generate-temporaries #'(tmp1 tmp2)))
|
(match-define (list temp1 temp2) (generate-temporaries #'(tmp1 tmp2)))
|
||||||
(define-values (proj-stx pat match-pat bindings)
|
(define-values (proj-stx pat match-pat bindings)
|
||||||
(analyze-pattern outer-stx pat-stx))
|
(analyze-pattern outer-stx pat-stx))
|
||||||
(list temp1 temp2 pat match-pat)))
|
(list temp1 temp2 proj-stx bindings)))
|
||||||
|
|
||||||
;; trie projection symbol -> (U set exn:fail?)
|
;; trie projection symbol -> (U set exn:fail?)
|
||||||
;; tries to project the trie. If the resulting trie would be infinite, raise an
|
;; tries to project the trie. If the resulting trie would be infinite, raise an
|
||||||
;; error, using the third argument to describe the pattern being projected.
|
;; error, using the third argument to describe the pattern being projected.
|
||||||
;; If the resulting trie is finite, return it as a set.
|
;; If the resulting trie is finite, return it as a set.
|
||||||
(define (project-finite t proj pat)
|
(define (project-finite t proj pat)
|
||||||
(define s? (trie-project/set t (compile-projection (?! proj))))
|
(define s? (trie-project/set t (compile-projection proj)))
|
||||||
(unless s?
|
(unless s?
|
||||||
(error "pattern projection created infinite trie:" pat))
|
(error "pattern projection created infinite trie:" pat))
|
||||||
s?)
|
s?)
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
...)
|
...)
|
||||||
([loop-tmp (in-set #,set-tmp)])
|
([loop-tmp (in-set #,set-tmp)])
|
||||||
(match loop-tmp
|
(match loop-tmp
|
||||||
[(list #,match-pat)
|
[(list #,@match-pat)
|
||||||
#,(build-fold
|
#,(build-fold
|
||||||
#`(_ ([acc-id acc-id]
|
#`(_ ([acc-id acc-id]
|
||||||
...)
|
...)
|
||||||
|
|
Loading…
Reference in New Issue