Nec
enum Nec[t: Type]Sourcecase NecOne(t)case Nec(Nec[t], Nec[t])The NonEmpty Chain type.
A chain is a list represented as an unbalanced binary tree. It supports efficient append and "snoc" - appending elements at the tail of the list.
Note - the constructors NecOne and Nec should not be used directly.
Instances
instance Applicative[Nec]Sourceinstance Formattable[Nec[a]] with Formattable[a]Sourceinstance Traversable[Nec]Sourceinstance UnorderedFoldable[Nec]SourceDefinitions
Apply every function from f to every argument from x and return a Nec with all results.
For f = f1, f2, ... and x = x1, x2, ... the results appear in the order
f1(x1), f1(x2), ..., f2(x1), f2(x2), ....
Returns a new Nec formed by appending the Necs c1 and c2.
Returns the number of elements in c that satisfy the predicate f.
Returns c without the longest prefix that satisfies the predicate f.
Returns c without the longest sufffix that satisfies the predicate f.
Returns true if and only if c1 and c2 and equal.
Returns true if and only if at least one element in c satisfies the predicate f.
Returns a list of every element in c that satisfies the predicate f.
Collects the results of applying the partial function f to every element in c.
Optionally returns the first element of c that satisfies the predicate f when searching from left to right.
Returns the first non-None result of applying the partial function f to each element of c.
Returns None if f(c) for every element of c is None.
Optionally returns the first element of c that satisfies the predicate f when searching from right to left.
Returns the result of applying f to every element in c and concatenating the results.
Returns the result of applying combine to all the elements in l, using empty as the initial value.
Applies f to a start value s and all elements in c going from left to right.
That is, the result is of the form: f(...f(f(s, x1), x2)..., xn).
Returns the result of mapping each element and combining the results.
Applies f to a start value s and all elements in c going from right to left.
That is, the result is of the form: f(x1, ...f(xn-1, f(xn, s))...).
Returns true if and only if all elements in c satisfy the predicate f.
Applies f to every element of c along with that element's index.
Returns the element at position i in the non-empty chain c.
Throws IndexOutOfBoundsException if the index is out of bounds.
Optionally returns the position of a in c.
Returns a range of all valid indices of the non-empty chain c.
Returns the positions of all occurrences of x in c.
Returns c with a inserted between every two adjacent elements.
Returns the concatenation of the string representation
of each element in c with sep inserted between each element.
Returns the concatenation of the string representation
of each element in c according to f with sep inserted between each element.
Returns the result of applying f to every element in c.
That is, the result is of the form: f(x1) :: f(x2) :: ....
mapAccumLeft is a stateful version of map. The accumulating parameter s is updated at each
step in a left-to-right traversal.
mapAccumRight is a stateful version of map. The accumulating parameter s is updated at each
step in a right-to-left traversal.
Returns the result of applying f to every element in c along with that element's index.
That is, the result is of the form: f(0, x0) :: f(1, x1) :: ....
Finds the largest element of c according to the Order on a.
Finds the largest element of c according to the given comparator cmp.
Returns true if and only if c contains the element a.
Finds the smallest element of c according to the Order on a.
Finds the smallest element of c according to the given comparator cmp.
Optionally returns the element at position i in the non-empty chain c.
Returns all permutations of c in lexicographical order by element indices in c.
That is, c is the first permutation and reverse(c) is the last permutation.
Returns a list of all integers between b (inclusive) and e (exclusive) wrapped in Some.
Returns None if b >= e.
Applies combine to all elements in c until a single value is obtained.
Applies f to all elements in c going from left to right until a single value v is obtained.
That is, the result is of the form: f(...f(f(x1, x2), x3)..., xn)
Left-associative reduction of a structure.
Applies g to the initial element of c and combines it
with the remainder of c using f going from left to right.
Applies f to all elements in c going from right to left until a single value v is obtained.
That is, the result is of the form: f(x1, ...f(xn-2, f(xn-1, xn))...)
Right-associative reduction of a structure.
Applies g to the initial element of c and combines it
with the remainder of c using f going from right to left.
Returns l with every occurrence of src replaced by dst.
def sequence(c: Nec[m[a]]): m[Nec[a]] with Applicative[m]§ SourceReturns the result of running all the actions in the Nec c.
Optionally returns the Nec c shuffled using the Fisher–Yates shuffle.
Sort Nec c so that elements are ordered from low to high according to their Order instance.
The sort is not stable, i.e., equal elements may appear in a different order than in the input c.
The sort implementation is a Quicksort.
Sort Nec c so that elements are ordered from low to high according to the Order instance
for the values obtained by applying f to each element.
The sort is not stable, i.e., equal elements may appear in a different order than in the input c.
The sort implementation is a Quicksort.
Sort Nec c so that elements are ordered from low to high according to the comparison function cmp.
The sort is not stable, i.e., equal elements may appear in a different order than in the input c.
The sort implementation is a Quicksort.
Returns all subsequences of l in lexicographical order by element indices in l.
That is, l is the first subsequence and Nil is the last subsequence.
Returns the sum of all elements in the Nec c according to the function f.
Returns the longest prefix of c that satisfies the predicate f.
Returns the longest prefix of c that satisfies the predicate f.
Returns the Nec of pairs c that represents an association list as a map.
If c contains multiple mappings with the same key, toMap does not
make any guarantees about which mapping will be in the resulting map.
Returns a map with elements of l as keys and f applied as values.
If l contains multiple mappings with the same key, toMapWith does not
make any guarantees about which mapping will be in the resulting map.
def traverse(f: a -> m[b] \ ef, c: Nec[a]): m[Nec[b]] \ ef with Applicative[m]§ SourceReturns the result of applying the applicative mapping function f to all the elements of the
Nec c.
Returns a pair of Necs, the first containing all first components in c
and the second containing all second components in c.
Deconstruct a Nec from left-to-right.
Returns ViewLeft.SomeLeft(x, rs) if the Nec has at least two elements, where x is the leftmost
element of the Nec c, and rs is the rest of the Nec.
Returns ViewLeft.OneLeft if the Nec has a single element.
Deconstruct a Nec from right-to-left.
Returns ViewRight.SomeRight(rs, x) if the Nec has at least two elements, where x is the rightmost
element of the Nec c, and rs is the front of the Nec.
Returns ViewRight.OneRight if the Nec has a single element.
Returns a Nec where the element at index i is (a, b) where
a is the element at index i in c1 and b is the element at index i in c2.
If either c1 or c2 becomes depleted, then no further elements are added to the resulting Nec.
Returns a Nec where the element at index i is f(a, b) where
a is the element at index i in c1 and b is the element at index i in c2.
If either c1 or c2 becomes depleted, then no further elements are added to the resulting Nec.
def zipWithA(f: a -> (b -> f[c] \ ef), xs: Nec[a], ys: Nec[b]): f[Nec[c]] \ ef with Applicative[f]§ SourceGeneralize zipWith to an applicative functor f.