#iterables

[ follow ]
Python
fromMathspp
3 days ago

Generalising itertools.pairwise

itertools.pairwise yields overlapping consecutive pairs from any iterable, and a deque+islice implementation generalises pairwise to non-sliceable iterables.
JavaScript
fromSmashing Magazine
1 month ago

JavaScript For Everyone: Iterators - Smashing Magazine

Iterables implement a [Symbol.iterator]() method to produce iterators; iterators follow the iterator protocol and allow sequential element access (usable by for...of).
[ Load more ]