John Porter and I have created a new module Algorithm::Intersperse.
I wanted some confirmation on our name choice, tho. 

  NAME
     Algorithm::Intersperse - Intersperse / unsort / disperse a
     list

  SYNOPSIS
       use Algorithm::Intersperse qw/intersperseq/;

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

       @ispersed = Algorithm::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 even 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.


So /A A B B C C/ comes out like /A B C A B C/. 

We thought Algorithm:: because of Algorithm::Numerical::Shuffle and
Algorithm::Permute. The other choice was Sort::Intersperse. Any
comments or suggestions? Thanks a lot.

Hope you have a very nice day, :-)
Tim Ayers ([EMAIL PROTECTED])

Reply via email to