Find words with alternating vowels and consonants: Difference between revisions

m
Line 159:
set fpWordList to scriptFolder() & "unixdict.txt"
if doesFileExist(fpWordList) then
set matches to filteredLines(query, readFile(fpWordList))
inColumns(4, ¬
set matches to filteredLines(query, readFile(fpWordList)))
--------------- MATCHES LISTED IN COLUMNS --------------
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.
set widest to maximum(map(my |length|, matchesxs))
unlines({(length of matchesxs as text) & " matches:" & linefeed} & ¬
map(my unwords, chunksOf(4n, ¬
map(justifyLeft(widest, space), matchesxs))))
end inColumns
 
 
9,655

edits