Zafu/Collection/LazyListsource code:
public dependencies: Bosatsu/Lazy,
Zafu/Abstract/Foldable,
Zafu/Abstract/Traverse
LazyListconcat, cons, cons_take, empty_LazyList, filter, filter_map, flat_map, foldable_LazyList, foldl, from_List, interleave, is_empty, lazy_singleton, map, non_empty, singleton, take, to_List, traverse_LazyList, unconsLazyList[a]type LazyList[a: +*]
Cons(head: Bosatsu/Lazy::Lazy[a], tail: Bosatsu/Lazy::Lazy[LazyList[a]])EmptyconcatConcatenates two lazy lists while preserving laziness. Empty inputs are returned directly without rebuilding.
references: LazyList
def concat[a](first: LazyList[a], second: LazyList[a]) -> LazyList[a]
consPrepends head to tail.
references: Bosatsu/Lazy::Lazy,
LazyList
def cons[a](head: Bosatsu/Lazy::Lazy[a], tail: Bosatsu/Lazy::Lazy[LazyList[a]]) -> LazyList[a]
cons_takePrepends head to tail, capped to
size.
references: Bosatsu/Lazy::Lazy,
Int, LazyList
def cons_take[a
](head: Bosatsu/Lazy::Lazy[a], tail: Bosatsu/Lazy::Lazy[LazyList[a]], size: Int) -> LazyList[a]
empty_LazyListThe empty lazy list.
references: LazyList
empty_LazyList: forall a: *. LazyList[a]
filterLazily keeps elements where pred returns true.
def filter[a](ll: LazyList[a], pred: a -> Bool) -> LazyList[a]
filter_mapLazily map+filter elements by keeping only Some results.
def filter_map[a, b](ll: LazyList[a], fn: a -> Option[b]) -> LazyList[b]
flat_mapLazily flat-maps elements with fn.
references: LazyList
def flat_map[a, b](ll: LazyList[a], fn: a -> LazyList[b]) -> LazyList[b]
foldable_LazyListreferences: LazyList, Zafu/Abstract/Foldable::Foldable
foldable_LazyList: Zafu/Abstract/Foldable::Foldable[LazyList]
foldlStrict left fold over values in iteration order.
references: LazyList
def foldl[a, b](ll: LazyList[a], init: b, fn: (b, a) -> b) -> b
from_ListBuilds a lazy list view over an existing strict list.
def from_List[a](lst: List[a]) -> LazyList[a]
interleaveinterleave two LazyLists lazily
references: LazyList
def interleave[a](left: LazyList[a], right: LazyList[a]) -> LazyList[a]
is_emptydef is_empty[a](ll: LazyList[a]) -> Bool
lazy_singletondef lazy_singleton[a](item: () -> a) -> LazyList[a]
mapLazily maps elements with fn.
references: LazyList
def map[a, b](ll: LazyList[a], fn: a -> b) -> LazyList[b]
non_emptydef non_empty[a](ll: LazyList[a]) -> Bool
singletonreferences: LazyList
def singleton[a](item: a) -> LazyList[a]
takeReturns a prefix with at most count elements. Negative
counts return the empty list.
def take[a](ll: LazyList[a], count: Int) -> LazyList[a]
to_ListConversions Converts a lazy list to a strict list in iteration order.
def to_List[a](ll: LazyList[a]) -> List[a]
traverse_LazyListreferences: LazyList, Zafu/Abstract/Traverse::Traverse
traverse_LazyList: Zafu/Abstract/Traverse::Traverse[LazyList]
unconsExtracts the head and remaining tail if the list is non-empty.
references: Bosatsu/Lazy::Lazy,
LazyList, Option, Tuple2
def uncons[a](ll: LazyList[a]) -> Option[(Bosatsu/Lazy::Lazy[a], Bosatsu/Lazy::Lazy[LazyList[a]])]