Jump to content

Power set: Difference between revisions

(+ blsq)
Line 1,193:
end
return ret
end
 
--non-recurse implementation
function powerset(s)
local t = {{}}
for i = 1, #s do
local limit = #t
for j = 1, limit do
t[#t+1] = {s[i],unpack(t[j])}
end
end
return t
end
 
3

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.