Alternade words: Difference between revisions

(→‎{{header|Ruby}}: bsearch block)
Line 1,533:
twirly : til, wry
</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>dic = Once[Import["https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt"]];
dic = StringSplit[dic, "\n"];
largerthansix = Select[dic, StringLength /* GreaterEqualThan[6]];
smallerthansix = Select[dic, StringLength /* LessEqualThan[5]];
ClearAll[AlternadeQ]
AlternadeQ[w_String, words_List] := Module[{chars, ws, c1, c2},
chars = Characters[w];
c1 = StringJoin@chars[[1 ;; ;; 2]];
c2 = StringJoin@chars[[2 ;; ;; 2]];
If[MemberQ[words, c1] \[And] MemberQ[words, c2], w -> {c1, c2}, {}]
]
all = DeleteCases[Table[AlternadeQ[w, smallerthansix], {w, largerthansix}], {}];
all // Column</lang>
{{out}}
<pre>accost->{acs,cot}
accuse->{acs,cue}
afield->{ail,fed}
agleam->{ala,gem}
alcott->{act,lot}
allele->{all,lee}
allied->{ale,lid}
alpert->{apr,let}
ambient->{abet,min}
annette->{ante,net}
apport->{apr,pot}
ariadne->{aide,ran}
assist->{ass,sit}
battle->{btl,ate}
blaine->{ban,lie}
brenda->{bed,rna}
calliope->{clip,aloe}
choose->{cos,hoe}
choosy->{cos,hoy}
claire->{car,lie}
collude->{clue,old}
effete->{eft,fee}
fabric->{fbi,arc}
fealty->{fat,ely}
fluent->{fun,let}
forwent->{fret,own}
friend->{fin,red}
george->{gog,ere}
inroad->{ira,nod}
israel->{ire,sal}
jaunty->{jut,any}
joanne->{jan,one}
lounge->{lug,one}
oriole->{oil,roe}
oswald->{owl,sad}
parrot->{pro,art}
peoria->{poi,era}
pierre->{per,ire}
poodle->{pol,ode}
pounce->{puc,one}
racial->{rca,ail}
realty->{rat,ely}
sordid->{sri,odd}
spatial->{sail,pta}
sprain->{sri,pan}
strain->{sri,tan}
strait->{sri,tat}
sturdy->{sud,try}
sweaty->{set,way}
tattle->{ttl,ate}
theorem->{term,hoe}
though->{tog,huh}
throaty->{tray,hot}
triode->{tid,roe}
triune->{tin,rue}
troupe->{top,rue}
truant->{tun,rat}
twirly->{til,wry}</pre>
 
=={{header|Nim}}==
1,111

edits