Skip to content

Commit fa46a81

Browse files
author
Carl Masak
committed
[S32/Containers] clarify that the *first* is kept
...in .uniq and .squish -- not the last, or an arbitrary one. The first.
1 parent ec1b7c6 commit fa46a81

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

S32-setting-library/Containers.pod

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ DRAFT: Synopsis 32: Setting Library - Containers.pod
1919

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

22-
Last Modified: 13 Jul 2013
23-
Version: 40
22+
Last Modified: 3 Aug 2013
23+
Version: 41
2424

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

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

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

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

479480
Returns a list of values from the invocant/argument list where runs
480-
of more than one object of the same identity are squished down to
481-
a single instance. Unlike C<uniq>, this function only removes adjacent
482-
duplicates; identical objects further apart are still kept. The order of the
483-
original list is preserved even as duplicates are removed.
481+
of more than one value are replaced with only the first instance.
482+
Unlike C<uniq>, this function only removes adjacent duplicates; identical
483+
values further apart are still kept. The order of the original list is
484+
preserved even as duplicates are removed.
484485

485486
say <a a b b b c c>.squish # a b c
486487
say <a b b c c b a>.squish # a b c b a

0 commit comments

Comments
 (0)