Constructing a string by repeating the operation `^` (or `sprintf "... %s" ... acc`) is really inefficient.  Construct a list of individual strings and concatenate them at the end.