1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Allow multiple functions with different arities

This commit is contained in:
Nicolas Williams
2014-06-14 23:53:15 -05:00
parent 63dbac28ad
commit 088a42fc53
3 changed files with 51 additions and 2 deletions

View File

@@ -1549,6 +1549,11 @@ sections:
With that definition, `addvalue(.foo)` will add the current
input's `.foo` field to each element of the array.
Multiple definitions using the same function name are allowed.
Each re-definition replaces the previous one for the same
number of function arguments, but only for references from
functions (or main program) subsequent to the re-definition.
examples:
- program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))'
input: '[[1,2],[10,20]]'