List-Intersperse

 view release on metacpan or  search on metacpan

Intersperse.pm  view on Meta::CPAN

This function returns a list of elements interspersed so that equivalent items
are evenly distributed throughout the list.

=item intersperseq BLOCK LIST

C<intersperseq> works like C<intersperse> but it applies BLOCK to the elements
of LIST to determine the equivalance key.

=cut

sub intersperseq(&@) {
  # wrapper with a prototype, allows calling like map
  _intersperse( @_ )
}

sub intersperse(@) { # no key func
  _intersperse( sub { $_[0] }, @_ )
}

sub _intersperse {
  my $keyf = shift;



( run in 0.667 second using v1.01-cache-2.11-cpan-49f99fa48dc )