Category talk:Wren-seq: Difference between revisions

→‎Source code: Added Lst.areEqual method.
(→‎Source code: Added Lst.reverse and Lst.removeBy, removed Lst.toMap (going to new MapUtil module).)
(→‎Source code: Added Lst.areEqual method.)
Line 471:
// Returns true if all elements of a list are the same, false otherwise.
static allSame(a) { distinct(a).count == 1 }
 
// Returns whether two lists a, b are the same length
// and contain 'equal' elements (using the '==' operator)
// in the same order.
static areEqual(a, b) {
isList_(a)
isList_(b)
if (a == b) return true
var ac = a.count
var bc = b.count
if (ac != bc) return false
for (i in 0...ac) {
if (a[i] != b[i]) return false
}
return true
}
 
// Splits a list into chunks of not more than 'size' elements.
9,476

edits