Implement add/1 (#3144)

This commit is contained in:
myaaaaaaaaa authored and GitHub committed 2024-08-20 21:02:24 +09:00
1 parent 137018d2ae
commit 0b5ae30f19
5 files changed
+35 -4

No files matched your search

+7 -1
View File
@@ -1300,7 +1300,7 @@ sections:
input: '[1,[[],{"a":2}]]'
output: ['[[0],[1,1,"a"]]']
- title: "`add`"
- title: "`add`, `add(generator)`"
body: |
The filter `add` takes as input an array, and produces as
@@ -1311,6 +1311,9 @@ sections:
If the input is an empty array, `add` returns `null`.
`add(generator)` operates on the given generator rather than
the input.
examples:
- program: add
input: '["a","b","c"]'
@@ -1321,6 +1324,9 @@ sections:
- program: add
input: '[]'
output: ["null"]
- program: add(.[].a)
input: '[{"a":3}, {"a":5}, {"b":6}]'
output: ['8']
- title: "`any`, `any(condition)`, `any(generator; condition)`"
body: |