Find words with alternating vowels and consonants: Difference between revisions

m
Line 569:
 
=={{header|Haskell}}==
<lang haskell>import Data.List.Split (chunksOftranspose)
import Data.List.Split (chunksOf)
 
------ WORDS WITHOUT SUCCESSIVE VOWELS OR CONSONANTS -----
Line 587 ⟶ 588:
mapM_ putStrLn $
((:) =<< (<> " matching words:\n") . show . length) $
filter isLongAlternator (lines s)</lang>
 
------------------------ FORMATTING ----------------------
 
paddedCols :: Show a => [[a]] -> [[String]]
paddedCols cols =
let cells = fmap show <$> cols
w = maximum $ length <$> concat cells
in map (justifyRight w ' ') <$> cells
 
justifyRight n c = (drop . length) <*> (replicate n c <>)</lang>
{{Out}}
<pre>67 matching words:
9,659

edits