I want to touch on a tangent to what ww said.
There is no doubt that map (and the various regix tools) can be very powerful. But, that said, it is sometimes better to forgo the temptation to boil an operation down to the minimum lines and instead make it easy for the next person (or yourself) who has read that code 6 months or more down the road.
This is even more important if you are doing this for a living. It is better to make code clear and easy to read than to try to be "elegant" and spend far more time in the process and cause others to spend more time than needed when it needs to be changed.
In all honesty, I think you are trying to use a sledgehammer to drive a 4p nail. A simple loop and counter would probably be just as efficient and much easier to understand.
In reply to Re: Using map function to print few elements of list returned by sort function
by boftx
in thread Using map function to print few elements of list returned by sort function
by jaypal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |