#include "List.h"

/* NB. Below, opL is an `accumulating' parameter  -- L.Allison */

List accumulateAndReverse(List inL, List opL)
 { if(inL == NULL) return opL;
   /*else*/ return accumulateAndReverse(inL->tl, cons(inL->hd, opL));
 }

List reverse(List L)
 { return accumulateAndReverse(L, NULL); }

/* O(|L|)-time List Reversal */
