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

  1. ############################################################################
  2. #
  3. #    File:     lcomb.icn
  4. #
  5. #    Subject:  Procedure to generate lists of combinations
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     September 8, 1992
  10. #
  11. ###########################################################################
  12. #
  13. #  This procedure generates the combinations of items in a list.
  14. #
  15. ############################################################################
  16.  
  17. procedure lcomb(L,i)
  18.    local j
  19.  
  20.    if i < 1 then fail
  21.    suspend if i = 1 then [!L]
  22.       else [L[j := 1 to *L - i + 1]] ||| lcomb(L[j + 1:0],i - 1)
  23. end
  24.