|
45 | 45 | (arr-seq-sc-map f (combinator-args v)) |
46 | 46 | (void)) |
47 | 47 | (define (sc->contract v f) |
48 | | - (match v |
49 | | - [(arr-combinator (arr-seq args rest range)) |
50 | | - (with-syntax ([(arg-stx ...) (map f args)] |
51 | | - [(rest-stx ...) (if rest #`(#:rest #,(f rest)) #'())] |
52 | | - [range-stx (if range #`(values #,@(map f range)) #'any)]) |
53 | | - #'(arg-stx ... rest-stx ... . -> . range-stx))])) |
| 48 | + (match-define (arr-combinator (arr-seq args rest range)) v) |
| 49 | + (with-syntax ([(arg-stx ...) (map f args)] |
| 50 | + [(rest-stx ...) (if rest |
| 51 | + #`(#:rest #,(f rest)) |
| 52 | + #'())] |
| 53 | + [range-stx (if range |
| 54 | + #`(values #,@(map f range)) |
| 55 | + #'any)]) |
| 56 | + #'(arg-stx ... rest-stx ... . -> . range-stx))) |
54 | 57 | (define (sc->constraints v f) |
55 | 58 | (merge-restricts* 'chaperone (map f (arr-seq->list (combinator-args v)))))]) |
56 | 59 |
|
|
66 | 69 |
|
67 | 70 |
|
68 | 71 | (define (arr-seq-sc-map f seq) |
69 | | - (match seq |
70 | | - [(arr-seq args rest range) |
71 | | - (arr-seq |
72 | | - (map (λ (a) (f a 'contravariant)) args) |
73 | | - (and rest (f rest 'contravariant)) |
74 | | - (and range (map (λ (a) (f a 'covariant)) range)))])) |
| 72 | + (match-define (arr-seq args rest range) seq) |
| 73 | + (arr-seq (map (λ (a) (f a 'contravariant)) args) |
| 74 | + (and rest (f rest 'contravariant)) |
| 75 | + (and range (map (λ (a) (f a 'covariant)) range)))) |
75 | 76 |
|
76 | 77 | (define (arr-seq->list seq) |
77 | | - (match seq |
78 | | - [(arr-seq args rest range) |
79 | | - (append |
80 | | - args |
81 | | - (if rest (list rest) empty) |
82 | | - (or range empty))])) |
| 78 | + (match-define (arr-seq args rest range) seq) |
| 79 | + (append args |
| 80 | + (if rest |
| 81 | + (list rest) |
| 82 | + empty) |
| 83 | + (or range empty))) |
83 | 84 |
|
84 | 85 |
|
85 | 86 | (struct arr-seq (args rest range) |
|
0 commit comments