DelayList

0.40.0

Definitions

@Experimental@LazyWhenPure

def ap [aefb] ( f : DelayList[a -> b \ ef] l : DelayList[a] ) : DelayList[b] \ ef

Source

Apply every function from f to every argument from l and return a list with all results. For f = f1, f2, ... and l = x1, x2, ... the results appear in the order f1(x1), f1(x2), ..., f2(x1), f2(x2), ....

Whether the i-th function in f (fi) is applied eagerly or lazily depends on its purity:

  • If fi is pure then it is applied lazily (i.e. the tail of l is not forced).
  • If fi is impure then it is applied eagerly (i.e. the entire list l is forced).

Note that this implies that ALL functions in f must be pure to avoid forcing l.

@Experimental@Lazy

def append [a] ( l1 : DelayList[a] l2 : DelayList[a] ) : DelayList[a] \ Pure

Source

Returns l2 appended to l1.

Does not force the tail of l1.

@Experimental

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

Source

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

Forces the entire list l.

@Experimental@Lazy

def drop [a] ( n : Int32 l : DelayList[a] ) : DelayList[a] \ Pure

Source

Returns l without the first n elements.

Returns ENil if n > length(l). Returns l if n < 1.

Does not force the tail of l.

@Experimental@LazyWhenPure

def dropWhile [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : DelayList[a] \ ef

Source

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

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the tail is forced until the first element that satisfies f).
@Experimental

def empty [a] : DelayList[a] \ Pure

Source

Returns an empty DelayList.

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

Source

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

@Experimental

def exists [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : Bool \ ef

Source

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

Returns false if l is empty.

Forces elements of l until the predicate f is satisfied.

@Experimental@LazyWhenPure

def filter [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : DelayList[a] \ ef

Source

Returns a DelayList with every element in l that satisfies the predicate f.

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the entire list l is forced).
@Experimental@LazyWhenPure

def filterMap [aefb] ( f : a -> Option[b] \ ef l : DelayList[a] ) : DelayList[b] \ ef

Source

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

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the entire list l is forced).
@Experimental

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

Source

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

Forces elements of l until the predicate f is satisfied.

@Experimental

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

Source

Returns the first non-None result of applying the partial function f to each element of l.

Returns None if every element f(x) of l is None.

Forces elements of l until f(x) returns Some(v).

@Experimental

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

Source

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

Forces the entire list l.

@Experimental@LazyWhenPure

def flatMap [aefb] ( f : a -> DelayList[b] \ ef l : DelayList[a] ) : DelayList[b] \ ef

Source

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

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the entire list l is forced).
@Experimental@Lazy

def flatten [a] ( l : DelayList[DelayList[a]] ) : DelayList[a] \ Pure

Source

Returns the concatenation of the elements in l.

Does not force the tail of l.

@Experimental

def foldLeft [baef] ( f : b -> (a -> b \ ef) s : b l : DelayList[a] ) : b \ ef

Source

Applies f to a start value s and all elements in l going from left to right.

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

Forces the entire list l.

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

Source

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

@Experimental

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

Source

Applies f to a start value s and all elements in l going from right to left.

That is, the result is of the form: f(x1, ...f(xn-1, f(xn, s))...).

Forces the entire list l.

@Experimental

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

Source

Applies f to a start value z and all elements in l 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.

Calling the continuation forces the list l.

@Experimental

def forAll [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : Bool \ ef

Source

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

Returns true if l is empty.

Forces elements in l until the first element that does not satisfy the predicate f (inclusive).

@Experimental

def forEach [aef] ( f : a -> Unit \ ef l : DelayList[a] ) : Unit \ ef

Source

Applies f to every element of l.

Forces the entire list l.

@Experimental

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

Source

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

Forces the entire list l.

@Experimental@Lazy

def from ( n : Int32 ) : DelayList[Int32] \ Pure

Source

Returns an infinite sequence of integers starting from and including n.

@Experimental

def head [a] ( l : DelayList[a] ) : Option[a] \ Pure

Source

Returns Some(x) if x is the first element of l.

Returns None if l is empty.

Does not force the tail of l.

@Experimental@Lazy

def intercalate [a] ( l1 : DelayList[a] l2 : DelayList[DelayList[a]] ) : DelayList[a] \ Pure

Source

Returns the concatenation of the elements in l2 with the elements of l1 inserted between every two adjacent elements of l2.

That is, returns l2.1 :: l1.1 ... l1.n :: l2.2 :: ... :: l2.n-1 :: l1.1 :: ... :: l1.n :: l2.n :: ENil.

Does not force the tail of l2.

@Experimental@Lazy

def intersperse [a] ( x : a l : DelayList[a] ) : DelayList[a] \ Pure

Source

Returns l with x inserted between every two adjacent elements.

Does not force the tail of l.

@Experimental

def isEmpty [a] ( l : DelayList[a] ) : Bool \ Pure

Source

Returns true if and only if l is the empty DelayList, i.e. ENil.

Does not force the tail of l.

@Experimental@Lazy

def iterator [ra] ( rc : Region[r] l : DelayList[a] ) : Iterator[a, r, r] \ r

Source

Returns l as an Iterator.

Does not force any elements of the list.

@Experimental

def join [a] ( sep : String l : DelayList[a] ) : String \ Pure with ToString[a]

Source

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

Forces the entire list l.

@Experimental

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

Source

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

Forces the entire list l.

@Experimental

def last [a] ( l : DelayList[a] ) : Option[a] \ Pure

Source

Returns Some(x) if x is the last element of l.

Returns None if l is empty.

Forces the entire list l.

@Experimental

def length [a] ( l : DelayList[a] ) : Int32 \ Pure

Source

Returns the length of l.

Forces the entire list l.

@Experimental@LazyWhenPure

def map [aefb] ( f : a -> b \ ef l : DelayList[a] ) : DelayList[b] \ ef

Source

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

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the entire list l is forced).
@Experimental@LazyWhenPure

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

Source

Returns the result of applying f to every element in l along with that element's index.

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

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the entire list l is forced).
@Experimental

def maximum [a] ( l : DelayList[a] ) : Option[a] \ Pure with Order[a]

Source

Optionally finds the largest element of l according to the Order on a.

Returns None if l is empty.

Forces the entire list l.

@Experimental

def maximumBy [a] ( cmp : a -> (a -> Comparison) l : DelayList[a] ) : Option[a] \ Pure

Source

Optionally finds the largest element of l according to the given comparator cmp.

Returns None if l is empty.

Forces the entire list l.

@Experimental

def memberOf [a] ( x : a l : DelayList[a] ) : Bool \ Pure with Eq[a]

Source

Returns true if and only if l contains the element x.

Forces elements until x is found.

@Experimental

def minimum [a] ( l : DelayList[a] ) : Option[a] \ Pure with Order[a]

Source

Optionally finds the smallest element of l according to the Order on a.

Returns None if l is empty.

Forces the entire list l.

@Experimental

def minimumBy [a] ( cmp : a -> (a -> Comparison) l : DelayList[a] ) : Option[a] \ Pure

Source

Optionally finds the smallest element of l according to the given comparator cmp.

Returns None if l is empty.

Forces the entire list l.

@Experimental

def partition [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : (DelayList[a], DelayList[a]) \ ef

Source

Returns a pair of lists (l1, l2) where:

  • l1 contains all elements of l that satisfy the predicate f.
  • l2 contains all elements of l that DO NOT satisfy the predicate f.

Forces the entire list l.

@Experimental@Lazy

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

Source

Returns a DelayList of all integers between b (inclusive) and e (exclusive).

Returns an empty DelayList if b >= e.

@Experimental

def reduceLeft [aef] ( f : a -> (a -> a \ ef) l : DelayList[a] ) : Option[a] \ ef

Source

Applies f to all elements in l going from left to right until a single value v is obtained. Returns Some(v).

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

Returns None if l is empty.

Forces the entire list l.

@Experimental

def reduceRight [aef] ( f : a -> (a -> a \ ef) l : DelayList[a] ) : Option[a] \ ef

Source

Applies f to all elements in l going from right to left until a single value v is obtained. Returns Some(v).

That is, the result is of the form: Some(f(x1, ...f(xn-2, f(xn-1, xn))...))

Returns None if l is empty.

Forces the entire list l.

@Experimental@Lazy

def repeat [a] ( x : a ) : DelayList[a] \ Pure

Source

Returns an infinite DelayList of repeating xs.

@Experimental@Lazy

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

Source

Returns l with every occurrence of from replaced by to.

Does not force the tail of l.

@Experimental@Lazy

def reverse [a] ( l : DelayList[a] ) : DelayList[a] \ Pure

Source

Reverses the list l.

Does not force the tail of l.

@Experimental

def sequence [ma] ( l : DelayList[m[a]] ) : m[DelayList[a]] \ Pure with Applicative[m]

Source

Returns the result of running all the actions in the DelayList l.

def shuffle [a] ( rnd : Random l : DelayList[a] ) : DelayList[a] \ IO

Source

Shuffles l using the Fisher–Yates shuffle.

@Experimental

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

Source

Return the singleton list with element x.

@Experimental@LazyWhenPure

def span [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : (DelayList[a], DelayList[a]) \ ef

Source

Returns a pair of lists (l1, l2) where:

  • l1 is the longest prefix of l that satisfies the predicate f.
  • l2 is the remainder of l.

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the entire list l is forced).
@Experimental

def sum ( l : DelayList[Int32] ) : Int32 \ Pure

Source

Returns the sum of all elements in the DelayList l.

Forces the entire list l.

@Experimental

def sumWith [aef] ( f : a -> Int32 \ ef l : DelayList[a] ) : Int32 \ ef

Source

Returns the sum of all elements in the DelayList l according to the function f.

Forces the entire list l.

@Experimental@Lazy

def tail [a] ( l : DelayList[a] ) : DelayList[a] \ Pure

Source

Returns l without the first element.

Does not force the tail of l.

@Experimental@Lazy

def take [a] ( n : Int32 l : DelayList[a] ) : DelayList[a] \ Pure

Source

Returns the first n elements of l.

Does not force the tail of l.

@Experimental@LazyWhenPure

def takeWhile [aef] ( f : a -> Bool \ ef l : DelayList[a] ) : DelayList[a] \ ef

Source

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

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tail is not forced).
  • If f is impure then it is applied eagerly (i.e. the tail is forced until the first element that satisfies f).
@Experimental

def toArray [ra] ( rc : Region[r] l : DelayList[a] ) : Array[a, r] \ r

Source

Returns l as an Array.

Forces the entire list l.

@Experimental

def toList [a] ( l : DelayList[a] ) : List[a] \ Pure

Source

Returns l as a List.

Forces the entire list l.

@Experimental

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

Source

Returns the association list l as a map.

If l contains multiple mappings with the same key, toMap does not make any guarantees about which mapping will be in the resulting map.

Forces the entire list l.

def toMutDeque [ra] ( rc : Region[r] l : DelayList[a] ) : MutDeque[a, r] \ r

Source

Returns l as a MutDeque.

@Experimental

def toMutList [ra] ( rc : Region[r] l : DelayList[a] ) : MutList[a, r] \ r

Source

Returns l as a List.

Forces the entire list l.

@Experimental

def toSet [a] ( l : DelayList[a] ) : Set[a] \ Pure with Order[a]

Source

Returns l as a Set.

Forces the entire list l.

@Experimental

def toString [a] ( l : DelayList[a] ) : String \ Pure with ToString[a]

Source

Returns a string representation of l.

Forces the entire list l.

@Experimental

def toVector [a] ( l : DelayList[a] ) : Vector[a] \ Pure

Source

Returns l as a Vector.

Forces the entire list l.

@Experimental

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

Source

Returns the result of applying the applicative mapping function f to all the elements of the DelayList l.

@Experimental@Lazy

def zip [ab] ( l1 : DelayList[a] l2 : DelayList[b] ) : DelayList[(a, b)] \ Pure

Source

Returns a list where the element at index i is (a, b) where a is the element at index i in l1 and b is the element at index i in l2.

If either l1 or l2 is depleted, then no further elements are added to the resulting list.

Does not force the tail of either l1 or l2.

@Experimental@LazyWhenPure

def zipWith [abefc] ( f : a -> (b -> c \ ef) l1 : DelayList[a] l2 : DelayList[b] ) : DelayList[c] \ ef

Source

Returns a list where the element at index i is f(a, b) where a is the element at index i in l1 and b is the element at index i in l2.

If either l1 or l2 is depleted, then no further elements are added to the resulting list.

Whether f is applied eagerly or lazily depends on its purity:

  • If f is pure then it is applied lazily (i.e. the tails are not forced).
  • If f is impure then it is applied eagerly (i.e. both lists l1 and l2 are forced).

def zipWithIndex [a] ( l : DelayList[a] ) : DelayList[(Int32, a)] \ Pure

Source

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

Does not force the tail of l.