home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / progs / ll.icn < prev    next >
Text File  |  2000-07-29  |  836b  |  37 lines

  1. ############################################################################
  2. #
  3. #    File:     ll.icn
  4. #
  5. #    Subject:  Program to list shortest and longest lines in a file
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     June 12, 1999
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program reads a file from standard input and writes out the
  18. #  lengths of the shortest and longest lines in it.
  19. #
  20. ############################################################################
  21.  
  22. procedure main()
  23.    local length, max, min
  24.  
  25.    max := 0
  26.    min := 2 ^ 31            #  good enough ...
  27.  
  28.    while length := *read() do {
  29.       max <:= length
  30.       min >:= length
  31.       }
  32.  
  33.    write(min)
  34.    write(max)
  35.  
  36. end
  37.