ALGO: generalize the QuadTree folds

Now we traverse over all nodes (TNode, TLeaf, TNil),
not just TLeaf.