Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal

container

container

§
:
Any
 is
 
[Module base]
container -- unit feature to group features that provide some kind of
data structure to store and retrieve values

Constructors

§
(T 
type
)
:
Sequence T
 is
  
[Contains abstract features]
 
[Module base]
abstract_array -- parent of array implementation like `array` and `expanding_array`

This provides basic functionality that an array should provide based on `index[i]`
and `length` that have to be provided by children of `abstract_array`.
§
(T 
type
)
:
abstract_array T
 is
 
[Private constructor]
 
[Module base]
expanding_array -- an array with a length and a (possible larger) capacity

An expanding array is a persistent data structure that has cumulative O(1)
performance of adding single elements at its end.

WARNING: Due to the high worst-case time for addition, this structure should
not be used in situations when adding a single element repeatedly to the same
instance of `expanding_array` is performance critical. If the resulting
`expanding_array`'s length is `l`, this will trigger the worst-case
addition time, resulting in cumulative time O(m*l) for adding an element m
times.

This constructor is for internal use only, to create instance of
`expanding_array`, use `(expanding_array T).type.empty` to create an empty
expanding array instance.
§
(T 
type
)
 ref
:
Sequence T
 is
  
[Contains abstract features]
 
[Module base]
abstract type for 'Linked_List'
§
(LM 
type
:
mutate, T 
type
)
 ref
:
Linked_List T
 is
 
[Private constructor]
 
[Module base]
a type for mutable singly linked lists

On call to `Mutable_Linked_List LM T data` creates a minimal list consisting
of only one single element. To create larger rings, you can either call
`append` to add single cells, or `concat` to concatenate two lists.
§
(K 
type
:
property.orderable)
:
Set K
 is
 
[Private constructor]
 
[Module base]
ps_set -- a partially sorted set based on ps_map

ps_set is a persistent set of ordered values. This set is generally
well-behaved with respect to cumulative and average performance.

WARNING: Due to the high worst-case time for addition, this structure should
not be used in situations when adding a single element repeatedly to the same
instance of ps_set is performance critical. If the resulting set's size n is a
power of 2, this will trigger the worst-case addition time resulting in
O(m*n log² n) for adding an element m times.
§
(E 
type
:
property.equatable)
 ref
:
Sequence E,equatable
 is
  
[Contains abstract features]
 
[Module base]
Set -- an abstract set of values
set_of_hashable -- routine to initialize a set from a Sequence of hashable elements

This feature creates an instance of a Set.
§
(T 
type
, from Sequence T, less_or_equal Binary bool T T)
:
array T
 is
 
[Module base]
sorted_array -- sorted one-dimensional immutable array

This takes an unsorted array and a compare function as an arguments and
returns a sorted one.

Non-mutating heap sort is used internally. This gives guaranteed performance in
O(n log n) comparisons and assignments for an array of size n.

This is a little wasteful on allocated memory, which is also O(n log n) since
partially sorted arrays are thrown away. This might be improved to use an
in-place heap sort to bring allocated memory down to O(n).
0.093dev (2025-05-13 15:50:27 GIT hash 38f965e14265a6f3ba3f96f18ddedb79352428af built by fridi@fzen)