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 / chop.icn < prev    next >
Text File  |  2000-07-29  |  867b  |  37 lines

  1. ############################################################################
  2. #
  3. #    File:     chop.icn
  4. #
  5. #    Subject:  Program to restrict numerical values
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     January 21, 1999
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program limits the numerical values in a sequence
  18. #  visualization stream.  The limit is given on the command line;
  19. #  default 200.
  20. #
  21. ############################################################################
  22.  
  23. procedure main(args)
  24.    local max, line, i
  25.  
  26.    max := \args[1] | 200
  27.  
  28.    while line := read() do {
  29.       line ? {
  30.          i := tab(upto(' \t') | 0)
  31.          if i > max then i := max
  32.          write(i, tab(0))
  33.          }
  34.       }
  35.  
  36. end
  37.