Skip to content

Bug in iteration over a FPGroup? #32

Description

@MFrankenbach

I noticed that when iterating over a finite group, not all elements are visited, and group elements can be visited twice.
Strangely, it looks fine when I only iterate and print:

using Groups
Z3 = FPGroup(FreeGroup(1), [only(gens(F))^3 => one(F)])
for g in Z3
  println(g)
end

gives

(id)
f1
F1

But: As soon as I 'do' something with the gs, elements repeat:

julia> for g in Z3
           push!(v, g)
       end

julia> v
3-element Vector{FPGroupElement}:
 (id)
 f1
 f1

The inverse of f1 is not present in v.

Similar problems occur when creating a dictionary:

julia> d = Dict()
Dict{Any, Any}()

julia> ig = 0
0

julia> for g in Z3
           ig += 1
           d[g]=ig
       end

julia> display(d)
Dict{Any, Any} with 3 entries:
  f1   => 2
  (id) => 1
  f1   => 3

Am I doing something wrong? I'm also wondering why the dictionary can have two keys f1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions