Skip to content

Commit f99d888

Browse files
committed
add descriptions of grep behavior
1 parent 589127e commit f99d888

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ppcs/ppc0033-map-grep-with-topic.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ This will evaluate `BLOCK` for each element of `LIST`, aliasing `VAR` to each
7272
element. Its behavior will otherwise match `map BLOCK LIST`. It is only
7373
possible to use `my` variables for this.
7474

75+
### `grep my VAR BLOCK LIST`
76+
77+
This will evaluate `BLOCK` for each element of `LIST`, aliasing `VAR` to each
78+
element. Its behavior will otherwise match `grep BLOCK LIST`. It is only
79+
possible to use `my` variables for this.
80+
7581
### `map my (VAR, VAR) BLOCK LIST`
7682

7783
This will evaluate `BLOCK` for each set of two elements in `LIST`, aliasing
@@ -82,6 +88,17 @@ On the last iteration, there may not be enough elements remaining to fill
8288
every `VAR` slot. In this case, a warning will be issued, and the extra `VAR`
8389
slots will be filled with `undef`.
8490

91+
### `grep my (VAR, VAR) BLOCK LIST`
92+
93+
This will evaluate `BLOCK` for each set of two elements in `LIST`, aliasing
94+
the `VAR` to the first of each set, and the second `VAR` to the second. More
95+
than two variables can be used to iterate over sets of three or more items.
96+
97+
On the last iteration, there may not be enough elements remaining to fill
98+
every `VAR` slot. In this case, a warning will be issued, and the extra `VAR`
99+
slots will be filled with `undef`. The extra `undef` values used will also be
100+
included in the returned list.
101+
85102
## Backwards Compatibility
86103

87104
As the syntax chosen is currently invalid, it should not present any backwards

0 commit comments

Comments
 (0)