RosettaCodeData/Task/Power-set/Julia/power-set.julia

8 lines
169 B
Text
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
function powerset{T}(x::Vector{T})
result = Vector{T}[[]]
for elem in x, j in eachindex(result)
push!(result, [result[j] ; elem])
end
result
2014-01-17 05:32:22 +00:00
end