Skip to content

Instantly share code, notes, and snippets.

@dkinzer
Created August 21, 2014 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkinzer/a03d7b64b5d48aa015b6 to your computer and use it in GitHub Desktop.
Save dkinzer/a03d7b64b5d48aa015b6 to your computer and use it in GitHub Desktop.
(define (subsets s)
(define (subset item)
(cons (car s) item))
(if (null? s)
(list nil)
(let ((rest (subsets (cdr s))))
(append rest (map subset rest)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment