diff options
Diffstat (limited to 'tests/general/others.dat')
-rw-r--r-- | tests/general/others.dat | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/general/others.dat b/tests/general/others.dat new file mode 100644 index 0000000..da17d7a --- /dev/null +++ b/tests/general/others.dat @@ -0,0 +1,23 @@ +# +# W O R D T A B U L A T I O N +# + +# This main procedure processes standard input and writes the results +# with the words in a column 20 characters wide. + +procedure main() + wordcount(20) +end + +procedure wordcount(n) + local t, line, x, y + static letters + initial letters := &lcase ++ &ucase + t := table(,0) + every line := !&input do + scan line using + while tab(upto(letters)) do + t[tab(many(letters))] +:= 1 + x := sort(t) + every y := !x do write(left(y[1],n),y[2]) +end |