Avoid laborious projection if all we're doing is capturing the whole thing anyway.
This commit is contained in:
parent
2014c22c41
commit
bdab665e36
|
@ -92,12 +92,16 @@
|
||||||
(define (compile-gestalt-projection . specs)
|
(define (compile-gestalt-projection . specs)
|
||||||
(compile-gestalt-projection* specs))
|
(compile-gestalt-projection* specs))
|
||||||
|
|
||||||
|
(define capture-everything-projection (compile-gestalt-projection (?!)))
|
||||||
|
|
||||||
;; Gestalt × Natural × Natural × Boolean × CompiledSpec → Matcher
|
;; Gestalt × Natural × Natural × Boolean × CompiledSpec → Matcher
|
||||||
(define (gestalt-project g metalevel level get-advertisements? capture-spec)
|
(define (gestalt-project g metalevel level get-advertisements? capture-spec)
|
||||||
(define levels (safe-list-ref (gestalt-metalevels g) metalevel (lambda () empty-metalevel)))
|
(define levels (safe-list-ref (gestalt-metalevels g) metalevel (lambda () empty-metalevel)))
|
||||||
(define matcher ((if get-advertisements? cdr car)
|
(define matcher ((if get-advertisements? cdr car)
|
||||||
(safe-list-ref levels level (lambda () empty-level))))
|
(safe-list-ref levels level (lambda () empty-level))))
|
||||||
(matcher-project matcher capture-spec))
|
(if (equal? capture-spec capture-everything-projection)
|
||||||
|
matcher
|
||||||
|
(matcher-project matcher capture-spec)))
|
||||||
|
|
||||||
(define (drop-gestalt g)
|
(define (drop-gestalt g)
|
||||||
(gestalt (safe-cdr (gestalt-metalevels g))))
|
(gestalt (safe-cdr (gestalt-metalevels g))))
|
||||||
|
|
Loading…
Reference in New Issue