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 / inter.icn < prev    next >
Text File  |  2000-07-29  |  842b  |  36 lines

  1. ############################################################################
  2. #
  3. #    File:     inter.icn
  4. #
  5. #    Subject:  Program to find common values in two lists
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     August 13, 1995
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program lists lines common to two files.
  18. #
  19. ############################################################################
  20.  
  21. procedure main(args)
  22.    local in1, in2, one, two
  23.  
  24.    in1 := open(args[1]) | stop("*** cannot open file 1")
  25.    in2 := open(args[2]) | stop("*** cannot open file 2")
  26.  
  27.    one := set()
  28.    two := set()
  29.  
  30.    every insert(one, !in1)
  31.    every insert(two, !in2)
  32.  
  33.    every write(!sort(one ** two))
  34.  
  35. end
  36.