Find words which contain the most consonants: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(2 intermediate revisions by 2 users not shown)
Line 3,998:
 
done...
</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 ncons
≪ { }
1 words EVAL SIZE '''FOR''' j
words j GET
'''IF''' DUP SIZE 10 ≤ '''THEN''' DROP '''ELSE'''
{ 21 } 0 CON
1 3 PICK SIZE '''FOR''' j
OVER j DUP SUB
NUM R→B #DFh AND B→R CHR
'''IF''' "BCDFGHJKLMNPQRSTVWXYZ" SWAP POS '''THEN'''
LAST DUP2 GET 1 + PUT END
'''NEXT'''
1 SF
1 21 '''FOR''' j
'''IF''' DUP j GET 1 > '''THEN''' 1 CF 21 'j' STO '''END'''
NEXT
'''IF''' DUP 1 CON DOT ncons < 1 FC? OR '''THEN''' DROP '''ELSE''' + '''END'''
'''END NEXT'''
≫ ≫ ‘<span style="color:blue">CONSONANTS</span>’ STO
 
'Unixdict' 9 <span style="color:blue">CONSONANTS</span>
'Unixdict' 8 <span style="color:blue">CONSONANTS</span>
{{out}}
<pre>
2: { "comprehensible" }
1: { "administrable" "anthropology" "blameworthy" "bluestocking" "boustrophedon" "bricklaying" "chemisorption" "christendom" "claustrophobia" "compensatory" "comprehensive" "counterexample" "demonstrable" "disciplinary" "discriminable" "geochemistry" "hypertensive" "indecipherable" "indecomposable" "indiscoverable" "lexicography" "manslaughter" "misanthropic" "mockingbird" "monkeyflower" "neuropathology" "paralinguistic" "pharmacology" "pitchblende" "playwriting" "shipbuilding" "shortcoming" "springfield" "stenography" "stockholder" "switchblade" "switchboard" "switzerland" "thunderclap" }
</pre>
 
Line 4,075 ⟶ 4,106:
onomatopoeia
</pre>
 
=={{header|TypeScript}}==
<syntaxhighlight lang="typescript">
Line 4,175 ⟶ 4,207:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<syntaxhighlight lang="wren">import "io" for File
{{libheader|Wren-seq}}
<syntaxhighlight lang="ecmascript">import "io./fmt" for FileFmt
import "/fmt" for Fmt
import "/seq" for Lst
 
var wordList = "unixdict.txt" // local copy
Line 4,212 ⟶ 4,242:
var s = (count == 1) ? "" : "s"
System.print("%(count) word%(s) found with %(i) unique consonants:")
for (chunk in Lst.chunks(wordGroups[i], 5)) Fmt.printtprint("$-14s", chunkwordGroups[i], 5)
System.print()
}
9,482

edits