develooper Front page | perl.perl6.language | Postings from May 2005

Re: [S29] uniq

Thread Previous | Thread Next
From:
Adriano Ferreira
Date:
May 19, 2005 12:01
Subject:
Re: [S29] uniq
Message ID:
73ddeb6c05051912013fcf61b7@mail.gmail.com
The former implementation can be shortened:

sub uniq {
  my %h;
  return grep { ! $h{$_}++ } @_;
}

But realize that none of the proposed solutions (which are based on
hashes for computing the return) is amenable to the extension Ingo
called for with comparator blocks.

Adriano.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About