Find words with alternating vowels and consonants: Difference between revisions
Find words with alternating vowels and consonants (view source)
Revision as of 14:50, 22 January 2021
, 3 years ago→AppleScript :: Functional
Line 159:
set fpWordList to scriptFolder() & "unixdict.txt"
if doesFileExist(fpWordList) then
set matches to filteredLines(query, readFile(fpWordList))▼
inColumns(4, ¬
set widest to maximum(map(|length|, matches))▼
unlines({(length of matches as text) & " matches:" & linefeed} & ¬▼
map(unwords, chunksOf(4, ¬▼
map(justifyLeft(widest, space), matches))))▼
else
display dialog "Word list not found at:" & ¬
Line 268 ⟶ 263:
end tell
end foldl
-- inColumns :: Int -> [String] -> String
on inColumns(n, xs)
-- The strings in xs displayed in n columns
-- of equal width.
end inColumns
|