RosettaCodeData/Task/Power-set/Julia/power-set-1.julia
2023-07-01 13:44:08 -04:00

7 lines
193 B
Text

function powerset(x::Vector{T})::Vector{Vector{T}} where T
result = Vector{T}[[]]
for elem in x, j in eachindex(result)
push!(result, [result[j] ; elem])
end
result
end