txt: ## join.md
  join
  
  Combined from primary sources listed below.
  
  # [In Thread](#___top "go to top of document")[§](#(Thread)_method_join "direct link")
  
  See primary documentation
  [in context](/type/Thread#method_join)
  for **method join**.
  
  ```raku
  method join(Thread:D:)
  ```
  
  Waits for the thread to finish.
  
  # [In IO::Spec::Cygwin](#___top "go to top of document")[§](#(IO::Spec::Cygwin)_method_join "direct link")
  
  See primary documentation
  [in context](/type/IO/Spec/Cygwin#method_join)
  for **method join**.
  
  ```raku
  method join(|c)
  ```
  
  Same as [`IO::Spec::Win32.join`](/type/IO/Spec/Win32#method_join), except replaces backslashes with slashes in the final result.
  
  # [In Any](#___top "go to top of document")[§](#(Any)_method_join "direct link")
  
  See primary documentation
  [in context](/type/Any#method_join)
  for **method join**.
  
  ```raku
  method join($separator = '') is nodal
  ```
  
  Converts the object to a list by calling [`self.list`](/type/Any#method_list), and calls [`.join`](/type/List#routine_join) on the list. Can take a separator, which is an empty string by default.
  
  ```raku
  (1..3).join.say;       # OUTPUT: «123␤»
  <a b c>.join("❧").put; # OUTPUT: «a❧b❧c␤»
  ```
  
  # [In List](#___top "go to top of document")[§](#(List)_routine_join "direct link")
  
  See primary documentation
  [in context](/type/List#routine_join)
  for **routine join**.
  
  ```raku
  sub    join($separator, *@list)
  method join(List:D: $separator = "")
  ```
  
  Treats the elements of the list as strings by calling [`.Str`](/type/Mu#method_Str) on each of them, interleaves them with `$separator` and concatenates everything into a single string.
  
  Example:
  
  ```raku
  say join ', ', <a b c>;             # OUTPUT: «a, b, c␤»
  ```
  
  The method form also allows you to omit the separator:
  
  ```raku
  say <a b c>.join;               # OUTPUT: «abc␤»
  ```
  
  Note that the method form does not flatten sublists:
  
  ```raku
  say (1, <a b c>).join('|');     # OUTPUT: «1|a b c␤»
  ```
  
  The subroutine form behaves slurpily, flattening all arguments after the first into a single list:
  
  ```raku
  say join '|', 1, <a b c>;       # OUTPUT: «1|a|b|c␤»
  ```
  
  In this case, the list `<a b c>` is *slurped* and flattened, unlike what happens when `join` is invoked as a method.
  
  If one of the elements of the list happens to be a [`Junction`](/type/Junction), then `join` will also return a [`Junction`](/type/Junction) with concatenation done as much as possible:
  
  ```raku
  say ("a"|"b","c","d").join;     # OUTPUT: «any(acd,bcd)␤»
  ```
  
  # [In IO::Spec::Unix](#___top "go to top of document")[§](#(IO::Spec::Unix)_method_join "direct link")
  
  See primary documentation
  [in context](/type/IO/Spec/Unix#method_join)
  for **method join**.
  
  ```raku
  method join ($, Str:D $dir, Str:D $file --> Str:D)
  ```
  
  Similar to [`catpath`](/routine/catpath), takes two path fragments and concatenates them, adding or removing a path separator, if necessary, except it will return just `$file` if both `$dir` and `$file` are string `'/'` or if `$dir` is the string `'.'`. The first argument is ignored (it exists to maintain consistent interface with other [`IO::Spec`](/type/IO/Spec) types for systems that have volumes).
  
  ```raku
  IO::Spec::Unix.join($, 'foo', 'bar').say; # OUTPUT: «foo/bar␤»
  IO::Spec::Unix.join($, '/', '/').say;     # OUTPUT: «/␤»
  IO::Spec::Unix.join($, '.', 'foo').say;   # OUTPUT: «foo␤»
  say $*SPEC.join(True,".","/foo");         # OUTPUT: «/foo␤»
  ```
  
  # [In IO::Spec::Win32](#___top "go to top of document")[§](#(IO::Spec::Win32)_method_join "direct link")
  
  See primary documentation
  [in context](/type/IO/Spec/Win32#method_join)
  for **method join**.
  
  ```raku
  method join (Str:D $volume, Str:D $dir, Str:D $file --> Str:D)
  ```
  
  Similar to [`catpath`](/routine/catpath), takes two path fragments and concatenates them, adding or removing a path separator, if necessary, except it will return just `$file` if both `$dir` and `$file` are string `'/'` or if `$dir` is the string `'.'`. The first argument is ignored (it exists to maintain consistent interface with other [`IO::Spec`](/type/IO/Spec) types for systems that have volumes).
  
  ```raku
  IO::Spec::Win32.join('C:', '/some/dir', 'foo.txt').say;
  # OUTPUT: «C:/some/dir\and/more␤»
  
  IO::Spec::Win32.join('C:', '.', 'foo.txt').say;
  # OUTPUT: «C:foo.txt␤»
  
  IO::Spec::Win32.join('C:', ｢\｣, '/').say;
  # OUTPUT: «C:\␤»
  
  IO::Spec::Win32.join('//server/share', ｢\｣, '/').say;
  # OUTPUT: «//server/share␤»
  
  IO::Spec::Win32.join('E:', '', 'foo.txt').say;
  # OUTPUT: «E:foo.txt␤»
  ```
  