Saturday, June 30, 2012

Re: What does the second example for map() mean?

Chris Jones <cjns1989@gmail.com>:
> On Tue, Jun 26, 2012 at 09:56:48PM EDT, Benjamin R. Haskell wrote:
>> There's an example in the help for map() that reads:
>>
>> :let tlist = map(copy(mylist), ' & . "\t"')
>>
>> What is that ampersand doing there? Is the example incomplete?
>> Obsolete? Should it be v:val instead?
>
> Yes. Looks like someone was making quick changes to the doc and used '&'
> to recall the last match and somehow, a literal ampersand ended up in
> there instead...

From looking at the commit logs it seems that rather an '&' is what was
originally used for substituting in the current value, and then got
replaced by 'v:val' a bit later. This line seems to have been
overlooked. I'll send a patch to vim-dev.

Jan

--
-[ OpenPGP key ID: 00A0FD5F ]-
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
-- Isaac Asimov

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: