Determine if a string is collapsible: Difference between revisions
Content deleted Content added
m →{{header|Haskell}}: pointfree |
|||
Line 646: | Line 646: | ||
</pre> |
</pre> |
||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell> |
<lang haskell>import Text.Printf (printf) |
||
import Text.Printf (printf) |
|||
import Data.Maybe (catMaybes) |
import Data.Maybe (catMaybes) |
||
import Control.Monad (guard) |
import Control.Monad (guard) |
||
Line 668: | Line 667: | ||
main = |
main = |
||
mapM_ (\(a, b) -> printf "old: %3d «««%s»»»\nnew: %3d «««%s»»»\n\n" (length a) a (length b) b) |
mapM_ (\(a, b) -> printf "old: %3d «««%s»»»\nnew: %3d «««%s»»»\n\n" (length a) a (length b) b) |
||
$ ((,) <*> collapse) <$> input |
$ ((,) <*> collapse) <$> input</lang> |
||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |