Hi All,

I adore the "kv" method:

$ p6 'for "abc\n23\n4.56".lines.kv -> $i, $j { say "$i  $j" };'
0  abc
1  23
2  4.56

So, I decided to go and look at:
   https://docs.perl6.org/routine/kv

multi method kv(Any:U:  -->List)
multi method kv(Any:D:  -->List)


Okay, here is what I see:

"method"  is .foo style of a routine

"Any:U:" and "Any:D:" are what goes in front of .foo
and it can be of type "Any".

     https://docs.perl6.org/type/Any

     ":D" mean constrained, meaning it much have something

     What is ":U"?

     Whatever ":U", how can it be both?

The second ":" is the delimiter for what goes in front of the .foo,
meaning it has finished its declaration of what that in front is.
Kind of like a comma.

"-->List" mean something is returned of type "List"
     https://docs.perl6.org/type/List

     0  abc
     1  23
     2  4.56


How have I done so far?


And is there a list somewhere of the meanings of ":U" and ":D"
and such so the next time I see one that I do not recognize,
I can look it up?

Many thanks,
-T

Reply via email to