txt: ## list.md
  list
  
  Combined from primary sources listed below.
  
  # [In role Buf](#___top "go to top of document")[§](#(role_Buf)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Buf#method_list)
  for **method list**.
  
  ```raku
  multi method list(Buf:D:)
  ```
  
  Returns a [`List`](/type/List) of integers.
  
  ```raku
  say Buf.new(122,105,112,205).list; # OUTPUT: «(122 105 112 205)␤»
  ```
  
  # [In Uni](#___top "go to top of document")[§](#(Uni)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Uni#method_list)
  for **method list**.
  
  ```raku
  method list(Uni:D:)
  ```
  
  Returns a [`Seq`](/type/Seq) of integer codepoints.
  
  # [In List](#___top "go to top of document")[§](#(List)_routine_list "direct link")
  
  See primary documentation
  [in context](/type/List#routine_list)
  for **routine list**.
  
  ```raku
  multi        list(+list)
  multi method list(List:D:)
  ```
  
  The method just returns the invocant [self](/routine/self). The subroutine adheres to the [single argument rule](/language/functions#Slurpy_conventions): if called with a single argument that is a non-[itemized](/language/mop#VAR) [`Iterable`](/type/Iterable) it returns a `List` based on the argument's [iterator](/routine/iterator); otherwise it just returns the argument list.
  
  For example:
  
  ```raku
  my $tuple = (1, 2);         # an itemized List
  put $tuple.list.raku;       # OUTPUT: «(1, 2)␤»
  put list($tuple).raku;      # OUTPUT: «($(1, 2),)␤»
  put list(|$tuple).raku;     # OUTPUT: «(1, 2)␤»
  ```
  
  The last statement uses the [`prefix:<|>`](/language/operators#prefix_|) operator to flatten the tuple into an argument list, so it is equivalent to:
  
  ```raku
  put list(1, 2).raku;        # OUTPUT: «(1, 2)␤»
  ```
  
  There are other ways to list the elements of an itemized single argument. For example, you can [decontainerize](/routine/<>) the argument or use the [`@` list contextualizer](/type/Any#index-entry-@_list_contextualizer):
  
  ```raku
  put list($tuple<>).raku;    # OUTPUT: «(1, 2)␤»
  put list(@$tuple).raku;     # OUTPUT: «(1, 2)␤»
  
  ```
  
  Note that converting a type object to a list may not do what you expect:
  
  ```raku
  put List.list.raku;         # OUTPUT: «(List,)␤»
  ```
  
  This is because the `.list` candidate accepting a type object as the invocant is provided by [`Any`](/routine/list#(Any)_method_list). That candidate returns a list with one element: the type object self. If you're developing a collection type whose type object should be a valid representation of an empty collection, you may want to provide your own candidate for undefined invocants or override the `Any:` candidates with an "only" method. For example:
  
  ```raku
  my class LinkedList {
      has $.value;            # the value stored in this node
      has LinkedList $.next;  # undefined if there is no next node
  
      method values( --> Seq:D) {
          my $node := self;
          gather while $node {
              take $node.value;
              $node := $node.next;
          }
      }
  
      method list( --> List:D) {
          self.values.list;
      }
  }
  
  my LinkedList $nodes;       # an empty linked list
  put $nodes.list.raku;       # OUTPUT: «()␤»
  
  ```
  
  # [In Capture](#___top "go to top of document")[§](#(Capture)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Capture#method_list)
  for **method list**.
  
  ```raku
  method list(Capture:D:)
  ```
  
  Returns the positional part of the `Capture`.
  
  ```raku
  my Capture $c = \(2, 3, 5, apples => (red => 2));
  say $c.list; # OUTPUT: «(2 3 5)␤»
  ```
  
  # [In Match](#___top "go to top of document")[§](#(Match)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Match#method_list)
  for **method list**.
  
  Returns a list of positional submatches.
  
  # [In Range](#___top "go to top of document")[§](#(Range)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Range#method_list)
  for **method list**.
  
  ```raku
  multi method list(Range:D:)
  ```
  
  Generates the list of elements that the range represents.
  
  ```raku
  say (1..5).list;                                  # OUTPUT: «(1 2 3 4 5)␤»
  say (1^..^5).list;                                # OUTPUT: «(2 3 4)␤»
  ```
  
  # [In Map](#___top "go to top of document")[§](#(Map)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Map#method_list)
  for **method list**.
  
  ```raku
  multi method list(Map:D: --> List:D)
  ```
  
  Returns a [`List`](/type/List) of [`Pair`](/type/Pair) objects of all keys and values in the Map.
  
  ```raku
  my $m = Map.new('a' => (2, 3), 'b' => 17);
  say $m.list;                            # OUTPUT: «(b => 17 a => (2 3))␤»
  ```
  
  # [In Any](#___top "go to top of document")[§](#(Any)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Any#method_list)
  for **method list**.
  
  ```raku
  multi method list(Any:U:)
  multi method list(Any:D \SELF:)
  ```
  
  Applies the infix [`,`](/routine/,) operator to the invocant and returns the resulting [`List`](/type/List):
  
  ```raku
  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`](/type/Positional) role from [`.list`](/routine/list). Use [`.List`](/routine/List) to coerce specifically to [`List`](/type/List).
  
  `@` can also be used as a list or [`Positional`](/type/Positional) contextualizer:
  
  ```raku
  my $not-a-list-yet = $[1,2,3];
  say $not-a-list-yet.raku;             # OUTPUT: «$[1, 2, 3]␤»
  my @maybe-a-list = @$not-a-list-yet;
  say @maybe-a-list.^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`](/type/Array).
  
  # [In Failure](#___top "go to top of document")[§](#(Failure)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Failure#method_list)
  for **method list**.
  
  ```raku
  multi method list(Failure:D:)
  ```
  
  Marks the failure as handled and throws the invocant's [exception](/type/Failure#method_exception).
  
  # [In role Blob](#___top "go to top of document")[§](#(role_Blob)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Blob#method_list)
  for **method list**.
  
  ```raku
  multi method list(Blob:D:)
  ```
  
  Returns a [`List`](/type/List) of integers:
  
  ```raku
  say "zipi".encode("ascii").list; # OUTPUT: «(122 105 112 105)␤»
  ```
  
  # [In role PositionalBindFailover](#___top "go to top of document")[§](#(role_PositionalBindFailover)_method_list "direct link")
  
  See primary documentation
  [in context](/type/PositionalBindFailover#method_list)
  for **method list**.
  
  ```raku
  multi method list(::?CLASS:D:)
  ```
  
  Returns a [`List`](/type/List) based on the `iterator` method without caching it.
  
  # [In role QuantHash](#___top "go to top of document")[§](#(role_QuantHash)_method_list "direct link")
  
  See primary documentation
  [in context](/type/QuantHash#method_list)
  for **method list**.
  
  ```raku
  multi method list(QuantHash:D:)
  ```
  
  Returns a list of [`Pair`](/type/Pair) objects of all keys and values in the QuantHash.
  
  # [In Channel](#___top "go to top of document")[§](#(Channel)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Channel#method_list)
  for **method list**.
  
  ```raku
  method list(Channel:D:)
  ```
  
  Returns a list based on the [`Seq`](/type/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.
  
  ```raku
  my $c = Channel.new; $c.send(1); $c.send(2);
  $c.close;
  say $c.list; # OUTPUT: «(1 2)␤»
  ```
  
  # [In Backtrace](#___top "go to top of document")[§](#(Backtrace)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Backtrace#method_list)
  for **method list**.
  
  ```raku
  multi method list(Backtrace:D:)
  ```
  
  Returns a list of [`Backtrace::Frame`](/type/Backtrace/Frame) objects for this backtrace.
  
  # [In Supply](#___top "go to top of document")[§](#(Supply)_method_list "direct link")
  
  See primary documentation
  [in context](/type/Supply#method_list)
  for **method list**.
  
  ```raku
  multi method list(Supply:D:)
  ```
  
  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.
  