mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-23 16:08:43 +00:00
66 lines
2.1 KiB
Text
66 lines
2.1 KiB
Text
|
|
================================================================
|
|
OLD NULL-HANDLING
|
|
|
|
|
|
================================================================
|
|
NARROW IN
|
|
|
|
|
|
----------------------------------------------------------------
|
|
mlr cat
|
|
x=1
|
|
x=
|
|
x=7
|
|
|
|
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
|
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
|
x= osum=1 ostype=MT_INT xtype=MT_VOID nstype=MT_VOID nsum=
|
|
x=7 osum= ostype=MT_VOID xtype=MT_INT nstype=MT_VOID nsum=
|
|
sum=
|
|
|
|
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
|
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
|
x= osum=1 ostype=MT_INT xtype=MT_VOID nstype=MT_VOID nsum=
|
|
x=7 osum= ostype=MT_VOID xtype=MT_INT nstype=MT_VOID nsum=
|
|
sum=
|
|
|
|
|
|
----------------------------------------------------------------
|
|
mlr cat
|
|
x=1
|
|
y=
|
|
x=7
|
|
|
|
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
|
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
|
y= osum=1 ostype=MT_INT xtype=MT_ABSENT nstype=MT_INT nsum=1
|
|
x=7 osum=1 ostype=MT_INT xtype=MT_INT nstype=MT_INT nsum=8
|
|
sum=8
|
|
|
|
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
|
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
|
y= osum=1 ostype=MT_INT xtype=MT_ABSENT nstype=MT_INT nsum=1
|
|
x=7 osum=1 ostype=MT_INT xtype=MT_INT nstype=MT_INT nsum=8
|
|
sum=8
|
|
|
|
|
|
----------------------------------------------------------------
|
|
mlr cat
|
|
x=1
|
|
x=
|
|
y=
|
|
x=7
|
|
|
|
mlr --ofs tab put $xtype=typeof($x);$sum = $x + 10; $stype=typeof($sum)
|
|
x=1 xtype=MT_INT sum=11 stype=MT_INT
|
|
x= xtype=MT_VOID sum= stype=MT_VOID
|
|
y= xtype=MT_ABSENT sum=10 stype=MT_INT
|
|
x=7 xtype=MT_INT sum=17 stype=MT_INT
|
|
|
|
mlr --ofs tab put $xtype=typeof($x);$sum = ispresent($x) ? $x + 10 : 999; $stype=typeof($sum)
|
|
x=1 xtype=MT_INT sum=11 stype=MT_INT
|
|
x= xtype=MT_VOID sum= stype=MT_VOID
|
|
y= xtype=MT_ABSENT sum=999 stype=MT_INT
|
|
x=7 xtype=MT_INT sum=17 stype=MT_INT
|
|
|