In List§
See primary documentation in context for method Set
In general, creates a set which has as members elements of the list.
say <æ ß þ €>.Set; # OUTPUT: «Set(ß æ þ €)»
However, there might be some unexpected changes in case the list includes non-scalar data structures. For instance, with Pair
s:
my = (:42a, :33b);say ; # OUTPUT: «[a => 42 b => 33]»say .Set; # OUTPUT: «Set(a b)»
The set will be composed of the key
s of the Pair whose corresponding value is not 0, eliminating all the values. Please check the Set
documentation for more examples and a more thorough explanation.
In role Baggy§
See primary documentation in context for method Set
method Set(--> Set)
Returns a Set
whose elements are the keys of the invocant.
my = (eggs => 2, bacon => 3).BagHash;say .Set; # OUTPUT: «Set(bacon eggs)»
In Any§
See primary documentation in context for method Set
method Set(--> Set) is nodal
Coerces the invocant to Set
, whereby Positional
s are treated as lists of values.