Nec

0.40.0

Enums

enum ViewLeft [a : Type] with Eq

Source
case OneLeft(a)
case SomeLeft(a, Nec[a])

enum ViewRight [a : Type] with Eq

Source
case OneRight(a)
case SomeRight(Nec[a], a)

A datatype for pattern matching on a Nec (traversing right-to-left).

Definitions

def ap [aefb] ( f : Nec[a -> b \ ef] c : Nec[a] ) : Nec[b] \ ef

Source

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), ....

def append [a] ( c1 : Nec[a] c2 : Nec[a] ) : Nec[a] \ Pure

Source

Returns a new Nec formed by appending the Necs c1 and c2.

def cons [a] ( x : a c : Nec[a] ) : Nec[a] \ Pure

Source

Add element x to the left end of Nec c.

def count [aef] ( f : a -> Bool \ ef c : Nec[a] ) : Int32 \ ef

Source

Returns the number of elements in c that satisfy the predicate f.

def dropWhileLeft [aef] ( f : a -> Bool \ ef c : Nec[a] ) : List[a] \ ef

Source

Returns c without the longest prefix that satisfies the predicate f.

def dropWhileRight [aef] ( f : a -> Bool \ ef c : Nec[a] ) : List[a] \ ef

Source

Returns c without the longest sufffix that satisfies the predicate f.

def enumerator [ra] ( rc : Region[r] c : Nec[a] ) : Iterator[(Int32, a), r, r] \ r

Source

Returns an iterator over c zipped with the indices of the elements.

def equals [a] ( c1 : Nec[a] c2 : Nec[a] ) : Bool \ Pure with Eq[a]

Source

Returns true if and only if c1 and c2 and equal.

def exists [aef] ( f : a -> Bool \ ef c : Nec[a] ) : Bool \ ef

Source

Returns true if and only if at least one element in c satisfies the predicate f.

Returns false if c is empty.

def filter [aef] ( f : a -> Bool \ ef c : Nec[a] ) : List[a] \ ef

Source

Returns a list of every element in c that satisfies the predicate f.

def filterMap [aefb] ( f : a -> Option[b] \ ef c : Nec[a] ) : List[b] \ ef

Source

Collects the results of applying the partial function f to every element in c.

def find [aef] ( f : a -> Bool \ ef c : Nec[a] ) : Option[a] \ ef

Source

Alias for findLeft.

def findLeft [aef] ( f : a -> Bool \ ef c : Nec[a] ) : Option[a] \ ef

Source

Optionally returns the first element of c that satisfies the predicate f when searching from left to right.

def findMap [aefb] ( f : a -> Option[b] \ ef c : Nec[a] ) : Option[b] \ ef

Source

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.

def findRight [aef] ( f : a -> Bool \ ef c : Nec[a] ) : Option[a] \ ef

Source

Optionally returns the first element of c that satisfies the predicate f when searching from right to left.

def flatMap [aefb] ( f : a -> Nec[b] \ ef c : Nec[a] ) : Nec[b] \ ef

Source

Returns the result of applying f to every element in c and concatenating the results.

def flatten [a] ( c : Nec[Nec[a]] ) : Nec[a] \ Pure

Source

Returns the concatenation of the elements in c.

def fold [a] ( l : Nec[a] ) : a \ Pure with Monoid[a]

Source

Returns the result of applying combine to all the elements in l, using empty as the initial value.

def foldLeft [baef] ( f : b -> (a -> b \ ef) acc : b c : Nec[a] ) : b \ ef

Source

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).

def foldMap [aefb] ( f : a -> b \ ef c : Nec[a] ) : b \ ef with Monoid[b]

Source

Returns the result of mapping each element and combining the results.

def foldRight [abef] ( f : a -> (b -> b \ ef) s : b c : Nec[a] ) : b \ ef

Source

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))...).

def foldRightWithCont [aefb] ( f : a -> ((Unit -> b \ ef) -> b \ ef) z : b c : Nec[a] ) : b \ ef

Source

Applies f to a start value z 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, z))...). A foldRightWithCont allows early termination by not calling the continuation.

def forAll [aef] ( f : a -> Bool \ ef c : Nec[a] ) : Bool \ ef

Source

Returns true if and only if all elements in c satisfy the predicate f.

Returns true if c is empty.

def forEach [aef] ( f : a -> Unit \ ef c : Nec[a] ) : Unit \ ef

Source

Applies f to every element of c.

def forEachWithIndex [aef] ( f : Int32 -> (a -> Unit \ ef) c : Nec[a] ) : Unit \ ef

Source

Applies f to every element of c along with that element's index.

def head [a] ( c : Nec[a] ) : a \ Pure

Source

Returns the first element of c.

def indexOf [a] ( a : a c : Nec[a] ) : Option[Int32] \ Pure with Eq[a]

Source

Optionally returns the position of a in c.

def init [a] ( c : Nec[a] ) : List[a] \ Pure

Source

Returns the list of elements in c without the last element.

def intersperse [a] ( sep : a c : Nec[a] ) : Nec[a] \ Pure

Source

Returns c with a inserted between every two adjacent elements.

def isSingleton [a] ( c : Nec[a] ) : Bool \ Pure

Source

Returns true if and only if c is a single element Nec.

def iterator [ra] ( rc : Region[r] c : Nec[a] ) : Iterator[a, r, r] \ r

Source

Returns an iterator over c.

def join [a] ( sep : String c : Nec[a] ) : String \ Pure with ToString[a]

Source

Returns the concatenation of the string representation of each element in c with sep inserted between each element.

def joinWith [aef] ( f : a -> String \ ef sep : String c : Nec[a] ) : String \ ef

Source

Returns the concatenation of the string representation of each element in c according to f with sep inserted between each element.

def last [a] ( c : Nec[a] ) : a \ Pure

Source

Returns the last element of c.

def length [a] ( c : Nec[a] ) : Int32 \ Pure

Source

Returns the length of c.

def map [aefb] ( f : a -> b \ ef c : Nec[a] ) : Nec[b] \ ef

Source

Returns the result of applying f to every element in c.

That is, the result is of the form: f(x1) :: f(x2) :: ....

def mapAccumLeft [saefb] ( f : s -> (a -> (s, b) \ ef) start : s c : Nec[a] ) : (s, Nec[b]) \ ef

Source

mapAccumLeft is a stateful version of map. The accumulating parameter s is updated at each step in a left-to-right traversal.

def mapAccumRight [saefb] ( f : s -> (a -> (s, b) \ ef) start : s c : Nec[a] ) : (s, Nec[b]) \ ef

Source

mapAccumRight is a stateful version of map. The accumulating parameter s is updated at each step in a right-to-left traversal.

def mapWithIndex [aefb] ( f : Int32 -> (a -> b \ ef) c : Nec[a] ) : Nec[b] \ ef

Source

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(x1, 0) :: f(x2, 1) :: ....

def maximum [a] ( c : Nec[a] ) : a \ Pure with Order[a]

Source

Finds the largest element of c according to the Order on a.

def maximumBy [a] ( cmp : a -> (a -> Comparison) c : Nec[a] ) : a \ Pure

Source

Finds the largest element of c according to the given comparator cmp.

def memberOf [a] ( a : a c : Nec[a] ) : Bool \ Pure with Eq[a]

Source

Returns true if and only if c contains the element a.

def minimum [a] ( c : Nec[a] ) : a \ Pure with Order[a]

Source

Finds the smallest element of c according to the Order on a.

def minimumBy [a] ( cmp : a -> (a -> Comparison) c : Nec[a] ) : a \ Pure

Source

Finds the smallest element of c according to the given comparator cmp.

def permutations [a] ( c : Nec[a] ) : Nec[List[a]] \ Pure

Source

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.

def range ( b : Int32 e : Int32 ) : Option[Nec[Int32]] \ Pure

Source

Returns a list of all integers between b (inclusive) and e (exclusive) wrapped in Some.

Returns None if b >= e.

def reduce [a] ( c : Nec[a] ) : a \ Pure with SemiGroup[a]

Source

Applies combine to all elements in c until a single value is obtained.

def reduceLeft [aef] ( f : a -> (a -> a \ ef) c : Nec[a] ) : a \ ef

Source

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)

def reduceLeftTo [baef1ef2] ( f : b -> (a -> b \ ef1) g : a -> b \ ef2 c : Nec[a] ) : b \ ef1 + ef2

Source

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.

def reduceRight [aef] ( f : a -> (a -> a \ ef) c : Nec[a] ) : a \ ef

Source

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: Some(f(x1, ...f(xn-2, f(xn-1, xn))...))

def reduceRightTo [abef1ef2] ( f : a -> (b -> b \ ef1) g : a -> b \ ef2 c : Nec[a] ) : b \ ef1 + ef2

Source

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.

def replace [a] ( from : { from = a } to : { to = a } l : Nec[a] ) : Nec[a] \ Pure with Eq[a]

Source

Returns l with every occurrence of from replaced by to.

def reverse [a] ( c : Nec[a] ) : Nec[a] \ Pure

Source

Returns the reverse of c.

def sequence [ma] ( c : Nec[m[a]] ) : m[Nec[a]] \ Pure with Applicative[m]

Source

Returns the result of running all the actions in the Nec c.

def shuffle [a] ( rnd : Random c : Nec[a] ) : Option[Nec[a]] \ IO

Source

Optionally returns the Nec c shuffled using the Fisher–Yates shuffle.

def singleton [a] ( x : a ) : Nec[a] \ Pure

Source

Return the singleton Nec with element x.

def snoc [a] ( c : Nec[a] x : a ) : Nec[a] \ Pure

Source

Add element x to the right end of Nec c.

def sort [a] ( c : Nec[a] ) : Nec[a] \ Pure with Order[a]

Source

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.

def sortBy [ab] ( f : a -> b c : Nec[a] ) : Nec[a] \ Pure with Order[b]

Source

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.

def sortWith [a] ( cmp : a -> (a -> Comparison) c : Nec[a] ) : Nec[a] \ Pure

Source

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.

def subsequences [a] ( c : Nec[a] ) : Nec[List[a]] \ Pure

Source

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.

def sum ( c : Nec[Int32] ) : Int32 \ Pure

Source

Returns the sum of all elements in the Nec c.

def sumWith [aef] ( f : a -> Int32 \ ef c : Nec[a] ) : Int32 \ ef

Source

Returns the sum of all elements in the Nec c according to the function f.

def tail [a] ( c : Nec[a] ) : List[a] \ Pure

Source

Returns all elements in c without the first element.

def takeWhileLeft [aef] ( f : a -> Bool \ ef c : Nec[a] ) : List[a] \ ef

Source

Returns the longest prefix of c that satisfies the predicate f.

def takeWhileRight [aef] ( f : a -> Bool \ ef c : Nec[a] ) : List[a] \ ef

Source

Returns the longest prefix of c that satisfies the predicate f.

def toArray [ra] ( rc : Region[r] c : Nec[a] ) : Array[a, r] \ r

Source

Returns the Nec c as an array.

def toList [a] ( c : Nec[a] ) : List[a] \ Pure

Source

Returns c as a list.

def toMap [ab] ( c : Nec[(a, b)] ) : Map[a, b] \ Pure with Order[a]

Source

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.

def toMapWith [ab] ( f : a -> b l : Nec[a] ) : Map[a, b] \ Pure with Order[a]

Source

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 toMutDeque [ra] ( rc : Region[r] c : Nec[a] ) : MutDeque[a, r] \ r

Source

Returns c as a MutDeque.

def toMutList [ra] ( rc1 : Region[r] c : Nec[a] ) : MutList[a, r] \ r

Source

Returns c as a mutable list.

def toSet [a] ( c : Nec[a] ) : Set[a] \ Pure with Order[a]

Source

Returns the list c as a set.

def toVector [a] ( c : Nec[a] ) : Vector[a] \ Pure

Source

Returns the Nec c as a vector.

def traverse [aefmb] ( f : a -> m[b] \ ef c : Nec[a] ) : m[Nec[b]] \ ef with Applicative[m]

Source

Returns the result of applying the applicative mapping function f to all the elements of the Nec c.

def unzip [ab] ( c : Nec[(a, b)] ) : (Nec[a], Nec[b]) \ Pure

Source

Returns a pair of Necs, the first containing all first components in c and the second containing all second components in c.

def viewLeft [a] ( c : Nec[a] ) : ViewLeft[a] \ Pure

Source

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.

def viewRight [a] ( c : Nec[a] ) : ViewRight[a] \ Pure

Source

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.

def zip [ab] ( c1 : Nec[a] c2 : Nec[b] ) : Nec[(a, b)] \ Pure

Source

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.

def zipWith [abefc] ( f : a -> (b -> c \ ef) c1 : Nec[a] c2 : Nec[b] ) : Nec[c] \ ef

Source

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 [abeffc] ( f : a -> (b -> f[c] \ ef) xs : Nec[a] ys : Nec[b] ) : f[Nec[c]] \ ef with Applicative[f]

Source

Generalize zipWith to an applicative functor f.

def zipWithIndex [a] ( c : Nec[a] ) : Nec[(Int32, a)] \ Pure

Source

Returns a Nec where each element e is mapped to (i, e) where i is the index of e.