
12 Dec
2006
12 Dec
'06
9:54 p.m.
Brandon S. Allbery KF8NH writes:
Off the top of my head, the C++ one translates to:
*Main> concatMap reverse . groupBy (\l r -> (l == ' ') == (r == ' ')) . reverse $ "one two three four " " four three two one"
There are almost certainly more idiomatic ways to do it, but I'm still learning.
Nice. Here is something similar: reverseWords = concat . reverse . groupBy eqsp where eqsp x y = isSpace x == isSpace y Regards, Yitz _._ .._. ___.. _. .... _.. . .__ _... ___.. ... _. _._