Hi all, The index() function returns the lowest index in a List where an item has a value equal to the supplied expression. This function cannot be used to find an item with a specific key/value pair in a List of Dicts (or to use a custom search in a List). You need to resort to using a for loop to find the index.
What do you think about extending the index() function to accept a lambda function (similar to map(), filter() and reduce())? This lambda function will be called with two arguments: the index of the item and the value of the item. If this function returns true, then the search will stop. Currently the index() function accepts four arguments (the first two arguments are mandatory and the last two arguments are optional). To support using a lambda function, a fifth optional argument 'eval' needs to be added. If this is true, then the second 'expr' argument will be evaluated. It would have been simpler to add new arguments if the third argument is a Dict. Regards, Yegappan -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7kOWjK1DahBiUUxo7PBBc%3D1v%2BkDF%2B4GjgEK%3DmOPxPunFg%40mail.gmail.com.