Determine if a string is squeezable: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 716: | Line 716: | ||
</pre> |
</pre> |
||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell> |
<lang haskell>import Text.Printf (printf) |
||
import Text.Printf (printf) |
|||
input :: [(String, Char)] |
input :: [(String, Char)] |
||
Line 742: | Line 741: | ||
main = |
main = |
||
mapM_ (\(a, b, c) -> printf "squeeze: '%c'\nold: %3d «««%s»»»\nnew: %3d «««%s»»»\n\n" c (length a) a (length b) b) |
mapM_ (\(a, b, c) -> printf "squeeze: '%c'\nold: %3d «««%s»»»\nnew: %3d «««%s»»»\n\n" c (length a) a (length b) b) |
||
$ (\(s, c) -> (s, collapse s c, c)) <$> input |
$ (\(s, c) -> (s, collapse s c, c)) <$> input</lang> |
||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |