Combined from primary sources listed below.
See primary docmentation in context for method count.
See primary docmentation in context for method count.
method count(Code:D: --> Real:D)
Returns the maximum number of positional arguments that may be passed when calling the code object. For code objects that can accept any number of positional arguments (that is, they have a slurpy parameter), count will return Inf. Named parameters do not contribute.
sub argless() { }
sub args($a, $b?) { }
sub slurpy($a, $b, *@c) { }
say &argless.count; # OUTPUT: «0»
say &args.count; # OUTPUT: «2»
say &slurpy.count; # OUTPUT: «Inf»
See primary docmentation in context for method count.
method count-only(--> Int:D) { ... }
It is expected to return the number of values the iterator can still produce without actually producing them. The returned number must adjust itself for items already pulled, so that the method can be called on a partially consumed Iterator.
It will be used in situations where only the number of values of an iterator is needed, e.g. when the .elems method is called.
Important: it's expected the Iterators that implement this method can return that number without producing any values. In other words, it's expected the user of the class will be able to still pull-one after calling this method, and eventually receive as many values as the return value of this method indicated.
See primary docmentation in context for method count.
method count(--> List:D)
Returns the maximal number of positional arguments that is needed for this format. Intended for introspection purposes.
use v6.e.PREVIEW;
my $d = Format.new("%05d%3x:%s");
say $d.count; # OUTPUT: «3»
See primary docmentation in context for method count.
method count(Signature:D: --> Real:D)
Returns the maximal number of positional arguments which can be bound to the signature. Returns Inf if there is a slurpy positional parameter.