Zafu/Collection/LazyList

Zafu/Collection/LazyList

source code:

public dependencies: Bosatsu/Lazy, Zafu/Abstract/Foldable, Zafu/Abstract/Traverse

Index

Types

LazyList[a]

type LazyList[a: +*]

Constructors

Values

concat

Concatenates 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]

cons

Prepends 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_take

Prepends 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_LazyList

The empty lazy list.

references: LazyList

empty_LazyList: forall a: *. LazyList[a]

filter

Lazily keeps elements where pred returns true.

references: Bool, LazyList

def filter[a](ll: LazyList[a], pred: a -> Bool) -> LazyList[a]

filter_map

Lazily map+filter elements by keeping only Some results.

references: LazyList, Option

def filter_map[a, b](ll: LazyList[a], fn: a -> Option[b]) -> LazyList[b]

flat_map

Lazily flat-maps elements with fn.

references: LazyList

def flat_map[a, b](ll: LazyList[a], fn: a -> LazyList[b]) -> LazyList[b]

foldable_LazyList

references: LazyList, Zafu/Abstract/Foldable::Foldable

foldable_LazyList: Zafu/Abstract/Foldable::Foldable[LazyList]

foldl

Strict left fold over values in iteration order.

references: LazyList

def foldl[a, b](ll: LazyList[a], init: b, fn: (b, a) -> b) -> b

from_List

Builds a lazy list view over an existing strict list.

references: LazyList, List

def from_List[a](lst: List[a]) -> LazyList[a]

interleave

interleave two LazyLists lazily

references: LazyList

def interleave[a](left: LazyList[a], right: LazyList[a]) -> LazyList[a]

is_empty

references: Bool, LazyList

def is_empty[a](ll: LazyList[a]) -> Bool

lazy_singleton

references: LazyList, Unit

def lazy_singleton[a](item: () -> a) -> LazyList[a]

map

Lazily maps elements with fn.

references: LazyList

def map[a, b](ll: LazyList[a], fn: a -> b) -> LazyList[b]

non_empty

references: Bool, LazyList

def non_empty[a](ll: LazyList[a]) -> Bool

singleton

references: LazyList

def singleton[a](item: a) -> LazyList[a]

take

Returns a prefix with at most count elements. Negative counts return the empty list.

references: Int, LazyList

def take[a](ll: LazyList[a], count: Int) -> LazyList[a]

to_List

Conversions Converts a lazy list to a strict list in iteration order.

references: LazyList, List

def to_List[a](ll: LazyList[a]) -> List[a]

traverse_LazyList

references: LazyList, Zafu/Abstract/Traverse::Traverse

traverse_LazyList: Zafu/Abstract/Traverse::Traverse[LazyList]

uncons

Extracts 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]])]