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

  1. ############################################################################
  2. #
  3. #    File:     delta.icn
  4. #
  5. #    Subject:  Program to list differences between successive numbers
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     January 22, 1999
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program reads a stream of numbers from standard input and write
  18. #  a stream of their first differences to standard output.
  19. #
  20. ############################################################################
  21.  
  22. procedure main()
  23.    local i, j
  24.  
  25.    i := read() | exit()
  26.  
  27.    while j := read() do {
  28.       write(j - i)
  29.       i := j
  30.       }
  31.  
  32. end
  33.