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 / iseq.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  51 lines

  1. ############################################################################
  2. #
  3. #    File:     iseq.icn
  4. #
  5. #    Subject:  Program to write sequence of integers
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 3, 1996
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program generates integers in sequence.
  18. #
  19. #  The following options are supported:
  20. #
  21. #    -b i    beginning integer; default 1
  22. #    -e i    ending integer; default no end
  23. #    -i i    increment; default 1
  24. #    -l i    limit on number of integers generated; default no limit
  25. #
  26. #  Large integer values are not supported.
  27. #
  28. ############################################################################
  29. #
  30. #  Links:  options
  31. #
  32. ############################################################################
  33.  
  34. link options
  35.  
  36. procedure main(args)
  37.    local opts, limit, start, stop, incr, i
  38.  
  39.    opts := options(args, "b+e+i+l+")
  40.  
  41.    limit := \opts["l"] | (2 ^ 32)        # good enough
  42.    start := \opts["b"] | 1
  43.    stop := \opts["e"] | (2 ^ 64)        # sort of good enough
  44.    incr := \opts["i"] | 1
  45.  
  46.    every i := seq(start, incr) \ limit do
  47.       if i > stop then exit()
  48.       else write(i)
  49.  
  50. end
  51.