3 ms·
Probably because that optimization involved a subroutine call to "something expecting to return an iolist", and that subroutine is what noticed it could reuse t
by jerf 11y ago
Probably because that optimization involved a subroutine call to "something expecting to return an iolist", and that subroutine is what noticed it could reuse the ampersand, then tacked on the replacement, then returned the iolist ["&", "amp;"], which the calling routine tacked on to its running list of the result, which was the final return.
That's part of what makes iolists nice to work with, in the face of immutable strings in a strict language; you can make subroutine calls that may return a string or an arbitrarily nested list of strings, and you simply write code that unconditionally gathers "Whatever was returned" into a list, instead of sitting there appending all the time. The common "concatenation" operation becomes a list consing instead of a laborious copy.