Documentation for routine repeated

Documentation for routine repeated, assembled from the following types:

class Any

From Any

(Any) method repeated

Defined As:

    method repeated(--> TODO)


class List

From List

(List) routine repeated

Defined as:

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

Returns a sequence of repeated values from the invocant/argument list. It takes the same parameters as unique, but instead of passing through any elements when they're first seen, they're only passed through as soon as they're seen for the second time (or more).


say <a a b b b c c>.repeated;                   # OUTPUT: «(a b b c)␤» 
say <a b b c c b a>.repeated;                   # OUTPUT: «(b c b a)␤» 
say <a A B b c b C>.repeated(:as(&lc));         # OUTPUT: «(A b b C)␤» 
my @list = {=> 42}{=> 13}{=> 42};
say @list.repeated(:with(&[eqv]))               # OUTPUT: «({a => 42})␤»