Tail Recursive Reverse in Java


public static Cons trrev (Cons lst) {
  return trrevb(lst, null); }

public static Cons trrevb (Cons in, Cons out) {
  if ( in == null )
     return out;
   else return trrevb( rest(in),
                       cons(first(in), out) ); }

Contents    Page-10    Prev    Next    Page+10    Index