Skip to content

Instantly share code, notes, and snippets.

@kouddy
Created April 12, 2015 14:13
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 kouddy/7ced4203ed2950b05ae6 to your computer and use it in GitHub Desktop.
Save kouddy/7ced4203ed2950b05ae6 to your computer and use it in GitHub Desktop.
(define (subsets s)
(if (null? s)
(list null)
(let ((rest (subsets (cdr s))))
(append rest ;;; append is like + for list
(map (lambda (l) (cons (car s) l)) rest)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment