Documentation for routine squish

Documentation for routine squish, assembled from the following types:

class Any

From Any

(Any) method squish

Defined As:

    method squish(--> TODO)


class List

From List

(List) routine squish

Defined as:

multi sub    squish(*@values:&as --> Seq:D)
multi method squish(List:D:  :&as --> Seq:D)

Returns a sequence of values from the invocant/argument list where runs of more than one value are replaced with only the first instance. Like unique, squish uses the semantics of the === operator to decide whether two objects are the same. Unlike 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.


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, allows values to be temporarily transformed before comparison.

class Supply

From Supply

(Supply) method squish

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 List.squish).