14template <
class T>
class list;
48template <
class T>
class list {
132 friend class list<T>;
136#define TMPL template <class T>
#define CONCRETE_NULL_TEMPLATE_CODE(PTR, TT, T)
Code for the templated concrete null pointer type.
#define TM_DEBUG(x)
Debugging macro used to disable debugging output.
The list_rep class represents a node in a linked list.
The list class represents a linked list.
list(T item1, T item2, list< T > next)
Construct a new list object with two items and a pointer to the next node.
list(T item1, T item2, T item3, list< T > next)
Construct a new list object with three items and a pointer to the next node.
list(T item)
Construct a new list object with a single item.
list(T item, list< T > next)
Construct a new list object with an item and a pointer to the next node.
friend bool is_atom LESSGTR(list< T > l)
CONCRETE_NULL_TEMPLATE(list, T)
static list< T > init
A static list object used for initializing new list objects.
T & operator[](int i)
Overloaded subscript operator to access the item at a specific index in the list.
friend bool strong_equal LESSGTR(list< T > l1, list< T > l2)
bool operator!=(list< T > l1, list< T > l2)
list< T > remove(list< T > l, T what)
Create a new list with a specific item removed.
bool strong_equal(list< T > l1, list< T > l2)
Check if two lists are strongly equal (i.e., have the same items in the same order).
bool operator<(list< T > l1, list< T > l2)
bool operator==(list< T > l1, list< T > l2)
bool is_nil(list< T > l)
Check if a list is nil (i.e., an empty list).
list< T > copy(list< T > l)
Create a copy of a list.
list< T > tail(list< T > l, int n=1)
Get all but the first n items of a list.
list< T > operator*(list< T > l1, T x)
Create a new list by appending an item to the end of an existing list.
list< T > reverse(list< T > l)
Create a new list with the items in reverse order.
list< T > head(list< T > l, int n=1)
Get the first n items of a list.
list< T > & operator>>(T item, list< T > &l)
bool is_atom(list< T > l)
Check if a list is an atom (i.e., a single item).
T last_item(list< T > l)
Return the last item of the list. The input list must not be an empty list.
bool operator<=(list< T > l1, list< T > l2)
int N(list< T > l)
Get the number of items in a list.
T & access_last(list< T > &l)
Get a reference to the last item in a list.
tm_ostream & operator<<(tm_ostream &out, list< T > l)
list< T > & suppress_last(list< T > &l)
Remove the last item from a list.
bool contains(list< T > l, T what)
Check if a list contains a specific item.
Structure representing a concrete object with a reference count.