mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 10:15:36 +00:00
Docs for funct keyword
This commit is contained in:
parent
17524b76cc
commit
6ff686fa8f
11 changed files with 59 additions and 1 deletions
|
|
@ -2854,6 +2854,11 @@ KEYWORDS FOR PUT AND FILTER
|
|||
|
||||
Example: 'func f(a,b) { return sqrt(a**2+b**2)} $d = f($x, $y)'
|
||||
|
||||
funct
|
||||
funct: used for saying that a function argument is a user-defined function.
|
||||
|
||||
Example: 'func g(num a, num b, funct f) :num { return f(a**2+b**2) }'
|
||||
|
||||
if
|
||||
if: starts an if/elif/elif chain. The body statements must be wrapped
|
||||
in curly braces.
|
||||
|
|
|
|||
|
|
@ -2833,6 +2833,11 @@ KEYWORDS FOR PUT AND FILTER
|
|||
|
||||
Example: 'func f(a,b) { return sqrt(a**2+b**2)} $d = f($x, $y)'
|
||||
|
||||
funct
|
||||
funct: used for saying that a function argument is a user-defined function.
|
||||
|
||||
Example: 'func g(num a, num b, funct f) :num { return f(a**2+b**2) }'
|
||||
|
||||
if
|
||||
if: starts an if/elif/elif chain. The body statements must be wrapped
|
||||
in curly braces.
|
||||
|
|
|
|||
|
|
@ -871,6 +871,7 @@ filter
|
|||
float
|
||||
for
|
||||
func
|
||||
funct
|
||||
if
|
||||
in
|
||||
int
|
||||
|
|
@ -1106,6 +1107,10 @@ func: used for defining a user-defined function.
|
|||
|
||||
Example: 'func f(a,b) { return sqrt(a**2+b**2)} $d = f($x, $y)'
|
||||
|
||||
funct: used for saying that a function argument is a user-defined function.
|
||||
|
||||
Example: 'func g(num a, num b, funct f) :num { return f(a**2+b**2) }'
|
||||
|
||||
if: starts an if/elif/elif chain. The body statements must be wrapped
|
||||
in curly braces.
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ var KEYWORD_USAGE_TABLE = []tKeywordUsageEntry{
|
|||
{"float", floatKeywordUsage},
|
||||
{"for", forKeywordUsage},
|
||||
{"func", funcKeywordUsage},
|
||||
{"funct", functKeywordUsage},
|
||||
{"if", ifKeywordUsage},
|
||||
{"in", inKeywordUsage},
|
||||
{"int", intKeywordUsage},
|
||||
|
|
@ -402,6 +403,13 @@ func funcKeywordUsage() {
|
|||
Example: 'func f(a,b) { return sqrt(a**2+b**2)} $d = f($x, $y)'`)
|
||||
}
|
||||
|
||||
func functKeywordUsage() {
|
||||
fmt.Println(
|
||||
`used for saying that a function argument is a user-defined function.
|
||||
|
||||
Example: 'func g(num a, num b, funct f) :num { return f(a**2+b**2) }'`)
|
||||
}
|
||||
|
||||
func ifKeywordUsage() {
|
||||
fmt.Println(
|
||||
`starts an if/elif/elif chain. The body statements must be wrapped
|
||||
|
|
|
|||
|
|
@ -2833,6 +2833,11 @@ KEYWORDS FOR PUT AND FILTER
|
|||
|
||||
Example: 'func f(a,b) { return sqrt(a**2+b**2)} $d = f($x, $y)'
|
||||
|
||||
funct
|
||||
funct: used for saying that a function argument is a user-defined function.
|
||||
|
||||
Example: 'func g(num a, num b, funct f) :num { return f(a**2+b**2) }'
|
||||
|
||||
if
|
||||
if: starts an if/elif/elif chain. The body statements must be wrapped
|
||||
in curly braces.
|
||||
|
|
|
|||
11
man/mlr.1
11
man/mlr.1
|
|
@ -4724,6 +4724,17 @@ func: used for defining a user-defined function.
|
|||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "funct"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
.\}
|
||||
.nf
|
||||
funct: used for saying that a function argument is a user-defined function.
|
||||
|
||||
Example: 'func g(num a, num b, funct f) :num { return f(a**2+b**2) }'
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "if"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
|
|
|
|||
1
test/cases/dsl-typedecl/0016/cmd
Normal file
1
test/cases/dsl-typedecl/0016/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --from test/input/abixy put -f ${CASEDIR}/mlr
|
||||
0
test/cases/dsl-typedecl/0016/experr
Normal file
0
test/cases/dsl-typedecl/0016/experr
Normal file
10
test/cases/dsl-typedecl/0016/expout
Normal file
10
test/cases/dsl-typedecl/0016/expout
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,d=0.8052985815845617
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,d=0.9209978658539777
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,d=0.3953756915115773
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,d=0.40431685157744135
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,d=1.036584492737304
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,d=0.7218928080781029
|
||||
a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,d=0.6399847495033941
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,d=1.1450751065334548
|
||||
a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,d=0.750209926579025
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,d=1.0770861812414247
|
||||
9
test/cases/dsl-typedecl/0016/mlr
Normal file
9
test/cases/dsl-typedecl/0016/mlr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
func f(x) {
|
||||
return sqrt(x)
|
||||
};
|
||||
|
||||
func g(num a, num b, funct f) :num {
|
||||
return f(a**2+b**2)
|
||||
};
|
||||
|
||||
$d = g($x, $y, f);
|
||||
1
todo.txt
1
todo.txt
|
|
@ -4,7 +4,6 @@ PUNCHDOWN LIST
|
|||
* blockers:
|
||||
- fractional-strptime
|
||||
- improved regex doc w/ lots of examples
|
||||
- kw olh for func and funct both
|
||||
- cmp-matrices
|
||||
- all-contribs: twi dm
|
||||
- license triple-checks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue