summaryrefslogtreecommitdiff
path: root/ipl/progs/inter.icn
blob: 87e6225e283ee93275b6ee25dca77347b6df14d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
############################################################################
#
#	File:     inter.icn
#
#	Subject:  Program to find common values in two lists
#
#	Author:   Ralph E. Griswold
#
#	Date:     August 13, 1995
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This program lists lines common to two files.
#
############################################################################

procedure main(args)
   local in1, in2, one, two

   in1 := open(args[1]) | stop("*** cannot open file 1")
   in2 := open(args[2]) | stop("*** cannot open file 2")

   one := set()
   two := set()

   every insert(one, !in1)
   every insert(two, !in2)

   every write(!sort(one ** two))

end