Loading

Paste #p6ca3gzgq

  1.     (define (combination k lst)
  2.       (cond
  3.        ((= k 0) '(()))
  4.        ((null? lst) '())
  5.        (else
  6.         (let ((head (car lst))
  7.               (tail (cdr lst)))
  8.           (append (map (lambda (y) (cons head y)) (combination (- k 1) tail))
  9.                   (combination k tail))))))

Version history

Revision # Author Created at
pibt7kicw Anonymous 12 Mar 2019, 09:50:10 UTC Diff