Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
Created May 4, 2013 07:00
Show Gist options
  • Save PuercoPop/5516539 to your computer and use it in GitHub Desktop.
Save PuercoPop/5516539 to your computer and use it in GitHub Desktop.
(defun create-pairs (lst)
"given a list, produces a list of all possible sets of pairings, without duplicates. "
(if (eq lst '())
*pair-list*
(progn
(dolist (item (cdr lst))
(push `(,(car lst) ,item) *pair-list*))
(create-pairs (cdr lst)))))
(defvar *pair-list*)
(let ((*pair-list* (list)))
(create-pairs '("Anne" "Beth" "Chet" "Dirk")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment