Find words with alternating vowels and consonants: Difference between revisions

m
(Added Arturo implementation)
m (→‎{{header|Wren}}: Minor tidy)
 
(23 intermediate revisions by 19 users not shown)
Line 10:
{{Template:Strings}}
<br><br>
 
=={{header|11l}}==
{{trans|Nim}}
 
<syntaxhighlight lang="11l">V vowels = ‘aeiou’
 
V count = 0
L(word) File(‘unixdict.txt’).read().split("\n")
I word.len > 9
V first = word[0] C vowels
L(i) (2 .< word.len).step(2)
I (word[i] C vowels) != first
L.break
L.was_no_break
L(i) (1 .< word.len).step(2)
I (word[i] C vowels) == first
L.break
L.was_no_break
count++
print(word.rjust(14), end' I count % 7 == 0 {"\n"} E ‘ ’)
print()</syntaxhighlight>
 
{{out}}
<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|Action!}}==
In the following solution the input file [https://gitlab.com/amarok8bit/action-rosetta-code/-/blob/master/source/unixdict.txt unixdict.txt] is loaded from H6 drive. Altirra emulator automatically converts CR/LF character from ASCII into 155 character in ATASCII charset used by Atari 8-bit computer when one from H6-H10 hard drive under DOS 2.5 is used.
<syntaxhighlight lang="action!">BYTE FUNC IsVovel(CHAR c)
IF c='a OR c='e OR c='i OR c='o OR c='u THEN
RETURN (1)
FI
RETURN (0)
 
BYTE FUNC IsValidWord(CHAR ARRAY word)
BYTE i,len,v
 
len=word(0)
IF len<=9 THEN RETURN (0) FI
 
v=IsVovel(word(1))
FOR i=2 TO len STEP 2
DO
IF IsVovel(word(i))=v THEN RETURN (0) FI
OD
FOR i=3 TO len STEP 2
DO
IF IsVovel(word(i))#v THEN RETURN (0) FI
OD
RETURN (1)
 
PROC FindWords(CHAR ARRAY fname)
CHAR ARRAY line(256)
CHAR ARRAY tmp(256)
BYTE pos,dev=[1]
 
pos=2
Close(dev)
Open(dev,fname,4)
WHILE Eof(dev)=0
DO
InputSD(dev,line)
IF IsValidWord(line) THEN
IF pos+line(0)>=39 THEN
PutE() pos=2
FI
Print(line) Put(32)
pos==+line(0)+1
FI
OD
Close(dev)
RETURN
 
PROC Main()
CHAR ARRAY fname="H6:UNIXDICT.TXT"
 
FindWords(fname)
RETURN</syntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Find_words_with_alternating_vowels_and_consonants.png Screenshot from Atari 8-bit computer]
<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|Ada}}==
<langsyntaxhighlight Adalang="ada">with Ada.Text_Io;
with Ada.Strings.Fixed;
 
Line 44 ⟶ 144:
end loop;
Close (File);
end Find_Alternating;</langsyntaxhighlight>
 
=={{header|ALGOL 68}}==
<langsyntaxhighlight lang="algol68"># read the list of words and show words with alternating vowels and #
# consonants #
IF FILE input file;
Line 103 ⟶ 203:
close( input file );
print( ( newline, whole( alternating count, 0 ), " words of alternating vowels and consonants found", newline ) )
FI</langsyntaxhighlight>
{{out}}
<pre>
Line 125 ⟶ 225:
The handler here is case- and diacritical-insensitive and has an option to treat "y" as a vowel. With the text file located on the computer's startup disk, it performs the set task in just under a third of a second on my machine, which is probably good enough for such a silly task.
 
<langsyntaxhighlight lang="applescript">(*
With AppleScript's text item delimiters set to all the vowels, the 'text items' of a word with alternating
vowels and consonants are single-character strings (the consonants), with the possibility of an empty
Line 167 ⟶ 267:
local theText
set theText to (read file ((path to desktop as text) & "unixdict.txt") as «class utf8»)
findWordsWithAlternatingVowelsAndConsonants from theText without yAsVowel given minLength:10</langsyntaxhighlight>
 
{{output}}
<langsyntaxhighlight lang="applescript">{"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"}</langsyntaxhighlight>
 
Or if you want to treat "y" as a vowel:
 
<langsyntaxhighlight lang="applescript">-- Task code:
local theText
set theText to (read file ((path to desktop as text) & "unixdict.txt") as «class utf8»)
findWordsWithAlternatingVowelsAndConsonants from theText with yAsVowel given minLength:10</langsyntaxhighlight>
 
{{output}}
<langsyntaxhighlight lang="applescript">{"aboriginal", "apologetic", "bimolecular", "borosilicate", "calorimeter", "capacitate", "capacitive", "capitoline", "capitulate", "caricature", "cohomology", "colatitude", "coloratura", "colorimeter", "debilitate", "decelerate", "decolonize", "definitive", "degeneracy", "degenerate", "dehumidify", "deliberate", "demodulate", "denominate", "denotative", "depositary", "depository", "deregulate", "deregulatory", "derogatory", "desiderata", "desideratum", "dicotyledon", "dilapidate", "diminutive", "epigenetic", "facilitate", "generosity", "hemosiderin", "hereditary", "heretofore", "heterodyne", "hexadecimal", "homogenate", "hypotenuse", "inoperative", "judicatory", "judicature", "laboratory", "latitudinal", "latitudinary", "legitimacy", "legitimate", "lepidolite", "literature", "locomotive", "locomotory", "luminosity", "manipulate", "metabolite", "mineralogy", "monocotyledon", "musicology", "nicotinamide", "numerology", "oratorical", "paragonite", "paramilitary", "pejorative", "peridotite", "peripatetic", "polarimeter", "polymerase", "pyrimidine", "pyroxenite", "recitative", "recuperate", "regulatory", "rehabilitate", "rejuvenate", "remunerate", "repetitive", "repository", "reticulate", "revelatory", "savonarola", "similitude", "solicitude", "solidarity", "tananarive", "telekinesis", "teratogenic", "teratology", "topologize", "toxicology", "unilateral", "unimodular", "uninominal", "verisimilitude", "veterinary", "vocabulary"}</langsyntaxhighlight>
 
===Functional===
 
Listing 'alternating' words for both '''{a,e,i,o,u}''' and '''{a,e,i,o,u,y}''' interpretations of 'vowel':
<langsyntaxhighlight lang="applescript">use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
Line 513 ⟶ 613:
set my text item delimiters to dlm
return s
end unwords</langsyntaxhighlight>
{{Out}}
<pre>Assuming aeiou – 67 matches:
Line 566 ⟶ 666:
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">words: read.lines relative "unixdict.txt"
vowels: [`a` `e` `i` `o` `u`]
alternatingVC?: function [w][
Line 585 ⟶ 685:
print word
]
]</langsyntaxhighlight>
 
{{out}}
Line 656 ⟶ 756:
uninominal
verisimilitude</pre>
 
=={{header|AutoHotkey}}==
<syntaxhighlight lang="autohotkey">FileRead, db, % A_Desktop "\unixdict.txt"
vowels := {"a":1, "e":1, "i":1, "o":1, "u":1}, c := 0
 
Main:
for i, word in StrSplit(db, "`n", "`r")
{
if StrLen(word) < 10
continue
vCount := cCount := 0
while (letter := SubStr(word, A_Index, 1))
{
if vowels[letter]
vCount++, cCount:=0
else
vCount:=0, cCount++
if (vCount > 1 || cCount > 1)
continue main
}
c++
result .= word (Mod(c, 9) ? "`t" : "`n")
}
MsgBox, 262144, , % result
return</syntaxhighlight>
{{out}}
<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|AWK}}==
<langsyntaxhighlight lang="awk">( length( $1 ) >= 10 ) \
{
# have an appropriate length word
Line 680 ⟶ 815:
{
printf( "\n%d words with alternating vowels and consonants found\n", alternatingCount );
} # END</langsyntaxhighlight>
{{out}}
<pre>
Line 699 ⟶ 834:
 
=={{header|C}}==
<langsyntaxhighlight lang="c">#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
Line 742 ⟶ 877:
fclose(fp);
return EXIT_SUCCESS;
}</langsyntaxhighlight>
 
{{out}}
Line 816 ⟶ 951:
 
=={{header|C++}}==
<langsyntaxhighlight lang="cpp">#include <cstdlib>
#include <fstream>
#include <iomanip>
Line 855 ⟶ 990:
}
return EXIT_SUCCESS;
}</langsyntaxhighlight>
 
{{out}}
Line 927 ⟶ 1,062:
67: verisimilitude
</pre>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|Classes,StdCtrls,SysUtils}}
Runtime = 4.3 ms.
 
<syntaxhighlight lang="Delphi">
var Dict: TStringList; {List holds dictionary}
 
function IsVowel(C: char): boolean;
begin
Result:=C in ['a','e','i','o','u'];
end;
 
function DoesAlternate(S: string): boolean;
var I: integer;
var Vowel: boolean;
begin
Result:=False;
Vowel:=IsVowel(S[1]);
for I:=2 to Length(S) do
begin
if not (Vowel xor IsVowel(S[I])) then exit;
Vowel:=IsVowel(S[I]);
end;
Result:=True;
end;
 
 
procedure AlternateVowelConsonant(Memo: TMemo);
{Find words where the letters alternate vowel,consonant}
var I,Cnt: integer;
var S: string;
begin
S:=''; Cnt:=0;
for I:=0 to Dict.Count-1 do
if Length(Dict[I])>9 then
begin
if DoesAlternate(Dict[I]) then
begin
Inc(Cnt);
S:=S+Format('%-23s',[Dict[I]]);
if (Cnt mod 4)=0 then S:=S+#$0D#$0A
end
end;
Memo.Lines.Add(IntToStr(Cnt)+' Alternate Vowel/Consonant words found.');
Memo.Lines.Add(S);
end;
 
 
initialization
{Create/load dictionary}
Dict:=TStringList.Create;
Dict.LoadFromFile('unixdict.txt');
Dict.Sorted:=True;
finalization
Dict.Free;
end.
 
</syntaxhighlight>
{{out}}
<pre>
67 Alternate Vowel/Consonant words found.
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|F_Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">
// Find words with alternating vowels and consonants. Nigel Galloway: January 20th., 2020
let vowels=set['a';'e';'i';'o';'u']
Line 936 ⟶ 1,153:
seq{use n=System.IO.File.OpenText("unixdict.txt") in while not n.EndOfStream do yield n.ReadLine()}
|>Seq.filter(fun g->g.Length>9 && fN g)|>Seq.iter(printfn "%s")
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 1,008 ⟶ 1,225:
</pre>
=={{header|Factor}}==
<code>group-by</code> is used to group words by vowels and consonants. For example, <code>"hello" [ "aeiou" member? ] group-by</code> produces a sequence like <code>{ 'h' 'e' 'll' 'o' }</code>. The number of elements in this grouping is the same as the length of the original word if and only if it has alternating vowels and consonants.
{{works with|Factor|0.99 2020-08-14}}
<langsyntaxhighlight lang="factor">USING: grouping.extras io.encodings.ascii io.files kernel math
prettyprint sequences ;
 
"unixdict.txt" ascii file-lines
[ length 9 > ] filter
[ dup [ "aeiou" member? ] group-by [ length ] bi@ =same? ] filter .</langsyntaxhighlight>
{{out}}
<pre style="height:20em">
Line 1,090 ⟶ 1,308:
=={{header|Forth}}==
{{works with|Gforth}}
<langsyntaxhighlight lang="forth">: vowel? ( c -- ? )
case
'a' of true endof
Line 1,127 ⟶ 1,345:
 
main
bye</langsyntaxhighlight>
 
{{out}}
Line 1,200 ⟶ 1,418:
</pre>
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">dim as string s, c
dim as boolean v = false, lv = false
dim as integer i, n, a=0
 
open "unixdict.txt" for input as #1
 
while not eof(1)
line input #1, s
n = len(s)
if n<10 then continue while
for i = 1 to n
c = mid(s,i,1)
if c="a" or c="e" or c="i" or c="o" or c="u" then
v = true
else
v = false
end if
'print c, v, lv
if v = lv and i>1 then continue while
lv = v
next i
a+=1
print s;" ";
if a mod 10 = 0 then print
wend
close #1</syntaxhighlight>
{{out}}<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|Go}}==
<langsyntaxhighlight lang="go">package main
 
import (
Line 1,252 ⟶ 1,506:
}
}
}</langsyntaxhighlight>
 
{{out}}
Line 1,328 ⟶ 1,582:
 
=={{header|Haskell}}==
<langsyntaxhighlight lang="haskell">import Control.Monad (join)
import Data.Bifunctor (bimap)
import Data.List.Split (chunksOf)
Line 1,364 ⟶ 1,618:
 
justifyLeft :: Int -> Char -> String -> String
justifyLeft n c s = take n (s <> replicate n c)</langsyntaxhighlight>
{{Out}}
<pre>67 matching words:
Line 1,386 ⟶ 1,640:
unimodular uninominal verisimilitude</pre>
 
=={{header|J}}==
We're looking for words which have more than 9 letters and where any adjacent pair of letters has both a vowel and a consonant.
<syntaxhighlight lang="j"> >(#~ (*/@(2 ~:/\ e.&'aeiou')*9<#)@>) cutLF fread'unixdict.txt'
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</syntaxhighlight>
=={{header|JavaScript}}==
As a standard for an embedded language which may have no access to a file-system,
Line 1,393 ⟶ 1,717:
macOS osascript instance of a JSContext.
 
<langsyntaxhighlight lang="javascript">(() => {
'use strict';
 
Line 1,571 ⟶ 1,895:
// MAIN ---
return main();
})();</langsyntaxhighlight>
{{Out}}
<pre>67 matches:
Line 1,592 ⟶ 1,916:
telekinesis teratogenic topologize unilateral
unimodular uninominal verisimilitude</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<syntaxhighlight 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</syntaxhighlight>
{{out}}
Invocation example: jq -nrR -f program.jq unixdict.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}}==
See [[Alternade_words#Julia]] for the foreachword function.
<langsyntaxhighlight lang="julia">isvowel(c) = c in ['a', 'e', 'i', 'o', 'u'] # NB. leaves out 'α' and similar unicode vowels, and what about y?
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)])
Line 1,601 ⟶ 2,021:
 
foreachword("unixdict.txt", eitheronlyvowels, minlen = 10)
</langsyntaxhighlight>{{out}}
<pre>
Word source: unixdict.txt
Line 1,618 ⟶ 2,038:
verisimilitude
</pre>
 
=={{header|Ksh}}==
<syntaxhighlight lang="ksh">
#!/bin/ksh
 
# Find words with alternating vowels and consonants
 
# # Variables:
#
dict='../unixdict.txt'
 
integer MINLENGTH=10
vowels='a|e|i|o|u'
 
# # Functions:
#
# # Function _isvowel(ch) - Return 1 if letter is a vowel
#
function _isvowel {
typeset _ch ; typeset -l -L1 _ch="$1"
 
[[ ${_ch} == @(${vowels}) ]] && return 1
return 0
}
# # Function _isalternating(str) - Return 1 if letter alternate vowel/const.
#
function _isalternating {
typeset _str ; typeset -l _str="$1"
typeset _i _rc ; integer _i _rc
 
for ((_i=0; _i<${#_str}-1; _i++)); do
_isvowel ${_str:${_i}:1} ; _rc=$?
_isvowel ${_str:$((_i+1)):1}
(( $? == _rc )) && return 0
done
return 1
}
 
######
# main #
######
while read; do
(( ${#REPLY} < MINLENGTH )) && continue
_isalternating "$REPLY"
(( $? )) && print "$REPLY"
done < ${dict}
</syntaxhighlight>
{{out}}<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|Mathematica}}/{{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica">vowels = Characters["euioa"];
consonants = DeleteCases[Alphabet[], Alternatives @@ vowels];
dict = Once[Import["https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt"]];
dict //= StringSplit[#, "\n"] &;
dict //= Select[StringLength /* GreaterThan[9]];
dict //=
Select[(ContainsAll[vowels, Characters[StringTake[#, {1, -1, 2}]]] &&
ContainsAll[consonants,
Characters[StringTake[#, {2, -1, 2}]]]) || (ContainsAll[
consonants, Characters[StringTake[#, {1, -1, 2}]]] &&
ContainsAll[vowels, Characters[StringTake[#, {2, -1, 2}]]]) &]</syntaxhighlight>
{{out}}
<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|MiniScript}}==
This implementation is for use with the [http://miniscript.org/MiniMicro Mini Micro] version of MiniScript. The command-line version does not include a HTTP library. The script can be modified to use the file class to read a local copy of the word list.
<syntaxhighlight lang="miniscript">
isVowel = function(c)
return "aeiou".indexOf(c) != null
end function
 
isAlternating = function(word)
compVowelState= isVowel(word[0])
for i in range(1, word.len - 1)
if isVowel(word[i]) == compVowelState then return false
compVowelState = not compVowelState
end for
return true
end function
 
wordList = http.get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").split(char(10))
results = []
 
for word in wordList
if word.len >9 and isAlternating(word) then results.push(word)
end for
c = 0
 
for word in results
word = (word + " " * 5)[:15] // padded for printing
print word, ""
c = c + 1
if c % 4 == 0 then print
end for
</syntaxhighlight>
 
{{out}}
<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|Nim}}==
<syntaxhighlight lang="nim">import strutils
 
const Vowels = {'a', 'e', 'i', 'o', 'u'}
 
var count = 0
for word in "unixdict.txt".lines:
if word.len > 9:
block checkWord:
let first = word[0] in Vowels
for i in countup(2, word.high, 2):
if word[i] in Vowels != first: break checkWord
for i in countup(1, word.high, 2):
if word[i] in Vowels == first: break checkWord
inc count
stdout.write word.align(14), if count mod 7 == 0: '\n' else: ' '
echo()</syntaxhighlight>
 
{{out}}
<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|Perl}}==
Line 1,623 ⟶ 2,254:
Used [https://metacpan.org/pod/App::a2p a2p].
{{trans|AWK}}
<langsyntaxhighlight Perllang="perl"># 20210104 added Perl programming solution
 
use strict;
Line 1,648 ⟶ 2,279:
}
 
printf "\n%d words with alternating vowels and consonants found\n", $alternatingCount;</langsyntaxhighlight>
{{out}}
<pre>
Line 1,667 ⟶ 2,298:
=== Regex solution ===
I've heard rumors that there are more than 5 vowels...
<langsyntaxhighlight lang="perl">$vowels = 'aeiou';
$v = qr/[$vowels]/;
$c = qr/[^$vowels]/;
 
/^ ( ($c$v)+ $c? | ($v$c)+ $v? ) $/ix and say for grep { /.{10}/ } split "\n", do { (@ARGV, $/) = 'unixdict.txt'; <> };</langsyntaxhighlight>
{{out}}
<pre>aboriginal
Line 1,680 ⟶ 2,311:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">odd</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">idx</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">idx</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)=</span><span style="color: #000000;">1</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">vowel</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">ch</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ch</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"aeiou"</span><span style="color: #0000FF;">)!=</span><span style="color: #000000;">0</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">oddeven</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">word</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">word</span><span style="color: #0000FF;">)<=</span><span style="color: #000000;">9</span> <span style="color: #008080;">then</span> <span style="color: #008080;">return</span> <span style="color: #004600;">false</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">consonants</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #000000;">word</span><span style="color: #0000FF;">,</span><span style="color: #000000;">vowel</span><span style="color: #0000FF;">),</span>
<span style="color: #000000;">ohoneohone</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">word</span><span style="color: #0000FF;">)),</span><span style="color: #0000007060A8;">odd</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">return</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #000000;">consonants</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">ohoneohone</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">sq_not</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ohoneohone</span><span style="color: #0000FF;">)})</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">words</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">get_textunix_dict</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"demo/unixdict.txt"</span><span style="color: #0000FF;">,</span><span style="color: #004600;">GT_LF_STRIPPED</span><span style="color: #0000FF;">),</span><span style="color: #000000;">oddeven</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d avac words found: %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">words</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">shorten</span><span style="color: #0000FF;">(</span><span style="color: #000000;">words</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">),</span><span style="color: #008000;">", "</span><span style="color: #0000FF;">)})</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 1,698 ⟶ 2,329:
 
=={{header|Plain English}}==
<langsyntaxhighlight lang="plainenglish">To run:
Start up.
Put "c:\unixdict.txt" into a path.
Line 1,728 ⟶ 2,359:
If the string's last's target is any consonant, set another flag.
If the flag is the other flag, say yes.
Say no.</langsyntaxhighlight>
{{out}}
<pre style="height:20em">
Line 1,802 ⟶ 2,433:
=={{header|Prolog}}==
{{works with|SWI Prolog}}
<langsyntaxhighlight lang="prolog">main:-
open("unixdict.txt", read, Stream),
main(Stream, 0),
Line 1,834 ⟶ 2,465:
alternating_vowels_and_consonants([Ch1, Ch2|Chars]):-
(vowel(Ch1) -> \+vowel(Ch2) ; vowel(Ch2)),
alternating_vowels_and_consonants([Ch2|Chars]).</langsyntaxhighlight>
 
{{out}}
Line 1,908 ⟶ 2,539:
 
=={{header|Python}}==
<langsyntaxhighlight lang="python">'''Words with alternating vowels and consonants'''
 
 
Line 1,974 ⟶ 2,605:
# MAIN ---
if __name__ == '__main__':
main()</langsyntaxhighlight>
{{Out}}
<pre>67 matching words:
Line 1,995 ⟶ 2,626:
telekinesis teratogenic topologize unilateral
unimodular uninominal verisimilitude</pre>
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="quackery">
[ [] swap ]'[ swap
witheach
[ dup nested
unrot over do
iff [ dip join ]
else nip ]
drop ] is filter ( [ --> [ )
 
[ [ 0
26 times
[ i^ char A +
bit | ]
26 times
[ i^ char a +
bit | ] ] constant ] is letters ( --> n )
 
[ [ 0 $ "AEIUOaeiou"
witheach [ bit | ] ]
constant ] is vowels ( --> n )
 
[ [ letters vowels ~ & ]
constant ] is consonants ( --> n )
 
[ true swap
witheach
[ bit letters & 0 =
if [ conclude not ] ] ] is onlyletters ( $ --> b )
 
[ stack [ ] ] is chartest ( $ --> b )
 
[ bit vowels & 0 > ] is isvowel ( c --> b )
 
[ bit consonants & 0 > ] is isconsonant ( c --> b )
 
forward is constest ( c --> b )
 
[ isvowel
' constest
chartest replace ] is voweltest ( c --> b )
 
[ isconsonant
' voweltest
chartest replace ] resolves constest ( c --> b )
 
[ behead isvowel iff
[ ' constest ]
else [ ' voweltest ]
chartest put
true swap witheach
[ chartest share do
not if
[ conclude not ] ] ] is alternating ( $ --> b )
 
[ dup size 10 < iff
[ drop false ] done
dup onlyletters not iff
[ drop false ] done
alternating ] is allcriteria ( $ --> b )
 
 
$ "rosetta/unixdict.txt" sharefile
drop nest$
filter allcriteria
80 wrap$</syntaxhighlight>
 
{{out}}
 
<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|Racket}}==
 
Echoing #Raku ... this is another one that can be done with a regex.
 
Here's a bit of variety; the match-lambda for the regex version could also be simplified to regexp-match.
 
<syntaxhighlight lang="racket">#lang racket
 
(define alternating?/re
(match-lambda
((regexp #rx"^[aeiou]?([^aeiou][aeiou])*[^aeiou]?$") #t)
(_ #f)))
 
(define/match (vowel? v)
[((or #\a #\e #\i #\o #\u)) #t]
[(_) #f])
 
(define consonant? (negate vowel?))
 
(define (alternating?/for w)
(or (string=? "" w)
(let/ec fail (or (for/fold ((expect-vowel? (consonant? (string-ref w 0))))
((c (in-string w 1)))
(if (eq? (vowel? c) expect-vowel?)
(not expect-vowel?)
(fail #f)))
#t))))
 
(define (alternating?/loop w)
(define w-len-- (sub1 (string-length w)))
(or (negative? w-len--)
(let loop ((expect-vowel? (consonant? (string-ref w w-len--))) (i w-len--))
(or (zero? i)
(let* ((i-- (sub1 i)) (c (string-ref w i--)))
(and (eq? (vowel? c) expect-vowel?)
(loop (not expect-vowel?) i--)))))))
 
(define (alternating?/letrec w)
(letrec ((l (string-length w))
(c (λ (i) (string-ref w i)))
(vc-alt? (match-lambda
[(== l) #t]
[(and (app c (? vowel?)) (app add1 i)) (cv-alt? i)]
[_ #f]))
(cv-alt? (match-lambda
[(== l) #t]
[(and (app c (? consonant?))(app add1 i)) (vc-alt? i)]
[_ #f])))
(or (vc-alt? 0) (cv-alt? 0))))
 
(define (filtered-word? pred)
(match-lambda [(and (? pred) (? (λ (w) (> (string-length w) 9)))) #t] [_ #f]))
 
(define all-words (file->lines "../../data/unixdict.txt"))
 
(module+ main
(filter (filtered-word? alternating?/re) all-words))
 
(module+ test
(require rackunit)
(define words/re (filter (filtered-word? alternating?/re) all-words))
(define words/fold (filter (filtered-word? alternating?/for) all-words))
(define words/loop (filter (filtered-word? alternating?/loop) all-words))
(define words/letrec (filter (filtered-word? alternating?/letrec) all-words))
 
(check-equal? words/re words/fold)
(check-equal? words/re words/loop)
(check-equal? words/re words/letrec))</syntaxhighlight>
 
{{out}}
 
<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|Raku}}==
Sigh. Yet another "Filter a word list" task. In a effort to make it a ''little'' more interesting, rather than just doing a one-liner, build a grammar and use that to filter.
 
<syntaxhighlight lang="raku" perl6line>grammar VOWCON {
token TOP { <|w> <vowel>? ( <consonant> <vowel> )* <consonant>? <|w> }
token vowel { <[aeiou]> }
Line 2,005 ⟶ 2,792:
}
 
say ( grep { VOWCON.parse: .lc }, grep { .chars > 9 }, 'unixdict.txt'.IO.words ).batch(6)».fmt('%-15s').join: "\n";</langsyntaxhighlight>
{{out}}
<pre>aboriginal apologetic bimolecular borosilicate calorimeter capacitate
Line 2,021 ⟶ 2,808:
 
=={{header|REXX}}==
<langsyntaxhighlight lang="rexx">/*REXX program finds all the caseless words (within an identified dictionary) that */
/*───────────────────────────────────────────────── either have odd letters that are vowels, and even letters that consonants, */
/*──────────────────────────────────────── even letters that consonants, or vice versa.*/
/*───────── or vice versa. */
parse arg minL iFID . /*obtain optional arguments from the CL*/
if minL=='' | minL=="," then minL= 10 /*Not specified? Then use the default.*/
Line 2,030 ⟶ 2,817:
do #=1 while lines(iFID)\==0 /*read each word in the file (word=X).*/
x= strip( linein( iFID) ) /*pick off a word from the input line. */
$.#= x; upper x /*save: original case and the semaphore*/
end /*#*/ /* [↑] semaphore name is uppercased. */
#= # - 1 /*adjust the record count (DO loop). */
say copies('─', 30) # "words in the dictionary file: " iFID; say
finds= 0 /*count of the words found (so far). */
vow= 'aeiou'; con= 'BCDFGHJKLMNPQRSTVWXYZ'"bcdfghjklmnpqrstvwxyz" /*list of vowels; list of consonants. */
@@@=; upper vow con /*@@@: list of words found (so far). */
w= 0 /*the maximum length of any word found.*/
Line 2,062 ⟶ 2,849:
finds= finds + 1 /*bump the count of "odd words" found. */
w= max(w, L) /*obtain the maximum length word found.*/
@@@= @@@ $.j /*add a word to the list of words found*/
end /*j*/
/*stick a fork in it, we're all done. */
say copies('─', 30) finds '" words found with a minimum length of '" minL
_=
do out=1 for finds; z= word(@@@, out) /*build a list that will be displayed. */
if length(_ right(z, w))>130 then do; say substr(_, 2); _=; end /*show a line.*/
_= _ right(z, w) /*append (aligned word) to output line.*/
end /*out*/
/*stick a fork in it, we're all done. */
 
if _\=='' then say substr(_, 2) /*Any residual words? Then show a line*/</langsyntaxhighlight>
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
Line 2,090 ⟶ 2,877:
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
cStr = read("unixdict.txt")
wordList = str2list(cStr)
Line 2,174 ⟶ 2,961:
 
see "done..." + nl
</syntaxhighlight>
</lang>
Output:
<pre>
Line 2,253 ⟶ 3,040:
 
=={{header|Ruby}}==
<langsyntaxhighlight lang="ruby">VOWELS =%w(a e i o u).map(&:freeze)
 
res = File.open("unixdict.txt").each_line.select do |line|
Line 2,259 ⟶ 3,046:
word.size > 9 && word.chars.each_cons(2).all?{|c1, c2| VOWELS.include?(c1) != VOWELS.include?(c2) }
end
puts res</langsyntaxhighlight>
{{out}}
<pre style="height:30em">
Line 2,330 ⟶ 3,117:
verisimilitude
</pre>
 
=={{header|sed}}==
<syntaxhighlight lang="sed">#!/bin/sed -f
 
/^.\{10\}/!d
/^[aeiou]\{0,1\}\([^aeiou][aeiou]\)*[^aeiou]\{0,1\}$/!d</syntaxhighlight>
{{out}}
<pre>
aboriginal
apologetic
bimolecular
[...]
unimodular
uninominal
verisimilitude
</pre>
 
=={{header|Seed7}}==
<syntaxhighlight lang="seed7">$include "seed7_05.s7i";
 
const func boolean: vowel (in char: letter) is
return letter in {'A', 'E', 'I', 'O', 'U'} |
{'a', 'e', 'i', 'o', 'u'};
const func boolean: consonant (in char: letter) is
return letter in {'B', 'C', 'D'} | {'F', 'G', 'H'} |
{'J' .. 'N'} | {'P' .. 'T'} | {'V' .. 'Z'} |
{'b', 'c', 'd'} | {'f', 'g', 'h'} |
{'j' .. 'n'} | {'p' .. 't'} | {'v' .. 'z'};
 
const func boolean: opposite (in char: letter1, in char: letter2) is
return vowel(letter1) and consonant(letter2) or
(consonant(letter1) and vowel(letter2));
 
const func boolean: alternating (in string: word) is func
result
var boolean: isAlternating is TRUE;
local
var integer: i is 2;
begin
while i <= length(word) and isAlternating do
isAlternating := opposite(word[i - 1], word[i]);
incr(i);
end while;
end func;
 
const proc: main is func
local
var file: dictionary is STD_NULL;
var string: word is "";
var integer: count is 1;
begin
dictionary := open("unixdict.txt", "r");
if dictionary <> STD_NULL then
while not eof(dictionary) do
readln(dictionary, word);
if length(word) > 9 and alternating(word) then
writeln(count lpad 2 <& ": " <& word);
incr(count);
end if;
end while;
close(dictionary);
end if;
end func;</syntaxhighlight>
{{out}}
<pre style="height:36em">
1: aboriginal
2: apologetic
3: bimolecular
4: borosilicate
5: calorimeter
6: capacitate
7: capacitive
8: capitoline
9: capitulate
10: caricature
11: colatitude
12: coloratura
13: colorimeter
14: debilitate
15: decelerate
16: decolonize
17: definitive
18: degenerate
19: deliberate
20: demodulate
21: denominate
22: denotative
23: deregulate
24: desiderata
25: desideratum
26: dilapidate
27: diminutive
28: epigenetic
29: facilitate
30: hemosiderin
31: heretofore
32: hexadecimal
33: homogenate
34: inoperative
35: judicature
36: latitudinal
37: legitimate
38: lepidolite
39: literature
40: locomotive
41: manipulate
42: metabolite
43: nicotinamide
44: oratorical
45: paragonite
46: pejorative
47: peridotite
48: peripatetic
49: polarimeter
50: recitative
51: recuperate
52: rehabilitate
53: rejuvenate
54: remunerate
55: repetitive
56: reticulate
57: savonarola
58: similitude
59: solicitude
60: tananarive
61: telekinesis
62: teratogenic
63: topologize
64: unilateral
65: unimodular
66: uninominal
67: verisimilitude
</pre>
 
=={{header|Swift}}==
<langsyntaxhighlight lang="swift">import Foundation
 
func isVowel(_ char: Character) -> Bool {
Line 2,354 ⟶ 3,276:
} catch {
print(error.localizedDescription)
}</langsyntaxhighlight>
 
{{out}}
Line 2,429 ⟶ 3,351:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<langsyntaxhighlight ecmascriptlang="wren">import "io" for File
import "./fmt" for Fmt
 
var isVowel = Fn.new { |c| "aeiou".contains(c) }
Line 2,461 ⟶ 3,383:
Fmt.print("$2d: $s", count, word)
}
}</langsyntaxhighlight>
 
{{out}}
Line 2,534 ⟶ 3,456:
66: uninominal
67: verisimilitude
</pre>
 
=={{header|XPL0}}==
<syntaxhighlight lang="xpl0">string 0; \Use zero-terminated strings
int Cnt, I, Ch, Len;
char Word(100); \(longest word in unixdict.txt is 22 chars)
def Tab=$09, LF=$0A, CR=$0D, EOF=$1A;
 
func Vowel(Ch); \Return 'true' if character is a vowel
int Ch;
case Ch of ^a, ^e, ^i, ^o, ^u: return true
other return false;
 
func Alternates; \Return 'true' if Word alternates vowel/consonant
int Sense, I;
[Sense:= Vowel(Word(0));
for I:= 0 to Len-1 do
[if Vowel(Word(I)) # Sense then return false;
Sense:= not Sense;
];
return true;
];
 
[FSet(FOpen("unixdict.txt", 0), ^I); \open dictionary and set it to device 3
OpenI(3);
Cnt:= 0;
repeat I:= 0;
loop [repeat Ch:= ChIn(3) until Ch # CR; \remove possible CR
if Ch=LF or Ch=EOF then quit;
Word(I):= Ch;
I:= I+1;
];
Word(I):= 0; \terminate string
Len:= I;
if Len > 9 then
[if Alternates then
[Text(0, Word);
Cnt:= Cnt+1;
if rem(Cnt/5) then ChOut(0, Tab) else CrLf(0);
];
];
until Ch = EOF;
]</syntaxhighlight>
 
{{out}}
<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>
9,476

edits