mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-25 17:04:01 +00:00
func/subr UT
This commit is contained in:
parent
9b48c5abd6
commit
486dc80e5c
3 changed files with 9 additions and 7 deletions
|
|
@ -33184,6 +33184,9 @@ zee wye 8 0.5985540091064224 0.976181385699006 8000.598554
|
|||
hat wye 9 0.03144187646093577 0.7495507603507059 9000.031442
|
||||
pan wye 10 0.5026260055412137 0.9526183602969864 10000.502626
|
||||
|
||||
mlr --opprint --from ./reg_test/input/abixy put func f(x,y,z){$nnn=999; local n=10; return $y} $o=f($i,$x,$y)
|
||||
mlr: assignments to $-variables are not valid within func blocks.
|
||||
|
||||
mlr --opprint --from ./reg_test/input/abixy put subr s(a,b) { $[a] = b } call s("W", 999)
|
||||
a b i x y W
|
||||
pan pan 1 0.3467901443380824 0.7268028627434533 999
|
||||
|
|
@ -33269,7 +33272,7 @@ mlr --from ./reg_test/input/abixy put
|
|||
|
||||
mlr: return statements within user-defined functions must return a value.
|
||||
|
||||
mlr --from s --opprint put func f(x) {return k} for (k,v in $*) {$o=f($x)}
|
||||
mlr --from ./reg_test/input/abixy --opprint put func f(x) {return k} for (k,v in $*) {$o=f($x)}
|
||||
a b i x y
|
||||
pan pan 1 0.3467901443380824 0.7268028627434533
|
||||
eks pan 2 0.7586799647899636 0.5221511083334797
|
||||
|
|
@ -33282,7 +33285,7 @@ zee wye 8 0.5985540091064224 0.976181385699006
|
|||
hat wye 9 0.03144187646093577 0.7495507603507059
|
||||
pan wye 10 0.5026260055412137 0.9526183602969864
|
||||
|
||||
mlr --from s --opprint put subr foo() {print "k is [".k."]"} for (k,v in $*) {call foo()}
|
||||
mlr --from ./reg_test/input/abixy --opprint put subr foo() {print "k is [".k."]"} for (k,v in $*) {call foo()}
|
||||
k is []
|
||||
k is []
|
||||
k is []
|
||||
|
|
|
|||
|
|
@ -1738,9 +1738,6 @@ run_mlr put -v '@["s"] = $x; emitp all' $indir/abixy
|
|||
|
||||
run_mlr put -v '@["t"]["u"] = $y; emitp all' $indir/abixy
|
||||
|
||||
# xxx indirect from full srec
|
||||
# xxx full srec from indirect
|
||||
|
||||
# xxx @* on the right
|
||||
# xxx @* on the left
|
||||
|
||||
|
|
@ -4608,8 +4605,7 @@ announce USER-DEFINED FUNCTIONS AND SUBROUTINES
|
|||
|
||||
run_mlr --opprint --from $indir/abixy put 'func f(u,v){return u+v} $o=f(NR*1000,$x)'
|
||||
|
||||
# xxx expect fail
|
||||
#run_mlr --opprint --from $indir/abixy put 'func f(x,y,z){$nnn=999; local n=10; return $y} $o=f($i,$x,$y)'
|
||||
mlr_expect_fail --opprint --from $indir/abixy put 'func f(x,y,z){$nnn=999; local n=10; return $y} $o=f($i,$x,$y)'
|
||||
|
||||
run_mlr --opprint --from $indir/abixy put 'subr s(a,b) { $[a] = b } call s("W", 999)'
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ MORE:
|
|||
* inverse-transform-sampling example at cookbook.
|
||||
* 10-min
|
||||
|
||||
* final xxx check
|
||||
* final valgrind check
|
||||
|
||||
----------------------------------------------------------------
|
||||
4.6.0 ideas:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue