Teacup rim text: Difference between revisions
Content deleted Content added
Thundergnat (talk | contribs) →{{header|Perl 6}}: Add a Perl 6 example |
julia example |
||
Line 27:
}
</pre>
=={{header|Julia}}==
Using the MIT 10000 word list, and excluding one-letter words.
<lang julia>
using HTTP
function getwords()
req = HTTP.request("GET", "https://www.mit.edu/~ecprice/wordlist.10000")
Dict{String, Int}((string(x), 1) for x in split(String(req.body), r"\s+"))
end
rotate(s, n) = String(circshift(Vector{UInt8}(s), n))
isliketea(w, d) = (n = length(w); n > 1 && all(i -> haskey(d, rotate(w, i)), 1:n-1))
function getteawords()
wordlistdict = getwords()
for word in collect(keys(wordlistdict))
if isliketea(word, wordlistdict)
println(word, ": ", [rotate(word, i) for i in 1:length(word)-1])
end
end
end
getteawords()
#=
</lang>{{out}}
<pre>
rj: ["jr"]
il: ["li"]
tc: ["ct"]
dj: ["jd"]
el: ["le"]
ru: ["ur"]
ws: ["sw"]
vc: ["cv"]
ot: ["to"]
pas: ["spa", "asp"]
nc: ["cn"]
st: ["ts"]
ab: ["ba"]
rh: ["hr"]
ld: ["dl"]
da: ["ad"]
sh: ["hs"]
ko: ["ok"]
xxx: ["xxx", "xxx"]
lu: ["ul"]
uh: ["hu"]
jj: ["jj"]
di: ["id"]
rc: ["cr"]
aw: ["wa"]
gs: ["sg"]
hu: ["uh"]
si: ["is"]
oc: ["co"]
fm: ["mf"]
gm: ["mg"]
im: ["mi"]
as: ["sa"]
iii: ["iii", "iii"]
xi: ["ix"]
za: ["az"]
of: ["fo"]
cb: ["bc"]
is: ["si"]
tt: ["tt"]
tu: ["ut"]
sv: ["vs"]
ah: ["ha"]
pa: ["ap"]
lc: ["cl"]
gl: ["lg"]
df: ["fd"]
ni: ["in"]
ta: ["at"]
bl: ["lb"]
hp: ["ph"]
hc: ["ch"]
mr: ["rm"]
ct: ["tc"]
np: ["pn"]
uc: ["cu"]
bc: ["cb"]
bp: ["pb"]
to: ["ot"]
ff: ["ff"]
ds: ["sd"]
gc: ["cg"]
ae: ["ea"]
ve: ["ev"]
wn: ["nw"]
pd: ["dp"]
hh: ["hh"]
sm: ["ms"]
fi: ["if"]
cg: ["gc"]
cf: ["fc"]
sk: ["ks"]
rm: ["mr"]
ak: ["ka"]
hr: ["rh"]
ti: ["it"]
ai: ["ia"]
mn: ["nm"]
os: ["so"]
mi: ["im"]
rd: ["dr"]
th: ["ht"]
pt: ["tp"]
asp: ["pas", "spa"]
gr: ["rg"]
cc: ["cc"]
tr: ["rt"]
vi: ["iv"]
dl: ["ld"]
mb: ["bm"]
bd: ["db"]
us: ["su"]
ix: ["xi"]
so: ["os"]
cj: ["jc"]
lp: ["pl"]
ip: ["pi"]
ln: ["nl"]
ac: ["ca"]
pr: ["rp"]
ft: ["tf"]
sd: ["ds"]
nn: ["nn"]
db: ["bd"]
ca: ["ac"]
sa: ["as"]
jr: ["rj"]
pf: ["fp"]
tea: ["ate", "eat"]
et: ["te"]
wa: ["aw"]
sb: ["bs"]
an: ["na"]
pe: ["ep"]
cn: ["nc"]
ha: ["ah"]
it: ["ti"]
ba: ["ab"]
spa: ["asp", "pas"]
vt: ["tv"]
ec: ["ce"]
bt: ["tb"]
tb: ["bt"]
pb: ["bp"]
pm: ["mp"]
mp: ["pm"]
li: ["il"]
cd: ["dc"]
ate: ["eat", "tea"]
dr: ["rd"]
ep: ["pe"]
ee: ["ee"]
ph: ["hp"]
jm: ["mj"]
me: ["em"]
rs: ["sr"]
pp: ["pp"]
em: ["me"]
mc: ["cm"]
ho: ["oh"]
fp: ["pf"]
hd: ["dh"]
aim: ["mai", "ima"]
ok: ["ko"]
lb: ["bl"]
oo: ["oo"]
ut: ["tu"]
ps: ["sp"]
iv: ["vi"]
ne: ["en"]
gp: ["pg"]
ma: ["am"]
mm: ["mm"]
mo: ["om"]
le: ["el"]
de: ["ed"]
aaa: ["aaa", "aaa"]
dg: ["gd"]
ur: ["ru"]
ht: ["th"]
wc: ["cw"]
go: ["og"]
car: ["rca", "arc"]
re: ["er"]
ed: ["de"]
sr: ["rs"]
pi: ["ip"]
az: ["za"]
mf: ["fm"]
nr: ["rn"]
dh: ["hd"]
fe: ["ef"]
mw: ["wm"]
rp: ["pr"]
wm: ["mw"]
cw: ["wc"]
ob: ["bo"]
nm: ["mn"]
nu: ["un"]
sp: ["ps"]
or: ["ro"]
at: ["ta"]
eg: ["ge"]
ri: ["ir"]
sn: ["ns"]
cs: ["sc"]
ooo: ["ooo", "ooo"]
sip: ["psi", "ips"]
nw: ["wn"]
wu: ["uw"]
ol: ["lo"]
hs: ["sh"]
fd: ["df"]
vs: ["sv"]
ml: ["lm"]
sc: ["cs"]
dm: ["md"]
ic: ["ci"]
ro: ["or"]
mg: ["gm"]
arc: ["car", "rca"]
ips: ["sip", "psi"]
ka: ["ak"]
um: ["mu"]
ii: ["ii"]
pl: ["lp"]
oh: ["ho"]
ny: ["yn"]
tv: ["vt"]
mt: ["tm"]
am: ["ma"]
dt: ["td"]
ms: ["sm"]
ks: ["sk"]
fs: ["sf"]
gd: ["dg"]
cp: ["pc"]
pc: ["cp"]
av: ["va"]
tf: ["ft"]
br: ["rb"]
www: ["www", "www"]
jc: ["cj"]
gb: ["bg"]
ll: ["ll"]
kb: ["bk"]
bk: ["kb"]
la: ["al"]
ge: ["eg"]
ar: ["ra"]
om: ["mo"]
ea: ["ae"]
uw: ["wu"]
ir: ["ri"]
mai: ["ima", "aim"]
lm: ["ml"]
id: ["di"]
va: ["av"]
pn: ["np"]
bb: ["bb"]
nt: ["tn"]
su: ["us"]
en: ["ne"]
ci: ["ic"]
he: ["eh"]
te: ["et"]
if: ["fi"]
lo: ["ol"]
rca: ["arc", "car"]
aa: ["aa"]
fr: ["rf"]
se: ["es"]
al: ["la"]
ag: ["ga"]
yn: ["ny"]
aj: ["ja"]
op: ["po"]
rg: ["gr"]
sf: ["fs"]
mj: ["jm"]
es: ["se"]
wr: ["rw"]
rf: ["fr"]
nl: ["ln"]
dd: ["dd"]
cl: ["lc"]
ef: ["fe"]
bw: ["wb"]
eat: ["tea", "ate"]
fc: ["cf"]
cr: ["rc"]
wb: ["bw"]
jd: ["dj"]
ja: ["aj"]
jp: ["pj"]
bm: ["mb"]
ww: ["ww"]
rt: ["tr"]
dc: ["cd"]
fo: ["of"]
bg: ["gb"]
ra: ["ar"]
fl: ["lf"]
rb: ["br"]
tm: ["mt"]
lf: ["fl"]
lg: ["gl"]
md: ["dm"]
ia: ["ai"]
fa: ["af"]
af: ["fa"]
ss: ["ss"]
tn: ["nt"]
sl: ["ls"]
rw: ["wr"]
td: ["dt"]
og: ["go"]
bo: ["ob"]
ts: ["st"]
psi: ["ips", "sip"]
ch: ["hc"]
cv: ["vc"]
pg: ["gp"]
mu: ["um"]
ce: ["ec"]
in: ["ni"]
ga: ["ag"]
rr: ["rr"]
ns: ["sn"]
un: ["nu"]
pj: ["jp"]
ap: ["pa"]
er: ["re"]
ev: ["ve"]
tp: ["pt"]
rn: ["nr"]
gg: ["gg"]
bs: ["sb"]
co: ["oc"]
dp: ["pd"]
xx: ["xx"]
ul: ["lu"]
sg: ["gs"]
eh: ["he"]
ima: ["aim", "mai"]
sw: ["ws"]
ls: ["sl"]
no: ["on"]
po: ["op"]
na: ["an"]
cu: ["uc"]
ad: ["da"]
on: ["no"]
cm: ["mc"]
</pre>
=={{header|Perl 6}}==
|