tree datastructure: map via fold