


# list-fns.api
#
#
# General list utilities
# Compiled by:
# src/lib/std/standard.libapi List_Fns {
exception ZIP;
exception SPLIT;
find: (X -> Bool) -> List(X) -> List(X);
#
# Given a filter predicate and a list,
# return list of all elements satisfied
# by predicate.
find_first: (X -> Bool) -> List(X) -> Null_Or(X);
#
# Given a filter function and a list,
# finds the first accepted element in the list,
# or NULL.
remove: (X -> Bool) -> List(X) -> List(X);
#
# remove prior l = find (not o prior) l
remove_first: (X -> Bool) -> List(X) -> List(X);
#
# Given a filter function and a list,
# returns the list of all elements in the list
# except the first accepted element.
filter: (X -> Null_Or(Y)) -> List(X) -> List(Y);
#
# Maps the given function across the list, discarding the NULLs.
splitp: (X -> Bool) -> List(X) -> (List(X), List(X));
#
# Given a filter function and a list,
# returns the sublist of all elements
# before the first accepted element, plus the sublist of
# from the first accepted element until the end.
prefix: (X -> Bool) -> List(X) -> List(X);
suffix: (X -> Bool) -> List(X) -> List(X);
#
# prefix prior l = #1 (splitp prior l)
# suffix prior l = case #2 (splitp prior l) of [] => [] | a ! tl => tl
split: Int -> List(X) -> (List(X), List(X));
#
# split n l = (l1, l2) where l = l1@l2 and length l1 = n
# Raises BAD_ARG if n < 0; raises Split if length l < n
flatten: List (List(X)) -> List(X);
#
# Given a list [l1, l2, ..., ln] of lists of X,
# return l1 @ l2 @ ... @ ln
zip: (List(X), List(Y)) -> List( (X, Y) );
unzip: List((X, Y)) -> (List(X), List(Y));
#
# Zip and unzip two lists; raise Zip if lists of unequal length.
from_to: (Int, Int) -> List( Int );
#
# fromto (lo, hi) generates list of ints from a to b
# Raises BAD_ARG if b < a
make_list: (Int, (Int -> X)) -> List(X);
#
# make_list (count, genfn) generates the list
# [genfn 0, genfn 1, ..., genfn (count - 1)]
# Raises BAD_ARG if count < 0.
}; # api List_Fns
# 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.


