diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2023-07-12 19:27:14 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2023-08-03 14:01:53 +0200 |
commit | d2f81330247ee060d557330b2716ccea8f789a50 (patch) | |
tree | cfc05f6f29b46d280a0207d71df51d8cda9b402e /runtime/lua/vim/iter.lua | |
parent | 214b125132778c5d51d4d7e673d31a9be835e150 (diff) | |
download | rneovim-d2f81330247ee060d557330b2716ccea8f789a50.tar.gz rneovim-d2f81330247ee060d557330b2716ccea8f789a50.tar.bz2 rneovim-d2f81330247ee060d557330b2716ccea8f789a50.zip |
docs: misc
Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
Diffstat (limited to 'runtime/lua/vim/iter.lua')
-rw-r--r-- | runtime/lua/vim/iter.lua | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index 7bffcc9c20..a278e96a5f 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -1,22 +1,15 @@ ---@defgroup vim.iter --- ---- This module provides a generic interface for working with ---- iterables: tables, lists, iterator functions, pair()/ipair()-like iterators, ---- and \`vim.iter()\` objects. ---- ---- \*vim.iter()\* wraps its table or function argument into an \*Iter\* object ---- with methods (such as |Iter:filter()| and |Iter:map()|) that transform the ---- underlying source data. These methods can be chained together to create ---- iterator "pipelines". Each pipeline stage receives as input the output ---- values from the prior stage. The values used in the first stage of the ---- pipeline depend on the type passed to this function: +--- \*vim.iter()\* is an interface for |iterable|s: it wraps a table or function argument into an +--- \*Iter\* object with methods (such as |Iter:filter()| and |Iter:map()|) that transform the +--- underlying source data. These methods can be chained together to create iterator "pipelines". +--- Each pipeline stage receives as input the output values from the prior stage. The values used in +--- the first stage of the pipeline depend on the type passed to this function: --- --- - List tables pass only the value of each element ---- - Non-list tables pass both the key and value of each element ---- - Function iterators pass all of the values returned by their respective ---- function ---- - Tables with a metatable implementing __call are treated as function ---- iterators +--- - Non-list (dict) tables pass both the key and value of each element +--- - Function |iterator|s pass all of the values returned by their respective function +--- - Tables with a metatable implementing |__call()| are treated as function iterators --- --- Examples: --- <pre>lua |