Skip to content

Instantly share code, notes, and snippets.

@Dimanaux
Last active August 29, 2023 09:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dimanaux/fc635a2033a0a0a9ea49ab2fb8622702 to your computer and use it in GitHub Desktop.
Save Dimanaux/fc635a2033a0a0a9ea49ab2fb8622702 to your computer and use it in GitHub Desktop.
Generating all subsets of a set (list) on Haskell
module Subsets
(
subsets
) where
subsets :: [a] -> [[a]]
subsets [] = [[]]
subsets (x:xs) = subsets xs ++ map (x:) (subsets xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment