Documentation for method cando
assembled from the following pages:
Class: Code §
From Code
(Code) method cando §
method cando(Capture )
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 = \'a'; # a single argument Capture my = \('a', 42); # a two argument Capture my = ; # a Block object, that is a subclass of Code, taking one argument say .cando(); # OUTPUT: «(-> $a { #`(Block|94212856419136) ... })» say .cando(); # OUTPUT: «()»
Class: Routine §
From Routine
(Routine) method cando §
method cando(Capture )
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, *%_)»