Back to index

texmacs  1.0.7.15
Defines | Functions
list.cpp File Reference
#include "list.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define LIST_CC

Functions

template<class T >
tm_ostreamoperator<< (tm_ostream &out, list< T > l)
template<class T >
list< T > & operator<< (list< T > &l, T item)
template<class T >
list< T > & operator<< (list< T > &l1, list< T > l2)
template<class T >
list< T > & operator>> (T item, list< T > &l)
template<class T >
list< T > & operator<< (T &item, list< T > &l)
template<class T >
T last_item (list< T > l)
template<class T >
Taccess_last (list< T > &l)
template<class T >
list< T > & suppress_last (list< T > &l)
template<class T >
bool strong_equal (list< T > l1, list< T > l2)
template<class T >
bool operator== (list< T > l1, list< T > l2)
template<class T >
bool operator!= (list< T > l1, list< T > l2)
template<class T >
bool operator< (list< T > l1, list< T > l2)
template<class T >
bool operator<= (list< T > l1, list< T > l2)
template<class T >
int N (list< T > l)
template<class T >
list< Tcopy (list< T > l)
template<class T >
list< Toperator* (list< T > l1, T x)
template<class T >
list< Toperator* (list< T > l1, list< T > l2)
template<class T >
list< Thead (list< T > l, int n)
template<class T >
list< Ttail (list< T > l, int n)
template<class T >
list< Treverse (list< T > l)
template<class T >
list< Tremove (list< T > l, T what)
template<class T >
bool contains (list< T > l, T what)

Define Documentation

#define LIST_CC

Definition at line 13 of file list.cpp.


Function Documentation

template<class T >
T& access_last ( list< T > &  l)

Definition at line 88 of file list.cpp.

                         {
  ASSERT (!is_nil (l), "empty path");
  if (is_nil (l->next)) return l->item;
  return access_last (l->next);
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
bool contains ( list< T l,
T  what 
)

Definition at line 197 of file list.cpp.

                             {
  return (!is_nil(l) && (l->item == what || contains(l->next, what)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
list<T> copy ( list< T l)

Definition at line 146 of file list.cpp.

                 {
  if (is_nil (l)) return list<T> ();
  else return list<T> (l->item, copy (l->next));
}

Here is the call graph for this function:

template<class T >
list<T> head ( list< T l,
int  n 
)

Definition at line 164 of file list.cpp.

                        {
  if (n==0) return list<T> ();
  ASSERT (!is_nil (l), "list too short");
  return list<T> (l->item, head (l->next, n-1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
T last_item ( list< T l)

Definition at line 81 of file list.cpp.

                      {
  ASSERT (!is_nil (l), "empty path");
  if (is_nil (l->next)) return l->item;
  return last_item (l->next);
}

Here is the call graph for this function:

template<class T >
int N ( list< T l)

Definition at line 140 of file list.cpp.

              {
  if (is_nil (l)) return 0;
  else return N (l->next) + 1;
}

Here is the call graph for this function:

template<class T >
bool operator!= ( list< T l1,
list< T l2 
)

Definition at line 118 of file list.cpp.

                                     {
  if (is_nil (l1) || is_nil (l2)) return (is_nil (l1) != is_nil (l2));
  return (l1->item!=l2->item) || (l1->next!=l2->next);
}

Here is the call graph for this function:

template<class T >
list<T> operator* ( list< T l1,
T  x 
)

Definition at line 152 of file list.cpp.

                             {
  if (is_nil (l1)) return x;
  else return list<T> (l1->item, l1->next * x);
}

Here is the call graph for this function:

template<class T >
list<T> operator* ( list< T l1,
list< T l2 
)

Definition at line 158 of file list.cpp.

                                    {
  if (is_nil (l1)) return copy (l2);
  else return list<T> (l1->item, l1->next * l2);
}

Here is the call graph for this function:

template<class T >
bool operator< ( list< T l1,
list< T l2 
)

Definition at line 124 of file list.cpp.

                                    {
  if (is_nil (l1) || is_nil (l2)) return !is_nil (l2);
  return (l1->item==l2->item) && (l1->next<l2->next);
}

Here is the call graph for this function:

template<class T >
tm_ostream& operator<< ( tm_ostream out,
list< T l 
)

Definition at line 21 of file list.cpp.

                                         {
  out << "[";
  if (!is_nil (l)) {
    out << " " << l->item;
    l=l->next;
  }
  while (!is_nil (l)) {
    out << ", " << l->item;
    l=l->next;
  }
  return out << " ]";
}

Here is the call graph for this function:

template<class T >
list<T>& operator<< ( list< T > &  l,
T  item 
)

Definition at line 55 of file list.cpp.

                                 {
  if (is_nil (l)) l= list<T> (item, list<T> ());
  else l->next << item;
  return l;
}

Here is the call graph for this function:

template<class T >
list<T>& operator<< ( list< T > &  l1,
list< T l2 
)

Definition at line 62 of file list.cpp.

                                      {
  if (is_nil (l1)) l1= l2;
  else l1->next << l2;
  return l1;
}

Here is the call graph for this function:

template<class T >
list<T>& operator<< ( T item,
list< T > &  l 
)

Definition at line 74 of file list.cpp.

                                  {
  item= l->item;
  l   = l->next;
  return l;
}
template<class T >
bool operator<= ( list< T l1,
list< T l2 
)

Definition at line 130 of file list.cpp.

                                     {
  if (is_nil (l1) || is_nil (l2)) return is_nil (l1);
  return (l1->item==l2->item) && (l1->next<=l2->next);
}

Here is the call graph for this function:

template<class T >
bool operator== ( list< T l1,
list< T l2 
)

Definition at line 112 of file list.cpp.

                                     {
  if (is_nil (l1) || is_nil (l2)) return (is_nil (l1) == is_nil (l2));
  return (l1->item==l2->item) && (l1->next==l2->next);
}

Here is the call graph for this function:

template<class T >
list<T>& operator>> ( T  item,
list< T > &  l 
)

Definition at line 69 of file list.cpp.

                                 {
  return (l= list<T> (item, l));
}
template<class T >
list<T> remove ( list< T l,
T  what 
)

Definition at line 190 of file list.cpp.

                           {
  if (is_nil (l)) return l;
  else if (l->item == what) return remove (l->next, what);
  else return list<T> (l->item, remove (l->next, what));
}

Here is the call graph for this function:

template<class T >
list<T> reverse ( list< T l)

Definition at line 180 of file list.cpp.

                    {
  list<T> r;
  while (!is_nil(l)) {
    r= list<T> (l->item, r);
    l=l->next;
  }
  return r;
}

Here is the call graph for this function:

template<class T >
bool strong_equal ( list< T l1,
list< T l2 
)

Definition at line 107 of file list.cpp.

                                      {
  return l1.rep == l2.rep;
}

Here is the caller graph for this function:

template<class T >
list<T>& suppress_last ( list< T > &  l)

Definition at line 95 of file list.cpp.

                           {
  ASSERT (!is_nil (l), "empty path");
  if (is_nil (l->next)) l= list<T> ();
  else suppress_last (l->next);
  return l;
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
list<T> tail ( list< T l,
int  n 
)

Definition at line 171 of file list.cpp.

                        {
  for (; n>0; n--) {
    ASSERT (!is_nil (l), "list too short");
    l=l->next;
  }
  return l;
}

Here is the call graph for this function: