Kwargs: map and reduce (#6480)

Migrate array's `map`, `reduce` and `push` functions to use keyword arguments.
This commit is contained in:
Adam Chalmers
2025-04-25 19:09:03 -05:00
committed by GitHub
parent 5a4f8bd522
commit 50f8131d83
35 changed files with 3852 additions and 3498 deletions

View File

@ -181,27 +181,30 @@ description: Result of parsing double_map_fn.kcl
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "increment",
"name": "f",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "increment",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -222,33 +225,37 @@ description: Result of parsing double_map_fn.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "increment",
"name": "f",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "increment",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -269,8 +276,9 @@ description: Result of parsing double_map_fn.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"commentStart": 0,

View File

@ -4,5 +4,5 @@ fn increment(i) {
xs = [0..2]
ys = xs
|> map(%, increment)
|> map(%, increment)
|> map(f = increment)
|> map(f = increment)

View File

@ -8,5 +8,5 @@ fn increment(i) {
xs = [0..2]
ys = xs
|> map(%, increment)
|> map(%, increment)
|> map(f = increment)
|> map(f = increment)