Change e letters to i in words: Difference between revisions
Content deleted Content added
m →{{header|Phix}}: sorry |
Realize in F# |
||
Line 175: | Line 175: | ||
welles ──► willis</pre> |
welles ──► willis</pre> |
||
=={{header|F_Sharp|F#}}== |
|||
<lang fsharp> |
|||
// Change 'e' to 'i' in words. Nigel Galloway: February 18th., 2021 |
|||
let g=[|use n=System.IO.File.OpenText("unixdict.txt") in while not n.EndOfStream do yield n.ReadLine()|]|>Array.filter(fun n->n.Length>5) |
|||
let fN g=(g,(Seq.map(fun n->if n='e' then 'i' else n)>>Array.ofSeq>>System.String)g) |
|||
g|>Array.filter(Seq.contains 'e')|>Array.map fN|>Array.filter(fun(_,n)-> Array.contains n g)|>Array.iter(fun(n,g)->printfn "%s -> %s" n g) |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
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|Factor}}== |
=={{header|Factor}}== |
||
<lang factor>USING: assocs binary-search formatting io.encodings.ascii |
<lang factor>USING: assocs binary-search formatting io.encodings.ascii |