Search code examples
hashmapmutablerakuunorderedsethash

Method to add element to SetHash in Perl6


I'm just starting out with Perl6, and I'm trying to determine how to add an element to a SetHash. It seems that hash notation works, but I'm wondering if I'm missing a method that does the same thing? I'm looking at the SetHash documentation, but I find it a bit opaque.

my $foo = SetHash.new();
$foo{'a'} = True;
'a' ∈ $foo # True;

Solution

  • This is a bug, though what exact method SetHash should have is still up for debate. https://rt.perl.org/Public/Bug/Display.html?id=128903.

    Someone else posted this as an answer, but it seems to have been deleted.