Functions | |
void | free_list (bool data, list *l) |
Free a list. | |
list * | prepend (data obj, list *l) |
Prepend some data in front of a list---in place. | |
unsigned int | length (const list *l) |
Return the length of a list. | |
data | hd (const list *l) |
Return the first element of the list. | |
list * | tl (list *l) |
Return the tail of the list in place. | |
data | nth (unsigned int n, const list *l) |
Return the nth element of a list. | |
list * | rev (list *l) |
Reverse a list in place. | |
list * | append (list *l1, list *l2) |
Catenate two lists in place. | |
bool | mem (const data e, const list *l) |
Tests whether an element is a member of a list. | |
void | map (data(*f)(data), list *l) |
Apply in place a function on each element of a list. | |
val | fold_left (val(*f)(val, data), val init, const list *l) |
Fold left. | |
val | _the_pred (val v, data d) |
bool | for_all (bool(*pred)(data), const list *l) |
Check that a predicate holds of all elements of a list. | |
val | _the_proc (val v, data d) |
void | iter (void(*proc)(data), const list *l) |
Apply a function on each element of a list. | |
Variables | |
bool(* | _cur_pred )(data) = NULL |
void(* | _cur_proc )(data) = NULL |
Catenate two lists in place.
l1 | a first list. |
l2 | a second list. |
Fold left.
f | a pointer to a function of two arguments. |
init | an initial value. |
l | a list. |
Check that a predicate holds of all elements of a list.
pred | a pointer to a predicate function. |
l | a list. |
void free_list | ( | bool | data, |
list * | l | ||
) |
Free a list.
data | a boolean telling whether to free the list contents. |
l | a list to free. |
Return the first element of the list.
l | a list of length >= 1. |
Apply a function on each element of a list.
proc | a pointer to a procedure on data elements. |
l | a list. |
unsigned int length | ( | const list * | l | ) |
Return the length of a list.
l | a list. |
Apply in place a function on each element of a list.
f | a pointer to a function on data elements. |
l | a list. |
Tests whether an element is a member of a list.
e | some data value. |
l | a list. |
Return the nth element of a list.
n | a natural number. |
l | a list of length >= 1. |
Prepend some data in front of a list---in place.
obj | some data to add to the list. |
l | a list; might be NULL for the empty list. |
Reverse a list in place.
l | the list to reverse. |
Return the tail of the list in place.
l | a list of length >= 1 |