PreviousUpNext

14.2.24  List

The standard library List api defines access to lisp-style Lists.

The List api is implemented by the list package.

The List api source code is in src/lib/std/src/list.api.

The above information is manually maintained and may contain errors.

api {
    List X = ! (X , List(X )) | NIL;
    exception EMPTY;
    null : List(X ) -> Bool;
    head : List(X ) -> X;
    tail : List(X ) -> List(X );
    last : List(X ) -> X;
    get_item : List(X ) -> Null_Or(((X , List(X ))) );
    nth : (List(X ) , Int) -> X;
    take_n : (List(X ) , Int) -> List(X );
    drop_n : (List(X ) , Int) -> List(X );
    split_n : (List(X ) , Int) -> (List(X ) , List(X ));
    length : List(X ) -> Int;
    reverse : List(X ) -> List(X );
    @ : (List(X ) , List(X )) -> List(X );
    cat : List(List(X ) ) -> List(X );
    reverse_and_prepend : (List(X ) , List(X )) -> List(X );
    repeat : (List(X ) , Int) -> List(X );
    apply : (X -> Void) -> List(X ) -> Void;
    map : (X -> Y) -> List(X ) -> List(Y );
    apply' : List(X ) -> (X -> Void) -> Void;
    map' : List(X ) -> (X -> Y) -> List(Y );
    map_partial_fn : (X -> Null_Or(Y )) -> List(X ) -> List(Y );
    find : (X -> Bool) -> List(X ) -> Null_Or(X );
    remove_first : (X -> Bool) -> List(X ) -> List(X );
    filter : (X -> Bool) -> List(X ) -> List(X );
    remove : (X -> Bool) -> List(X ) -> List(X );
    partition : (X -> Bool) -> List(X ) -> (List(X ) , List(X ));
    split_at_first : (X -> Bool) -> List(X ) -> (List(X ) , List(X ));
    prefix_to_first : (X -> Bool) -> List(X ) -> List(X );
    suffix_from_first : (X -> Bool) -> List(X ) -> List(X );
    fold_backward : ((X , Y) -> Y) -> Y -> List(X ) -> Y;
    fold_forward : ((X , Y) -> Y) -> Y -> List(X ) -> Y;
    exists : (X -> Bool) -> List(X ) -> Bool;
    all : (X -> Bool) -> List(X ) -> Bool;
    from_fn : (Int , (Int -> X)) -> List(X );
    compare_sequences : ((X , X) -> Order) -> (List(X ) , List(X )) -> Order;
    in : (''a , List(''a )) -> Bool;
    drop : (''a , List(''a )) -> List(''a );};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext