[...]
> I would like to simplify this code by passing the output of
> `matchfuzzypos()` directly to `filter()` so that it removes the
> entries where a match is located after the tab. But I can't do it,
> because if `filter()` removes one tag name from `taglist_filtered`,
> the next time `pos[i]` is evaluated, it will no longer apply to the
> right item. IOW, I need to filter both lists returned by
> `matchfuzzypos()` simultaneously. The only way I found to do that is
> to temporarily merge the lists into a single one. It works but I
> think it would be easier and more efficient if `matchfuzzypos()`
> returned a single list. Maybe a list of dictionaries:
The filter() function passes the index to the lambda. You can perhaps
use this to filter() one list, and then add the flag to a new list.
Then filter the second list, and compare use the flag from that new
list. I haven't tried this, but something like:
var flagList = []
def Evaluate(i: number, v: string): bool
var match = v =~ 'pattern'
flagList->add(match)
return match
enddef
filter(matches, {i, v -> Evaluate(i, v) })
filter(positions, {i, _ -> flagList[i] })
Alternatively we would need to implement the Python zip() function.
That might be useful anyway.
--
On the other hand, you have different fingers.
-- Steven Wright
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" 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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202010051809.095I9J6U2472499%40masaka.moolenaar.net.