Definitions
import Juvix.Builtin.V1.List open public
find {A} (predicate : A → Bool) : List A → Maybe ASource#
𝒪(𝓃). Returns the leftmost element of the list satisfying the predicate or nothing if there's no such element.
listFoldl {A B} (f : B → A → B) (z : B) : List A → BSource#
Left-associative and tail-recursive fold.
listMap {A B} (f : A → B) : List A → List BSource#
𝒪(𝓃). Maps a function over each element of a List.
replicate {A} : Nat → A → List ASource#
Returns a List of length n where every element is the given value.
splitAt {A} : Nat → List A → Pair (List A) (List A)Source#
𝒪(𝓃). splitAt n xs returns a tuple where first element is xs prefix of length n and second element is the remainder of the List.
terminating merge {A} {{Ord A}} : List A → List A → List ASource#
𝒪(𝓃 + 𝓂). Merges two lists according the given ordering.
partition {A} (f : A → Bool) : List A → Pair (List A) (List A)Source#
𝒪(𝓃). Returns a tuple where the first component has the items that satisfy the predicate and the second component has the elements that don't.
prependToAll {A} (sep : A) : List A → List ASource#
𝒪(𝓃). Inserts the given element before every element in the given List.
intersperse {A} (sep : A) : List A → List ASource#
𝒪(𝓃). Inserts the given element inbetween every two elements in the given List.
zipWith {A B C} (f : A -> B -> C) : List A -> List B -> List CSource#
𝒪(min(𝓂, 𝓃)). Returns a list containing the results of applying a function to each pair of elements from the input lists.
zip {A B} : List A -> List B -> List (Pair A B)Source#
𝒪(min(𝓂, 𝓃)). Returns a list of pairs formed from the input lists.
mergeSort {A} {{Ord A}} (l : List A) : List ASource#
𝒪(𝓃 log 𝓃). Sorts a list of elements in ascending order using the MergeSort algorithm.
terminating quickSort {A} {{Ord A}} : List A → List ASource#
On average 𝒪(𝓃 log 𝓃), worst case 𝒪(𝓃²). Sorts a list of elements in ascending order using the QuickSort algorithm.