Find words with alternating vowels and consonants: Difference between revisions
Find words with alternating vowels and consonants (view source)
Revision as of 22:57, 3 January 2021
, 3 years ago→{{header|Julia}}
m (added related tasks.) |
|||
Line 348:
dict, shown = Dict(w => 1 for w in words), 0
for word in words
if (output = condition(word, dict)) != "" && (minlen < 1 || length(word) >= minlen)
shown += 1
print(rpad(
toshow > 0 && toshow <
end
end
Line 359:
onlyodds(f, s) = all(c -> f(c), s[1:2:length(s)]) && !any(c -> f(c), s[2:2:length(s)])
onlyevens(f, s) = !any(c -> f(c), s[1:2:length(s)]) && all(c -> f(c), s[2:2:length(s)])
eitheronlyvowels(w, _) = onlyodds(isvowel, w) || onlyevens(isvowel, w) ? w : ""
foreachword("unixdict.txt", eitheronlyvowels, minlen = 10)
</lang>{{out}}
<pre>
Word source: unixdict.txt
aboriginal apologetic bimolecular borosilicate calorimeter capacitate
capacitive capitoline capitulate caricature colatitude coloratura
|