Generalise ASSIGN-TN-DEPTHS to expose the reduce function