Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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