Tim Ayers > List-Intersperse-1.00 > List::Intersperse

Download:
List-Intersperse-1.00.tar.gz

Dependencies

Annotate this POD

Related Modules

Geo::ShapeFile
Crypt::RandPasswd
more...
By perlmonks.org
View/Report Bugs
Module Version: 1.00   Source  

NAME ^

List::Intersperse - Intersperse / unsort / disperse a list

SYNOPSIS ^

  use List::Intersperse qw/intersperseq/;

  @ispersed = intersperseq {substr($_[0],0,1)} qw/A1 A2 B1 B2 C1 C2/;

  @ispersed = List::Intersperse::intersperse qw/A A B B B B B B C/;

DESCRIPTION ^

intersperse and intersperseq evenly distribute elements of a list. Elements that are considered equal are spaced as far apart from each other as possible.

FUNCTIONS ^

intersperse LIST

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

intersperseq BLOCK LIST

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

AUTHORS ^

 This module was written by
 Tim Ayers (http://search.cpan.org/search?mode=author&query=tayers) and
 John Porter (http://search.cpan.org/search?mode=author&query=jdporter).

ACKNOWLEDGEMENTS ^

Thanks to John Porter for providing and implementing an improved algorithm for solving the problem.

COPYRIGHT ^

Copyright (c) 2001 Tim Ayers and John Porter.

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: