join
Looping over a list of values one at a time, two at a time and more
The uniq functionsexamples/arrays/unique.p6 #!/usr/bin/perl6 use v6; my @duplicates = 1, 1, 2, 5, 1, 4, 3, 2, 1; say @duplicates.perl; # prints [1, 1, 2, 5, 1, 4, 3, 2, 1] my @unique = uniq @duplicates; say @unique.perl; # prints [1, 2, 5, 4, 3] my @chars = <b c a d b a a a b>; say @chars.perl; # prints ["b", "c", "a", "d", "b", "a", "a", "a", "b"] my @singles = uniq @chars; say @singles.perl; # prints ["b", "c", "a", "d"] Copyright 2006, 2007, 2008, 2009, 2010 Gabor Szabo http://szabgab.com/ Index | TOC |
Follow me: