Alternade words: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 2,278:
truant->{tun,rat}
twirly->{til,wry}</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. Modify the declaration of wordList object to use the file class to read a local copy of the word list file.
<syntaxhighlight lang="miniscript">
alternateLetters = function(word, ix)
if ix != 0 then ix = 1
altWord = ""
for i in range(ix, word.len - 1, 2)
altWord += word[i]
end for
return altWord
end function
 
wordList = http.get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").split(char(10))
ctr = 0
for word in wordList
if word.len > 5 then
word1 = alternateLetters(word, 0)
word2 = alternateLetters(word, 1)
if wordList.indexOf(word1) != null and wordList.indexOf(word2) != null then
ctr += 1
print [ctr, word, char(18), word1, word2].join(" ")
end if
end if
end for
</syntaxhighlight>
{{out}}
<pre>
1 accost : acs cot
2 accuse : acs cue
3 afield : ail fed
4 agleam : ala gem
5 alcott : act lot
6 allele : all lee
7 allied : ale lid
8 alpert : apr let
9 ambient : abet min
10 annette : ante net
11 apport : apr pot
12 ariadne : aide ran
13 assist : ass sit
14 battle : btl ate
15 blaine : ban lie
16 brenda : bed rna
17 calliope : clip aloe
18 choose : cos hoe
19 choosy : cos hoy
20 claire : car lie
21 collude : clue old
22 effete : eft fee
23 fabric : fbi arc
24 fealty : fat ely
25 fluent : fun let
26 forwent : fret own
27 friend : fin red
28 george : gog ere
29 inroad : ira nod
30 israel : ire sal
31 jaunty : jut any
32 joanne : jan one
33 lounge : lug one
34 oriole : oil roe
35 oswald : owl sad
36 parrot : pro art
37 peoria : poi era
38 pierre : per ire
39 poodle : pol ode
40 pounce : puc one
41 racial : rca ail
42 realty : rat ely
43 sordid : sri odd
44 spatial : sail pta
45 sprain : sri pan
46 strain : sri tan
47 strait : sri tat
48 sturdy : sud try
49 sweaty : set way
50 tattle : ttl ate
51 theorem : term hoe
52 though : tog huh
53 throaty : tray hot
54 triode : tid roe
55 triune : tin rue
56 troupe : top rue
57 truant : tun rat
58 twirly : til wry
</pre>
 
=={{header|Nim}}==
Line 3,944 ⟶ 4,031:
{{libheader|Wren-set}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "io" for File
import "./set" for Set
import "./fmt" for Fmt
 
var wordList = "unixdict.txt" // local copy
9,482

edits