PreviousUpNext

15.3.555  src/lib/std/src/vector.api

## vector.api

# Compiled by:
#     src/lib/std/src/standard-core.sublib



###                       "Against my will, in the course of my travels,
###                        the belief that everything worth knowing
###                        was known at Cambridge gradually wore off.
###                        In this respect my travels were very useful to me."
###
###                                                -- Bertrand Russell



api Vector {
    #
    eqtype Vector(X);

    max_len:    Int;

    from_list:  List(X) -> Vector(X);
    tabulate:  (Int, (Int -> X)) -> Vector(X);

    length:     Vector(X) -> Int;

    # Note:  The (_[])   enables   'vec[index]'           notation;
    #        The (_[]:=) enables   'vec[index] := value'  notation;

    get:       (Vector(X), Int) -> X; 
    (_[]):     (Vector(X), Int) -> X; 

    set:       (Vector(X), Int, X) -> Vector(X);
    (_[]:=):   (Vector(X), Int, X) -> Vector(X);

    cat:        List( Vector(X) ) -> Vector(X);

    keyed_apply:    ((Int, X) -> Void) -> Vector(X) -> Void;
    apply:                 (X -> Void) -> Vector(X) -> Void;

    keyed_map:    ((Int, X) -> Y) -> Vector(X) -> Vector(Y);
    map:                 (X -> Y) -> Vector(X) -> Vector(Y);

    keyed_fold_left:   ((Int, X, Y) -> Y) -> Y -> Vector(X) -> Y;
    keyed_fold_right:  ((Int, X, Y) -> Y) -> Y -> Vector(X) -> Y;

    fold_left:            ((X, Y) -> Y) -> Y -> Vector(X) -> Y;
    fold_right:           ((X, Y) -> Y) -> Y -> Vector(X) -> Y;

    findi:    ((Int, X) -> Bool) -> Vector(X) -> Null_Or( (Int, X) );
    find:     (X -> Bool) -> Vector(X) -> Null_Or(X);
    exists:   (X -> Bool) -> Vector(X) -> Bool;
    all:      (X -> Bool) -> Vector(X) -> Bool;
    collate:  ((X, X) -> Order) -> (Vector(X), Vector(X)) -> Order;
};


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


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext