Change e letters to i in words: Difference between revisions

Content added Content deleted
m (→‎{{header|AppleScript}}: →‎Core language: Different sort, tidy-up.)
(add RPL)
Line 1,976: Line 1,976:
done...
done...
</pre>
</pre>
=={{header|RPL}}==
The only way to use <code>unixdict.txt</code> as input is to convert it into a list of 25104 strings. Fortunately, emulators can handle such a big data structure in RAM.
{{works with|Halcyon Calc|4.2.7}}
≪ → words
≪ { }
<span style="color:red">1</span> words EVAL SIZE '''FOR''' j
words j GET
'''IF''' DUP SIZE <span style="color:red">5</span> ≤ OVER <span style="color:red">"e"</span> POS NOT OR '''THEN''' DROP '''ELSE'''
<span style="color:red">""</span>
<span style="color:red">1 3</span> PICK SIZE '''FOR''' j
OVER j DUP SUB
NUM R→B <span style="color:red">#20h</span> OR B→R CHR <span style="color:grey">@turn into lowercase</span>
DUP <span style="color:red">"e"</span> == <span style="color:red">"i"</span> ROT IFTE +
'''NEXT'''
'''IF''' words EVAL OVER POS '''THEN''' <span style="color:red">" → "</span> SWAP + + + '''ELSE''' DROP2 '''END'''
'''END NEXT'''
≫ ≫ ‘<span style="color:blue">E→I</span>’ STO
{{out}}
<pre>
1: { "analyses → analysis" "atlantes → atlantis" "bellow → billow" "breton → briton" "clench → clinch" "convect → convict" "crises → crisis" "diagnoses → diagnosis" "enfant → infant" "enquiry → inquiry" "frances → francis" "galatea → galatia" "harden → hardin" "heckman → hickman" "inequity → iniquity" "inflect → inflict" "jacobean → jacobian" "marten → martin" "module → moduli" "pegging → pigging" "psychoses → psychosis" "rabbet → rabbit" "sterling → stirling" "synopses → synopsis" "vector → victor" "welles → willis" }
</pre>

=={{header|Ruby}}==
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">words = File.readlines("unixdict.txt").map(&:chomp)
<syntaxhighlight lang="ruby">words = File.readlines("unixdict.txt").map(&:chomp)
Line 2,014: Line 2,036:
welles -> willis
welles -> willis
</pre>
</pre>

=={{header|Rust}}==
=={{header|Rust}}==
<syntaxhighlight lang="rust">use std::collections::BTreeSet;
<syntaxhighlight lang="rust">use std::collections::BTreeSet;