Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip holes when iterating over GAP lists? #970

Closed
fingolfin opened this issue Feb 23, 2024 · 1 comment · Fixed by #1057
Closed

Skip holes when iterating over GAP lists? #970

fingolfin opened this issue Feb 23, 2024 · 1 comment · Fixed by #1057

Comments

@fingolfin
Copy link
Member

Currently we have this:

julia> l = GAP.evalstr("[1,,3]")
GAP: [ 1,, 3 ]

julia> collect(l)
3-element Vector{Any}:
 1
  nothing
 3

Perhaps we should do what GAP does in this situation and just skip holes? I.e., do this:

julia> l = GAP.evalstr("[1,,3]")
GAP: [ 1,, 3 ]

julia> collect(l)
3-element Vector{Any}:
 1
 3

Note that this is purely about iteration. When converting to a vector, I'd expect things to stay as they are:

julia> Vector{Any}(l)
3-element Vector{Any}:
 1
  nothing
 3

Motivated by discussion at PR #967.

@ThomasBreuer
Copy link
Member

I am not sure.

Julia does not know the concept of holes.
If we say that Julia shall interpret a GAP list with holes as an array of the same length as in GAP such that unbound entries correspond to nothing (this is what getindex does) then a different behaviour for iteration might look inconsistent.

On the other hand, we could define that Julia iteration over a GAP list is the same as GAP iteration.

In both cases, we mainly have to document the situation (also in the Oscar manual section on "Notes for users of other computer algebra systems").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants