diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-17 13:41:43 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-17 15:20:47 +0800 |
commit | c5576fcc8003280489c0aa0323a966e6de33e31f (patch) | |
tree | 85b5fb71ed9e7c5d28a0491e7ded93c63eecfb10 /runtime/doc/builtin.txt | |
parent | 7f51829cf75e0d3ca546cab0e70a4c089eac40ec (diff) | |
download | rneovim-c5576fcc8003280489c0aa0323a966e6de33e31f.tar.gz rneovim-c5576fcc8003280489c0aa0323a966e6de33e31f.tar.bz2 rneovim-c5576fcc8003280489c0aa0323a966e6de33e31f.zip |
vim-patch:8.2.3848: cannot use reduce() for a string
Problem: Cannot use reduce() for a string.
Solution: Make reduce() work with a string. (Naruhiko Nishino, closes vim/vim#9366)
https://github.com/vim/vim/commit/0ccb5842f5fb103763d106c7aa364d758343c35a
Omit tv_get_first_char() as it doesn't really save much code.
Co-authored-by: rbtnn <naru123456789@gmail.com>
Diffstat (limited to 'runtime/doc/builtin.txt')
-rw-r--r-- | runtime/doc/builtin.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 0b24ed8d85..6303d73db5 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5514,9 +5514,9 @@ readfile({fname} [, {type} [, {max}]]) *readfile()* reduce({object}, {func} [, {initial}]) *reduce()* *E998* {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 @@ -5527,6 +5527,7 @@ reduce({object}, {func} [, {initial}]) *reduce()* *E99 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 }) < reg_executing() *reg_executing()* |