Fix match-value/captures for vectors (and hence structs)
This commit is contained in:
parent
31ee4cb2cd
commit
d244866617
|
@ -42,8 +42,10 @@
|
||||||
[#f #f]
|
[#f #f]
|
||||||
[c (walk v2 p2 c)])]
|
[c (walk v2 p2 c)])]
|
||||||
[((? vector? v) (? vector? p)) #:when (= (vector-length v) (vector-length p))
|
[((? vector? v) (? vector? p)) #:when (= (vector-length v) (vector-length p))
|
||||||
(for/fold [(c captures-rev)] [(vv (in-vector v)) (pp (in-vector p))]
|
(define limit (vector-length v))
|
||||||
(walk vv pp c))]
|
(do ((c captures-rev (walk (vector-ref v i) (vector-ref p i) c))
|
||||||
|
(i 0 (+ i 1)))
|
||||||
|
((or (= i limit) (not c)) c))]
|
||||||
[(_ _) #:when (or (treap? v) (treap? p))
|
[(_ _) #:when (or (treap? v) (treap? p))
|
||||||
(error 'match-value/captures "Cannot match on treaps at present")]
|
(error 'match-value/captures "Cannot match on treaps at present")]
|
||||||
[((? non-object-struct?) (? non-object-struct?))
|
[((? non-object-struct?) (? non-object-struct?))
|
||||||
|
|
Loading…
Reference in New Issue