Is implementing this words function possible without a postprocessing step after folding?
问题 Real World Haskell, chapter 4, page 98 of the print asks if words can be implemented using folds, and this is my question too: Is it possible? If not, why? If it is, how? I came up with the following, which is based on the idea that each non-space should be prepended to the last word in the output list (this happens in the otherwise guard), and that a space should trigger the appending of an emtpy word to the output list if there is not one already (this is handled in the if - then - else ).