Find words with alternating vowels and consonants: Difference between revisions
Find words with alternating vowels and consonants (view source)
Revision as of 22:13, 20 January 2021
, 3 years ago→{{header|JavaScript}}: Abstracted out an inColumns function.
(→{{header|JavaScript}}: Added a JS draft.) |
(→{{header|JavaScript}}: Abstracted out an inColumns function.) |
||
Line 653:
matches = lines(
readFile('unixdict.txt')
).filter(isLongAlternator)
w = maximum(matches.map(length));▼
return `${matches.length} matches:\n\n` + (
chunksOf(4)(▼
matches.map(justifyLeft(w)(' '))▼
).map(unwords)▼
)▼
);
};
// ------------------- FORMATTING --------------------
// inColumns :: Int -> [String] -> String
const inColumns = n =>
xs => {
return unlines(
▲ ).map(unwords)
▲ )
};
// --------------------- GENERIC ---------------------
|