My motivation for such changes is not so much to save lines of code
(though this is usually a beneficial side-effect), but to improve code
readability by exposing the patterns and factoring them into (re-usable)
functions. That we can do this sort of refactoring easily is the
milestone of functional programming, IMO.
In this case I added a small, generally usable function that captures
the pattern of what goes on (showing a list of items on one line,
separated with comma and space) and gave it a name that reflects what it
does. Using this function made two narrow, specialized procedures so
trivial that it made sense to inline them at their call site.
|