doc updates

This commit is contained in:
John Kerl 2016-02-27 10:56:21 -05:00
parent 0bf436d569
commit b652d0e8da
4 changed files with 44 additions and 28 deletions

View file

@ -69,7 +69,7 @@ function_lookup_t FUNCTION_LOOKUP_TABLE[] = {
{FUNC_CLASS_CONVERSION, "hexfmt", 1, "Convert int to string, e.g. 255 to \"0xff\"."},
{FUNC_CLASS_CONVERSION, "int", 1, "Convert int/float/bool/string to int."},
{FUNC_CLASS_CONVERSION, "string", 1, "Convert int/float/bool/string to string."},
{FUNC_CLASS_CONVERSION, "typeof", 1, "Convert argument to type of argument (e.g. string). For debug."},
{FUNC_CLASS_CONVERSION, "typeof", 1, "Convert argument to type of argument (e.g. MT_STRING). For debug."},
{FUNC_CLASS_STRING, ".", 2, "String concatenation."},
{FUNC_CLASS_STRING, "gsub", 3, "Example: '$name=gsub($name, \"old\", \"new\")'\n(replace all)."},

View file

@ -8,15 +8,14 @@ TOP-OF-LIST SUMMARY
* rh/fedora/centos mlr-3.4.0
* tri-split null. then RT @sum[$group] = @sum[$group] + $value etc. be sure $nosuch sums to MT_ABSENT.
* tri-split null. then RT @sum[$group] += $value etc. be sure $nosuch sums to MT_ABSENT.
? @x = $0 ? $0 = @x ?
* parameterized-emit () vs. no-() unification
* parameterized-emit neatens
* += et al. UTs
? unset/clear? for srec as well as oosvar. either rhs="" or remove key. latter since ass't does former. cf. cut -x.
* allow begin/end srec assignments in the grammar, to allow better error messages than 'syntax error' in the caller
* double-check oosvar+emit+tri-split-null by re-implementing as many mappers as possible using ossvars + emit
? unset/clear ... ?
? rethink filter ... ?
* 64-bit lengths for containers. test with 5-billion-integer-seq data.
@ -52,7 +51,8 @@ PARAMETERIZED EMIT
* handle too-short, too-long, just-right cases
* rename functions
* rename variables as needed for clarity
* needs significant comment-by-example
* rename 'temp' functions
* needs significant comment-by-example in the code
* emit w/ and w/o parentheses in the grammar -- try to get just one
* mld section, w/ olh brief example & xref to it.
@ -62,13 +62,15 @@ TRI-SPLIT NULL, AND += ET AL.
* to mld:ref
! UTs
-
----------------------------------------------------------------
mlr put '@sum += $x; filter false; end{emit @sum}' ../data/small
mlr put '@sum += $x; filter false; end{emit(@sum)}' ../data/small
mlr put '@sum[$a] += $x; filter false; end{emit(@sum, "a")}' ../data/small
mlr put '$nonesuch = @nonesuch' ../data/small
----------------------------------------------------------------
echo x=1,y=2 | mlr put '$z = $x + $y' # $y is MT_INT
echo x=1,y= | mlr put '$z = $x + $y' # $y is MT_EMPTY: key present but value empty
echo x=1,y= | mlr put '$z = $x + $u' # $y is MT_ABSENT : key not present
@ -85,13 +87,22 @@ x=1,y=2
x=1,y=
x=1,y=
echo x=1,y=2 | mlr put '$z = $x + $y; $x=typeof($x)' # $y is MT_INT
echo x=1,y= | mlr put '$z = $x + $y' # $y is MT_EMPTY: key present but value empty
echo x=1,y= | mlr put '$z = $x + $u' # $y is MT_ABSENT : key not present
----------------------------------------------------------------
echo x=1,y=2 | mlr put '$z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)'
echo x=1,y= | mlr put '$z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)'
echo x=1,y= | mlr put '$z = $x + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z)'
echo x=1,y=2 | mlr put '@s = @s + $y' # @s is MT_UNINIT on first record, then MT_INT on second
echo x=1,y= | mlr put '@s = @s + $y' # MT_
echo x=1,y= | mlr put '@s = @s + $u' # MT_
echo x=1,y=2 | mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)'
echo x=1,y= | mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)'
echo x=1,y= | mlr put '@s = @s + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z)'
x=MT_INT,y=MT_INT,z=MT_INT
x=MT_INT,y=MT_VOID,z=MT_VOID
x=MT_INT,y=MT_VOID,z=MT_VOID
x=MT_INT,y=MT_INT,z=MT_ABSENT
x=MT_INT,y=MT_VOID,z=MT_ABSENT
x=MT_INT,y=MT_VOID,z=MT_ABSENT
================================================================
64-BIT CONTAINER SIZES
@ -132,12 +143,6 @@ OOSVARS:
> top?
- uniq?
o DSL more:
- people will ask for an unset/clear syntax
- people will ask for +=, -=, etc.
- if / else ... not yet (if ever) but think carefully about how not to break the (possible) future while
implementing the present
o perf notes:
$ time mlr stats1 -a mean -f x ../data/big.dkvp

View file

@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2016-02-26
.\" Date: 2016-02-27
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2016-02-26" "\ \&" "\ \&"
.TH "MILLER" "1" "2016-02-27" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -156,12 +156,12 @@ output separator to the given value.
.\}
.nf
+ + - - * / // % ** | ^ & ~ << >> == != =~ !=~ > >= < <= && || ^^ ! ? : isnull
isnotnull boolean float fmtnum hexfmt int string . gsub strlen sub tolower
toupper abs acos acosh asin asinh atan atan2 atanh cbrt ceil cos cosh erf erfc
exp expm1 floor invqnorm log log10 log1p logifit madd max mexp min mmul msub
pow qnorm round roundm sgn sin sinh sqrt tan tanh urand urand32 urandint
dhms2fsec dhms2sec fsec2dhms fsec2hms gmt2sec hms2fsec hms2sec sec2dhms
sec2gmt sec2hms strftime strptime systime
isnotnull boolean float fmtnum hexfmt int string typeof . gsub strlen sub
tolower toupper abs acos acosh asin asinh atan atan2 atanh cbrt ceil cos cosh
erf erfc exp expm1 floor invqnorm log log10 log1p logifit madd max mexp min
mmul msub pow qnorm round roundm sgn sin sinh sqrt tan tanh urand urand32
urandint dhms2fsec dhms2sec fsec2dhms fsec2hms gmt2sec hms2fsec hms2sec
sec2dhms sec2gmt sec2hms strftime strptime systime
Please use "mlr --help-function {function name}" for function-specific help.
Please use "mlr --help-all-functions" or "mlr -f" for help on all functions.
.fi
@ -1459,6 +1459,15 @@ printf-style format string, e.g. "%06lld".
.fi
.if n \{\
.RE
.SS "typeof"
.if n \{\
.RS 0
.\}
.nf
(class=conversion #args=1): Convert argument to type of argument (e.g. MT_STRING). For debug.
.fi
.if n \{\
.RE
.SS "."
.if n \{\
.RS 0

View file

@ -372,8 +372,8 @@ Verbs:
Functions for the filter and put verbs:
+ + - - * / // % ** | ^ &amp; ~ &lt;&lt; &gt;&gt; == != =~ !=~ &gt; &gt;= &lt; &lt;= &amp;&amp; || ^^ ! ? :
isnull isnotnull boolean float fmtnum hexfmt int string . gsub strlen sub
tolower toupper abs acos acosh asin asinh atan atan2 atanh cbrt ceil cos
isnull isnotnull boolean float fmtnum hexfmt int string typeof . gsub strlen
sub tolower toupper abs acos acosh asin asinh atan atan2 atanh cbrt ceil cos
cosh erf erfc exp expm1 floor invqnorm log log10 log1p logifit madd max mexp
min mmul msub pow qnorm round roundm sgn sin sinh sqrt tan tanh urand
urand32 urandint dhms2fsec dhms2sec fsec2dhms fsec2hms gmt2sec hms2fsec
@ -3714,6 +3714,8 @@ int (class=conversion #args=1): Convert int/float/bool/string to int.
string (class=conversion #args=1): Convert int/float/bool/string to string.
typeof (class=conversion #args=1): Convert argument to type of argument (e.g. MT_STRING). For debug.
. (class=string #args=2): String concatenation.
gsub (class=string #args=3): Example: '$name=gsub($name, "old", "new")'