absent-handling experiments

This commit is contained in:
John Kerl 2016-04-07 09:21:50 -04:00
parent 8cb02c6b0e
commit 29dce9986e
3 changed files with 174 additions and 9 deletions

View file

@ -4,7 +4,65 @@ ABSENT-HANDLING
mlr put $a = $a * 2
a=2,b=2
a=6,b=4
a=,b=6
x=7,b=8,a=2
a=,b=4
x=,b=6,a=2
a=14,b=8
mlr put $new = $a * 2
a=1,b=2,new=2
a=,b=4,new=
x=,b=6,new=2
a=7,b=8,new=14
mlr put $new = @nonesuch * 2
a=1,b=2,new=2
a=,b=4,new=2
x=,b=6,new=2
a=7,b=8,new=2
mlr put $new = @nonesuch * $a
a=1,b=2,new=1
a=,b=4,new=
x=,b=6,new=
a=7,b=8,new=7
mlr put @sum = @sum + $a; emit @sum
sum=1
a=1,b=2
sum=
a=,b=4
sum=
x=,b=6
sum=
a=7,b=8
mlr put @product = @product * $a; emit @product
product=1
a=1,b=2
product=
a=,b=4
product=
x=,b=6
product=
a=7,b=8
mlr put begin { @sum = 10 }; @sum = @sum + $a; emit @sum
sum=11
a=1,b=2
sum=
a=,b=4
sum=
x=,b=6
sum=
a=7,b=8
mlr put begin { @product = 10 }; @product = @product * $a; emit @product
product=10
a=1,b=2
product=
a=,b=4
product=
x=,b=6
product=
a=7,b=8

View file

@ -68,9 +68,58 @@ announce ABSENT-HANDLING
run_mlr put '$a = $a * 2' <<EOF
a=1,b=2
a=3,b=4
a=,b=6
x=7,b=8
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put '$new = $a * 2' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put '$new = @nonesuch * 2' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put '$new = @nonesuch * $a' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put '@sum = @sum + $a; emit @sum' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put '@product = @product * $a; emit @product' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put 'begin { @sum = 10 }; @sum = @sum + $a; emit @sum' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
run_mlr put 'begin { @product = 10 }; @product = @product * $a; emit @product' <<EOF
a=1,b=2
a=,b=4
x=,b=6
a=7,b=8
EOF
# ================================================================

View file

@ -4,7 +4,65 @@ ABSENT-HANDLING
mlr put $a = $a * 2
a=2,b=2
a=6,b=4
a=,b=6
x=7,b=8,a=2
a=,b=4
x=,b=6,a=2
a=14,b=8
mlr put $new = $a * 2
a=1,b=2,new=2
a=,b=4,new=
x=,b=6,new=2
a=7,b=8,new=14
mlr put $new = @nonesuch * 2
a=1,b=2,new=2
a=,b=4,new=2
x=,b=6,new=2
a=7,b=8,new=2
mlr put $new = @nonesuch * $a
a=1,b=2,new=1
a=,b=4,new=
x=,b=6,new=
a=7,b=8,new=7
mlr put @sum = @sum + $a; emit @sum
sum=1
a=1,b=2
sum=
a=,b=4
sum=
x=,b=6
sum=
a=7,b=8
mlr put @product = @product * $a; emit @product
product=1
a=1,b=2
product=
a=,b=4
product=
x=,b=6
product=
a=7,b=8
mlr put begin { @sum = 10 }; @sum = @sum + $a; emit @sum
sum=11
a=1,b=2
sum=
a=,b=4
sum=
x=,b=6
sum=
a=7,b=8
mlr put begin { @product = 10 }; @product = @product * $a; emit @product
product=10
a=1,b=2
product=
a=,b=4
product=
x=,b=6
product=
a=7,b=8