aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/struct/vector.lux18
1 files changed, 17 insertions, 1 deletions
diff --git a/stdlib/source/lux/data/struct/vector.lux b/stdlib/source/lux/data/struct/vector.lux
index bb31063a4..4b8fb4bf3 100644
--- a/stdlib/source/lux/data/struct/vector.lux
+++ b/stdlib/source/lux/data/struct/vector.lux
@@ -352,9 +352,25 @@
(wrap (list (` (from-list (list (~@ elems)))))))
## [Structures]
+(struct: #export (Eq<Node> Eq<a>) (All [a] (-> (Eq a) (Eq (Node a))))
+ (def: (= v1 v2)
+ (case [v1 v2]
+ [(#Base b1) (#Base b2)]
+ (:: (array;Eq<Array> Eq<a>) = b1 b2)
+
+ [(#Hierarchy h1) (#Hierarchy h2)]
+ (:: (array;Eq<Array> (Eq<Node> Eq<a>)) = h1 h2)
+ )))
+
(struct: #export (Eq<Vector> Eq<a>) (All [a] (-> (Eq a) (Eq (Vector a))))
(def: (= v1 v2)
- (:: (list;Eq<List> Eq<a>) = (to-list v1) (to-list v2))))
+ (and (=+ (get@ #size v1) (get@ #size v2))
+ (:: (Eq<Node> Eq<a>) =
+ (#Base (get@ #tail v1))
+ (#Base (get@ #tail v2)))
+ (:: (Eq<Node> Eq<a>) =
+ (#Hierarchy (get@ #root v1))
+ (#Hierarchy (get@ #root v2))))))
(struct: _ (Fold Node)
(def: (fold f init xs)