On Wed, 12 Dec 2007, Don Stewart wrote: > ndmitchell: > > > > A much simpler version: > > > > main = print . length . words =<< getContents > > > > Beautiful, specification orientated, composed of abstract components. > > My thoughts too when reading the initial post was that it was all very > low level imperative programming. Not of the Haskell flavour.
I remember there was a discussion about how to implement full 'wc' in an elegant but maximally lazy form, that is counting bytes, words and lines in one go. Did someone have a nice idea of how to compose the three counters from implementations of each counter? I'm afraid one cannot simply use the "split and count fragments" trick then. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe