From d2f81330247ee060d557330b2716ccea8f789a50 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 12 Jul 2023 19:27:14 +0200 Subject: docs: misc Co-authored-by: Kevin Pham --- runtime/lua/vim/iter.lua | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'runtime/lua/vim/iter.lua') 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: ---
lua
-- 
cgit