Expr.adoc: automatic variables in the interator infix operators"

This commit is contained in:
2026-06-02 11:35:36 +02:00
parent 02ea20cdb5
commit ee7f488ebb
4 changed files with 20 additions and 8 deletions
+9 -1
View File
@@ -1875,13 +1875,21 @@ TIP: Iterators built on custom data-sources can provide additional named operato
There are also some infixed operators that can be used with iterators. They are defined as follows.
* <<_cat,cat operator>>
* <<_diget,digest operator>>
* <<_digest,digest operator>>
* <<_filter,filter operator>>
* <<_groupby,groupby operator>>
* <<_map,map operator>>
//* <<_reduce,reduce operator>>: applies a binary expression cumulatively to the elements of the iterator, from left to right, to reduce the iterator to a single value.
//* <<_zip,zip operator>>: takes two or more iterators and returns a list of tuples, where the i-th tuple contains the i-th element from each of the input iterators.
==== Automatic variables in operators
At each iteration, the following automatic variables are available for use in the expression of the [blue]`digest`, [blue]`filter`, [blue]`groupby`, and [blue]`map` operators.
* `$_`: the current element of the iterator.
* `$__`: the index of the current element in the iterator, starting from 0.
* `$_#`: the number of elements already visited in the iterator, starting from 0.
---
==== [blue]`cat` operator