On 26-Sep-09 0:09, Hari Krishna Dara wrote: > I think we can get some interesting use cases if the index of v:val is > exposed during the map() execution, and I think we can reuse v:key for > that purpose. E.g., I have a use case in which, given a list of > increasing numbers, get a list of differences, so something like the > below will get it done: > > :let l = [9, 17, 26, 36] > :echo map(l[1:], 'v:val-l[v:key]') > [8, 9, 10] > > You could achieve the above using workarounds or using a for loop, but > is there anything wrong in using v:key for this purpose? The change > seems to be minimal, as the below patch worked fine for me:
Awesome idea, Hari. I have encountered the same problem several times (and had to use a for-loop), too. -- regards, ingo --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
