Fuzion Logo
flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

list

🌌list

list -- feature used to define lists

list provides an abstract type for a sequence of elements of the same type.

A list sequence may be empty and contain no element, or it may have a fixed
or even infitie number of elements.

The core of the implementation of an actual list lies in the implementation
of the actual Cons cell a non-empty list consists of.

Lists can typically be traversed using only immutable data. This makes them
more flexible than streams that require to store and update their state.


create stream from this list

In contrast to list's immutable Cons cells, a stream instance is mutable, i.e,
it cannot be shared with threads or used in pure functions

create a string representation of this list including all the string
representations of its contents, separated by ',' and enclosed in '['
and ']'.

Lazy list concatenation, O(1)

List concatenation, O(count)

count the elements of this list

create a list that repeats the current list indefinitely. In case 'list.this'
is 'nil', returns 'nil'

create a list from the tail of list.this dropping n elements (or fewer
if the list is shorter than n).

Lazily drop the first elements of a list for which predicate 'p' holds.

get the head of this list, panic if list is empty

fold the elements of this list using the given monoid.

e.g., to sum the elements of a list of i32, use l.fold i32.sum

call f in order on all elements of this list

get the head of this list, panic if list is empty

get the tail of this list, panic if list is empty

get the head of this list if it exists

infix operand synonyme for concat

is this list empty?

get the last element of this list, panic if list is empty

This may take time in O(count), in particular, it may not terminate
for an infinite list.

map the list to a new list applying function f to all elements

This performs a lazy mapping, f is called only when the elements
are taken from the list.

reverse the order of the elements in this list

create a slice from this list that consists of the elements starting at index
'from' (including) up to index 'to' (excluding).

get the tail of this list if it exists, nil if it does
not exist or it is the empty list

create a lazy list of all the tails of this list, including the complete list
'list.this' and the empty list 'nil'.

Lazily take the first n elements of a list, alternatively the whole list if it
is shorter than n, or the empty list if n <= 0

Lazily take the first elements of a list for which predicate 'p' holds.

create a new list from the result of applying 'f' to the
elements of this list and 'b' in order.