Skip to content

Commit 51dc09a

Browse files
committed
Vector<t> equals
1 parent d52aac9 commit 51dc09a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

PLATFORM/C/LIB/vector.lsts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,23 @@ let print(v: Vector<x>): Nil = (
8080
};
8181
print(c"]");
8282
);
83+
84+
let $"=="(a: Vector<t>, b: Vector<t>): U64 = (
85+
let al = a.length();
86+
let bl = b.length();
87+
if al == bl {
88+
let i = 0_u64;
89+
let ok = 1_u64;
90+
while i < al {
91+
if a[i] != b[i] {
92+
ok = 0_u64;
93+
i = al; # break
94+
} else {
95+
i = i + 1;
96+
}
97+
};
98+
ok
99+
} else {
100+
0_u64
101+
}
102+
);

0 commit comments

Comments
 (0)