[plt-scheme] Tail recursion and the Visitor Pattern

From: wooks . (wookiz at hotmail.com)
Date: Sat Dec 30 12:50:54 EST 2006

Thought I'd try and make this tail recursive and got into a tangle.

  class ButLastV extends EmptyException implements IList{
    public AList forCons(Object first, AList rest) {
      return rest.isEmpty() ?
        Empty.ONLY :
        new Cons(first, ((AList)rest.accept(this)));
    }
  }

Then I realised there is no recursive call .... well there is but its of 
indirect. Does this make tail recursion in the Visitor Pattern a no no.

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!  
http://www.msn.co.uk/newsletters



Posted on the users mailing list.