Module "Array.curry"

Implementation of Arrays with Braun Trees. Conceptually, Braun trees are always infinite. Consequently, there is no test on emptiness.


 Exported names:

Datatypes:
Array

Functions:
! | // | applyAt | combine | combineSimilar | emptyDefaultArray | emptyErrorArray | listToDefaultArray | listToErrorArray | update


 Summary of exported functions:

emptyErrorArray  :: Array a  deterministic 
          Creates an empty array which generates errors for non-initialized indexes.
emptyDefaultArray  :: (Int -> a) -> Array a  deterministic 
          Creates an empty array, call given function for non-initialized indexes.
(//)  :: Array a -> [(Int,a)] -> Array a  deterministic flexible
          Inserts a list of entries into an array.
update  :: Array a -> Int -> a -> Array a  deterministic flexible
          Inserts a new entry into an array.
applyAt  :: Array a -> Int -> (a -> a) -> Array a  deterministic flexible
          Applies a function to an element.
(!)  :: Array a -> Int -> a  deterministic flexible
          Yields the value at a given position.
listToDefaultArray  :: (Int -> a) -> [a] -> Array a  deterministic 
          Creates a default array from a list of entries.
listToErrorArray  :: [a] -> Array a  deterministic 
          Creates an error array from a list of entries.
combine  :: (a -> b -> c) -> Array a -> Array b -> Array c  deterministic flexible
          combine two arbitrary arrays
combineSimilar  :: (a -> a -> a) -> Array a -> Array a -> Array a  deterministic flexible
          the combination of two arrays with identical default function and a combinator which is neutral in the default can be implemented much more efficient

 Imported modules:

Integer
Prelude

 Exported datatypes:

Array

Constructors:



 Exported functions:

emptyErrorArray :: Array a  deterministic 

Creates an empty array which generates errors for non-initialized indexes.


emptyDefaultArray :: (Int -> a) -> Array a  deterministic 

Creates an empty array, call given function for non-initialized indexes.

Example call:  (emptyDefaultArray default)

Parameters:
default - function to call for each non-initialized index
Further infos:
  • solution complete, i.e., able to compute all solutions

(//) :: Array a -> [(Int,a)] -> Array a  deterministic flexible

Inserts a list of entries into an array.

Example call:  (array // modifications)

Parameters:
array - array to modify
modifications - list of new (indexes,entries) If an index in the list was already initialized, the old value will be overwritten. Likewise the last entry with a given index will be contained in the result array.
Further infos:
  • defined as left-associative infix operator with precedence 9

update :: Array a -> Int -> a -> Array a  deterministic flexible

Inserts a new entry into an array.

Example call:  (update array idx val)

Parameters:
array - array to modify
idx - index of update
val - value to update at index idx Entries already initialized will be overwritten.

applyAt :: Array a -> Int -> (a -> a) -> Array a  deterministic flexible

Applies a function to an element.

Example call:  (applyAt array idx fun)

Parameters:
array - array to modify
idx - index of update
fun - function to apply on element at index idx

(!) :: Array a -> Int -> a  deterministic flexible

Yields the value at a given position.

Example call:  (a ! n)

Parameters:
a - array to look up in
n - index, where to look
Further infos:
  • defined as left-associative infix operator with precedence 9

listToDefaultArray :: (Int -> a) -> [a] -> Array a  deterministic 

Creates a default array from a list of entries.

Example call:  (listToDefaultArray def xs)

Parameters:
def - default funtion for non-initialized indexes
xs - list of entries

listToErrorArray :: [a] -> Array a  deterministic 

Creates an error array from a list of entries.

Example call:  (listToErrorArray xs)

Parameters:
xs - list of entries

combine :: (a -> b -> c) -> Array a -> Array b -> Array c  deterministic flexible

combine two arbitrary arrays


combineSimilar :: (a -> a -> a) -> Array a -> Array a -> Array a  deterministic flexible

the combination of two arrays with identical default function and a combinator which is neutral in the default can be implemented much more efficient



Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:25:27 2008