15 lines
510 B
JavaScript
15 lines
510 B
JavaScript
export * from './Types/Tuple.mjs'
|
|
|
|
export const equal = {
|
|
// Change this to a template implementation (or maybe add template
|
|
// implementation to handle matching types, and have mixed template-base
|
|
// method returning false to catch test of two tuples of different types.
|
|
'Tuple,Tuple': ({self, length}) => (s,t) => {
|
|
if (length(s) !== length(t)) return false
|
|
for (let i = 0; i < length(s); ++i) {
|
|
if (!self(s.elts[i], t.elts[i])) return false
|
|
}
|
|
return true
|
|
}
|
|
}
|