Skip to content

Instantly share code, notes, and snippets.

@mLuby
mLuby / powerset.js
Created December 21, 2015 22:50
Generate power set from a string
function powerset (input) {
return input
.split(input ? '' : false)
.filter(duplicates({}))
.map(concatEmptyStr)
.reduce(multiplyMatrix)
}
function concatEmptyStr (str) {
return str ? ['', str] : ['']