Jump to content

Find words with alternating vowels and consonants: Difference between revisions

→‎{{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` + (
unlinesinColumns(4)(matches)
chunksOf(4)(
matches.map(justifyLeft(w)(' '))
).map(unwords)
)
);
};
 
// ------------------- FORMATTING --------------------
 
// inColumns :: Int -> [String] -> String
const inColumns = n =>
xs => {
const w = maximum(matchesxs.map(length));
return unlines(
chunksOf(4n)(
matchesxs.map(justifyLeft(w)(' '))
).map(unwords)
)
};
 
// --------------------- GENERIC ---------------------
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.