Implementation of Arrays with Braun Trees. Conceptually, Braun trees are always infinite. Consequently, there is no test on emptiness.
Version: December 2020
emptyErrorArray
:: Array a
Creates an empty array which generates errors for non-initialized indexes. |
emptyDefaultArray
:: (Int -> a) -> Array a
Creates an empty array, call given function for non-initialized indexes. |
(//)
:: Array a -> [(Int,a)] -> Array a
Inserts a list of entries into an array. |
update
:: Array a -> Int -> a -> Array a
Inserts a new entry into an array. |
applyAt
:: Array a -> Int -> (a -> a) -> Array a
Applies a function to an element. |
(!)
:: Array a -> Int -> a
Yields the value at a given position. |
listToDefaultArray
:: (Int -> a) -> [a] -> Array a
Creates a default array from a list of entries. |
listToErrorArray
:: [a] -> Array a
Creates an error array from a list of entries. |
combine
:: (a -> b -> c) -> Array a -> Array b -> Array c
combine two arbitrary arrays |
combineSimilar
:: (a -> a -> a) -> Array a -> Array a -> Array a
the combination of two arrays with identical default function and a combinator which is neutral in the default can be implemented much more efficient |
Constructors:
Creates an empty array which generates errors for non-initialized indexes. |
Creates an empty array, call given function for non-initialized indexes.
|
Inserts a list of entries into an array.
|
Inserts a new entry into an array.
|
Applies a function to an element.
|
Yields the value at a given position.
|
Creates a default array from a list of entries.
|
Creates an error array from a list of entries.
|
the combination of two arrays with identical default function and a combinator which is neutral in the default can be implemented much more efficient |