FP-ify the SimpleXML

use `\Functional\reduce_left()` instead of iteration to build the `termSet`