Created
May 4, 2013 07:00
-
-
Save PuercoPop/5516539 to your computer and use it in GitHub Desktop.
Programming Praxis http://programmingpraxis.com/2013/05/03/pairing-students/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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