On Thu, Oct 21, 2004 at 02:43:12PM +1300, Carl Cerecke wrote:
> I have a list with an even number of elements, and I want to step
> through each pair of elements.
>
> So, for example, with the list ls=[1,2,3,4,5,6], I want to deal with 1,2
> then 3,4 then 5,6.
this is not a python solution, but an excellent opportunity to show some
of the nicer features of pike:
array ls=({ 1,2,3,4,5,6 });
array pairs=ls/2;
the result is then:
({ ({ 1,2 }), ({ 3,4 }), ({ 5,6 }) })
greetings, martin.
--
- Pike - Caudium - sTeam - psycMUVE - LPC -
Pike Camp, October 13 - 19, 2004, Unperfekthaus, Essen, Germany
--
pike programmer travelling and working in europe open-steam.org
unix system- is.schon.org camp.gotpike.org
administrator bahai.or.at iaeste.(tuwien.ac|or).at
Martin B�hr http://www.iaeste.or.at/~mbaehr/