Documentation for routine squish
Documentation for routine squish, assembled from the following types:
method squish(--> TODO)
multi sub squish(*, : --> Seq)multi method squish(List: : --> Seq)
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
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)␤»
:as parameter, just like with
unique, allows values to be temporarily transformed before comparison.
method squish(Supply: :, :, : --> Supply)
Creates a supply that only provides unique values, as defined by the optional :as and :with parameters (same as with List.squish). The optional :expires parameter how long to wait (in seconds) before "resetting" and not considering a value to have been seen, even if it's the same as an old value.