Skip to content

Instantly share code, notes, and snippets.

@taboege
Created April 26, 2019 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taboege/500b3c4c3dc64668e2fe5f09699c7ead to your computer and use it in GitHub Desktop.
Save taboege/500b3c4c3dc64668e2fe5f09699c7ead to your computer and use it in GitHub Desktop.
ENTER $H<> sometimes empty?
class A {
has $.x;
method WHICH {
ValueObjAt.new: "A|$!x.WHICH()"
}
}
# Whose images we collect.
my @G = A.new(x => 1);
my Set $H;
loop {
$H ∪= @G;
last if $H<> eqv ENTER $H<>;
# If this line is commented in (to prevent the infinite loop),
# it suddenly works as expected, ENTER $H<> is not a Set type object
# and the loop finishes before $ reaches 20.
#last if $++ > 20;
# Prints (Set) infinitely?
say (ENTER $H<>);
@G .= map: { A.new(x => (.x + 1) % 13) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment