[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Unsort/disperse a list



>>>>> "E" == Eli Evans <eevans@libronix.com> writes:
E> But I give:

E>    HA H2 H3 H4 H5 H6 H7 H8 H9 HJ HQ HK SA S2 S3 S4 S5 S6 S7 S8
E>    H2 S2 H3 S3 H4 S4 H5 S5 H6 S6 H7 S7 H8 S8 H9 SA HA HJ HK HQ

E> Is that more what you were thinking? Or what ...

The problem is that all the H's at the end of the list. My intent is
to evenly scatter everything throughout the resultant list. So I would
expect something more like

  SA HA H2 S2 H3 S3 H4 H5 S4 H6 S5 H7 H8 S6 H9 S7 HJ HQ S8 HK

which is what John Porter's function gives or my function's result of

  HA SA H2 H3 S2 H4 H5 S3 H6 H7 S4 H8 H9 S5 HJ HQ S6 HK S7 S8

A more problematic case is

  A1 A2 A3 B1 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D1 D2

which my and your function choke on by piling way too many C's at the
end of the list. But John's function handles it very nicely by
returning 

  A1 C1 C2 C3 B1 C4 C5 A2 C6 C7 C8 D1 C9 CA A3 CB CC CD D2 CE CF

Thanks, John, for a very nice solution.

Hope you have a very nice day, :-)
Tim Ayers (tayers@bridge.com)


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe