Find words with alternating vowels and consonants: Difference between revisions
Content deleted Content added
→{{header|JavaScript}}: Added a JS draft. |
→{{header|JavaScript}}: Abstracted out an inColumns function. |
||
Line 653: | Line 653: | ||
matches = lines( |
matches = lines( |
||
readFile('unixdict.txt') |
readFile('unixdict.txt') |
||
).filter(isLongAlternator) |
).filter(isLongAlternator); |
||
⚫ | |||
return `${matches.length} matches:\n\n` + ( |
return `${matches.length} matches:\n\n` + ( |
||
inColumns(4)(matches) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
); |
); |
||
}; |
}; |
||
// ------------------- FORMATTING -------------------- |
|||
// inColumns :: Int -> [String] -> String |
|||
const inColumns = n => |
|||
xs => { |
|||
⚫ | |||
return unlines( |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}; |
|||
// --------------------- GENERIC --------------------- |
// --------------------- GENERIC --------------------- |