Implementing the FoldTree operations