txt: ## roundrobin.md
  roundrobin
  
  Combined from primary sources listed below.
  
  # [In List](#___top "go to top of document")[§](#(List)_routine_roundrobin "direct link")
  
  See primary documentation
  [in context](/type/List#routine_roundrobin)
  for **routine roundrobin**.
  
  ```raku
  sub roundrobin(+list-of-lists --> Seq)
  ```
  
  Builds a 'list of lists', returned as a sequence, from multiple input lists or other [`Iterable`](/type/Iterable)s. `roundrobin` returns an identical result to that of [zip](/type/List#routine_zip), except when the input lists are allowed to have an unequal number of elements.
  
  ```raku
  say roundrobin <a b c>, <d e f>, <g h i>;
  # OUTPUT: «((a d g) (b e h) (c f i))␤»
  
  say .join(",") for roundrobin([1, 2], [2, 3], [3, 4]);
  # OUTPUT: «1,2,3␤2,3,4␤»
  ```
  
  `roundrobin` does not terminate once one or more of the input lists become exhausted, but proceeds until all elements from all lists have been processed.
  
  ```raku
  say roundrobin <a b c>, <d e f m n o p>, <g h i j>;
  # OUTPUT: «((a d g) (b e h) (c f i) (m j) (n) (o) (p))␤»
  
  say .join(",") for roundrobin([1, 2], [2, 3, 57, 77], [3, 4, 102]);
  # OUTPUT: «1,2,3␤2,3,4␤57,102␤77␤»
  ```
  
  Therefore no data values are lost due in the 'zipping' operation. A record of which input list provided which element cannot be gleaned from the resulting sequence, however.
  
  `roundrobin` can be useful in combining messy data to the point where a manual post-processing step can then be undertaken.
  
  ```raku
  sub roundrobin(+list-of-lists, :$slip --> Seq)
  ```
  
  As of release 2022.02 of the Rakudo compiler, it is also possible to specify a `:slip` named argument. If specified with a true value, will [slip](/language/list#Slips) the produced values.
  
  ```raku
  say roundrobin <a b c>, <d e f m n o p>, <g h i j>, :slip;
  # OUTPUT: «(a d g b e h c f i m j n o p)␤»
  ```
  