diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-17 16:06:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-17 16:06:29 +0800 |
commit | 200dafb8a5839826bc157bdc9153f1171ce639e1 (patch) | |
tree | 0f2ba228c173892c16b082236f0eb124ad02fab8 /runtime/lua/vim/_meta/vimfn.lua | |
parent | 7f51829cf75e0d3ca546cab0e70a4c089eac40ec (diff) | |
parent | b193674b4a1dce1b348489fa13dd42254b9a3ebb (diff) | |
download | rneovim-200dafb8a5839826bc157bdc9153f1171ce639e1.tar.gz rneovim-200dafb8a5839826bc157bdc9153f1171ce639e1.tar.bz2 rneovim-200dafb8a5839826bc157bdc9153f1171ce639e1.zip |
Merge pull request #24749 from zeertzjq/vim-8.2.3848
vim-patch:8.2.{3848,partial:3849}: reduce() on a string
Diffstat (limited to 'runtime/lua/vim/_meta/vimfn.lua')
-rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 4b90a9e3c0..17eda634e0 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -2017,8 +2017,8 @@ function vim.fn.filewritable(file) end --- of the current item. For a |Dictionary| |v:key| has the key --- of the current item and for a |List| |v:key| has the index of --- the current item. For a |Blob| |v:key| has the index of the ---- current byte. ---- +--- current byte. For a |String| |v:key| has the index of the +--- current character. --- Examples: >vim --- call filter(mylist, 'v:val !~ "OLD"') --- <Removes the items where "OLD" appears. >vim @@ -4937,7 +4937,8 @@ function vim.fn.log10(expr) end --- of the current item. For a |Dictionary| |v:key| has the key --- of the current item and for a |List| |v:key| has the index of --- the current item. For a |Blob| |v:key| has the index of the ---- current byte. +--- current byte. For a |String| |v:key| has the index of the +--- current character. --- Example: >vim --- call map(mylist, '"> " .. v:val .. " <"') --- <This puts "> " before and " <" after each item in "mylist". @@ -6551,9 +6552,9 @@ function vim.fn.readdir(directory, expr) end function vim.fn.readfile(fname, type, max) end --- {func} is called for every item in {object}, which can be a ---- |List| or a |Blob|. {func} is called with two arguments: the ---- result so far and current item. After processing all items ---- the result is returned. +--- |String|, |List| or a |Blob|. {func} is called with two +--- arguments: the result so far and current item. After +--- processing all items the result is returned. --- --- {initial} is the initial result. When omitted, the first item --- in {object} is used and {func} is first called for the second @@ -6564,6 +6565,7 @@ function vim.fn.readfile(fname, type, max) end --- echo reduce([1, 3, 5], { acc, val -> acc + val }) --- echo reduce(['x', 'y'], { acc, val -> acc .. val }, 'a') --- echo reduce(0z1122, { acc, val -> 2 * acc + val }) +--- echo reduce('xyz', { acc, val -> acc .. ',' .. val }) --- < --- --- @param object any |