// This may look like C code, but it is really -*- C++ -*-
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
typedef void (*<T>Procedure)(<T&>);
typedef <T> (*<T>Mapper)(<T&>);
typedef <T> (*<T>Combiner)(<T&>, <T&>);
typedef int (*<T>Predicate)(<T&>);
typedef int (*<T>Comparator)(<T&>, <T&>);
extern <T>ListNode Nil<T>ListNode;
<T>List(<T&> head, <T>List& tl);
<T>List& operator = (<T>List& a);
<T>& operator [] (int n);
<T>List find(<T>List& targ);
int contains(<T>List& targ);
friend <T>List copy(<T>List& a);
friend <T>List concat(<T>List& a, <T>List& b);
friend <T>List append(<T>List& a, <T>List& b);
friend <T>List map(<T>Mapper f, <T>List& a);
friend <T>List merge(<T>List& a, <T>List& b, <T>Comparator f);
friend <T>List combine(<T>Combiner f, <T>List& a, <T>List& b);
friend <T>List reverse(<T>List& a);
friend <T>List select(<T>Predicate f, <T>List& a);
friend <T>List remove(<T&> targ, <T>List& a);
friend <T>List remove(<T>Predicate f, <T>List& a);
friend <T>List subst(<T&> old, <T&> repl, <T>List& a);
void set_tail(<T>List& p);
void prepend(<T>List& p);
void del(<T>Predicate f);
void select(<T>Predicate f);
void subst(<T&> old, <T&> repl);
void sort(<T>Comparator f);
void apply(<T>Procedure f);
<T> reduce(<T>Combiner f, <T&> base);
friend int operator == (<T>List& a, <T>List& b);
friend int operator != (<T>List& a, <T>List& b);
<T>& operator () (Pix p);
inline void reference(<T>ListNode* p)
if (p->ref >= 0) ++p->ref;
inline void dereference(<T>ListNode* p)
while (p->ref > 0 && --p->ref == 0)
inline <T>ListNode* new<T>ListNode(<T&> h)
<T>ListNode* p = new <T>ListNode;
inline <T>ListNode* new<T>ListNode(<T&> h, <T>ListNode* t)
<T>ListNode* p = new <T>ListNode;
inline <T>List::~<T>List()
inline <T>List::<T>List()
inline <T>List::<T>List(<T>ListNode* p)
inline <T>List::<T>List(<T&> head)
P = new<T>ListNode(head);
inline <T>List::<T>List(<T&> head, <T>List& tl)
P = new<T>ListNode(head, tl.P);
inline <T>List::<T>List(<T>List& a)
inline <T>& <T>List::get()
inline <T>& <T>List::head()
inline <T>List <T>List::tail()
inline int <T>List::null()
return P == &Nil<T>ListNode;
inline int <T>List::valid()
return P != &Nil<T>ListNode;
inline <T>List::operator const void* ()
return (P == &Nil<T>ListNode)? 0 : this;
inline int <T>List::operator ! ()
return (P == &Nil<T>ListNode);
inline void <T>List::push(<T&> head)
P = new<T>ListNode(head, oldp);
inline int operator != (<T>List& x, <T>List& y)
inline Pix <T>List::first()
return (P == &Nil<T>ListNode)? 0 : Pix(P);
inline <T>& <T>List::operator () (Pix p)
return ((<T>ListNode*)p)->hd;
inline void <T>List::next(Pix& p)
p = Pix(((<T>ListNode*)p)->tl);
if (p == &Nil<T>ListNode) p = 0;
inline <T>List::<T>List(Pix p)