.TH REPETITION 2 "13 May 1991" "Demeter" "Demeter Software" .SH NAME Repetition \- methods attached to class repetition .SH DESCRPTION Summary of methods attached to class .I Repetition. The interfaces are given in terms of type ent which is personalized by macros. .TP 10 typedef void* ent; .TP typedef int(*PFC) (ent a,ent b); .TP int insert(ent a); Inserts .I a at the beginning of the list. .TP int append(ent a); Appends .I a at the end of the list. .TP int list_length(); Returns the number of entries in the list. .TP int empty() Returns 0 if list is empty and non-zero otherwise. .TP ent get(); Gets first element from list and removes it. .TP ent car(); Gets first element of list without removing it. .TP int member(ent a,PFC f); Tests whether .I a is an element of list, using .I f as test function. .I f should be a function taking two list elements as arguments and returning an int. member returns 0 if .I a is not in the list, otherwise, member returns the position at which .I a appears in the list, relative to 1 (i.e., if .I a is the first element, member returns 1). .TP NonEmptyList* remove(ent a,PFC f); Removes all elements of the list that pass the test in .I f, as compared with .I a. .I f should be a function taking two list elements as arguments and returning an int. .I remove returns a list that contains every element in the current list except for those for which .I f becomes true. That is, .I remove has a lisp-like behavior. .TP NonEmptyList* lisp_append(NonEmptyList* p); Returns a new list that results from concatenating the receiver of the message with the list .I p. .TP void concatenate( repetition* lst ); Destructively appends .I lst to the end of the receiver list. The original list is contained in the result. .TP ent n_th(int a); Returns the .I a th element of the list. n_th is 1-based, i.e., the first element has number 1. .TP ent lastexp(); Returns the last element in list without removing it. Returns 0 if list is empty. .TP repetition(); Constructor. The actual name used is given by the class of the desired list object. .TP repetition(ent a); Nonempty lists can also be constructed. .TP repetition_iterator(repetition &s); Associates an iterator object to a list. .TP ent operator()(); The operator () applied to an iterator object returns the next element in the list to which the iterator is associated. .LP