Annotation of 43BSD/contrib/icon/book/05/wordlen.icn, revision 1.1.1.1

1.1       root        1: procedure main()
                      2:    wchar := &lcase ++ &ucase ++ '\'-'
                      3:    wordlength := list(10,0)    # initial zero counts
                      4:    while line := read() do {
                      5:       i := 1
                      6:       while j := upto(wchar,line,i) do {
                      7:          i := many(wchar,line,j)
                      8:          wordlength[*line[i:j]] +:= 1
                      9:          }
                     10:       }
                     11:    write("word length   count:\n")
                     12:    i := 0
                     13:    while i < *wordlength do {
                     14:       i +:= 1
                     15:       write(left(i || ":",12),right(wordlength[i],3))
                     16:       }
                     17: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.