Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created May 29, 2013 21:32
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 adilakhter/5674002 to your computer and use it in GitHub Desktop.
Save adilakhter/5674002 to your computer and use it in GitHub Desktop.
powerset.fs
let powerset (s:string): Set<string> =
s.ToCharArray()
|> Array.fold(
fun (acc: Set<string>) x -> acc + (Set.map(fun y -> x.ToString()+y) acc)
) (Set.empty.Add(""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment