home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / BIPL.ZIP / PROCS.ZIP / TWT.ICN < prev    next >
Encoding:
Text File  |  1992-09-28  |  741 b   |  30 lines

  1. ############################################################################
  2. #
  3. #    File:     twt.icn
  4. #
  5. #    Subject:  Procedure to create two-way table
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 8, 1991
  10. #
  11. ###########################################################################
  12. #
  13. #  This procedure convert a table to a "two-way" table, adding all values
  14. #  as keys with the corresponding keys as values.  The result is only
  15. #  well-formed if all values in the table are unique.
  16. #
  17. ############################################################################
  18.  
  19. procedure twt(T)
  20.    local swapper, k
  21.  
  22.    swapper := sort(T,3)
  23.  
  24.    while k := get(swapper) do
  25.       insert(T, get(swapper), k)
  26.  
  27.    return T
  28.  
  29. end
  30.