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
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
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
: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