= Solution
Apply one replacement to each original character and concatenate the results:
``
step :: [Rule] -> State -> State
step rules = concatMap (applyRule rules)
``
The <concatMap> operation combines a <map function> and <list concatenation>. Replacements occur in original-character order, so a character produced by a replacement is not processed again during the same step. This is parallel <string rewriting>. In particular `step rules "" = ""`, with no rule lookup required for the empty state.
Back to article page