JuliaMath / JuliaMath/Combinatorics.jl

collect(powerset(::Set)) doesn't work

Open
#98 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
230
Forks
62
PR merge metrics
No merged PRs in 30d

Description

powerset(::Set) works, but returns Iterator.
```julia
julia> s
Set{Char} with 3 elements:
'a'
'c'
'b'

julia> collect(powerset(s))
ERROR: MethodError: no method matching getindex(::Set{Char}, ::Int64)
```

`collect(powerset(collect(s)))` works as expected though.

I think it'd be nice to be able to work with set theory without syntactic issues like this, particularly for pedagogic purposes.

edit: sorry accidentally pressed enter and it made the issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.