Julia 0.7 : how to use iterate() to remove warning in Combinatorics.Combinations?



Hi !

In Julia 0.7, the following code produce no error in the REPL

julia> using Combinatorics
julia> for c in Combinatorics.Combinations(1:3,2)
[1, 2]
[1, 3]
[2, 3]

If I execute the code in a file, I have a warning

$ julia combination-04.jl 
┌ Warning: The start/next/done iteration protocol is deprecated. Implement `iterate(::Combinatorics.Combinations{UnitRange{Int64}})`.
│   caller = ip:0x0
└ @ Core :-1
[1, 2]
[1, 3]
[2, 3]

How should I use iterate() to remove the warning ?

Thanks !


On my 0.7 REPL I get the error at least the first time i run the code and that’s expected. The source of the deprecation is within Combinatorics.jl, so until this package has been updated there’s not much you can do about it (except for a pull request of course).
If you just want to silence (all) deprecation warnings run the script with --depwarn=no


@laborg thank you, it was unclear for me where the error was located.


Ref https://github.com/JuliaMath/Combinatorics.jl/issues/66