Alternade words: Difference between revisions

Added 11l
(Realize in F#)
(Added 11l)
Line 21:
{{Template:Strings}}
<br><br>
 
=={{header|11l}}==
{{trans|Nim}}
 
<lang 11l>F alternating_words(word)
V r = [‘’, ‘’]
L(c) word
r[L.index [&] 1] ‘’= c
R r
 
V words = Set(File(‘unixdict.txt’).read().split("\n"))
 
[String] result
L(word) words
I word.len >= 6
V alt_words = alternating_words(word)
I alt_words[0] C words & alt_words[1] C words
result.append(word.rjust(8)‘ → ’alt_words[0]‘ ’alt_words[1])
result.sort()
L(line) result
V i = L.index
print((‘#2:’.format(i + 1))‘ ’line)</lang>
 
{{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: apport → apr pot
10: assist → ass sit
11: battle → btl ate
12: blaine → ban lie
13: brenda → bed rna
14: choose → cos hoe
15: choosy → cos hoy
16: claire → car lie
17: effete → eft fee
18: fabric → fbi arc
19: fealty → fat ely
20: fluent → fun let
21: friend → fin red
22: george → gog ere
23: inroad → ira nod
24: israel → ire sal
25: jaunty → jut any
26: joanne → jan one
27: lounge → lug one
28: oriole → oil roe
29: oswald → owl sad
30: parrot → pro art
31: peoria → poi era
32: pierre → per ire
33: poodle → pol ode
34: pounce → puc one
35: racial → rca ail
36: realty → rat ely
37: sordid → sri odd
38: sprain → sri pan
39: strain → sri tan
40: strait → sri tat
41: sturdy → sud try
42: sweaty → set way
43: tattle → ttl ate
44: though → tog huh
45: triode → tid roe
46: triune → tin rue
47: troupe → top rue
48: truant → tun rat
49: twirly → til wry
50: ambient → abet min
51: annette → ante net
52: ariadne → aide ran
53: collude → clue old
54: forwent → fret own
55: spatial → sail pta
56: theorem → term hoe
57: throaty → tray hot
58: calliope → clip aloe
</pre>
 
=={{header|Ada}}==
1,481

edits