PreviousUpNext

15.3.429  src/lib/src/typelocked-expanding-rw-vector.api

## typelocked-expanding-rw-vector.api

# Compiled by:
#     src/lib/std/standard.lib



# Api for unbounded Rw_Vectors.
# See also:  src/lib/src/expanding-rw-vector.api


###               "It becomes plausible that information
###                belongs among the great concepts of
###                science such as matter, energy and
###                electric charge."
###
###                            -- Norbert Wiener, in 1954



api Typelocked_Expanding_Rw_Vector {

    Element;
    Rw_Vector;

    rw_vector:  ((Int, Element)) -> Rw_Vector;
        #
        # rw_vector (size, e) creates an unbounded rw_vector all of whose elements
        # are initialized to e.  size (>= 0) is used as a
        # hint of the potential range of indices.  Raises SIZE if a
        # negative hint is given.


    copy_rw_subvector:  (Rw_Vector, Int, Int) -> Rw_Vector;
        #
        # sub_array (a, lo, hi) creates a new rw_vector with the same default
        # as a, and whose values in the range [0, hi-lo] are equal to
        # the values in b in the range [lo, hi].
        # Raises SIZE if lo > hi


    from_list:  (List( Element ), Element) -> Rw_Vector;
     # arrayoflist (l, v) creates an rw_vector using the list of values l
     # plus the default value v.


    tabulate: (Int, (Int -> Element), Element) -> Rw_Vector;
     # tabulate (size, fill, default) acts like rw_vector::tabulate, plus 
     # stores default value default.  Raises SIZE if size < 0.


    default:  Rw_Vector -> Element;
     #  Default returns rw_vector's default value 

    get:  (Rw_Vector, Int) -> Element;
     # sub (a, idx) returns value of the rw_vector at index idx.
     # If that value has not been set by update, it returns the default value.
     # Raises SUBSCRIPT if idx < 0


    set:  (Rw_Vector, Int, Element) -> Void;
     # update (a, idx, v) sets the value at index idx of the rw_vector to v. 
     # Raises SUBSCRIPT if idx < 0


    bound:  Rw_Vector -> Int;
     # bound returns an upper bound on the index of values that have been
     # changed.


    truncate:  (Rw_Vector, Int) -> Void;
     #  truncate (a, size) makes every entry with index > size the default value 

# * what about iterators??? *  XXX BUGGO FIXME

}; #  MONO_DYNAMIC_ARRAY 



## COPYRIGHT (c) 1993 by AT&T Bell Laboratories.  See COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext