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 / sample.icn < prev    next >
Text File  |  2000-07-29  |  772b  |  31 lines

  1. ############################################################################
  2. #
  3. #    File:     sample.icn
  4. #
  5. #    Subject:  Program to "sample" input stream
  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 filters the input stream, producing every ith
  18. #  value, starting at 1.  i is given as a command-line argument; default 0.
  19. #
  20. ############################################################################
  21.  
  22. procedure main(args)
  23.     local line, skip
  24.  
  25.     skip := integer(args[1]) | 0
  26.  
  27.     while write(read()) do
  28.        every 1 to skip do read()
  29.  
  30. end
  31.