txt: ## tail.md
  tail
  
  Combined from primary sources listed below.
  
  # [In Any](#___top "go to top of document")[§](#(Any)_routine_tail "direct link")
  
  See primary documentation
  [in context](/type/Any#routine_tail)
  for **routine tail**.
  
  ```raku
  multi method tail() is raw
  multi method tail($n)
  ```
  
  Returns the last or the list of the `$n` last elements of an object. `$n` can be a [`Callable`](/type/Callable), usually a [`WhateverCode`](/type/WhateverCode), which will be used to get all but the first `n` elements of the object.
  
  ```raku
  say (^12).reverse.tail ;     # OUTPUT: «0␤»
  say (^12).reverse.tail(3);   # OUTPUT: «(2 1 0)␤»
  say (^12).reverse.tail(*-7); # OUTPUT: «(4 3 2 1 0)␤»
  
  ```
  
  As of release 2022.07 of the Rakudo compiler, there is also a "sub" version of `tail`.
  
  ```raku
  multi tail(\specifier, +values)
  ```
  
  It **must** have the tail specifier as the first argument. The rest of the arguments are turned into a [`Seq`](/type/Seq) and then have the `tail` method called on it.
  
  # [In List](#___top "go to top of document")[§](#(List)_method_tail "direct link")
  
  See primary documentation
  [in context](/type/List#method_tail)
  for **method tail**.
  
  ```raku
  multi method tail(List:D:)
  multi method tail(List:D: $n --> Seq:D)
  ```
  
  Returns a [`Seq`](/type/Seq) containing the **last** `$n` items of the list. Returns an empty [`Seq`](/type/Seq) if `$n` <= 0. Defaults to the last element if no argument is specified. Throws an exception if the list is lazy.
  
  Examples:
  
  ```raku
  say <a b c d e>.tail(*-3);# OUTPUT: «(d e)␤»
  say <a b c d e>.tail(2);  # OUTPUT: «(d e)␤»
  say <a b c d e>.tail;     # OUTPUT: «e␤»
  
  ```
  
  In the first case, `$n` is taking the shape of a [`WhateverCode`](/type/WhateverCode) to indicate the number of elements from the beginning that will be excluded. `$n` can be either a Callable, in which case it will be called with the value `0`, or anything else that can be converted to a number, in which case it will use that as the number of elements in the output [`Seq`](/type/Seq).
  
  ```raku
  say <a b c d e>.tail( { $_ - 2 } ); # OUTPUT: «(c d e)␤»
  ```
  
  # [In Supply](#___top "go to top of document")[§](#(Supply)_method_tail "direct link")
  
  See primary documentation
  [in context](/type/Supply#method_tail)
  for **method tail**.
  
  ```raku
  multi method tail(Supply:D:)
  multi method tail(Supply:D: Callable:D $limit)
  multi method tail(Supply:D: \limit)
  ```
  
  Creates a "tail" supply with the same semantics as [List.tail](/type/List#method_tail).
  
  ```raku
  my $s = Supply.from-list(4, 10, 3, 2);
  my $ts = $s.tail(2);
  $ts.tap(&say);           # OUTPUT: «3␤2␤»
  ```
  
  You can call `.tail` with [`Whatever`](/type/Whatever) or `Inf`; which will return a new supply equivalent to the initial one. Calling it with a [`WhateverCode`](/type/WhateverCode) will be equivalent to skipping until that number.
  
  ```raku
  my $s = Supply.from-list(4, 10, 3, 2);
  my $ts = $s.tail( * - 2 );
  $ts.tap(&say);           # OUTPUT: «3␤2␤»
  ```
  
  This feature is only available from the 2020.07 release of Raku.
  