import * as itertools from "https://deno.land/x/itertools@v1.1.0/mod.ts";
Functions
f all | Returns true when all of the items in iterable are truthy. An optional key function can be used to define what truthiness means for this specific collection. |
f any | Returns true when any of the items in iterable are truthy. An optional key function can be used to define what truthiness means for this specific collection. |
Returns an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence. | |
Break iterable into lists of length | |
See icompact(). | |
Removes all undefined values from the given object. Returns a new object. | |
Non-lazy version of icompress(). | |
Returns true when any of the items in the iterable are equal to the target object. | |
Returns an iterator that counts up values starting with number | |
Returns an iterator producing elements from the iterable and saving a copy of each. When the iterable is exhausted, return elements from the saved copy. Repeats indefinitely. | |
Returns an iterator that drops elements from the iterable as long as the predicate is true; afterwards, returns every remaining element. Note, the iterator does not produce any output until the predicate first becomes false. | |
Returns an iterable of enumeration pairs. Iterable must be a sequence, an iterator, or some other object which supports iteration. The elements produced by returns a tuple containing a counter value (starting from 0 by default) and the values obtained from iterating over given iterable. | |
Non-lazy version of ifilter(). | |
Returns the first item in the iterable for which the predicate holds, if
any. If no such item exists, | |
Returns 0 or more values for every value in the given iterable. Technically, it's just calling map(), followed by flatten(), but it's a very useful operation if you want to map over a structure, but not have a 1:1 input-output mapping. Instead, if you want to potentially return 0 or more values per input element, use flatmap(): | |
Return an iterator flattening one level of nesting in a list of lists: | |
Yields the heads of all of the given iterables. This is almost like
| |
Returns an iterable, filtering out any | |
Returns an iterator that filters elements from data returning only those
that have a corresponding element in selectors that evaluates to | |
Returns an iterator that filters elements from iterable returning only those for which the predicate is true. | |
f imap | Returns an iterator that computes the given mapper function using arguments from each of the iterables. |
Returns an iterable containing only the first | |
f iter | Returns an iterator object for the given iterable. This can be used to manually get an iterator for any iterable datastructure. The purpose and main use case of this function is to get a single iterator (a thing with state, think of it as a "cursor") which can only be consumed once. |
Returns an iterator that aggregates elements from each of the iterables.
Used for lock-step iteration over several iterables at a time. When
iterating over two iterables, use | |
Like izip2, but for three input iterables. | |
Like the other izips ( | |
f map | Non-lazy version of imap(). |
f max | Return the largest item in an iterable. Only works for numbers, as ordering
is pretty poorly defined on any other data type in JS. The optional |
f min | Return the smallest item in an iterable. Only works for numbers, as
ordering is pretty poorly defined on any other data type in JS. The
optional |
Returns an iterator of paired items, overlapping, from the original. When
the input iterable has a finite number of items | |
Returns a 2-tuple of arrays. Splits the elements in the input iterable into either of the two arrays. Will fully exhaust the input iterable. The first array contains all items that match the predicate, the second the rest: | |
Return successive | |
Returns an iterator producing all the numbers in the given range one by one,
starting from | |
Apply function of two arguments cumulatively to the items of sequence, from left to right, so as to reduce the sequence to a single value. For example: | |
Yields the next item from each iterable in turn, alternating between them. Continues until all items are exhausted. | |
Return a new sorted list from the items in iterable. | |
f sum | Sums the items of an iterable from left to right and returns the total. The sum will defaults to 0 if the iterable is empty. |
f take | Non-lazy version of itake(). |
Returns an iterator that produces elements from the iterable as long as the predicate is true. | |
Yield unique elements, preserving order. | |
Yields elements in order, ignoring serial duplicates. | |
f zip | See izip. |
f zip3 | See izip3. |