Category talk:Wren-seq: Difference between revisions
Content added Content deleted
m (→Source code: Minor change.) |
(→Source code: Added Lst.prune method.) |
||
Line 270: | Line 270: | ||
for (g in gr) res.add(g[0]) |
for (g in gr) res.add(g[0]) |
||
return res |
return res |
||
} |
|||
// Removes consecutive repeated elements from a list (not a copy). |
|||
// If the list is sorted, it removes all duplicates. |
|||
static prune(a) { |
|||
isList_(a) |
|||
var c = a.count |
|||
if (c < 2) return |
|||
for (i in c-1..1) { |
|||
if (a[i-1] == a[i]) a.removeAt(i) |
|||
} |
|||
} |
} |
||