|
next
|
 Subject: How to break down a sequence and return a few subsequences Author: Kam Chan Date: 30 Jun 2009 07:18 PM
|
I need to write a function that given a sequence of items, create and return a sequence of sub-sequences, with each sub-sequences containing "like" items.
For example:
given a sequence of 'a', 'b', c', 1', '2', 3','x','y','z'
I want the function to return something like:
( ('a', 'b', 'c'), ('1', '2', '3'), ('x', 'y', 'z'))
I don't need to go into the detail of how the items are decided to be in which sub-sequence. (In this above example, it might be each subsequence contains 3 items.)
But I don't know the mechanics of creating a new sub-sequences.
Any help is appreciated.
Kam
|
|
|