Help language development. Donate to The Perl Foundation

ValueMap zef:lizmat last updated on 2022-01-09


Actions Status


ValueMap - Provide an immutable Map value type


use ValueMap;

my %vm is ValueMap = foo => 42, bar => 666, baz => 137;

my $vm := (foo => 42, bar => 666, baz => 137) );

my %s is Set = $vm, %vm;
say %s.elems;  # 1


The functionality provided by this module, will be provided in language level 6.e and higher. If an implementation of ValueMap is already available, loading this module becomes a no-op.

Raku provides a semi-immutable Associative datatype: Map. A Map can not have any elements added or removed from it. However, since a Map can contain containers of which the value can be changed, it is not a value type. So you cannot use Maps in data structures such as Sets, because each Map is considered to be different from any other List, because they are not value types.


Elizabeth Mattijsen [email protected]


Copyright 2022 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.