@@ -640,8 +640,7 @@ to traverse the whole value at once, rather than one binding form at a time.
640
640
[redex-val redex-val])
641
641
(define maybe-car (if (value-with-spec? redex-val) values car))
642
642
(define maybe-cdr (if (value-with-spec? redex-val) values cdr))
643
- (define maybe-drop (if (value-with-spec? redex-val) values drop))
644
- (define maybe-take (if (value-with-spec? redex-val) values take))
643
+ (define maybe-drop (if (value-with-spec? redex-val) (λ (x y) x) drop))
645
644
(match body
646
645
;; I thought that `rename-reference`ing this subterm of the current form was
647
646
;; going to be a problem: `rename-reference` doesn't have any idea about the
@@ -657,13 +656,18 @@ to traverse the whole value at once, rather than one binding form at a time.
657
656
658
657
[`(,(.../internal sub-body driving-names) . ,body-rest)
659
658
(define red-match-under-... (pass-... red-match driving-names))
660
-
661
- `(,@(map (λ (sub-red-match sub-freshened-subterms redex-val)
662
- (loop sub-red-match sub-freshened-subterms sub-body redex-val))
663
- red-match-under-...
664
- (pass-... freshened-subterms driving-names (length red-match-under-...))
665
- (maybe-take redex-val (length red-match-under-...)))
666
-
659
+ (define fst
660
+ (if (value-with-spec? redex-val)
661
+ (map (λ (sub-red-match sub-freshened-subterms)
662
+ (loop sub-red-match sub-freshened-subterms sub-body redex-val))
663
+ red-match-under-...
664
+ (pass-... freshened-subterms driving-names (length red-match-under-...)))
665
+ (map (λ (sub-red-match sub-freshened-subterms redex-val)
666
+ (loop sub-red-match sub-freshened-subterms sub-body redex-val))
667
+ red-match-under-...
668
+ (pass-... freshened-subterms driving-names (length red-match-under-...))
669
+ (take redex-val (length red-match-under-...)))))
670
+ `(,@fst
667
671
. ,(loop red-match freshened-subterms body-rest
668
672
(maybe-drop redex-val (length red-match-under-...))))]
669
673
0 commit comments