Skip to content

Optimizations

Xavier Garcia Buils edited this page Jun 17, 2017 · 1 revision
rangeByStep(start, end, step).slice(m, n) === rangeByStep(start + step * m, Math.min(end, start + step * n))
rangeByStep(start, end, step).nth(n) === start + step * n < end ? start + step * n : undefined
iterable.map(f).map(g) === iterable.map(e => f(g(e)))
iterable.filter(f).filter(g) === iterable(e => f(e) && g(e))
iterable.filter(f).uniq() === iterable.uniq().filter(f)
iterable.filter(f).uniqBy(g) === iterable.uniqBy(g).filter(f)
iterable.filter(f).uniqWith(g) === iterable.uniqWith(g).filter(f)
rangeByStep(start, end, step).repeat(Infinity).slice(m, n) === rangeByStep((start + step * m) % (end - start), (start + step * n) % (end - start))
rangeByStep(start, end, step).repeat(Infinity).nth(n) === start + step * n < end ? start + step * n : undefined 
iterable.repeat(n).filter(f) === iterable.filter(f).repeat(n)
iterable.repeat(n).map(f) === iterable.map(f).repeat(n)
iterable.permutations().flatten(1).uniq() === iterable
iterable.power().flatten(1).uniq() === iterable
iterable.map(e => [e].repeat(n)).uniq() === iterable
Clone this wiki locally