Philippe Sigaud:
> Here is what I cooked, it's still a bit rough around the edges. It has an
> optional step argument, to see how many elements to jump.

It's better to give it a default chunk size of 2.
If I have understood this well, then this is the partition() function:
http://reference.wolfram.com/mathematica/ref/Partition.html

If you want to be more complete you can add two more features: to start 
counting items from the end (but they are given from the start) and give a 
"duplication window", so for example the natural numbers with a window of 2 and 
a duplication of 1 are [1, 2], [2, 3], [3, 4]. But adding too many features 
risks to produce functions like the Mathematica ones, that sometimes are hard 
to use because they have tons of complex arguments.)

Bye,
bearophile

Reply via email to