Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Nested-function/Jq/nested-function.jq
Normal file
12
Task/Nested-function/Jq/nested-function.jq
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def makeList(separator):
|
||||
# input: {text: _, counter: _}
|
||||
def makeItem(item):
|
||||
(.counter + 1) as $counter
|
||||
| .text += "\($counter)\(separator)\(item)\n"
|
||||
| .counter = $counter;
|
||||
|
||||
{text:"", counter:0} | makeItem("first") | makeItem("second") | makeItem("third")
|
||||
| .text
|
||||
;
|
||||
|
||||
makeList(". ")
|
||||
Loading…
Add table
Add a link
Reference in a new issue