diff --git a/c/dsl/function_manager.c b/c/dsl/function_manager.c index 3d4b3c33f..ff0acc27d 100644 --- a/c/dsl/function_manager.c +++ b/c/dsl/function_manager.c @@ -329,7 +329,7 @@ static function_lookup_t FUNCTION_LOOKUP_TABLE[] = { {FUNC_CLASS_TYPING, "is_present", 1,0, "True if field is present in input, false otherwise."}, {FUNC_CLASS_TYPING, "is_string", 1,0, "True if field is present with string (including empty-string) value"}, - {FUNC_CLASS_TYPING, "asserting_absent", 1,0, "Returns argument if it is absent in the input ata, else throws an error."}, + {FUNC_CLASS_TYPING, "asserting_absent", 1,0, "Returns argument if it is absent in the input data, else throws an error."}, {FUNC_CLASS_TYPING, "asserting_bool", 1,0, "Returns argument if it is present with boolean value, else throws an error."}, {FUNC_CLASS_TYPING, "asserting_boolean", 1,0, "Returns argument if it is present with boolean value, else throws an error."}, {FUNC_CLASS_TYPING, "asserting_empty", 1,0, "Returns argument if it is present in input with empty value, else throws an error."}, diff --git a/c/todo.txt b/c/todo.txt index d1074837c..5bb467929 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -8,9 +8,11 @@ BUGFIXES ! windows port +* mlrfunc docsection: + - POKI_RUN_UNESCAPED + * rh/fedora/centos * ship ./configure, w/ clean-target mods -? mlrfunc docsection? * start a draft-5.1.0-relnotes.md - incl. json-skip-arrays-on-input @@ -170,6 +172,7 @@ COMPARES: 5.2.0 IDEAS: * json_encode / json_decode functions? (map->string and string->map) + - array handling ... * strptime/strftime: - strptime w/ fractional seconds. maybe %OS? diff --git a/doc/content-for-reference-dsl.html b/doc/content-for-reference-dsl.html index 8fe40f2ca..fe5d4baf4 100644 --- a/doc/content-for-reference-dsl.html +++ b/doc/content-for-reference-dsl.html @@ -1216,7 +1216,1140 @@ notion of optional or default-on-absent arguments. All argument-passing is positional rather than by name; arguments are passed by value, not by reference. -POKI_RUN_COMMAND{{mlr --help-all-functions | fmt -80}}HERE +

You can get a list of all functions using mlr -F. + +

Operators

+ +
+
++
++
+-
+-
+*
+/
+//
+%
+**
+|
+^
+&
+~
+<<
+>>
+==
+!=
+=~
+!=~
+>
+>=
+<
+<=
+&&
+||
+^^
+!
+? :
+.
+
+
+ + +

abs

+ +

+

+
+abs (class=math #args=1): Absolute value.
+
+
+ +

acos

+ +

+

+
+acos (class=math #args=1): Inverse trigonometric cosine.
+
+
+ +

acosh

+ +

+

+
+acosh (class=math #args=1): Inverse hyperbolic cosine.
+
+
+ +

asin

+ +

+

+
+asin (class=math #args=1): Inverse trigonometric sine.
+
+
+ +

asinh

+ +

+

+
+asinh (class=math #args=1): Inverse hyperbolic sine.
+
+
+ +

asserting_absent

+ +

+

+
+asserting_absent (class=typing #args=1): Returns argument if it is absent in the
+input ata, else throws an error.
+
+
+ +

asserting_bool

+ +

+

+
+asserting_bool (class=typing #args=1): Returns argument if it is present with
+boolean value, else throws an error.
+
+
+ +

asserting_boolean

+ +

+

+
+asserting_boolean (class=typing #args=1): Returns argument if it is present with
+boolean value, else throws an error.
+
+
+ +

asserting_empty

+ +

+

+
+asserting_empty (class=typing #args=1): Returns argument if it is present in
+input with empty value, else throws an error.
+
+
+ +

asserting_empty_map

+ +

+

+
+asserting_empty_map (class=typing #args=1): Returns argument if it is a map with
+empty value, else throws an error.
+
+
+ +

asserting_float

+ +

+

+
+asserting_float (class=typing #args=1): Returns argument if it is present with
+float value, else throws an error.
+
+
+ +

asserting_int

+ +

+

+
+asserting_int (class=typing #args=1): Returns argument if it is present with int
+value, else throws an error.
+
+
+ +

asserting_map

+ +

+

+
+asserting_map (class=typing #args=1): Returns argument if it is a map, else
+throws an error.
+
+
+ +

asserting_nonempty_map

+ +

+

+
+asserting_nonempty_map (class=typing #args=1): Returns argument if it is a
+non-empty map, else throws an error.
+
+
+ +

asserting_not_empty

+ +

+

+
+asserting_not_empty (class=typing #args=1): Returns argument if it is present in
+input with non-empty value, else throws an error.
+
+
+ +

asserting_not_map

+ +

+

+
+asserting_not_map (class=typing #args=1): Returns argument if it is not a map,
+else throws an error.
+
+
+ +

asserting_not_null

+ +

+

+
+asserting_not_null (class=typing #args=1): Returns argument if it is non-null
+(non-empty and non-absent), else throws an error.
+
+
+ +

asserting_null

+ +

+

+
+asserting_null (class=typing #args=1): Returns argument if it is null (empty or
+absent), else throws an error.
+
+
+ +

asserting_numeric

+ +

+

+
+asserting_numeric (class=typing #args=1): Returns argument if it is present with
+int or float value, else throws an error.
+
+
+ +

asserting_present

+ +

+

+
+asserting_present (class=typing #args=1): Returns argument if it is present in
+input, else throws an error.
+
+
+ +

asserting_string

+ +

+

+
+asserting_string (class=typing #args=1): Returns argument if it is present with
+string (including empty-string) value, else throws an error.
+
+
+ +

atan

+ +

+

+
+atan (class=math #args=1): One-argument arctangent.
+
+
+ +

atan2

+ +

+

+
+atan2 (class=math #args=2): Two-argument arctangent.
+
+
+ +

atanh

+ +

+

+
+atanh (class=math #args=1): Inverse hyperbolic tangent.
+
+
+ +

boolean

+ +

+

+
+boolean (class=conversion #args=1): Convert int/float/bool/string to boolean.
+
+
+ +

cbrt

+ +

+

+
+cbrt (class=math #args=1): Cube root.
+
+
+ +

ceil

+ +

+

+
+ceil (class=math #args=1): Ceiling: nearest integer at or above.
+
+
+ +

cos

+ +

+

+
+cos (class=math #args=1): Trigonometric cosine.
+
+
+ +

cosh

+ +

+

+
+cosh (class=math #args=1): Hyperbolic cosine.
+
+
+ +

depth

+ +

+

+
+depth (class=maps #args=1): Prints maximum depth of hashmap: ''. Scalars have
+depth 0.
+
+
+ +

dhms2fsec

+ +

+

+
+dhms2fsec (class=time #args=1): Recovers floating-point seconds as in
+dhms2fsec("5d18h53m20.250000s") = 500000.250000
+
+
+ +

dhms2sec

+ +

+

+
+dhms2sec (class=time #args=1): Recovers integer seconds as in
+dhms2sec("5d18h53m20s") = 500000
+
+
+ +

erf

+ +

+

+
+erf (class=math #args=1): Error function.
+
+
+ +

erfc

+ +

+

+
+erfc (class=math #args=1): Complementary error function.
+
+
+ +

exp

+ +

+

+
+exp (class=math #args=1): Exponential function e**x.
+
+
+ +

expm1

+ +

+

+
+expm1 (class=math #args=1): e**x - 1.
+
+
+ +

float

+ +

+

+
+float (class=conversion #args=1): Convert int/float/bool/string to float.
+
+
+ +

floor

+ +

+

+
+floor (class=math #args=1): Floor: nearest integer at or below.
+
+
+ +

fmtnum

+ +

+

+
+fmtnum (class=conversion #args=2): Convert int/float/bool to string using
+printf-style format string, e.g. '$s = fmtnum($n, "%06lld")'.
+
+
+ +

fsec2dhms

+ +

+

+
+fsec2dhms (class=time #args=1): Formats floating-point seconds as in
+fsec2dhms(500000.25) = "5d18h53m20.250000s"
+
+
+ +

fsec2hms

+ +

+

+
+fsec2hms (class=time #args=1): Formats floating-point seconds as in
+fsec2hms(5000.25) = "01:23:20.250000"
+
+
+ +

gmt2sec

+ +

+

+
+gmt2sec (class=time #args=1): Parses GMT timestamp as integer seconds since the
+epoch.
+
+
+ +

gsub

+ +

+

+
+gsub (class=string #args=3): Example: '$name=gsub($name, "old", "new")' (replace
+all).
+
+
+ +

haskey

+ +

+

+
+haskey (class=maps #args=2): True/false if map has/hasn't key, e.g. 'haskey($*,
+"a")' or 'haskey(mymap, mykey)'. Error if 1st argument is not a map.
+
+
+ +

hexfmt

+ +

+

+
+hexfmt (class=conversion #args=1): Convert int to string, e.g. 255 to "0xff".
+
+
+ +

hms2fsec

+ +

+

+
+hms2fsec (class=time #args=1): Recovers floating-point seconds as in
+hms2fsec("01:23:20.250000") = 5000.250000
+
+
+ +

hms2sec

+ +

+

+
+hms2sec (class=time #args=1): Recovers integer seconds as in hms2sec("01:23:20")
+= 5000
+
+
+ +

int

+ +

+

+
+int (class=conversion #args=1): Convert int/float/bool/string to int.
+
+
+ +

invqnorm

+ +

+

+
+invqnorm (class=math #args=1): Inverse of normal cumulative distribution
+function. Note that invqorm(urand()) is normally distributed.
+
+
+ +

is_absent

+ +

+

+
+is_absent (class=typing #args=1): False if field is present in input, false
+otherwise
+
+
+ +

is_bool

+ +

+

+
+is_bool (class=typing #args=1): True if field is present with boolean value.
+Synonymous with is_boolean.
+
+
+ +

is_boolean

+ +

+

+
+is_boolean (class=typing #args=1): True if field is present with boolean value.
+Synonymous with is_bool.
+
+
+ +

is_empty

+ +

+

+
+is_empty (class=typing #args=1): True if field is present in input with empty
+string value, false otherwise.
+
+
+ +

is_empty_map

+ +

+

+
+is_empty_map (class=typing #args=1): True if argument is a map which is empty.
+
+
+ +

is_float

+ +

+

+
+is_float (class=typing #args=1): True if field is present with value inferred to
+be float
+
+
+ +

is_int

+ +

+

+
+is_int (class=typing #args=1): True if field is present with value inferred to
+be int
+
+
+ +

is_map

+ +

+

+
+is_map (class=typing #args=1): True if argument is a map.
+
+
+ +

is_nonempty_map

+ +

+

+
+is_nonempty_map (class=typing #args=1): True if argument is a map which is
+non-empty.
+
+
+ +

is_not_empty

+ +

+

+
+is_not_empty (class=typing #args=1): False if field is present in input with
+empty value, false otherwise
+
+
+ +

is_not_map

+ +

+

+
+is_not_map (class=typing #args=1): True if argument is not a map.
+
+
+ +

is_not_null

+ +

+

+
+is_not_null (class=typing #args=1): False if argument is null (empty or absent),
+true otherwise.
+
+
+ +

is_null

+ +

+

+
+is_null (class=typing #args=1): True if argument is null (empty or absent),
+false otherwise.
+
+
+ +

is_numeric

+ +

+

+
+is_numeric (class=typing #args=1): True if field is present with value inferred
+to be int or float
+
+
+ +

is_present

+ +

+

+
+is_present (class=typing #args=1): True if field is present in input, false
+otherwise.
+
+
+ +

is_string

+ +

+

+
+is_string (class=typing #args=1): True if field is present with string
+(including empty-string) value
+
+
+ +

joink

+ +

+

+
+joink (class=maps #args=2): Makes string from map keys. E.g. 'joink($*, ",")'.
+
+
+ +

joinkv

+ +

+

+
+joinkv (class=maps #args=3): Makes string from map key-value pairs. E.g.
+'joinkv(@v[2], "=", ",")'
+
+
+ +

joinv

+ +

+

+
+joinv (class=maps #args=2): Makes string from map keys. E.g. 'joinv(mymap,
+",")'.
+
+
+ +

leafcount

+ +

+

+
+leafcount (class=maps #args=1): Counts total number of terminal values in
+hashmap. For single-level maps, same as length.
+
+
+ +

length

+ +

+

+
+length (class=maps #args=1): Counts number of top-level entries in hashmap.
+Scalars have length 1.
+
+
+ +

log

+ +

+

+
+log (class=math #args=1): Natural (base-e) logarithm.
+
+
+ +

log10

+ +

+

+
+log10 (class=math #args=1): Base-10 logarithm.
+
+
+ +

log1p

+ +

+

+
+log1p (class=math #args=1): log(1-x).
+
+
+ +

logifit

+ +

+

+
+logifit (class=math #args=3): Given m and b from logistic regression, compute
+fit: $yhat=logifit($x,$m,$b).
+
+
+ +

madd

+ +

+

+
+madd (class=math #args=3): a + b mod m (integers)
+
+
+ +

mapdiff

+ +

+

+
+mapdiff (class=maps variadic): With 0 args, returns empty map. With 1 arg,
+returns copy of arg. With 2 or more, returns copy of arg 1 with all keys from
+any of remaining argument maps removed.
+
+
+ +

mapsum

+ +

+

+
+mapsum (class=maps variadic): With 0 args, returns empty map. With >= 1 arg,
+returns a map with key-value pairs from all arguments. Rightmost collisions win,
+e.g. 'mapsum({1:2,3,4},{1:5})' is '{1:5,3:4}'.
+
+
+ +

max

+ +

+

+
+max (class=math variadic): max of n numbers; null loses
+
+
+ +

mexp

+ +

+

+
+mexp (class=math #args=3): a ** b mod m (integers)
+
+
+ +

min

+ +

+

+
+min (class=math variadic): Min of n numbers; null loses
+
+
+ +

mmul

+ +

+

+
+mmul (class=math #args=3): a * b mod m (integers)
+
+
+ +

msub

+ +

+

+
+msub (class=math #args=3): a - b mod m (integers)
+
+
+ +

pow

+ +

+

+
+pow (class=math #args=2): Exponentiation; same as **.
+
+
+ +

qnorm

+ +

+

+
+qnorm (class=math #args=1): Normal cumulative distribution function.
+
+
+ +

round

+ +

+

+
+round (class=math #args=1): Round to nearest integer.
+
+
+ +

roundm

+ +

+

+
+roundm (class=math #args=2): Round to nearest multiple of m: roundm($x,$m) is
+the same as round($x/$m)*$m
+
+
+ +

sec2dhms

+ +

+

+
+sec2dhms (class=time #args=1): Formats integer seconds as in sec2dhms(500000) =
+"5d18h53m20s"
+
+
+ +

sec2gmt

+ +

+

+
+sec2gmt (class=time #args=1): Formats seconds since epoch (integer part) as GMT
+timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z".  Leaves
+non-numbers as-is.
+
+
+ +

sec2gmtdate

+ +

+

+
+sec2gmtdate (class=time #args=1): Formats seconds since epoch (integer part) as
+GMT timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) =
+"2015-08-28".  Leaves non-numbers as-is.
+
+
+ +

sec2hms

+ +

+

+
+sec2hms (class=time #args=1): Formats integer seconds as in sec2hms(5000) =
+"01:23:20"
+
+
+ +

sgn

+ +

+

+
+sgn (class=math #args=1): +1 for positive input, 0 for zero input, -1 for
+negative input.
+
+
+ +

sin

+ +

+

+
+sin (class=math #args=1): Trigonometric sine.
+
+
+ +

sinh

+ +

+

+
+sinh (class=math #args=1): Hyperbolic sine.
+
+
+ +

splitkv

+ +

+

+
+splitkv (class=maps #args=3): Splits string by separators into map with type
+inference. E.g. 'splitkv("a=1,b=2,c=3", "=", ",")' gives '{"a" : 1, "b" : 2, "c"
+: 3}'.
+
+
+ +

splitkvx

+ +

+

+
+splitkvx (class=maps #args=3): Splits string by separators into map without type
+inference (keys and values are strings). E.g. 'splitkv("a=1,b=2,c=3", "=", ",")'
+gives '{"a" : "1", "b" : "2", "c" : "3"}'.
+
+
+ +

splitnv

+ +

+

+
+splitnv (class=maps #args=2): Splits string by separator into integer-indexed
+map with type inference. E.g. 'splitnv("a,b,c" , ",")' gives '{1 : "a", 2 : "b",
+3 : "c"}'.
+
+
+ +

splitnvx

+ +

+

+
+splitnvx (class=maps #args=2): Splits string by separator into integer-indexed
+map without type inference (values are strings). E.g. 'splitnv("4,5,6" , ",")'
+gives '{1 : "4", 2 : "5", 3 : "6"}'.
+
+
+ +

sqrt

+ +

+

+
+sqrt (class=math #args=1): Square root.
+
+
+ +

strftime

+ +

+

+
+strftime (class=time #args=2): Formats seconds since epoch (integer part) as
+timestamp, e.g.  strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") =
+"2015-08-28T13:33:21Z".
+
+
+ +

string

+ +

+

+
+string (class=conversion #args=1): Convert int/float/bool/string to string.
+
+
+ +

strlen

+ +

+

+
+strlen (class=string #args=1): String length.
+
+
+ +

strptime

+ +

+

+
+strptime (class=time #args=2): Parses timestamp as integer seconds since epoch,
+e.g. strptime("2015-08-28T13:33:21Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.
+
+
+ +

sub

+ +

+

+
+sub (class=string #args=3): Example: '$name=sub($name, "old", "new")' (replace
+once).
+
+
+ +

substr

+ +

+

+
+substr (class=string #args=3): substr(s,m,n) gives substring of s from 0-up
+position m to n inclusive. Negative indices -len .. -1 alias to 0 .. len-1.
+
+
+ +

systime

+ +

+

+
+systime (class=time #args=0): Floating-point seconds since the epoch, e.g.
+1440768801.748936.
+
+
+ +

tan

+ +

+

+
+tan (class=math #args=1): Trigonometric tangent.
+
+
+ +

tanh

+ +

+

+
+tanh (class=math #args=1): Hyperbolic tangent.
+
+
+ +

tolower

+ +

+

+
+tolower (class=string #args=1): Convert string to lowercase.
+
+
+ +

toupper

+ +

+

+
+toupper (class=string #args=1): Convert string to uppercase.
+
+
+ +

typeof

+ +

+

+
+typeof (class=conversion #args=1): Convert argument to type of argument (e.g.
+MT_STRING). For debug.
+
+
+ +

urand

+ +

+

+
+urand (class=math #args=0): Floating-point numbers on the unit interval.
+Int-valued example: '$n=floor(20+urand()*11)'.
+
+
+ +

urand32

+ +

+

+
+urand32 (class=math #args=0): Integer uniformly distributed 0 and 2**32-1
+inclusive.
+
+
+ +

urandint

+ +

+

+
+urandint (class=math #args=2): Integer uniformly distributed between inclusive
+integer endpoints.
+
+
+ + + diff --git a/doc/reference-dsl.html b/doc/reference-dsl.html index 825a40da7..3dbd7ba7a 100644 --- a/doc/reference-dsl.html +++ b/doc/reference-dsl.html @@ -227,6 +227,120 @@ Miller commands were run with pretty-print-tabular output format. • Unset statements
• Filter statements
• Built-in functions for filter and put
+    • Operators
+    • abs
+    • acos
+    • acosh
+    • asin
+    • asinh
+    • asserting_absent
+    • asserting_bool
+    • asserting_boolean
+    • asserting_empty
+    • asserting_empty_map
+    • asserting_float
+    • asserting_int
+    • asserting_map
+    • asserting_nonempty_map
+    • asserting_not_empty
+    • asserting_not_map
+    • asserting_not_null
+    • asserting_null
+    • asserting_numeric
+    • asserting_present
+    • asserting_string
+    • atan
+    • atan2
+    • atanh
+    • boolean
+    • cbrt
+    • ceil
+    • cos
+    • cosh
+    • depth
+    • dhms2fsec
+    • dhms2sec
+    • erf
+    • erfc
+    • exp
+    • expm1
+    • float
+    • floor
+    • fmtnum
+    • fsec2dhms
+    • fsec2hms
+    • gmt2sec
+    • gsub
+    • haskey
+    • hexfmt
+    • hms2fsec
+    • hms2sec
+    • int
+    • invqnorm
+    • is_absent
+    • is_bool
+    • is_boolean
+    • is_empty
+    • is_empty_map
+    • is_float
+    • is_int
+    • is_map
+    • is_nonempty_map
+    • is_not_empty
+    • is_not_map
+    • is_not_null
+    • is_null
+    • is_numeric
+    • is_present
+    • is_string
+    • joink
+    • joinkv
+    • joinv
+    • leafcount
+    • length
+    • log
+    • log10
+    • log1p
+    • logifit
+    • madd
+    • mapdiff
+    • mapsum
+    • max
+    • mexp
+    • min
+    • mmul
+    • msub
+    • pow
+    • qnorm
+    • round
+    • roundm
+    • sec2dhms
+    • sec2gmt
+    • sec2gmtdate
+    • sec2hms
+    • sgn
+    • sin
+    • sinh
+    • splitkv
+    • splitkvx
+    • splitnv
+    • splitnvx
+    • sqrt
+    • strftime
+    • string
+    • strlen
+    • strptime
+    • sub
+    • substr
+    • systime
+    • tan
+    • tanh
+    • tolower
+    • toupper
+    • typeof
+    • urand
+    • urand32
+    • urandint
• User-defined functions and subroutines
    • User-defined functions
    • User-defined subroutines
@@ -3538,387 +3652,1138 @@ notion of optional or default-on-absent arguments. All argument-passing is positional rather than by name; arguments are passed by value, not by reference. +

You can get a list of all functions using mlr -F. + +

Operators

+ +
++ ++ +- +- +* +/ +// +% +** +| +^ +& +~ +<< +>> +== +!= +=~ +!=~ +> +>= +< +<= +&& +|| +^^ +! +? : +. +
+ + +

abs

+

-$ mlr --help-all-functions | fmt -80
-+ (class=arithmetic #args=2): Addition.
-
-+ (class=arithmetic #args=1): Unary plus.
-
-- (class=arithmetic #args=2): Subtraction.
-
-- (class=arithmetic #args=1): Unary minus.
-
-* (class=arithmetic #args=2): Multiplication.
-
-/ (class=arithmetic #args=2): Division.
-
-// (class=arithmetic #args=2): Integer division: rounds to negative (pythonic).
-
-% (class=arithmetic #args=2): Remainder; never negative-valued (pythonic).
-
-** (class=arithmetic #args=2): Exponentiation; same as pow, but as an infix
-operator.
-
-| (class=arithmetic #args=2): Bitwise OR.
-
-^ (class=arithmetic #args=2): Bitwise XOR.
-
-& (class=arithmetic #args=2): Bitwise AND.
-
-~ (class=arithmetic #args=1): Bitwise NOT. Beware '$y=~$x' since =~ is the
-regex-match operator: try '$y = ~$x'.
-
-<< (class=arithmetic #args=2): Bitwise left-shift.
-
->> (class=arithmetic #args=2): Bitwise right-shift.
-
-== (class=boolean #args=2): String/numeric equality. Mixing number and string
-results in string compare.
-
-!= (class=boolean #args=2): String/numeric inequality. Mixing number and string
-results in string compare.
-
-=~ (class=boolean #args=2): String (left-hand side) matches regex (right-hand
-side), e.g. '$name =~ "^a.*b$"'.
-
-!=~ (class=boolean #args=2): String (left-hand side) does not match regex
-(right-hand side), e.g. '$name !=~ "^a.*b$"'.
-
-> (class=boolean #args=2): String/numeric greater-than. Mixing number and string
-results in string compare.
-
->= (class=boolean #args=2): String/numeric greater-than-or-equals. Mixing number
-and string results in string compare.
-
-< (class=boolean #args=2): String/numeric less-than. Mixing number and string
-results in string compare.
-
-<= (class=boolean #args=2): String/numeric less-than-or-equals. Mixing number
-and string results in string compare.
-
-&& (class=boolean #args=2): Logical AND.
-
-|| (class=boolean #args=2): Logical OR.
-
-^^ (class=boolean #args=2): Logical XOR.
-
-! (class=boolean #args=1): Logical negation.
-
-? : (class=boolean #args=3): Ternary operator.
-
-. (class=string #args=2): String concatenation.
-
-gsub (class=string #args=3): Example: '$name=gsub($name, "old", "new")' (replace
-all).
-
-strlen (class=string #args=1): String length.
-
-sub (class=string #args=3): Example: '$name=sub($name, "old", "new")' (replace
-once).
-
-substr (class=string #args=3): substr(s,m,n) gives substring of s from 0-up
-position m to n inclusive. Negative indices -len .. -1 alias to 0 .. len-1.
-
-tolower (class=string #args=1): Convert string to lowercase.
-
-toupper (class=string #args=1): Convert string to uppercase.
-
 abs (class=math #args=1): Absolute value.
+
+
+

acos

+ +

+

+
 acos (class=math #args=1): Inverse trigonometric cosine.
+
+
+

acosh

+ +

+

+
 acosh (class=math #args=1): Inverse hyperbolic cosine.
+
+
+

asin

+ +

+

+
 asin (class=math #args=1): Inverse trigonometric sine.
+
+
+

asinh

+ +

+

+
 asinh (class=math #args=1): Inverse hyperbolic sine.
+
+
-atan (class=math #args=1): One-argument arctangent. - -atan2 (class=math #args=2): Two-argument arctangent. - -atanh (class=math #args=1): Inverse hyperbolic tangent. - -cbrt (class=math #args=1): Cube root. - -ceil (class=math #args=1): Ceiling: nearest integer at or above. - -cos (class=math #args=1): Trigonometric cosine. - -cosh (class=math #args=1): Hyperbolic cosine. - -erf (class=math #args=1): Error function. - -erfc (class=math #args=1): Complementary error function. - -exp (class=math #args=1): Exponential function e**x. - -expm1 (class=math #args=1): e**x - 1. - -floor (class=math #args=1): Floor: nearest integer at or below. - -invqnorm (class=math #args=1): Inverse of normal cumulative distribution -function. Note that invqorm(urand()) is normally distributed. - -log (class=math #args=1): Natural (base-e) logarithm. - -log10 (class=math #args=1): Base-10 logarithm. - -log1p (class=math #args=1): log(1-x). - -logifit (class=math #args=3): Given m and b from logistic regression, compute -fit: $yhat=logifit($x,$m,$b). - -madd (class=math #args=3): a + b mod m (integers) - -max (class=math variadic): max of n numbers; null loses - -mexp (class=math #args=3): a ** b mod m (integers) - -min (class=math variadic): Min of n numbers; null loses - -mmul (class=math #args=3): a * b mod m (integers) - -msub (class=math #args=3): a - b mod m (integers) - -pow (class=math #args=2): Exponentiation; same as **. - -qnorm (class=math #args=1): Normal cumulative distribution function. - -round (class=math #args=1): Round to nearest integer. - -roundm (class=math #args=2): Round to nearest multiple of m: roundm($x,$m) is -the same as round($x/$m)*$m - -sgn (class=math #args=1): +1 for positive input, 0 for zero input, -1 for -negative input. - -sin (class=math #args=1): Trigonometric sine. - -sinh (class=math #args=1): Hyperbolic sine. - -sqrt (class=math #args=1): Square root. - -tan (class=math #args=1): Trigonometric tangent. - -tanh (class=math #args=1): Hyperbolic tangent. - -urand (class=math #args=0): Floating-point numbers on the unit interval. -Int-valued example: '$n=floor(20+urand()*11)'. - -urand32 (class=math #args=0): Integer uniformly distributed 0 and 2**32-1 -inclusive. - -urandint (class=math #args=2): Integer uniformly distributed between inclusive -integer endpoints. - -dhms2fsec (class=time #args=1): Recovers floating-point seconds as in -dhms2fsec("5d18h53m20.250000s") = 500000.250000 - -dhms2sec (class=time #args=1): Recovers integer seconds as in -dhms2sec("5d18h53m20s") = 500000 - -fsec2dhms (class=time #args=1): Formats floating-point seconds as in -fsec2dhms(500000.25) = "5d18h53m20.250000s" - -fsec2hms (class=time #args=1): Formats floating-point seconds as in -fsec2hms(5000.25) = "01:23:20.250000" - -gmt2sec (class=time #args=1): Parses GMT timestamp as integer seconds since the -epoch. - -hms2fsec (class=time #args=1): Recovers floating-point seconds as in -hms2fsec("01:23:20.250000") = 5000.250000 - -hms2sec (class=time #args=1): Recovers integer seconds as in hms2sec("01:23:20") -= 5000 - -sec2dhms (class=time #args=1): Formats integer seconds as in sec2dhms(500000) = -"5d18h53m20s" - -sec2gmt (class=time #args=1): Formats seconds since epoch (integer part) as GMT -timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Leaves -non-numbers as-is. - -sec2gmtdate (class=time #args=1): Formats seconds since epoch (integer part) as -GMT timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = -"2015-08-28". Leaves non-numbers as-is. - -sec2hms (class=time #args=1): Formats integer seconds as in sec2hms(5000) = -"01:23:20" - -strftime (class=time #args=2): Formats seconds since epoch (integer part) as -timestamp, e.g. strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = -"2015-08-28T13:33:21Z". - -strptime (class=time #args=2): Parses timestamp as integer seconds since epoch, -e.g. strptime("2015-08-28T13:33:21Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801. - -systime (class=time #args=0): Floating-point seconds since the epoch, e.g. -1440768801.748936. - -is_absent (class=typing #args=1): False if field is present in input, false -otherwise - -is_bool (class=typing #args=1): True if field is present with boolean value. -Synonymous with is_boolean. - -is_boolean (class=typing #args=1): True if field is present with boolean value. -Synonymous with is_bool. - -is_empty (class=typing #args=1): True if field is present in input with empty -string value, false otherwise. - -is_empty_map (class=typing #args=1): True if argument is a map which is empty. - -is_float (class=typing #args=1): True if field is present with value inferred to -be float - -is_int (class=typing #args=1): True if field is present with value inferred to -be int - -is_map (class=typing #args=1): True if argument is a map. - -is_nonempty_map (class=typing #args=1): True if argument is a map which is -non-empty. - -is_not_empty (class=typing #args=1): False if field is present in input with -empty value, false otherwise - -is_not_map (class=typing #args=1): True if argument is not a map. - -is_not_null (class=typing #args=1): False if argument is null (empty or absent), -true otherwise. - -is_null (class=typing #args=1): True if argument is null (empty or absent), -false otherwise. - -is_numeric (class=typing #args=1): True if field is present with value inferred -to be int or float - -is_present (class=typing #args=1): True if field is present in input, false -otherwise. - -is_string (class=typing #args=1): True if field is present with string -(including empty-string) value +

asserting_absent

+

+

+
 asserting_absent (class=typing #args=1): Returns argument if it is absent in the
 input ata, else throws an error.
+
+
+

asserting_bool

+ +

+

+
 asserting_bool (class=typing #args=1): Returns argument if it is present with
 boolean value, else throws an error.
+
+
+

asserting_boolean

+ +

+

+
 asserting_boolean (class=typing #args=1): Returns argument if it is present with
 boolean value, else throws an error.
+
+
+

asserting_empty

+ +

+

+
 asserting_empty (class=typing #args=1): Returns argument if it is present in
 input with empty value, else throws an error.
+
+
+

asserting_empty_map

+ +

+

+
 asserting_empty_map (class=typing #args=1): Returns argument if it is a map with
 empty value, else throws an error.
+
+
+

asserting_float

+ +

+

+
 asserting_float (class=typing #args=1): Returns argument if it is present with
 float value, else throws an error.
+
+
+

asserting_int

+ +

+

+
 asserting_int (class=typing #args=1): Returns argument if it is present with int
 value, else throws an error.
+
+
+

asserting_map

+ +

+

+
 asserting_map (class=typing #args=1): Returns argument if it is a map, else
 throws an error.
+
+
+

asserting_nonempty_map

+ +

+

+
 asserting_nonempty_map (class=typing #args=1): Returns argument if it is a
 non-empty map, else throws an error.
+
+
+

asserting_not_empty

+ +

+

+
 asserting_not_empty (class=typing #args=1): Returns argument if it is present in
 input with non-empty value, else throws an error.
+
+
+

asserting_not_map

+ +

+

+
 asserting_not_map (class=typing #args=1): Returns argument if it is not a map,
 else throws an error.
+
+
+

asserting_not_null

+ +

+

+
 asserting_not_null (class=typing #args=1): Returns argument if it is non-null
 (non-empty and non-absent), else throws an error.
+
+
+

asserting_null

+ +

+

+
 asserting_null (class=typing #args=1): Returns argument if it is null (empty or
 absent), else throws an error.
+
+
+

asserting_numeric

+ +

+

+
 asserting_numeric (class=typing #args=1): Returns argument if it is present with
 int or float value, else throws an error.
+
+
+

asserting_present

+ +

+

+
 asserting_present (class=typing #args=1): Returns argument if it is present in
 input, else throws an error.
+
+
+

asserting_string

+ +

+

+
 asserting_string (class=typing #args=1): Returns argument if it is present with
 string (including empty-string) value, else throws an error.
+
+
+

atan

+ +

+

+
+atan (class=math #args=1): One-argument arctangent.
+
+
+ +

atan2

+ +

+

+
+atan2 (class=math #args=2): Two-argument arctangent.
+
+
+ +

atanh

+ +

+

+
+atanh (class=math #args=1): Inverse hyperbolic tangent.
+
+
+ +

boolean

+ +

+

+
 boolean (class=conversion #args=1): Convert int/float/bool/string to boolean.
+
+
-float (class=conversion #args=1): Convert int/float/bool/string to float. +

cbrt

-fmtnum (class=conversion #args=2): Convert int/float/bool to string using -printf-style format string, e.g. '$s = fmtnum($n, "%06lld")'. +

+

+
+cbrt (class=math #args=1): Cube root.
+
+
-hexfmt (class=conversion #args=1): Convert int to string, e.g. 255 to "0xff". +

ceil

-int (class=conversion #args=1): Convert int/float/bool/string to int. +

+

+
+ceil (class=math #args=1): Ceiling: nearest integer at or above.
+
+
-string (class=conversion #args=1): Convert int/float/bool/string to string. +

cos

-typeof (class=conversion #args=1): Convert argument to type of argument (e.g. -MT_STRING). For debug. +

+

+
+cos (class=math #args=1): Trigonometric cosine.
+
+
+

cosh

+ +

+

+
+cosh (class=math #args=1): Hyperbolic cosine.
+
+
+ +

depth

+ +

+

+
 depth (class=maps #args=1): Prints maximum depth of hashmap: ''. Scalars have
 depth 0.
+
+
+

dhms2fsec

+ +

+

+
+dhms2fsec (class=time #args=1): Recovers floating-point seconds as in
+dhms2fsec("5d18h53m20.250000s") = 500000.250000
+
+
+ +

dhms2sec

+ +

+

+
+dhms2sec (class=time #args=1): Recovers integer seconds as in
+dhms2sec("5d18h53m20s") = 500000
+
+
+ +

erf

+ +

+

+
+erf (class=math #args=1): Error function.
+
+
+ +

erfc

+ +

+

+
+erfc (class=math #args=1): Complementary error function.
+
+
+ +

exp

+ +

+

+
+exp (class=math #args=1): Exponential function e**x.
+
+
+ +

expm1

+ +

+

+
+expm1 (class=math #args=1): e**x - 1.
+
+
+ +

float

+ +

+

+
+float (class=conversion #args=1): Convert int/float/bool/string to float.
+
+
+ +

floor

+ +

+

+
+floor (class=math #args=1): Floor: nearest integer at or below.
+
+
+ +

fmtnum

+ +

+

+
+fmtnum (class=conversion #args=2): Convert int/float/bool to string using
+printf-style format string, e.g. '$s = fmtnum($n, "%06lld")'.
+
+
+ +

fsec2dhms

+ +

+

+
+fsec2dhms (class=time #args=1): Formats floating-point seconds as in
+fsec2dhms(500000.25) = "5d18h53m20.250000s"
+
+
+ +

fsec2hms

+ +

+

+
+fsec2hms (class=time #args=1): Formats floating-point seconds as in
+fsec2hms(5000.25) = "01:23:20.250000"
+
+
+ +

gmt2sec

+ +

+

+
+gmt2sec (class=time #args=1): Parses GMT timestamp as integer seconds since the
+epoch.
+
+
+ +

gsub

+ +

+

+
+gsub (class=string #args=3): Example: '$name=gsub($name, "old", "new")' (replace
+all).
+
+
+ +

haskey

+ +

+

+
 haskey (class=maps #args=2): True/false if map has/hasn't key, e.g. 'haskey($*,
 "a")' or 'haskey(mymap, mykey)'. Error if 1st argument is not a map.
+
+
+

hexfmt

+ +

+

+
+hexfmt (class=conversion #args=1): Convert int to string, e.g. 255 to "0xff".
+
+
+ +

hms2fsec

+ +

+

+
+hms2fsec (class=time #args=1): Recovers floating-point seconds as in
+hms2fsec("01:23:20.250000") = 5000.250000
+
+
+ +

hms2sec

+ +

+

+
+hms2sec (class=time #args=1): Recovers integer seconds as in hms2sec("01:23:20")
+= 5000
+
+
+ +

int

+ +

+

+
+int (class=conversion #args=1): Convert int/float/bool/string to int.
+
+
+ +

invqnorm

+ +

+

+
+invqnorm (class=math #args=1): Inverse of normal cumulative distribution
+function. Note that invqorm(urand()) is normally distributed.
+
+
+ +

is_absent

+ +

+

+
+is_absent (class=typing #args=1): False if field is present in input, false
+otherwise
+
+
+ +

is_bool

+ +

+

+
+is_bool (class=typing #args=1): True if field is present with boolean value.
+Synonymous with is_boolean.
+
+
+ +

is_boolean

+ +

+

+
+is_boolean (class=typing #args=1): True if field is present with boolean value.
+Synonymous with is_bool.
+
+
+ +

is_empty

+ +

+

+
+is_empty (class=typing #args=1): True if field is present in input with empty
+string value, false otherwise.
+
+
+ +

is_empty_map

+ +

+

+
+is_empty_map (class=typing #args=1): True if argument is a map which is empty.
+
+
+ +

is_float

+ +

+

+
+is_float (class=typing #args=1): True if field is present with value inferred to
+be float
+
+
+ +

is_int

+ +

+

+
+is_int (class=typing #args=1): True if field is present with value inferred to
+be int
+
+
+ +

is_map

+ +

+

+
+is_map (class=typing #args=1): True if argument is a map.
+
+
+ +

is_nonempty_map

+ +

+

+
+is_nonempty_map (class=typing #args=1): True if argument is a map which is
+non-empty.
+
+
+ +

is_not_empty

+ +

+

+
+is_not_empty (class=typing #args=1): False if field is present in input with
+empty value, false otherwise
+
+
+ +

is_not_map

+ +

+

+
+is_not_map (class=typing #args=1): True if argument is not a map.
+
+
+ +

is_not_null

+ +

+

+
+is_not_null (class=typing #args=1): False if argument is null (empty or absent),
+true otherwise.
+
+
+ +

is_null

+ +

+

+
+is_null (class=typing #args=1): True if argument is null (empty or absent),
+false otherwise.
+
+
+ +

is_numeric

+ +

+

+
+is_numeric (class=typing #args=1): True if field is present with value inferred
+to be int or float
+
+
+ +

is_present

+ +

+

+
+is_present (class=typing #args=1): True if field is present in input, false
+otherwise.
+
+
+ +

is_string

+ +

+

+
+is_string (class=typing #args=1): True if field is present with string
+(including empty-string) value
+
+
+ +

joink

+ +

+

+
 joink (class=maps #args=2): Makes string from map keys. E.g. 'joink($*, ",")'.
+
+
+

joinkv

+ +

+

+
 joinkv (class=maps #args=3): Makes string from map key-value pairs. E.g.
 'joinkv(@v[2], "=", ",")'
+
+
+

joinv

+ +

+

+
 joinv (class=maps #args=2): Makes string from map keys. E.g. 'joinv(mymap,
 ",")'.
+
+
+

leafcount

+ +

+

+
 leafcount (class=maps #args=1): Counts total number of terminal values in
 hashmap. For single-level maps, same as length.
+
+
+

length

+ +

+

+
 length (class=maps #args=1): Counts number of top-level entries in hashmap.
 Scalars have length 1.
+
+
+

log

+ +

+

+
+log (class=math #args=1): Natural (base-e) logarithm.
+
+
+ +

log10

+ +

+

+
+log10 (class=math #args=1): Base-10 logarithm.
+
+
+ +

log1p

+ +

+

+
+log1p (class=math #args=1): log(1-x).
+
+
+ +

logifit

+ +

+

+
+logifit (class=math #args=3): Given m and b from logistic regression, compute
+fit: $yhat=logifit($x,$m,$b).
+
+
+ +

madd

+ +

+

+
+madd (class=math #args=3): a + b mod m (integers)
+
+
+ +

mapdiff

+ +

+

+
 mapdiff (class=maps variadic): With 0 args, returns empty map. With 1 arg,
 returns copy of arg. With 2 or more, returns copy of arg 1 with all keys from
 any of remaining argument maps removed.
+
+
-mapsum (class=maps variadic): With 0 args, returns empty map. With >= 1 arg, +

mapsum

+ +

+

+
+mapsum (class=maps variadic): With 0 args, returns empty map. With >= 1 arg,
 returns a map with key-value pairs from all arguments. Rightmost collisions win,
 e.g. 'mapsum({1:2,3,4},{1:5})' is '{1:5,3:4}'.
+
+
+

max

+ +

+

+
+max (class=math variadic): max of n numbers; null loses
+
+
+ +

mexp

+ +

+

+
+mexp (class=math #args=3): a ** b mod m (integers)
+
+
+ +

min

+ +

+

+
+min (class=math variadic): Min of n numbers; null loses
+
+
+ +

mmul

+ +

+

+
+mmul (class=math #args=3): a * b mod m (integers)
+
+
+ +

msub

+ +

+

+
+msub (class=math #args=3): a - b mod m (integers)
+
+
+ +

pow

+ +

+

+
+pow (class=math #args=2): Exponentiation; same as **.
+
+
+ +

qnorm

+ +

+

+
+qnorm (class=math #args=1): Normal cumulative distribution function.
+
+
+ +

round

+ +

+

+
+round (class=math #args=1): Round to nearest integer.
+
+
+ +

roundm

+ +

+

+
+roundm (class=math #args=2): Round to nearest multiple of m: roundm($x,$m) is
+the same as round($x/$m)*$m
+
+
+ +

sec2dhms

+ +

+

+
+sec2dhms (class=time #args=1): Formats integer seconds as in sec2dhms(500000) =
+"5d18h53m20s"
+
+
+ +

sec2gmt

+ +

+

+
+sec2gmt (class=time #args=1): Formats seconds since epoch (integer part) as GMT
+timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z".  Leaves
+non-numbers as-is.
+
+
+ +

sec2gmtdate

+ +

+

+
+sec2gmtdate (class=time #args=1): Formats seconds since epoch (integer part) as
+GMT timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) =
+"2015-08-28".  Leaves non-numbers as-is.
+
+
+ +

sec2hms

+ +

+

+
+sec2hms (class=time #args=1): Formats integer seconds as in sec2hms(5000) =
+"01:23:20"
+
+
+ +

sgn

+ +

+

+
+sgn (class=math #args=1): +1 for positive input, 0 for zero input, -1 for
+negative input.
+
+
+ +

sin

+ +

+

+
+sin (class=math #args=1): Trigonometric sine.
+
+
+ +

sinh

+ +

+

+
+sinh (class=math #args=1): Hyperbolic sine.
+
+
+ +

splitkv

+ +

+

+
 splitkv (class=maps #args=3): Splits string by separators into map with type
 inference. E.g. 'splitkv("a=1,b=2,c=3", "=", ",")' gives '{"a" : 1, "b" : 2, "c"
 : 3}'.
+
+
+

splitkvx

+ +

+

+
 splitkvx (class=maps #args=3): Splits string by separators into map without type
 inference (keys and values are strings). E.g. 'splitkv("a=1,b=2,c=3", "=", ",")'
 gives '{"a" : "1", "b" : "2", "c" : "3"}'.
+
+
+

splitnv

+ +

+

+
 splitnv (class=maps #args=2): Splits string by separator into integer-indexed
 map with type inference. E.g. 'splitnv("a,b,c" , ",")' gives '{1 : "a", 2 : "b",
 3 : "c"}'.
+
+
+

splitnvx

+ +

+

+
 splitnvx (class=maps #args=2): Splits string by separator into integer-indexed
 map without type inference (values are strings). E.g. 'splitnv("4,5,6" , ",")'
 gives '{1 : "4", 2 : "5", 3 : "6"}'.
-
-To set the seed for urand, you may specify decimal or hexadecimal 32-bit numbers
-of the form "mlr --seed 123456789" or "mlr --seed 0xcafefeed".  Miller's
-built-in variables are NF, NR, FNR, FILENUM, and FILENAME (awk-like) along with
-the mathematical constants PI and E.
 
+ +

sqrt

+

+

+
+sqrt (class=math #args=1): Square root.
+
+
+ +

strftime

+ +

+

+
+strftime (class=time #args=2): Formats seconds since epoch (integer part) as
+timestamp, e.g.  strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") =
+"2015-08-28T13:33:21Z".
+
+
+ +

string

+ +

+

+
+string (class=conversion #args=1): Convert int/float/bool/string to string.
+
+
+ +

strlen

+ +

+

+
+strlen (class=string #args=1): String length.
+
+
+ +

strptime

+ +

+

+
+strptime (class=time #args=2): Parses timestamp as integer seconds since epoch,
+e.g. strptime("2015-08-28T13:33:21Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.
+
+
+ +

sub

+ +

+

+
+sub (class=string #args=3): Example: '$name=sub($name, "old", "new")' (replace
+once).
+
+
+ +

substr

+ +

+

+
+substr (class=string #args=3): substr(s,m,n) gives substring of s from 0-up
+position m to n inclusive. Negative indices -len .. -1 alias to 0 .. len-1.
+
+
+ +

systime

+ +

+

+
+systime (class=time #args=0): Floating-point seconds since the epoch, e.g.
+1440768801.748936.
+
+
+ +

tan

+ +

+

+
+tan (class=math #args=1): Trigonometric tangent.
+
+
+ +

tanh

+ +

+

+
+tanh (class=math #args=1): Hyperbolic tangent.
+
+
+ +

tolower

+ +

+

+
+tolower (class=string #args=1): Convert string to lowercase.
+
+
+ +

toupper

+ +

+

+
+toupper (class=string #args=1): Convert string to uppercase.
+
+
+ +

typeof

+ +

+

+
+typeof (class=conversion #args=1): Convert argument to type of argument (e.g.
+MT_STRING). For debug.
+
+
+ +

urand

+ +

+

+
+urand (class=math #args=0): Floating-point numbers on the unit interval.
+Int-valued example: '$n=floor(20+urand()*11)'.
+
+
+ +

urand32

+ +

+

+
+urand32 (class=math #args=0): Integer uniformly distributed 0 and 2**32-1
+inclusive.
+
+
+ +

urandint

+ +

+

+
+urandint (class=math #args=2): Integer uniformly distributed between inclusive
+integer endpoints.
+
+
+ + +