home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # File: twt.icn
- #
- # Subject: Procedure to create two-way table
- #
- # Author: Ralph E. Griswold
- #
- # Date: November 8, 1991
- #
- ###########################################################################
- #
- # This procedure convert a table to a "two-way" table, adding all values
- # as keys with the corresponding keys as values. The result is only
- # well-formed if all values in the table are unique.
- #
- ############################################################################
-
- procedure twt(T)
- local swapper, k
-
- swapper := sort(T,3)
-
- while k := get(swapper) do
- insert(T, get(swapper), k)
-
- return T
-
- end
-