is* -> is_*

This commit is contained in:
John Kerl 2016-12-21 09:16:28 -05:00
parent 310b43d4d9
commit 2b312104b4
26 changed files with 543 additions and 550 deletions

View file

@ -563,7 +563,7 @@ static void main_usage_examples(FILE* o, char* argv0, char* leader) {
fprintf(o, "%s%s put -q '@sum[$a][$b] += $x; end {emit @sum, \"a\", \"b\"}' data/*\n", leader, argv0);
fprintf(o, "%s%s --from estimates.tbl put '\n", leader, argv0);
fprintf(o, " for (k,v in $*) {\n");
fprintf(o, " if (isnumeric(v) && k =~ \"^[t-z].*$\") {\n");
fprintf(o, " if (is_numeric(v) && k =~ \"^[t-z].*$\") {\n");
fprintf(o, " $sum += v; $count += 1\n");
fprintf(o, " }\n");
fprintf(o, " }\n");

View file

@ -32,7 +32,7 @@ typedef boxed_xval_t xv_ternary_func_t(
boxed_xval_t* pbxval3);
// ----------------------------------------------------------------
static inline boxed_xval_t b_x_ispresent_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_present_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal || mv_is_present(&pbxval1->xval.terminal_mlrval)
@ -40,7 +40,7 @@ static inline boxed_xval_t b_x_ispresent_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isabsent_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_absent_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_absent(&pbxval1->xval.terminal_mlrval)
@ -48,7 +48,7 @@ static inline boxed_xval_t b_x_isabsent_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_ismap_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_map_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal
@ -56,7 +56,7 @@ static inline boxed_xval_t b_x_ismap_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnotmap_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_not_map_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal
@ -64,7 +64,7 @@ static inline boxed_xval_t b_x_isnotmap_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnumeric_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_numeric_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_numeric(&pbxval1->xval.terminal_mlrval)
@ -72,7 +72,7 @@ static inline boxed_xval_t b_x_isnumeric_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isint_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_int_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_int(&pbxval1->xval.terminal_mlrval)
@ -80,7 +80,7 @@ static inline boxed_xval_t b_x_isint_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isfloat_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_float_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_float(&pbxval1->xval.terminal_mlrval)
@ -88,7 +88,7 @@ static inline boxed_xval_t b_x_isfloat_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isboolean_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_boolean_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_boolean(&pbxval1->xval.terminal_mlrval)
@ -96,7 +96,7 @@ static inline boxed_xval_t b_x_isboolean_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isstring_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_string_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_string(&pbxval1->xval.terminal_mlrval)
@ -104,7 +104,7 @@ static inline boxed_xval_t b_x_isstring_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnull_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_null_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_null(&pbxval1->xval.terminal_mlrval)
@ -112,7 +112,7 @@ static inline boxed_xval_t b_x_isnull_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnotnull_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_not_null_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!(pbxval1->xval.is_terminal && mv_is_null(&pbxval1->xval.terminal_mlrval))
@ -120,7 +120,7 @@ static inline boxed_xval_t b_x_isnotnull_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isempty_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_empty_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_empty(&pbxval1->xval.terminal_mlrval)
@ -136,7 +136,7 @@ static inline boxed_xval_t b_x_isnotempty_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isemptymap_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_empty_map_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal && pbxval1->xval.pnext_level->num_occupied == 0
@ -144,7 +144,7 @@ static inline boxed_xval_t b_x_isemptymap_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnonemptymap_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_nonempty_map_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal || pbxval1->xval.pnext_level->num_occupied != 0
@ -165,13 +165,13 @@ static inline boxed_xval_t s_x_typeof_xfunc(boxed_xval_t* pbxval1) {
// Most functions here free their inputs. E.g. for string concatenation, the
// output which is returned is the concatenation of the two inputs which are
// freed. For another example, isstring frees its input and returns the boolean
// freed. For another example, is_string frees its input and returns the boolean
// value of the result. These functions, by contrast, only return a boolean for
// the outcome of the test but do not free the inputs. The intended usage is for
// type-assertion checks. E.g. in '$b = asserting_string($a)', if $a is a string
// it is assigned to $b, else an error is thrown.
static inline boxed_xval_t b_x_ispresent_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_present_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal || mv_is_present(&pbxval1->xval.terminal_mlrval)
@ -179,7 +179,7 @@ static inline boxed_xval_t b_x_ispresent_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isabsent_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_absent_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_absent(&pbxval1->xval.terminal_mlrval)
@ -187,7 +187,7 @@ static inline boxed_xval_t b_x_isabsent_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_ismap_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_map_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal
@ -195,7 +195,7 @@ static inline boxed_xval_t b_x_ismap_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnotmap_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_not_map_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal
@ -203,7 +203,7 @@ static inline boxed_xval_t b_x_isnotmap_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnumeric_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_numeric_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_numeric(&pbxval1->xval.terminal_mlrval)
@ -211,7 +211,7 @@ static inline boxed_xval_t b_x_isnumeric_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isint_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_int_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_int(&pbxval1->xval.terminal_mlrval)
@ -219,7 +219,7 @@ static inline boxed_xval_t b_x_isint_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isfloat_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_float_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_float(&pbxval1->xval.terminal_mlrval)
@ -227,7 +227,7 @@ static inline boxed_xval_t b_x_isfloat_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isboolean_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_boolean_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_boolean(&pbxval1->xval.terminal_mlrval)
@ -235,7 +235,7 @@ static inline boxed_xval_t b_x_isboolean_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isstring_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_string_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_string(&pbxval1->xval.terminal_mlrval)
@ -243,7 +243,7 @@ static inline boxed_xval_t b_x_isstring_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnull_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_null_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_null(&pbxval1->xval.terminal_mlrval)
@ -251,7 +251,7 @@ static inline boxed_xval_t b_x_isnull_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnotnull_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_not_null_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!(pbxval1->xval.is_terminal && mv_is_null(&pbxval1->xval.terminal_mlrval))
@ -259,7 +259,7 @@ static inline boxed_xval_t b_x_isnotnull_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isempty_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_empty_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
pbxval1->xval.is_terminal && mv_is_empty(&pbxval1->xval.terminal_mlrval)
@ -275,7 +275,7 @@ static inline boxed_xval_t b_x_isnotempty_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isemptymap_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_empty_map_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal && pbxval1->xval.pnext_level->num_occupied == 0
@ -283,7 +283,7 @@ static inline boxed_xval_t b_x_isemptymap_no_free_xfunc(boxed_xval_t* pbxval1) {
);
}
static inline boxed_xval_t b_x_isnonemptymap_no_free_xfunc(boxed_xval_t* pbxval1) {
static inline boxed_xval_t b_x_is_nonempty_map_no_free_xfunc(boxed_xval_t* pbxval1) {
return box_ephemeral_val(
mv_from_bool(
!pbxval1->xval.is_terminal && pbxval1->xval.pnext_level->num_occupied != 0

View file

@ -268,22 +268,22 @@ static function_lookup_t FUNCTION_LOOKUP_TABLE[] = {
"Floating-point seconds since the epoch,\n"
"e.g. 1440768801.748936." },
{FUNC_CLASS_TYPING, "isabsent", 1,0, "False if field is present in input, false otherwise"},
{FUNC_CLASS_TYPING, "isbool", 1,0, "True if field is present with boolean value. Synonymous with isboolean."},
{FUNC_CLASS_TYPING, "isboolean", 1,0, "True if field is present with boolean value. Synonymous with isbool."},
{FUNC_CLASS_TYPING, "isempty", 1,0, "True if field is present in input with empty string value, false otherwise."},
{FUNC_CLASS_TYPING, "isemptymap", 1,0, "True if argument is a map which is empty."},
{FUNC_CLASS_TYPING, "isfloat", 1,0, "True if field is present with value inferred to be float"},
{FUNC_CLASS_TYPING, "isint", 1,0, "True if field is present with value inferred to be int "},
{FUNC_CLASS_TYPING, "ismap", 1,0, "True if argument is a map."},
{FUNC_CLASS_TYPING, "isnonemptymap", 1,0, "True if argument is a map which is non-empty."},
{FUNC_CLASS_TYPING, "is_absent", 1,0, "False if field is present in input, false otherwise"},
{FUNC_CLASS_TYPING, "is_bool", 1,0, "True if field is present with boolean value. Synonymous with is_boolean."},
{FUNC_CLASS_TYPING, "is_boolean", 1,0, "True if field is present with boolean value. Synonymous with is_bool."},
{FUNC_CLASS_TYPING, "is_empty", 1,0, "True if field is present in input with empty string value, false otherwise."},
{FUNC_CLASS_TYPING, "is_empty_map", 1,0, "True if argument is a map which is empty."},
{FUNC_CLASS_TYPING, "is_float", 1,0, "True if field is present with value inferred to be float"},
{FUNC_CLASS_TYPING, "is_int", 1,0, "True if field is present with value inferred to be int "},
{FUNC_CLASS_TYPING, "is_map", 1,0, "True if argument is a map."},
{FUNC_CLASS_TYPING, "is_nonempty_map", 1,0, "True if argument is a map which is non-empty."},
{FUNC_CLASS_TYPING, "isnotempty", 1,0, "False if field is present in input with empty value, false otherwise"},
{FUNC_CLASS_TYPING, "isnotmap", 1,0, "True if argument is not a map."},
{FUNC_CLASS_TYPING, "isnotnull", 1,0, "False if argument is null (empty or absent), true otherwise."},
{FUNC_CLASS_TYPING, "isnull", 1,0, "True if argument is null (empty or absent), false otherwise."},
{FUNC_CLASS_TYPING, "isnumeric", 1,0, "True if field is present with value inferred to be int or float"},
{FUNC_CLASS_TYPING, "ispresent", 1,0, "True if field is present in input, false otherwise."},
{FUNC_CLASS_TYPING, "isstring", 1,0, "True if field is present with string (including empty-string) value"},
{FUNC_CLASS_TYPING, "is_not_map", 1,0, "True if argument is not a map."},
{FUNC_CLASS_TYPING, "is_not_null", 1,0, "False if argument is null (empty or absent), true otherwise."},
{FUNC_CLASS_TYPING, "is_null", 1,0, "True if argument is null (empty or absent), false otherwise."},
{FUNC_CLASS_TYPING, "is_numeric", 1,0, "True if field is present with value inferred to be int or float"},
{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_bool", 1,0, "Returns argument if it is present with boolean value, else throws an error."},
@ -1201,70 +1201,70 @@ static rxval_evaluator_t* fmgr_alloc_xevaluator_from_variadic_func_name(
static rxval_evaluator_t* fmgr_alloc_xevaluator_from_unary_func_name(char* fnnm, rxval_evaluator_t* parg1) {
if (streq(fnnm, "asserting_absent")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isabsent_no_free_xfunc, parg1, "absent");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_absent_no_free_xfunc, parg1, "absent");
} else if (streq(fnnm, "asserting_bool")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isboolean_no_free_xfunc, parg1, "boolean");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_boolean_no_free_xfunc, parg1, "boolean");
} else if (streq(fnnm, "asserting_boolean")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isboolean_no_free_xfunc, parg1, "boolean");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_boolean_no_free_xfunc, parg1, "boolean");
} else if (streq(fnnm, "asserting_empty")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isempty_no_free_xfunc, parg1, "empty");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_empty_no_free_xfunc, parg1, "empty");
} else if (streq(fnnm, "asserting_empty_map")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isemptymap_no_free_xfunc, parg1, "emptymap");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_empty_map_no_free_xfunc, parg1, "emptymap");
} else if (streq(fnnm, "asserting_float")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isfloat_no_free_xfunc, parg1, "float");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_float_no_free_xfunc, parg1, "float");
} else if (streq(fnnm, "asserting_int")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isint_no_free_xfunc, parg1, "int");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_int_no_free_xfunc, parg1, "int");
} else if (streq(fnnm, "asserting_map")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_ismap_no_free_xfunc, parg1, "map");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_map_no_free_xfunc, parg1, "map");
} else if (streq(fnnm, "asserting_nonempty_map")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isnonemptymap_no_free_xfunc, parg1, "nonemptymap");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_nonempty_map_no_free_xfunc, parg1, "nonemptymap");
} else if (streq(fnnm, "asserting_not_empty")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isnotempty_no_free_xfunc, parg1, "notempty");
} else if (streq(fnnm, "asserting_not_map")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isnotmap_no_free_xfunc, parg1, "notmap");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_not_map_no_free_xfunc, parg1, "notmap");
} else if (streq(fnnm, "asserting_not_null")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isnotnull_no_free_xfunc, parg1, "notnull");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_not_null_no_free_xfunc, parg1, "notnull");
} else if (streq(fnnm, "asserting_null")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isnull_no_free_xfunc, parg1, "notnull");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_null_no_free_xfunc, parg1, "notnull");
} else if (streq(fnnm, "asserting_numeric")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isnumeric_no_free_xfunc, parg1, "numeric");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_numeric_no_free_xfunc, parg1, "numeric");
} else if (streq(fnnm, "asserting_present")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_ispresent_no_free_xfunc, parg1, "present");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_present_no_free_xfunc, parg1, "present");
} else if (streq(fnnm, "asserting_string")) {
return rxval_evaluator_alloc_from_A_x_func(b_x_isstring_no_free_xfunc, parg1, "string");
return rxval_evaluator_alloc_from_A_x_func(b_x_is_string_no_free_xfunc, parg1, "string");
} else if (streq(fnnm, "isabsent")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isabsent_xfunc, parg1);
} else if (streq(fnnm, "isbool")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isboolean_xfunc, parg1);
} else if (streq(fnnm, "isboolean")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isboolean_xfunc, parg1);
} else if (streq(fnnm, "isempty")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isempty_xfunc, parg1);
} else if (streq(fnnm, "isemptymap")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isemptymap_xfunc, parg1);
} else if (streq(fnnm, "isfloat")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isfloat_xfunc, parg1);
} else if (streq(fnnm, "isint")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isint_xfunc, parg1);
} else if (streq(fnnm, "ismap")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_ismap_xfunc, parg1);
} else if (streq(fnnm, "isnonemptymap")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isnonemptymap_xfunc, parg1);
} else if (streq(fnnm, "is_absent")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_absent_xfunc, parg1);
} else if (streq(fnnm, "is_bool")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_boolean_xfunc, parg1);
} else if (streq(fnnm, "is_boolean")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_boolean_xfunc, parg1);
} else if (streq(fnnm, "is_empty")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_empty_xfunc, parg1);
} else if (streq(fnnm, "is_empty_map")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_empty_map_xfunc, parg1);
} else if (streq(fnnm, "is_float")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_float_xfunc, parg1);
} else if (streq(fnnm, "is_int")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_int_xfunc, parg1);
} else if (streq(fnnm, "is_map")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_map_xfunc, parg1);
} else if (streq(fnnm, "is_nonempty_map")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_nonempty_map_xfunc, parg1);
} else if (streq(fnnm, "isnotempty")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isnotempty_xfunc, parg1);
} else if (streq(fnnm, "isnotmap")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isnotmap_xfunc, parg1);
} else if (streq(fnnm, "isnotnull")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isnotnull_xfunc, parg1);
} else if (streq(fnnm, "isnull")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isnull_xfunc, parg1);
} else if (streq(fnnm, "isnumeric")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isnumeric_xfunc, parg1);
} else if (streq(fnnm, "ispresent")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_ispresent_xfunc, parg1);
} else if (streq(fnnm, "isstring")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_isstring_xfunc, parg1);
} else if (streq(fnnm, "is_not_map")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_not_map_xfunc, parg1);
} else if (streq(fnnm, "is_not_null")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_not_null_xfunc, parg1);
} else if (streq(fnnm, "is_null")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_null_xfunc, parg1);
} else if (streq(fnnm, "is_numeric")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_numeric_xfunc, parg1);
} else if (streq(fnnm, "is_present")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_present_xfunc, parg1);
} else if (streq(fnnm, "is_string")) {
return rxval_evaluator_alloc_from_x_x_func(b_x_is_string_xfunc, parg1);
} else if (streq(fnnm, "typeof")) {
return rxval_evaluator_alloc_from_x_x_func(s_x_typeof_xfunc, parg1);

View file

@ -116,7 +116,7 @@ static void mapper_put_usage(FILE* o, char* argv0, char* verb) {
fprintf(o, " %s %s -q '@sum[$a] += $x; end {emit @sum, \"a\"}'\n", argv0, verb);
fprintf(o, " %s %s -q '@sum[$a][$b] += $x; end {emit @sum, \"a\", \"b\"}'\n", argv0, verb);
fprintf(o, " %s %s -q '@min=min(@min,$x);@max=max(@max,$x); end{emitf @min, @max}'\n", argv0, verb);
fprintf(o, " %s %s -q 'isnull(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'\n", argv0, verb);
fprintf(o, " %s %s -q 'is_null(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'\n", argv0, verb);
fprintf(o, " %s %s '\n", argv0, verb);
fprintf(o, " $x = 1;\n");
fprintf(o, " #$y = 2;\n");

View file

@ -17450,17 +17450,17 @@ foobar
================================================================
IS-PREDICATES
mlr --opprint filter isnull($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_null($x) ./reg_test/input/nullvals.dkvp
a x y z
b - 6 -
b - - -
mlr --opprint filter isnull($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_null($y) ./reg_test/input/nullvals.dkvp
a x y z
b 5 - -
b - - -
mlr --opprint filter isnull($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_null($z) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17468,7 +17468,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isnull($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_null($nosuch) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17476,27 +17476,27 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isnull($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_null($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnull({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_null({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnotnull($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_not_null($x) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
b 5 - -
mlr --opprint filter isnotnull($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_not_null($y) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
b - 6 -
mlr --opprint filter isnotnull($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_not_null($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnotnull($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_not_null($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnotnull($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_not_null($*) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17504,7 +17504,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isnotnull({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_not_null({1:2}) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17512,7 +17512,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint put $f=isnull($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_null($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17520,7 +17520,7 @@ b 5 - - false
b - 6 - true
b - - - true
mlr --opprint put $f=isnull($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_null($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17528,7 +17528,7 @@ b 5 - - true
b - 6 - false
b - - - true
mlr --opprint put $f=isnull($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_null($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17536,7 +17536,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnull($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_null($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17544,7 +17544,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnull(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_null(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17552,7 +17552,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put @somesuch=1;$f=isnull(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_null(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17560,7 +17560,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnotnull($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_null($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17568,7 +17568,7 @@ b 5 - - true
b - 6 - false
b - - - false
mlr --opprint put $f=isnotnull($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_null($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17576,7 +17576,7 @@ b 5 - - false
b - 6 - true
b - - - false
mlr --opprint put $f=isnotnull($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_null($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17584,7 +17584,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnotnull($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_null($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17592,7 +17592,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnotnull(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_null(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17600,7 +17600,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put @somesuch=1;$f=isnotnull(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_not_null(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17608,13 +17608,13 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint filter isabsent($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_absent($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isabsent($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_absent($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isabsent($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_absent($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isabsent($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_absent($nosuch) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17622,11 +17622,11 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isabsent($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_absent($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isabsent({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_absent({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter ispresent($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_present($x) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17634,7 +17634,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter ispresent($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_present($y) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17642,7 +17642,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter ispresent($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_present($z) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17650,9 +17650,9 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter ispresent($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_present($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter ispresent($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_present($*) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17660,7 +17660,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter ispresent({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_present({1:2}) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17668,37 +17668,37 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isnumeric($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_numeric($x) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
b 5 - -
mlr --opprint filter isnumeric($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_numeric($y) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
b - 6 -
mlr --opprint filter isnumeric($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_numeric($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnumeric($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_numeric($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnumeric($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_numeric($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnumeric({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_numeric({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isstring($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_string($x) ./reg_test/input/nullvals.dkvp
a x y z
b - 6 -
b - - -
mlr --opprint filter isstring($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_string($y) ./reg_test/input/nullvals.dkvp
a x y z
b 5 - -
b - - -
mlr --opprint filter isstring($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_string($z) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17706,13 +17706,13 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isstring($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_string($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isstring($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_string($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isstring({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_string({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=isabsent($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_absent($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17720,7 +17720,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isabsent($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_absent($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17728,7 +17728,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isabsent($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_absent($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17736,7 +17736,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isabsent($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_absent($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17744,7 +17744,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isabsent(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_absent(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17752,7 +17752,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put @somesuch=1;$f=isabsent(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_absent(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17760,7 +17760,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ispresent($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_present($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17768,7 +17768,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=ispresent($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_present($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17776,7 +17776,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=ispresent($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_present($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17784,7 +17784,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=ispresent($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_present($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17792,7 +17792,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ispresent(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_present(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17800,7 +17800,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put @somesuch=1;$f=ispresent(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_present(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17808,17 +17808,17 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint filter isempty($x) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_empty($x) ./reg_test/input/nullvals.dkvp
a x y z
b - 6 -
b - - -
mlr --opprint filter isempty($y) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_empty($y) ./reg_test/input/nullvals.dkvp
a x y z
b 5 - -
b - - -
mlr --opprint filter isempty($z) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_empty($z) ./reg_test/input/nullvals.dkvp
a x y z
b 1 2 -
b 3 4 -
@ -17826,11 +17826,11 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint filter isempty($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_empty($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isempty($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_empty($*) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isempty({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter is_empty({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint filter isnotempty($x) ./reg_test/input/nullvals.dkvp
a x y z
@ -17870,7 +17870,7 @@ b 5 - -
b - 6 -
b - - -
mlr --opprint put $f=isempty($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17878,7 +17878,7 @@ b 5 - - false
b - 6 - true
b - - - true
mlr --opprint put $f=isempty($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17886,7 +17886,7 @@ b 5 - - true
b - 6 - false
b - - - true
mlr --opprint put $f=isempty($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -17894,7 +17894,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isempty($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17902,7 +17902,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isempty(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17910,7 +17910,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isempty($*) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty($*) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17918,7 +17918,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isempty({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty({1:2}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17926,7 +17926,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put @somesuch=1;$f=isempty(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_empty(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -17998,7 +17998,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=ismap($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18006,7 +18006,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ismap($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18014,7 +18014,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ismap($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18022,7 +18022,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ismap($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18030,7 +18030,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ismap(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18038,7 +18038,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=ismap($*) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map($*) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18046,7 +18046,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=ismap({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map({1:2}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18054,7 +18054,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=ismap({}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_map({}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18062,7 +18062,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put @somesuch=1;$f=ismap(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_map(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18070,7 +18070,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnotmap($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18078,7 +18078,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnotmap($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18086,7 +18086,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnotmap($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18094,7 +18094,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnotmap($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18102,7 +18102,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnotmap(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18110,7 +18110,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnotmap($*) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map($*) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18118,7 +18118,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnotmap({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map({1:2}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18126,7 +18126,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnotmap({}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_not_map({}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18134,7 +18134,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put @somesuch=1;$f=isnotmap(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_not_map(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18142,7 +18142,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isemptymap($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18150,7 +18150,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18158,7 +18158,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18166,7 +18166,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18174,7 +18174,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18182,7 +18182,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap($*) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map($*) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18190,7 +18190,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map({1:2}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18198,7 +18198,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isemptymap({}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_empty_map({}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18206,7 +18206,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put @somesuch=1;$f=isemptymap(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_empty_map(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18214,7 +18214,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put $f=isnonemptymap($x) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map($x) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18222,7 +18222,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap($y) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map($y) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18230,7 +18230,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap($z) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map($z) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18238,7 +18238,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap($nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map($nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18246,7 +18246,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap(@nosuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map(@nosuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18254,7 +18254,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap($*) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map($*) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18262,7 +18262,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap({1:2}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map({1:2}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18270,7 +18270,7 @@ b 5 - - true
b - 6 - true
b - - - true
mlr --opprint put $f=isnonemptymap({}) ./reg_test/input/nullvals.dkvp
mlr --opprint put $f=is_nonempty_map({}) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - false
b 3 4 - false
@ -18278,7 +18278,7 @@ b 5 - - false
b - 6 - false
b - - - false
mlr --opprint put @somesuch=1;$f=isnonemptymap(@somesuch) ./reg_test/input/nullvals.dkvp
mlr --opprint put @somesuch=1;$f=is_nonempty_map(@somesuch) ./reg_test/input/nullvals.dkvp
a x y z f
b 1 2 - true
b 3 4 - true
@ -18834,7 +18834,7 @@ x=1,y=2,s=hello,z=true
x=1,y=,s=,z=true
x=,y=,s=hurrah,z=true
mlr put $z = isempty($s) ./reg_test/input/null-vs-empty.dkvp
mlr put $z = is_empty($s) ./reg_test/input/null-vs-empty.dkvp
x=1,y=2,s=hello,z=false
x=1,y=,s=,z=true
x=,y=,s=hurrah,z=false
@ -19433,7 +19433,7 @@ zee wye 8 0.5985540091064224 0.976181385699006 string string int float f
hat wye 9 0.03144187646093577 0.7495507603507059 string string int float float
pan wye 10 0.5026260055412137 0.9526183602969864 string string int float float
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (isfloat(v)) {@float[NR][k] = v}} end{ emit @float, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (is_float(v)) {@float[NR][k] = v}} end{ emit @float, "NR", "k" }
NR=1,k=x,float=0.346790
NR=1,k=y,float=0.726803
NR=2,k=x,float=0.758680
@ -19455,7 +19455,7 @@ NR=9,k=y,float=0.749551
NR=10,k=x,float=0.502626
NR=10,k=y,float=0.952618
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (isint(v)) {@int[NR][k] = v}} end{ emit @int, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (is_int(v)) {@int[NR][k] = v}} end{ emit @int, "NR", "k" }
NR=1,k=i,int=1
NR=2,k=i,int=2
NR=3,k=i,int=3
@ -19467,7 +19467,7 @@ NR=8,k=i,int=8
NR=9,k=i,int=9
NR=10,k=i,int=10
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (isnumeric(v)) {@numeric[NR][k] = v}} end{ emit @numeric, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (is_numeric(v)) {@numeric[NR][k] = v}} end{ emit @numeric, "NR", "k" }
NR=1,k=i,numeric=1
NR=1,k=x,numeric=0.346790
NR=1,k=y,numeric=0.726803
@ -19499,7 +19499,7 @@ NR=10,k=i,numeric=10
NR=10,k=x,numeric=0.502626
NR=10,k=y,numeric=0.952618
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (isstring(v)) {@string[NR][k] = v}} end{ emit @string, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (is_string(v)) {@string[NR][k] = v}} end{ emit @string, "NR", "k" }
NR=1,k=a,string=pan
NR=1,k=b,string=pan
NR=2,k=a,string=eks
@ -19521,9 +19521,9 @@ NR=9,k=bbb,string=wye
NR=10,k=a,string=pan
NR=10,k=b,string=wye
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (isbool(v)) {@bool[NR][k] = v}} end{ emit @bool, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (is_bool(v)) {@bool[NR][k] = v}} end{ emit @bool, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (isbool(NR==2)) {@bool[NR][k] = "NR==2"}} end{ emit @bool, "NR", "k" }
mlr --from ./reg_test/input/abixy-het put -q for (k,v in $*) {if (is_bool(NR==2)) {@bool[NR][k] = "NR==2"}} end{ emit @bool, "NR", "k" }
NR=1,k=a,bool=NR==2
NR=1,k=b,bool=NR==2
NR=1,k=i,bool=NR==2
@ -34659,7 +34659,7 @@ x= osum=1 ostype=int xtype=empty nstype=empty nsum=
x=7 osum= ostype=empty xtype=int nstype=empty 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 }
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);is_present($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
x=1 ostype=absent xtype=int nstype=int nsum=1
x= osum=1 ostype=int xtype=empty nstype=empty nsum=
x=7 osum= ostype=empty xtype=int nstype=empty nsum=
@ -34676,7 +34676,7 @@ xxx= osum=1 ostype=int xtype=absent nstype=int nsum=1
x=7 osum=1 ostype=int xtype=int nstype=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 }
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);is_present($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
x=1 ostype=absent xtype=int nstype=int nsum=1
xxx= osum=1 ostype=int xtype=absent nstype=int nsum=1
x=7 osum=1 ostype=int xtype=int nstype=int nsum=8
@ -34694,7 +34694,7 @@ x= xtype=empty sum= stype=empty
y= xtype=absent sum=10 stype=int
x=7 xtype=int sum=17 stype=int
mlr --ofs tab put $xtype=typeof($x);$sum = ispresent($x) ? $x + 10 : 999; $stype=typeof($sum)
mlr --ofs tab put $xtype=typeof($x);$sum = is_present($x) ? $x + 10 : 999; $stype=typeof($sum)
x=1 xtype=int sum=11 stype=int
x= xtype=empty sum= stype=empty
y= xtype=absent sum=999 stype=int
@ -45297,7 +45297,7 @@ pan wye 10 0.5026260055412137 0.9526183602969864 1010 2010
mlr --opprint --from ./reg_test/input/abixy put
func f(n) {
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n > 0) {
return n * f(n-1)
} else {
@ -45323,7 +45323,7 @@ pan wye 10 0.5026260055412137 0.9526183602969864 3628800
mlr --opprint --from ./reg_test/input/abixy head -n 5 then put
subr s(n) {
print "n = " . n;
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n > 0) {
call s(n-1)
}
@ -45411,7 +45411,7 @@ pan wye 10 0.5026260055412137 0.9526183602969864 89
mlr --from ./reg_test/input/abixy --opprint put
func f(n) {
if (ispresent(@fcache[n])) {
if (is_present(@fcache[n])) {
return @fcache[n]
} else {
num rv = 1;

View file

@ -1107,77 +1107,77 @@ run_mlr -n put 'begin{ENV["HOME"]="foobar"} end{print ENV["HOME"]}'
# ----------------------------------------------------------------
announce IS-PREDICATES
run_mlr --opprint filter 'isnull($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnull($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnull($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnull($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnull($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnull({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotnull($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotnull($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotnull($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotnull($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotnull($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotnull({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_null($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_null($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_null($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_null($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_null($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_null({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_not_null($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_not_null($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_not_null($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_not_null($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_not_null($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_not_null({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnull($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnull($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnull($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnull($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnull(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isnull(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotnull($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotnull($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotnull($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotnull($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotnull(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isnotnull(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_null($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_null($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_null($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_null($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_null(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_null(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_null($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_null($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_null($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_null($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_null(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_not_null(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isabsent($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isabsent($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isabsent($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isabsent($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isabsent($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isabsent({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'ispresent($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'ispresent($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'ispresent($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'ispresent($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'ispresent($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'ispresent({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_absent($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_absent($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_absent($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_absent($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_absent($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_absent({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_present($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_present($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_present($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_present($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_present($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_present({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnumeric($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnumeric($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnumeric($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnumeric($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnumeric($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnumeric({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'isstring($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isstring($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isstring($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isstring($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isstring($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isstring({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_numeric($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_numeric($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_numeric($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_numeric($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_numeric($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_numeric({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_string($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_string($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_string($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_string($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_string($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_string({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isabsent($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isabsent($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isabsent($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isabsent($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isabsent(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isabsent(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ispresent($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ispresent($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ispresent($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ispresent($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ispresent(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=ispresent(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_absent($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_absent($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_absent($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_absent($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_absent(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_absent(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_present($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_present($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_present($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_present($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_present(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_present(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isempty($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isempty($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isempty($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isempty($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isempty($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isempty({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_empty($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_empty($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_empty($z)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_empty($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_empty($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'is_empty({1:2})' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotempty($x)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotempty($y)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotempty($z)' $indir/nullvals.dkvp
@ -1185,14 +1185,14 @@ run_mlr --opprint filter 'isnotempty($nosuch)' $indir/nullvals.
run_mlr --opprint filter 'isnotempty($*)' $indir/nullvals.dkvp
run_mlr --opprint filter 'isnotempty({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isempty({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isempty(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_empty(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotempty($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotempty($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotempty($z)' $indir/nullvals.dkvp
@ -1202,43 +1202,43 @@ run_mlr --opprint put '$f=isnotempty($*)' $indir/nullvals.
run_mlr --opprint put '$f=isnotempty({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isnotempty(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=ismap({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=ismap(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnotmap({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isnotmap(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_map({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_map(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_not_map({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_not_map(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isemptymap({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isemptymap(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=isnonemptymap({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=isnonemptymap(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_empty_map({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_empty_map(@somesuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map($x)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map($y)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map($z)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map($nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map(@nosuch)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map($*)' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map({1:2})' $indir/nullvals.dkvp
run_mlr --opprint put '$f=is_nonempty_map({})' $indir/nullvals.dkvp
run_mlr --opprint put '@somesuch=1;$f=is_nonempty_map(@somesuch)' $indir/nullvals.dkvp
# ----------------------------------------------------------------
announce ASSERTION PASS-THROUGHS
@ -1361,7 +1361,7 @@ announce DSL NULL/EMPTY HANDLING
run_mlr put '$z = $s . $s' $indir/null-vs-empty.dkvp
run_mlr put '$z = $s == ""' $indir/null-vs-empty.dkvp
run_mlr put '$z = $s == $s' $indir/null-vs-empty.dkvp
run_mlr put '$z = isempty($s)' $indir/null-vs-empty.dkvp
run_mlr put '$z = is_empty($s)' $indir/null-vs-empty.dkvp
run_mlr put '$z = $x + $y' $indir/null-vs-empty.dkvp
run_mlr put '$z = $y + $y' $indir/null-vs-empty.dkvp
@ -1438,12 +1438,12 @@ announce DSL TYPE PREDICATES
run_mlr --from $indir/abixy --opprint put ' for (k, v in $*) { $[k."_type"] = typeof(v) } '
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isfloat(v)) {@float[NR][k] = v}} end{ emit @float, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isint(v)) {@int[NR][k] = v}} end{ emit @int, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isnumeric(v)) {@numeric[NR][k] = v}} end{ emit @numeric, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isstring(v)) {@string[NR][k] = v}} end{ emit @string, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isbool(v)) {@bool[NR][k] = v}} end{ emit @bool, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isbool(NR==2)) {@bool[NR][k] = "NR==2"}} end{ emit @bool, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (is_float(v)) {@float[NR][k] = v}} end{ emit @float, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (is_int(v)) {@int[NR][k] = v}} end{ emit @int, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (is_numeric(v)) {@numeric[NR][k] = v}} end{ emit @numeric, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (is_string(v)) {@string[NR][k] = v}} end{ emit @string, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (is_bool(v)) {@bool[NR][k] = v}} end{ emit @bool, "NR", "k" }'
run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (is_bool(NR==2)) {@bool[NR][k] = "NR==2"}} end{ emit @bool, "NR", "k" }'
# ----------------------------------------------------------------
announce DSL TYPE-INFERENCE
@ -3210,7 +3210,7 @@ x=
x=7
EOF
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);is_present($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
x=1
x=
x=7
@ -3228,7 +3228,7 @@ xxx=
x=7
EOF
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);is_present($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
x=1
xxx=
x=7
@ -3248,7 +3248,7 @@ y=
x=7
EOF
run_mlr --ofs tab put '$xtype=typeof($x);$sum = ispresent($x) ? $x + 10 : 999; $stype=typeof($sum)' <<EOF
run_mlr --ofs tab put '$xtype=typeof($x);$sum = is_present($x) ? $x + 10 : 999; $stype=typeof($sum)' <<EOF
x=1
x=
y=
@ -5085,7 +5085,7 @@ run_mlr --opprint --from $indir/abixy put '$o1 = a; int a=1000+NR; $o2 = a; a=20
# Test recursion
run_mlr --opprint --from $indir/abixy put '
func f(n) {
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n > 0) {
return n * f(n-1)
} else {
@ -5100,7 +5100,7 @@ run_mlr --opprint --from $indir/abixy put '
run_mlr --opprint --from $indir/abixy head -n 5 then put '
subr s(n) {
print "n = " . n;
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n > 0) {
call s(n-1)
}
@ -5135,7 +5135,7 @@ run_mlr --from $indir/abixy --opprint put '
run_mlr --from $indir/abixy --opprint put '
func f(n) {
if (ispresent(@fcache[n])) {
if (is_present(@fcache[n])) {
return @fcache[n]
} else {
num rv = 1;

View file

@ -772,7 +772,7 @@ time=1472819742,batch_size=100,num_filtered=728
<p/> Each print statement simply contains local information: the current
timestamp, whether a particular cache was hit or not, etc. Then using either
the system <tt>grep</tt> command, or Miller&rsquo;s <tt>having-fields</tt>, or
<tt>ispresent</tt>, we can pick out the parts we want and analyze them:
<tt>is_present</tt>, we can pick out the parts we want and analyze them:
<p/>
<div class="pokipanel">
@ -793,13 +793,6 @@ $ mlr --from log.txt --opprint \
filter 'ispresent($batch_size)' \
then step -a delta -f time,num_filtered \
then sec2gmt time
time batch_size num_filtered time_delta num_filtered_delta
2016-09-02T12:34:50Z 100 237 0 0
2016-09-02T12:35:05Z 100 348 15 111
2016-09-02T12:35:13Z 100 493 8 145
2016-09-02T12:35:20Z 100 554 7 61
2016-09-02T12:35:36Z 100 612 16 58
2016-09-02T12:35:42Z 100 728 6 116
</pre>
</div>
<p/>

View file

@ -270,7 +270,7 @@ POKI_RUN_COMMAND{{cat log.txt}}HERE
<p/> Each print statement simply contains local information: the current
timestamp, whether a particular cache was hit or not, etc. Then using either
the system <tt>grep</tt> command, or Miller&rsquo;s <tt>having-fields</tt>, or
<tt>ispresent</tt>, we can pick out the parts we want and analyze them:
<tt>is_present</tt>, we can pick out the parts we want and analyze them:
POKI_INCLUDE_AND_RUN_ESCAPED(10-1.sh)HERE
POKI_INCLUDE_AND_RUN_ESCAPED(10-2.sh)HERE

View file

@ -309,13 +309,13 @@ POKI_INCLUDE_AND_RUN_ESCAPED(data/keyed-min-max-with-oosvars.sh)HERE
POKI_RUN_COMMAND{{mlr --opprint step -a delta -f x data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint put '$x_delta = ispresent(@last) ? $x - @last : 0; @last = $x' data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint put '$x_delta = is_present(@last) ? $x - @last : 0; @last = $x' data/small}}HERE
<h2>Keyed delta without/with oosvars</h2>
POKI_RUN_COMMAND{{mlr --opprint step -a delta -f x -g a data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint put '$x_delta = ispresent(@last[$a]) ? $x - @last[$a] : 0; @last[$a]=$x' data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint put '$x_delta = is_present(@last[$a]) ? $x - @last[$a] : 0; @last[$a]=$x' data/small}}HERE
<h2>Exponentially weighted moving averages without/with oosvars</h2>

View file

@ -139,7 +139,7 @@ machine, and expect it to work.
# Iterate over data using DSL expressions
% mlr --from estimates.tbl put '
for (k,v in $*) {
if (isnumeric(v) && k =~ "^[t-z].*$") {
if (is_numeric(v) && k =~ "^[t-z].*$") {
$sum += v; $count += 1
}
}

View file

@ -80,7 +80,7 @@ POKI_RUN_COMMAND{{mlr --from data/small put -f data/fe-example-4.mlr -e '$xy = f
<p/>A suggested use-case here is defining functions in files, and calling them from command-line expressions.
<p/>Another suggest use-case is putting default parameter values in files, e.g. using
<tt>begin{@count=ispresent(@count)?@count:10}</tt> in the file, where you can precede that using
<tt>begin{@count=is_present(@count)?@count:10}</tt> in the file, where you can precede that using
<tt>begin{@count=40}</tt> using <tt>-e</tt>.
<p/>Moreover, you can have one or more <tt>-f</tt> expressions (maybe one
@ -261,7 +261,7 @@ commands separated by <tt>then</tt>, each put will have its own set of
out-of-stream variables:
POKI_RUN_COMMAND{{cat data/a.dkvp}}HERE
POKI_RUN_COMMAND{{mlr put '@sum += $a; end {emit @sum}' then put 'ispresent($a) {$a=10*$a; @sum += $a}; end {emit @sum}' data/a.dkvp}}HERE
POKI_RUN_COMMAND{{mlr put '@sum += $a; end {emit @sum}' then put 'is_present($a) {$a=10*$a; @sum += $a}; end {emit @sum}' data/a.dkvp}}HERE
<p/> Out-of-stream variables&rsquo; <b>extent</b> is from the start to the end of the record stream,
i.e. every time the <tt>put</tt> or <tt>filter</tt> statement referring to them is executed.
@ -430,11 +430,11 @@ POKI_RUN_COMMAND{{mlr --icsvlite --opprint put '$reachable = int(boolean($reacha
<p/> A second option is to flag badly formatted data within the output stream:
POKI_RUN_COMMAND{{mlr --icsvlite --opprint put '$format_ok = isstring($reachable)' data/het-bool.csv}}HERE
POKI_RUN_COMMAND{{mlr --icsvlite --opprint put '$format_ok = is_string($reachable)' data/het-bool.csv}}HERE
<p/> Or perhaps to flag badly formatted data outside the output stream:
POKI_RUN_COMMAND{{mlr --icsvlite --opprint put 'if (!isstring($reachable)) {eprint "Malformed at NR=".NR} ' data/het-bool.csv}}HERE
POKI_RUN_COMMAND{{mlr --icsvlite --opprint put 'if (!is_string($reachable)) {eprint "Malformed at NR=".NR} ' data/het-bool.csv}}HERE
<p/> A third way is to abort the process on first instance of bad data:
@ -562,7 +562,7 @@ the record for which the <tt>x</tt> field has the largest value in the input
stream:
POKI_RUN_COMMAND{{cat data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint put -q 'isnull(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}' data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint put -q 'is_null(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}' data/small}}HERE
<!-- ================================================================ -->
<h2>Keywords for filter and put</h2>

View file

@ -374,8 +374,8 @@ e.g. <tt>mlr put -q '@sum += $x'; end{emit @sum}'</tt> or <tt>mlr put -q
</ul>
<p/>You can test these programatically using the functions
<tt>isempty</tt>/<tt>isnotempty</tt>, <tt>isabsent</tt>/<tt>ispresent</tt>, and
<tt>isnull</tt>/<tt>isnotnull</tt>. For the last pair, note that null means
<tt>is_empty</tt>/<tt>isnotempty</tt>, <tt>is_absent</tt>/<tt>is_present</tt>, and
<tt>is_null</tt>/<tt>is_not_null</tt>. For the last pair, note that null means
either empty or absent.
<p/>
@ -420,8 +420,8 @@ The reasoning is as follows:
should accumulate numeric <tt>x</tt> values into the sum but an empty
<tt>x</tt>, when encountered in the input data stream, should make the sum
non-numeric. To work around this you can use the
<tt>isnotnull</tt> function as follows:
<tt>mlr put 'isnotnull($x) { @sum += $x }'</tt>
<tt>is_not_null</tt> function as follows:
<tt>mlr put 'is_not_null($x) { @sum += $x }'</tt>
<li/> Absent stream-record values should not break accumulations, since Miller
by design handles heterogenous data: the running <tt>@sum</tt> in
@ -449,11 +449,11 @@ as do within-record formulas if both operands are absent. If one operand is
present, you may get behavior you don&rsquo;t desire. To work around this
&mdash; namely, to set an output field only for records which have all the
inputs present &mdash; you can use a pattern-action block with
<tt>ispresent</tt>:
<tt>is_present</tt>:
POKI_RUN_COMMAND{{mlr cat data/het.dkvp}}HERE
POKI_RUN_COMMAND{{mlr put 'ispresent($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp}}HERE
POKI_RUN_COMMAND{{mlr put '$loadmillis = (ispresent($loadsec) ? $loadsec : 0.0) * 1000' data/het.dkvp}}HERE
POKI_RUN_COMMAND{{mlr put 'is_present($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp}}HERE
POKI_RUN_COMMAND{{mlr put '$loadmillis = (is_present($loadsec) ? $loadsec : 0.0) * 1000' data/het.dkvp}}HERE
<p/> If you&rsquo;re interested in a formal description of how empty and absent
fields participate in arithmetic, here&rsquo;s a table for plus (other

View file

@ -285,13 +285,13 @@ output when you see the inner IDs.
<div class="pokipanel">
<pre>
$ mlr --from data/rect.txt put -q '
ispresent($outer) {
is_present($outer) {
unset @r
}
for (k, v in $*) {
@r[k] = v
}
ispresent($inner1) {
is_present($inner1) {
emit @r
}'
outer=1,middle=10,inner1=100,inner2=101
@ -607,33 +607,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put '
' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds
i o fcount seconds_delta
1 1 1 0
2 2 3 0.000025034
3 3 5 0.000012875
4 5 9 0.000017166
5 8 15 0.000021935
6 13 25 0.000032902
7 21 41 0.000046015
8 34 67 0.000070095
9 55 109 0.000110865
10 89 177 0.000176191
11 144 287 0.000280857
12 233 465 0.000450134
13 377 753 0.000723839
14 610 1219 0.001165152
15 987 1973 0.001885891
16 1597 3193 0.003230095
17 2584 5167 0.005661011
18 4181 8361 0.008404016
19 6765 13529 0.013396025
20 10946 21891 0.023089886
21 17711 35421 0.034012079
22 28657 57313 0.055222034
23 46368 92735 0.090658903
24 75025 150049 0.144522905
25 121393 242785 0.255508184
26 196418 392835 0.373664856
27 317811 635621 0.630728960
28 514229 1028457 0.989997149
2 2 3 0.000026941
3 3 5 0.000014067
4 5 9 0.000016928
5 8 15 0.000022888
6 13 25 0.000034094
7 21 41 0.000047922
8 34 67 0.000075102
9 55 109 0.000117064
10 89 177 0.000185966
11 144 287 0.000295877
12 233 465 0.000475168
13 377 753 0.000759840
14 610 1219 0.001716137
15 987 1973 0.001904964
16 1597 3193 0.003031015
17 2584 5167 0.004718065
18 4181 8361 0.008718014
19 6765 13529 0.015923977
20 10946 21891 0.019734859
21 17711 35421 0.032289028
22 28657 57313 0.051721096
23 46368 92735 0.086901903
24 75025 150049 0.137820959
25 121393 242785 0.208922148
26 196418 392835 0.343050003
27 317811 635621 0.545367956
28 514229 1028457 0.885298967
</pre>
</div>
<p/>
@ -648,7 +648,7 @@ of previous computations:
$ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put '
func f(n) {
@fcount += 1; # count number of calls to the function
if (ispresent(@fcache[n])) { # cache hit
if (is_present(@fcache[n])) { # cache hit
return @fcache[n]
} else { # cache miss
num rv = 1;
@ -665,27 +665,27 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put '
' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds
i o fcount seconds_delta
1 1 1 0
2 2 3 0.000036955
2 2 3 0.000027895
3 3 3 0.000013113
4 5 3 0.000010967
5 8 3 0.000010967
6 13 3 0.000010014
7 21 3 0.000010967
6 13 3 0.000010967
7 21 3 0.000010014
8 34 3 0.000010014
9 55 3 0.000010014
10 89 3 0.000010967
10 89 3 0.000010014
11 144 3 0.000010014
12 233 3 0.000014067
13 377 3 0.000010967
14 610 3 0.000010014
15 987 3 0.000010014
13 377 3 0.000011921
14 610 3 0.000010967
15 987 3 0.000010967
16 1597 3 0.000010014
17 2584 3 0.000010014
18 4181 3 0.000010014
18 4181 3 0.000010967
19 6765 3 0.000010014
20 10946 3 0.000010967
21 17711 3 0.000010967
22 28657 3 0.000010014
20 10946 3 0.000010014
21 17711 3 0.000012159
22 28657 3 0.000010967
23 46368 3 0.000011921
24 75025 3 0.000010967
25 121393 3 0.000010014
@ -1523,7 +1523,7 @@ wye pan 5 0.5732889198020006 0.8636244699032729 0.191890
<p/>
<div class="pokipanel">
<pre>
$ mlr --opprint put '$x_delta = ispresent(@last) ? $x - @last : 0; @last = $x' data/small
$ mlr --opprint put '$x_delta = is_present(@last) ? $x - @last : 0; @last = $x' data/small
a b i x y x_delta
pan pan 1 0.3467901443380824 0.7268028627434533 0
eks pan 2 0.7586799647899636 0.5221511083334797 0.411890
@ -1553,7 +1553,7 @@ wye pan 5 0.5732889198020006 0.8636244699032729 0.368686
<p/>
<div class="pokipanel">
<pre>
$ mlr --opprint put '$x_delta = ispresent(@last[$a]) ? $x - @last[$a] : 0; @last[$a]=$x' data/small
$ mlr --opprint put '$x_delta = is_present(@last[$a]) ? $x - @last[$a] : 0; @last[$a]=$x' data/small
a b i x y x_delta
pan pan 1 0.3467901443380824 0.7268028627434533 0
eks pan 2 0.7586799647899636 0.5221511083334797 0

View file

@ -1,6 +1,6 @@
mlr --opprint --from data/small put '
func f(n) {
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n > 0) {
return n * f(n-1);
} else {

View file

@ -1,7 +1,7 @@
mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put '
func f(n) {
@fcount += 1; # count number of calls to the function
if (ispresent(@fcache[n])) { # cache hit
if (is_present(@fcache[n])) { # cache hit
return @fcache[n]
} else { # cache miss
num rv = 1;

View file

@ -2,7 +2,7 @@ mlr --from data/small --opprint put '
$sum1 = 0;
$sum2 = 0;
for (k,v in $*) {
if (isnumeric(v)) {
if (is_numeric(v)) {
$sum1 +=v;
$sum2 += $[k];
}

View file

@ -1,7 +1,7 @@
mlr --from data/small --opprint put '
@sum = 0;
for (k,v in $*) {
if (isnumeric(v)) {
if (is_numeric(v)) {
@sum += $[k];
}
}

View file

@ -1,10 +1,10 @@
mlr --from data/rect.txt put -q '
ispresent($outer) {
is_present($outer) {
unset @r
}
for (k, v in $*) {
@r[k] = v
}
ispresent($inner1) {
is_present($inner1) {
emit @r
}'

View file

@ -4,7 +4,7 @@ mlr --opprint --from data/small put -q '
}
subr s(n) {
@call_count += 1;
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n > 1) {
call s(n-1);
} else {

View file

@ -282,7 +282,7 @@ machine, and expect it to work.
# Iterate over data using DSL expressions
% mlr --from estimates.tbl put '
for (k,v in $*) {
if (isnumeric(v) && k =~ "^[t-z].*$") {
if (is_numeric(v) && k =~ "^[t-z].*$") {
$sum += v; $count += 1
}
}

View file

@ -182,7 +182,7 @@ EXAMPLES
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/*
mlr --from estimates.tbl put '
for (k,v in $*) {
if (isnumeric(v) &amp;&amp; k =~ "^[t-z].*$") {
if (is_numeric(v) &amp;&amp; k =~ "^[t-z].*$") {
$sum += v; $count += 1
}
}
@ -282,11 +282,11 @@ OPTIONS
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 sec2gmtdate sec2hms strftime strptime systime
isabsent isbool isboolean isempty isemptymap isfloat isint ismap isnonemptymap
isnotempty isnotmap isnotnull isnull isnumeric ispresent isstring
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
is_absent is_bool is_boolean is_empty is_empty_map is_float is_int is_map
is_nonempty_map isnotempty is_not_map is_not_null is_null is_numeric
is_present is_string 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 boolean float fmtnum hexfmt int string typeof depth haskey
joink joinkv joinv leafcount length mapdiff mapsum splitkv splitkvx splitnv
@ -884,7 +884,7 @@ VERBS
mlr put -q '@sum[$a] += $x; end {emit @sum, "a"}'
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}'
mlr put -q '@min=min(@min,$x);@max=max(@max,$x); end{emitf @min, @max}'
mlr put -q 'isnull(@xmax) || $x &gt; @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put -q 'is_null(@xmax) || $x &gt; @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put '
$x = 1;
#$y = 2;
@ -1529,52 +1529,52 @@ FUNCTIONS FOR FILTER/PUT
(class=time #args=0): Floating-point seconds since the epoch,
e.g. 1440768801.748936.
isabsent
is_absent
(class=typing #args=1): False if field is present in input, false otherwise
isbool
(class=typing #args=1): True if field is present with boolean value. Synonymous with isboolean.
is_bool
(class=typing #args=1): True if field is present with boolean value. Synonymous with is_boolean.
isboolean
(class=typing #args=1): True if field is present with boolean value. Synonymous with isbool.
is_boolean
(class=typing #args=1): True if field is present with boolean value. Synonymous with is_bool.
isempty
is_empty
(class=typing #args=1): True if field is present in input with empty string value, false otherwise.
isemptymap
is_empty_map
(class=typing #args=1): True if argument is a map which is empty.
isfloat
is_float
(class=typing #args=1): True if field is present with value inferred to be float
isint
is_int
(class=typing #args=1): True if field is present with value inferred to be int
ismap
is_map
(class=typing #args=1): True if argument is a map.
isnonemptymap
is_nonempty_map
(class=typing #args=1): True if argument is a map which is non-empty.
isnotempty
(class=typing #args=1): False if field is present in input with empty value, false otherwise
isnotmap
is_not_map
(class=typing #args=1): True if argument is not a map.
isnotnull
is_not_null
(class=typing #args=1): False if argument is null (empty or absent), true otherwise.
isnull
is_null
(class=typing #args=1): True if argument is null (empty or absent), false otherwise.
isnumeric
is_numeric
(class=typing #args=1): True if field is present with value inferred to be int or float
ispresent
is_present
(class=typing #args=1): True if field is present in input, false otherwise.
isstring
is_string
(class=typing #args=1): True if field is present with string (including empty-string) value
asserting_absent
@ -1989,7 +1989,7 @@ SEE ALSO
2016-12-20 MILLER(1)
2016-12-21 MILLER(1)
</pre>
</div>
<p/>

View file

@ -33,7 +33,7 @@ EXAMPLES
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/*
mlr --from estimates.tbl put '
for (k,v in $*) {
if (isnumeric(v) && k =~ "^[t-z].*$") {
if (is_numeric(v) && k =~ "^[t-z].*$") {
$sum += v; $count += 1
}
}
@ -133,11 +133,11 @@ OPTIONS
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 sec2gmtdate sec2hms strftime strptime systime
isabsent isbool isboolean isempty isemptymap isfloat isint ismap isnonemptymap
isnotempty isnotmap isnotnull isnull isnumeric ispresent isstring
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
is_absent is_bool is_boolean is_empty is_empty_map is_float is_int is_map
is_nonempty_map isnotempty is_not_map is_not_null is_null is_numeric
is_present is_string 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 boolean float fmtnum hexfmt int string typeof depth haskey
joink joinkv joinv leafcount length mapdiff mapsum splitkv splitkvx splitnv
@ -735,7 +735,7 @@ VERBS
mlr put -q '@sum[$a] += $x; end {emit @sum, "a"}'
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}'
mlr put -q '@min=min(@min,$x);@max=max(@max,$x); end{emitf @min, @max}'
mlr put -q 'isnull(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put -q 'is_null(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put '
$x = 1;
#$y = 2;
@ -1380,52 +1380,52 @@ FUNCTIONS FOR FILTER/PUT
(class=time #args=0): Floating-point seconds since the epoch,
e.g. 1440768801.748936.
isabsent
is_absent
(class=typing #args=1): False if field is present in input, false otherwise
isbool
(class=typing #args=1): True if field is present with boolean value. Synonymous with isboolean.
is_bool
(class=typing #args=1): True if field is present with boolean value. Synonymous with is_boolean.
isboolean
(class=typing #args=1): True if field is present with boolean value. Synonymous with isbool.
is_boolean
(class=typing #args=1): True if field is present with boolean value. Synonymous with is_bool.
isempty
is_empty
(class=typing #args=1): True if field is present in input with empty string value, false otherwise.
isemptymap
is_empty_map
(class=typing #args=1): True if argument is a map which is empty.
isfloat
is_float
(class=typing #args=1): True if field is present with value inferred to be float
isint
is_int
(class=typing #args=1): True if field is present with value inferred to be int
ismap
is_map
(class=typing #args=1): True if argument is a map.
isnonemptymap
is_nonempty_map
(class=typing #args=1): True if argument is a map which is non-empty.
isnotempty
(class=typing #args=1): False if field is present in input with empty value, false otherwise
isnotmap
is_not_map
(class=typing #args=1): True if argument is not a map.
isnotnull
is_not_null
(class=typing #args=1): False if argument is null (empty or absent), true otherwise.
isnull
is_null
(class=typing #args=1): True if argument is null (empty or absent), false otherwise.
isnumeric
is_numeric
(class=typing #args=1): True if field is present with value inferred to be int or float
ispresent
is_present
(class=typing #args=1): True if field is present in input, false otherwise.
isstring
is_string
(class=typing #args=1): True if field is present with string (including empty-string) value
asserting_absent
@ -1840,4 +1840,4 @@ SEE ALSO
2016-12-20 MILLER(1)
2016-12-21 MILLER(1)

View file

@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2016-12-20
.\" Date: 2016-12-21
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2016-12-20" "\ \&" "\ \&"
.TH "MILLER" "1" "2016-12-21" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -58,7 +58,7 @@ mlr stats2 -a linreg-pca -f u,v -g shape data/*
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/*
mlr --from estimates.tbl put '
for (k,v in $*) {
if (isnumeric(v) && k =~ "^[t-z].*$") {
if (is_numeric(v) && k =~ "^[t-z].*$") {
$sum += v; $count += 1
}
}
@ -182,11 +182,11 @@ output separator to the given value.
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 sec2gmtdate sec2hms strftime strptime systime
isabsent isbool isboolean isempty isemptymap isfloat isint ismap isnonemptymap
isnotempty isnotmap isnotnull isnull isnumeric ispresent isstring
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
is_absent is_bool is_boolean is_empty is_empty_map is_float is_int is_map
is_nonempty_map isnotempty is_not_map is_not_null is_null is_numeric
is_present is_string 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 boolean float fmtnum hexfmt int string typeof depth haskey
joink joinkv joinv leafcount length mapdiff mapsum splitkv splitkvx splitnv
@ -972,7 +972,7 @@ Examples:
mlr put -q '@sum[$a] += $x; end {emit @sum, "a"}'
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}'
mlr put -q '@min=min(@min,$x);@max=max(@max,$x); end{emitf @min, @max}'
mlr put -q 'isnull(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put -q 'is_null(@xmax) || $x > @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put '
$x = 1;
#$y = 2;
@ -2263,7 +2263,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isabsent"
.SS "is_absent"
.if n \{\
.RS 0
.\}
@ -2272,25 +2272,25 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isbool"
.SS "is_bool"
.if n \{\
.RS 0
.\}
.nf
(class=typing #args=1): True if field is present with boolean value. Synonymous with isboolean.
(class=typing #args=1): True if field is present with boolean value. Synonymous with is_boolean.
.fi
.if n \{\
.RE
.SS "isboolean"
.SS "is_boolean"
.if n \{\
.RS 0
.\}
.nf
(class=typing #args=1): True if field is present with boolean value. Synonymous with isbool.
(class=typing #args=1): True if field is present with boolean value. Synonymous with is_bool.
.fi
.if n \{\
.RE
.SS "isempty"
.SS "is_empty"
.if n \{\
.RS 0
.\}
@ -2299,7 +2299,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isemptymap"
.SS "is_empty_map"
.if n \{\
.RS 0
.\}
@ -2308,7 +2308,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isfloat"
.SS "is_float"
.if n \{\
.RS 0
.\}
@ -2317,7 +2317,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isint"
.SS "is_int"
.if n \{\
.RS 0
.\}
@ -2326,7 +2326,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "ismap"
.SS "is_map"
.if n \{\
.RS 0
.\}
@ -2335,7 +2335,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isnonemptymap"
.SS "is_nonempty_map"
.if n \{\
.RS 0
.\}
@ -2353,7 +2353,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isnotmap"
.SS "is_not_map"
.if n \{\
.RS 0
.\}
@ -2362,7 +2362,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isnotnull"
.SS "is_not_null"
.if n \{\
.RS 0
.\}
@ -2371,7 +2371,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isnull"
.SS "is_null"
.if n \{\
.RS 0
.\}
@ -2380,7 +2380,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isnumeric"
.SS "is_numeric"
.if n \{\
.RS 0
.\}
@ -2389,7 +2389,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "ispresent"
.SS "is_present"
.if n \{\
.RS 0
.\}
@ -2398,7 +2398,7 @@ e.g. 1440768801.748936.
.fi
.if n \{\
.RE
.SS "isstring"
.SS "is_string"
.if n \{\
.RS 0
.\}

View file

@ -403,7 +403,7 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,xy=1.036584
<p/>A suggested use-case here is defining functions in files, and calling them from command-line expressions.
<p/>Another suggest use-case is putting default parameter values in files, e.g. using
<tt>begin{@count=ispresent(@count)?@count:10}</tt> in the file, where you can precede that using
<tt>begin{@count=is_present(@count)?@count:10}</tt> in the file, where you can precede that using
<tt>begin{@count=40}</tt> using <tt>-e</tt>.
<p/>Moreover, you can have one or more <tt>-f</tt> expressions (maybe one
@ -748,7 +748,7 @@ a=4,b=5,c=6
<p/>
<div class="pokipanel">
<pre>
$ mlr put '@sum += $a; end {emit @sum}' then put 'ispresent($a) {$a=10*$a; @sum += $a}; end {emit @sum}' data/a.dkvp
$ mlr put '@sum += $a; end {emit @sum}' then put 'is_present($a) {$a=10*$a; @sum += $a}; end {emit @sum}' data/a.dkvp
a=10,b=2,c=3
a=40,b=5,c=6
sum=5
@ -1141,22 +1141,22 @@ type, and cause a fatal error otherwise:
<div class="pokipanel">
<pre>
$ mlr -F | grep ^is
isabsent
isbool
isboolean
isempty
isemptymap
isfloat
isint
ismap
isnonemptymap
is_absent
is_bool
is_boolean
is_empty
is_empty_map
is_float
is_int
is_map
is_nonempty_map
isnotempty
isnotmap
isnotnull
isnull
isnumeric
ispresent
isstring
is_not_map
is_not_null
is_null
is_numeric
is_present
is_string
</pre>
</div>
<p/>
@ -1239,7 +1239,7 @@ wilma 1
<p/>
<div class="pokipanel">
<pre>
$ mlr --icsvlite --opprint put '$format_ok = isstring($reachable)' data/het-bool.csv
$ mlr --icsvlite --opprint put '$format_ok = is_string($reachable)' data/het-bool.csv
name reachable format_ok
barney false true
betty true true
@ -1254,7 +1254,7 @@ wilma 1 false
<p/>
<div class="pokipanel">
<pre>
$ mlr --icsvlite --opprint put 'if (!isstring($reachable)) {eprint "Malformed at NR=".NR} ' data/het-bool.csv
$ mlr --icsvlite --opprint put 'if (!is_string($reachable)) {eprint "Malformed at NR=".NR} ' data/het-bool.csv
Malformed at NR=4
name reachable
barney false
@ -1449,7 +1449,7 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
<p/>
<div class="pokipanel">
<pre>
$ mlr --opprint put -q 'isnull(@xmax) || $x &gt; @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}' data/small
$ mlr --opprint put -q 'is_null(@xmax) || $x &gt; @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}' data/small
a b i x y
eks pan 2 0.7586799647899636 0.5221511083334797
</pre>
@ -2033,7 +2033,7 @@ $ mlr --from data/small --opprint put '
$sum1 = 0;
$sum2 = 0;
for (k,v in $*) {
if (isnumeric(v)) {
if (is_numeric(v)) {
$sum1 +=v;
$sum2 += $[k];
}
@ -2059,7 +2059,7 @@ the stream record after the loop:
$ mlr --from data/small --opprint put '
@sum = 0;
for (k,v in $*) {
if (isnumeric(v)) {
if (is_numeric(v)) {
@sum += $[k];
}
}
@ -3417,50 +3417,50 @@ 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.
isabsent (class=typing #args=1): False if field is present in input, false
is_absent (class=typing #args=1): False if field is present in input, false
otherwise
isbool (class=typing #args=1): True if field is present with boolean value.
Synonymous with isboolean.
is_bool (class=typing #args=1): True if field is present with boolean value.
Synonymous with is_boolean.
isboolean (class=typing #args=1): True if field is present with boolean value.
Synonymous with isbool.
is_boolean (class=typing #args=1): True if field is present with boolean value.
Synonymous with is_bool.
isempty (class=typing #args=1): True if field is present in input with empty
is_empty (class=typing #args=1): True if field is present in input with empty
string value, false otherwise.
isemptymap (class=typing #args=1): True if argument is a map which is empty.
is_empty_map (class=typing #args=1): True if argument is a map which is empty.
isfloat (class=typing #args=1): True if field is present with value inferred to
is_float (class=typing #args=1): True if field is present with value inferred to
be float
isint (class=typing #args=1): True if field is present with value inferred to be
int
is_int (class=typing #args=1): True if field is present with value inferred to
be int
ismap (class=typing #args=1): True if argument is a map.
is_map (class=typing #args=1): True if argument is a map.
isnonemptymap (class=typing #args=1): True if argument is a map which is
is_nonempty_map (class=typing #args=1): True if argument is a map which is
non-empty.
isnotempty (class=typing #args=1): False if field is present in input with empty
value, false otherwise
isnotmap (class=typing #args=1): True if argument is not a map.
is_not_map (class=typing #args=1): True if argument is not a map.
isnotnull (class=typing #args=1): False if argument is null (empty or absent),
is_not_null (class=typing #args=1): False if argument is null (empty or absent),
true otherwise.
isnull (class=typing #args=1): True if argument is null (empty or absent), false
otherwise.
is_null (class=typing #args=1): True if argument is null (empty or absent),
false otherwise.
isnumeric (class=typing #args=1): True if field is present with value inferred
is_numeric (class=typing #args=1): True if field is present with value inferred
to be int or float
ispresent (class=typing #args=1): True if field is present in input, false
is_present (class=typing #args=1): True if field is present in input, false
otherwise.
isstring (class=typing #args=1): True if field is present with string (including
empty-string) value
is_string (class=typing #args=1): True if field is present with string
(including empty-string) value
asserting_absent (class=typing #args=1): Returns argument if it is absent in the
input ata, else throws an error.
@ -3593,7 +3593,7 @@ the mathematical constants PI and E.
<pre>
$ mlr --opprint --from data/small put '
func f(n) {
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n &gt; 0) {
return n * f(n-1);
} else {
@ -3672,7 +3672,7 @@ $ mlr --opprint --from data/small put -q '
}
subr s(n) {
@call_count += 1;
if (isnumeric(n)) {
if (is_numeric(n)) {
if (n &gt; 1) {
call s(n-1);
} else {

View file

@ -1665,7 +1665,7 @@ Examples:
mlr put -q '@sum[$a] += $x; end {emit @sum, "a"}'
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}'
mlr put -q '@min=min(@min,$x);@max=max(@max,$x); end{emitf @min, @max}'
mlr put -q 'isnull(@xmax) || $x &gt; @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put -q 'is_null(@xmax) || $x &gt; @xmax {@xmax=$x; @recmax=$*}; end {emit @recmax}'
mlr put '
$x = 1;
#$y = 2;

View file

@ -289,7 +289,7 @@ Command-line-syntax examples:
mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/*
mlr --from estimates.tbl put '
for (k,v in $*) {
if (isnumeric(v) &amp;&amp; k =~ "^[t-z].*$") {
if (is_numeric(v) &amp;&amp; k =~ "^[t-z].*$") {
$sum += v; $count += 1
}
}
@ -382,15 +382,15 @@ Functions for the filter and put verbs:
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 sec2gmtdate sec2hms strftime
strptime systime isabsent isbool isboolean isempty isemptymap isfloat isint
ismap isnonemptymap isnotempty isnotmap isnotnull isnull isnumeric ispresent
isstring 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 boolean float fmtnum hexfmt int string typeof depth haskey
joink joinkv joinv leafcount length mapdiff mapsum splitkv splitkvx splitnv
splitnvx
strptime systime is_absent is_bool is_boolean is_empty is_empty_map is_float
is_int is_map is_nonempty_map isnotempty is_not_map is_not_null is_null
is_numeric is_present is_string 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 boolean float fmtnum hexfmt int string
typeof depth haskey joink joinkv joinv leafcount length mapdiff mapsum
splitkv splitkvx splitnv splitnvx
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.
Please use "mlr --help-all-keywords" or "mlr -k" for help on all keywords.
@ -947,8 +947,8 @@ e.g. <tt>mlr put -q '@sum += $x'; end{emit @sum}'</tt> or <tt>mlr put -q
</ul>
<p/>You can test these programatically using the functions
<tt>isempty</tt>/<tt>isnotempty</tt>, <tt>isabsent</tt>/<tt>ispresent</tt>, and
<tt>isnull</tt>/<tt>isnotnull</tt>. For the last pair, note that null means
<tt>is_empty</tt>/<tt>isnotempty</tt>, <tt>is_absent</tt>/<tt>is_present</tt>, and
<tt>is_null</tt>/<tt>is_not_null</tt>. For the last pair, note that null means
either empty or absent.
<p/>
@ -1068,8 +1068,8 @@ The reasoning is as follows:
should accumulate numeric <tt>x</tt> values into the sum but an empty
<tt>x</tt>, when encountered in the input data stream, should make the sum
non-numeric. To work around this you can use the
<tt>isnotnull</tt> function as follows:
<tt>mlr put 'isnotnull($x) { @sum += $x }'</tt>
<tt>is_not_null</tt> function as follows:
<tt>mlr put 'is_not_null($x) { @sum += $x }'</tt>
<li/> Absent stream-record values should not break accumulations, since Miller
by design handles heterogenous data: the running <tt>@sum</tt> in
@ -1097,7 +1097,7 @@ as do within-record formulas if both operands are absent. If one operand is
present, you may get behavior you don&rsquo;t desire. To work around this
&mdash; namely, to set an output field only for records which have all the
inputs present &mdash; you can use a pattern-action block with
<tt>ispresent</tt>:
<tt>is_present</tt>:
<p/>
<div class="pokipanel">
@ -1114,7 +1114,7 @@ resource=/some/other/path,loadsec=0.97,ok=false
<p/>
<div class="pokipanel">
<pre>
$ mlr put 'ispresent($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp
$ mlr put 'is_present($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp
resource=/path/to/file,loadsec=0.45,ok=true,loadmillis=450.000000
record_count=100,resource=/path/to/file
resource=/path/to/second/file,loadsec=0.32,ok=true,loadmillis=320.000000
@ -1126,7 +1126,7 @@ resource=/some/other/path,loadsec=0.97,ok=false,loadmillis=970.000000
<p/>
<div class="pokipanel">
<pre>
$ mlr put '$loadmillis = (ispresent($loadsec) ? $loadsec : 0.0) * 1000' data/het.dkvp
$ mlr put '$loadmillis = (is_present($loadsec) ? $loadsec : 0.0) * 1000' data/het.dkvp
resource=/path/to/file,loadsec=0.45,ok=true,loadmillis=450.000000
record_count=100,resource=/path/to/file,loadmillis=0.000000
resource=/path/to/second/file,loadsec=0.32,ok=true,loadmillis=320.000000