Re: map() and lambda

2019-09-24 Fir de Conversatie Bram Moolenaar
Andy Massimino wrote: > On Thu, Aug 8, 2019, 10:29 AM 'Andy Wokula' via vim_dev < > vim_dev@googlegroups.com> wrote: > > > :h expr-lambda > > > > I think this is a design mistake: > > :echo map([1, 2, 3], {idx, val -> val + 1}) > > > > It should be > > :echo map([1, 2, 3], {val, idx

Re: map() and lambda

2019-09-23 Fir de Conversatie FUJIWARA Takuya
You can use v:val in map()/filter() 2019年9月24日(火) 8:01 Andy Massimino : > I also think this is a problem.. but can't think of any good way to solve > it. My best guess is to add a new scriptversion which would require the > lambda to take exactly two arguments. But this won't catch simply

Re: map() and lambda

2019-09-23 Fir de Conversatie Andy Massimino
I also think this is a problem.. but can't think of any good way to solve it. My best guess is to add a new scriptversion which would require the lambda to take exactly two arguments. But this won't catch simply swapping idx and val by accident. On Thu, Aug 8, 2019, 10:29 AM 'Andy Wokula' via

map() and lambda

2019-08-08 Fir de Conversatie 'Andy Wokula' via vim_dev
:h expr-lambda I think this is a design mistake: :echo map([1, 2, 3], {idx, val -> val + 1}) It should be :echo map([1, 2, 3], {val, idx -> val + 1}) 95% of map() expressions do not need v:key (er, idx). It annoys me whenever I use it. Especially nice: dummy examples that are