Skip to content

Instantly share code, notes, and snippets.

@yao2030
Created December 12, 2012 05:50
Show Gist options
  • Save yao2030/4265166 to your computer and use it in GitHub Desktop.
Save yao2030/4265166 to your computer and use it in GitHub Desktop.
(define (subsets s)
(if (null? s)
(list '())
(let ((rest (subsets (cdr s))))
(append rest (map (lambda (x) (cons (car s) x)) rest)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment