method list
Documentation for method list
assembled from the following types:
class Capture
From Capture
(Capture) method list
Defined as:
method list(Capture:)
Returns the positional part of the Capture.
my Capture = \(2, 3, 5, apples => (red => 2));say .list; # OUTPUT: «(2 3 5)»
class Supply
From Supply
(Supply) method list
method list(Supply: --> List)
Taps the Supply
it is called on, and returns a lazy list that will be reified as the Supply
emits values. The list will be terminated once the Supply
is done
. If the Supply
quit
s, then an exception will be thrown once that point in the lazy list is reached.
class Range
From Range
(Range) method list
method list(Range: --> List)
Generates the list of elements that the range represents.
say (1..5).list; # OUTPUT: «(1 2 3 4 5)»say (1^..^5).list; # OUTPUT: «(2 3 4)»
class Any
From Any
(Any) method list
Defined as:
multi method list(Any: --> List)multi method list(Any \SELF: --> List)
Applies the infix ,
operator to the invocant and returns the resulting List:
say 42.list.^name; # OUTPUT: «List»say 42.list.elems; # OUTPUT: «1»
Subclasses of Any
may choose to return any core type that does the Positional role from .list
. Use .List
to coerce specifically to List.
@
can also be used as a list or Positional
contextualizer:
my = $[1,2,3];say .perl; # OUTPUT: «$[1, 2, 3]»my = @;say .^name; # OUTPUT: «Array»
In the first case, the list is itemized. @
as a prefix puts the initial scalar in a list context by calling .list
and turning it into an Array
.
role PositionalBindFailover
(PositionalBindFailover) method list
method list(PositionalBindFailover: --> List)
Returns a List based on the iterator
method without caching it.
role Buf
From Buf
(Buf) method list
Defined as:
multi method list(Buf:)
Returns a Seq
of codepoints.
say Buf.new(122,105,112,205).list; # OUTPUT: «(122 105 112 205)»
class Channel
From Channel
(Channel) method list
Defined as:
method list(Channel: --> List)
Returns a list based on the Seq
which will iterate items in the queue and remove each item from it as it iterates. This can only terminate once the close
method has been called.
my = Channel.new; .send(1); .send(2);.close;say .list; # OUTPUT: «(1 2)»
class Backtrace
From Backtrace
(Backtrace) method list
Defined as:
multi method list(Backtrace:)
Returns a list of Backtrace::Frame objects for this backtrace.
class Match
From Match
(Match) method list
Returns a list of positional submatches.
role Blob
From Blob
(Blob) method list
Defined as:
multi method list(Blob:)
Returns the list of codepoints:
say "zipi".encode("ascii").list; # OUTPUT: «(122 105 112 105)»
class Map
From Map
(Map) method list
Defined as:
method list(Map: --> List)
Returns a List
of all keys and values in the Map.
my = Map.new('a' => (2, 3), 'b' => 17);say .list; # OUTPUT: «(b => 17 a => (2 3))»