ok, i'll bite. why should i prefer join rather than concat in the list monad. and, moreover, why is this a lambdabot trick?
i suspect that the answer actually has a deep connection to the 'dummies' thread next door. while any program that produces the right result is correct, there are some that are more correct than others. a good introductory guide to haskell should lead you in that direction. reasoning by analogy, for c++, andy koenig's accelerated c++ had a huge impact on teaching c++ because it didn't start with C or pidgen c++, but instead required the student to accept that many mechanisms would be explained later, but that they should be used -now-. i suspect that being biased towards higher order functions, and writing new functions such that monads (although the more i learn i think that should be typeclasses) can take advantage of those functions, is the skill that needs to be learned / taught. the equivalent of the central dogma of OO, where it's all about objects having identity, state , and behavior. On 12/13/06, Donald Bruce Stewart <[EMAIL PROTECTED]> wrote:
ulfn: > > On Dec 13, 2006, at 3:54 AM, Yitz Gale wrote: > > >Nice. Here is something similar: > > > >reverseWords = concat . reverse . groupBy eqsp > > where eqsp x y = isSpace x == isSpace y > > This can be made even nicer using the 'on' function [1]: > > reverseWords = concat . reverse . groupBy ((==) `on` isSpace) > > [1] http://www.haskell.org/pipermail/libraries/2006-November/006156.html Lambdabot trick(tm), use 'join' in the [] monad, instead of 'concat' join . reverse . groupBy ((==) `on` isSpace) -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe