Perl6 documentation indicated that when comparing two items in a set, ===
is used. This is quote from perl6 documentation:
Objects/values of any type are allowed as set elements. Within a Set, every element is guaranteed to be unique (in the sense that no two elements would compare positively with the
===
operator)
I am wondering if it is possible to use a user-defined function instead of ===
? E.g., How can I use ~~
instead of ===
in determining whether 2 elements in a set are "equal".
The problem I am trying to solve is this: set A has some first names and some last names in any order but all lower case and no punctuation, and set B has a number of first names and last names mixed in any order, and there may be punctuation attached to the names and may be upper or lower cases. I want to know if a person in set A (represented as a subset of A with one specific first and last name) appears in set B. In this case, I cannot use ===
because of the letter cases and punctuation in set B.
If I can use ~~
instead of ===
, the problem will be much simpler because I only need to determine if a subset of A is also a subset of B using ~~
. This is similar to a "permutation match" problem I mentioned before.
Thank you very much !