Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.2, exercise 2.32 #17

Open
kalikaneko opened this issue Mar 26, 2016 · 0 comments
Open

2.2.2, exercise 2.32 #17

kalikaneko opened this issue Mar 26, 2016 · 0 comments

Comments

@kalikaneko
Copy link
Contributor

maybe I'm missing an obvious alternative form, but in my solution for the exercise you need the "head" from the unpacking in the second case in the pattern match (which is discarded in the template).:

(defun subsets
  (('()) '(()))
  (((cons head tail))
    (let ((rest (subsets tail)))
      (++ rest (lists:map
                      (lambda (r) (cons head r))
                      rest)))))

Also, I think that using ++ instead of append might be useful to avoid loading that function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant