Okay, see if I got it right, finally:
multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos --> Bool)
"multi method"
This means there are multiple ways to address this, as in
multi method contains(Str:D: Cool:D $needle --> Bool)
multi method contains(Str:D: Str:D $needle --> Bool)
multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos
--> Bool)
multi method contains(Str:D: Str:D $needle, Int:D $pos --> Bool)
"Str"
means it want to be fed data as a string. Str.foo
":D"
means it wants actual data in the string and not a Nil.
The jargon for this requirement is that is is constrained
to an actual value
If it wanted a Nil, it would say ":U" or constrained to
a Nil
":"
is the delimiter that tells you it is finished defining
what is wants to be fed
"Cool:D $needle"
means it wants a type Cool (string or number) for the
substring ($needle) it is looking for in the Haystack (Str)
"Int(Cool:D)"
Means it will change a type Cool into a type Int (integer)
and the ":D" means it want some actual data and not a Nil.
"$pos"
Is short of Position. It is the starting index in the
haystack (Str) to start looking for the substring
(needle). Index starts at zero by way of string
convention in Perl 6
$pos is an optional parameter. Instead of $pos?
for optional, they stated it with several "multi method"
that do not include $pos.
"-->Bool"
means it return True or False
How did I do?
Thank you all for all the help with this!
-T