[Haskell-cafe] Reversing a string of words: C# v Perl V Ruby vHaskell

Neil Mitchell ndmitchell at gmail.com
Sun Dec 10 07:51:39 EST 2006


Hi

> What about just:
>
>     reverseWords = concat . intersperse " " . reverse . words

Dr Haskell says:
[http://www-users.cs.york.ac.uk/~ndm/projects/drhaskell.php]

"Use unwords instead of concat (intersperse space ...)"

Which gives us:

reverseWords = unwords . reverse . words

Thanks

Neil


More information about the Haskell-Cafe mailing list