Skip to content

Commit

Permalink
[S32/Containers] clarify that the *first* is kept
Browse files Browse the repository at this point in the history
...in .uniq and .squish -- not the last, or an arbitrary one.
The first.
  • Loading branch information
Carl Masak committed Aug 3, 2013
1 parent ec1b7c6 commit fa46a81
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions S32-setting-library/Containers.pod
Expand Up @@ -19,8 +19,8 @@ DRAFT: Synopsis 32: Setting Library - Containers.pod

Created: 19 Feb 2009 extracted from S29-functions.pod

Last Modified: 13 Jul 2013
Version: 40
Last Modified: 3 Aug 2013
Version: 41

If you read the HTML version, it is generated from the Pod in the specs
repository under
Expand Down Expand Up @@ -453,9 +453,10 @@ C<is canonicalized(&lc)>.)

multi sub uniq(*@values --> Positional:D, :&with = &[===])

Returns a list of unique values from the invocant/argument
list. The order of the original list is preserved
even as duplicates are removed.
Returns a list of unique values from the invocant/argument list, such
that only the first occurrence of each duplicated value remains in the
result list. The order of the original list is preserved even as
duplicates are removed.

say <a a b b b c c>.uniq # a b c
say <a b b c c b a>.uniq # a b c
Expand All @@ -477,10 +478,10 @@ objects are adjacent.)
multi sub squish(*@values --> Positional:D, :&with = &[===])

Returns a list of values from the invocant/argument list where runs
of more than one object of the same identity are squished down to
a single instance. Unlike C<uniq>, this function only removes adjacent
duplicates; identical objects further apart are still kept. The order of the
original list is preserved even as duplicates are removed.
of more than one value are replaced with only the first instance.
Unlike C<uniq>, 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 # a b c
say <a b b c c b a>.squish # a b c b a
Expand Down

0 comments on commit fa46a81

Please sign in to comment.