txt: ## squish.md
  squish
  
  Combined from primary sources listed below.
  
  # [In Independent routines](#___top "go to top of document")[§](#(Independent_routines)_routine_squish "direct link")
  
  See primary documentation
  [in context](/type/independent-routines#routine_squish)
  for **routine squish**.
  
  ```raku
  sub squish( +values, |c)
  ```
  
  Returns a sequence of values from the invocant/argument list where runs of one or more values are replaced with only the first instance. Like [`unique`](/routine/unique), `squish` uses the semantics of the [===](/routine/===) operator to decide whether two objects are the same. Unlike [`unique`](/routine/unique), this function only removes adjacent duplicates; identical values further apart are still kept. The order of the original list is preserved even as duplicates are removed.
  
  Examples:
  
  ```raku
  say <a a b b b c c>.squish; # OUTPUT: «(a b c)␤»
  say <a b b c c b a>.squish; # OUTPUT: «(a b c b a)␤»
  ```
  
  The optional `:as` parameter, just like with [`unique`](/routine/unique), allows values to be temporarily transformed before comparison.
  
  The optional `:with` parameter is used to set an appropriate comparison operator:
  
  ```raku
  say [42, "42"].squish;                      # OUTPUT: «(42 42)␤»
  # Note that the second item in the result is still Str
  say [42, "42"].squish(with => &infix:<eq>); # OUTPUT: «(42)␤»
  # The resulting item is Int
  ```
  
  # [In Any](#___top "go to top of document")[§](#(Any)_method_squish "direct link")
  
  See primary documentation
  [in context](/type/Any#method_squish)
  for **method squish**.
  
  ```raku
  multi method squish( :&as!, :&with = &[===] )
  multi method squish( :&with = &[===] )
  ```
  
  Similar to [`.repeated`](/type/Any#method_repeated), returns the sequence of first elements of contiguous sequences of equal elements, after normalization by the function `:as`, if present, and using as an equality operator the `:with` argument or `===` by default.
  
  ```raku
  "aabbccddaa".comb.squish.say;             # OUTPUT: «(a b c d a)␤»
  "aABbccdDaa".comb.squish( :as(&lc) ).say; # OUTPUT: «(a B c d a)␤»
  (3+2i,3+3i,4+0i).squish( as => *.re, with => &[==]).put; # OUTPUT: «3+2i 4+0i␤»
  
  ```
  
  As shown in the last example, a sequence can contain a single element. See [`squish`](/type/independent-routines#routine_squish) for additional `sub` examples.
  
  # [In Supply](#___top "go to top of document")[§](#(Supply)_method_squish "direct link")
  
  See primary documentation
  [in context](/type/Supply#method_squish)
  for **method squish**.
  
  ```raku
  method squish(Supply:D: :$as, :$with --> Supply:D)
  ```
  
  Creates a supply that only provides unique values, as defined by the optional `:as` and `:with` parameters (same as with [`squish`](/type/independent-routines#routine_squish)).
  