Find words with alternating vowels and consonants: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: use unix_dict(), odd() is now a builtin) |
|||
Line 1,593: | Line 1,593: | ||
telekinesis teratogenic topologize unilateral |
telekinesis teratogenic topologize unilateral |
||
unimodular uninominal verisimilitude</pre> |
unimodular uninominal verisimilitude</pre> |
||
=={{header|jq}}== |
|||
{{works with|jq}} |
|||
'''Works with gojq, the Go implementation of jq''' |
|||
<lang jq># input: an array |
|||
# output: if the $parity elements are all in $array then true, else false |
|||
def check($parity; $array): |
|||
. as $in |
|||
| all( range(0+$parity; length; 2); $in[.]|IN($array[])); |
|||
def alternating: |
|||
def c: explode[0]; |
|||
("aeiou" | explode) as $vowels |
|||
| ([range("a"|c; ("z"|c)+1)] - $vowels) as $consonants |
|||
| inputs |
|||
| select(length>9) |
|||
| . as $word |
|||
| explode |
|||
| select( |
|||
(check(0; $consonants) and check(1; $vowels)) or |
|||
(check(1; $consonants) and check(0; $vowels)) ) |
|||
| $word ; |
|||
alternating</lang> |
|||
{{out}} |
|||
Invocation example: jq -rR -f program.jqunixdict.txt |
|||
<pre> |
|||
aboriginal |
|||
apologetic |
|||
bimolecular |
|||
borosilicate |
|||
calorimeter |
|||
capacitate |
|||
capacitive |
|||
capitoline |
|||
capitulate |
|||
caricature |
|||
colatitude |
|||
coloratura |
|||
colorimeter |
|||
debilitate |
|||
decelerate |
|||
decolonize |
|||
definitive |
|||
degenerate |
|||
deliberate |
|||
demodulate |
|||
denominate |
|||
denotative |
|||
deregulate |
|||
desiderata |
|||
desideratum |
|||
dilapidate |
|||
diminutive |
|||
epigenetic |
|||
facilitate |
|||
hemosiderin |
|||
heretofore |
|||
hexadecimal |
|||
homogenate |
|||
inoperative |
|||
judicature |
|||
latitudinal |
|||
legitimate |
|||
lepidolite |
|||
literature |
|||
locomotive |
|||
manipulate |
|||
metabolite |
|||
nicotinamide |
|||
oratorical |
|||
paragonite |
|||
pejorative |
|||
peridotite |
|||
peripatetic |
|||
polarimeter |
|||
recitative |
|||
recuperate |
|||
rehabilitate |
|||
rejuvenate |
|||
remunerate |
|||
repetitive |
|||
reticulate |
|||
savonarola |
|||
similitude |
|||
solicitude |
|||
tananarive |
|||
telekinesis |
|||
teratogenic |
|||
topologize |
|||
unilateral |
|||
unimodular |
|||
uninominal |
|||
verisimilitude |
|||
</pre> |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |