Letter frequency: Difference between revisions

Add Draco
(Add Draco)
Line 2,303:
=={{header|Delphi}}==
See [https://www.rosettacode.org/wiki/Letter_frequency#Pascal Pascal].
 
=={{header|Draco}}==
<lang draco>proc nonrec main() void:
file() infile;
[256] char linebuf;
[256] word count;
*char line;
char c;
byte i;
word n;
channel input text filech;
channel input text linech;
for i from 0 upto 255 do count[i] := 0 od;
line := &linebuf[0];
open(filech, infile, "unixdict.txt");
while readln(filech; line) do
open(linech, line);
while read(linech; c) do
i := pretend(c, byte);
count[i] := count[i] + 1
od;
close(linech)
od;
close(filech);
for c from 'A' upto 'Z' do
i := pretend(c, byte);
n := count[i] + count[i | 32];
writeln(c, pretend(i | 32, char), ": ", n:5)
od
corp</lang>
{{out}}
<pre>Aa: 16421
Bb: 4115
Cc: 8216
Dd: 5799
Ee: 20144
Ff: 2662
Gg: 4129
Hh: 5208
Ii: 13980
Jj: 430
Kk: 1925
Ll: 10061
Mm: 5828
Nn: 12097
Oo: 12738
Pp: 5516
Qq: 378
Rr: 13436
Ss: 10210
Tt: 12836
Uu: 6489
Vv: 1902
Ww: 1968
Xx: 617
Yy: 3633
Zz: 433</pre>
 
=={{header|EchoLisp}}==
2,094

edits