Implement fold.