initial work on tail recursive implementation of partition