|
|
1.1 root 1: #
2: # W O R D T A B U L A T I O N
3: #
4:
5: # This main procedure processes standard input and writes the results
6: # with the words in a column 20 characters wide.
7:
8: procedure main()
9: wordcount(20)
10: end
11:
12: procedure wordcount(n)
13: local t, line, x, y
14: static letters
15: initial letters := &lcase ++ &ucase
16: t := table(,0)
17: every line := !&input do
18: scan line using
19: while tab(upto(letters)) do
20: t[tab(many(letters))] +:= 1
21: x := sort(t)
22: every y := !x do write(left(y[1],n),y[2])
23: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.