The 
mapAccumR function behaves like a combination of 
map
and a strict 
foldr; it applies a function to each element of a
Text, passing an accumulating parameter from right to left, and
returning a final value of this accumulator together with the new
Text. Performs replacement on invalid scalar values.