patch 9.1.0027: Vim is missing a foreach() func

Problem:  Vim is missing a foreach() func
Solution: Implement foreach({expr1}, {expr2}) function,
          which applies {expr2} for each item in {expr1}
          without changing it (Ernie Rael)

closes: #12166

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael
2024-01-13 11:47:33 +01:00
committed by Christian Brabandt
parent d8cb1ddab7
commit e79e207760
12 changed files with 303 additions and 61 deletions

View File

@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 9.1. Last change: 2023 May 06
*usr_41.txt* For Vim version 9.1. Last change: 2024 Jan 13
VIM USER MANUAL - by Bram Moolenaar
@ -798,6 +798,7 @@ List manipulation: *list-functions*
filter() remove selected items from a List
map() change each List item
mapnew() make a new List with changed items
foreach() apply function to List items
reduce() reduce a List to a value
slice() take a slice of a List
sort() sort a List
@ -829,6 +830,7 @@ Dictionary manipulation: *dict-functions*
filter() remove selected entries from a Dictionary
map() change each Dictionary entry
mapnew() make a new Dictionary with changed items
foreach() apply function to Dictionary items
keys() get List of Dictionary keys
values() get List of Dictionary values
items() get List of Dictionary key-value pairs