In Routine§

See primary documentation in context for method cando

method cando(Capture $c)

Returns a possibly-empty list of candidates that can be called with the given Capture, ordered by narrowest candidate first. For methods, the first element of the Capture needs to be the invocant:

.signature.say for "foo".^can("comb")[0].cando: \(Cool"o");
# OUTPUT: «(Cool $: Str $matcher, $limit = Inf, *%_)␤»

In Code§

See primary documentation in context for method cando

method cando(Capture $c)

Returns a list of candidates that can be called with the given Capture. Since Code objects do not have any multiple dispatch, this either returns a list with the object, or an empty list.

my $single = \'a';         # a single argument Capture 
my $plural = \('a'42);   # a two argument Capture 
my &block = { say $^a };   # a Block object, that is a subclass of Code, taking one argument 
say &block.cando($single); # OUTPUT: «(-> $a { #`(Block|94212856419136) ... })␤» 
say &block.cando($plural); # OUTPUT: «()␤»