118 ) = let(i =
first(search([k], m, 1, 0 )))
149 assert( key_check,
strl([
"map key missing [", k,
"]."]) )
250 missing_keys =
is_empty( ak ) || ignore
255 strl(["Update includes keys missing in map = ", ak])
275 function
map_equal(m1, m2, keys=true, values=false, sort=true) =
348 strl([ "All maps must be of equal size; sv=[", sv, "]." ])
353 strl([ "All maps must have same keys; kv=[", kv, "]." ])
356 for (k = sort ?
sort_q2( k0 ) : k0)
384 let ( entry = m[i], key =
first(entry) )
385 if ( 2 != len(entry) )
390 ", has incorrect
count=[", len(entry),"]"
398 let ( entry = m[i], key =
first(entry) )
399 if ( len(
first(search([key], m, 0, 0))) > 1 )
403 ", key=[", key,"] not
unique."
426 if (verbose)
log_info(
"begin map check");
428 if (verbose)
log_info (
"checking map format and keys.");
444 ", has incorrect count=[", len(entry),
"]"
449 if ( len(
first(search([key], m, 0, 0))) > 1 )
455 ", key=[", key,
"] not unique."
498 max ( [
for (i = keys) is_string(i) ? len(i) : len(
strl([i]) ) ] )
501 for (k = (sort ==
true) ?
sort_q(keys) : keys)
507 z = chr(
consts(p - len(str(i)), 48) )
516 s = is_string(k) ? len(k) : len(
strl([k]) )
519 chr(
consts(maxl - s, 32) )
524 log_echo ( str( num, pad,
"'", k,
"' = ",
"'", val,
"'" ) );
574 log_echo ( str ( num,
"key", fs,
"value" ) );
579 for (k = (sort ==
true) ?
sort_q(keys) : keys)
592 str(
strl_html([i], p=[index_tags]), fs )
599 log_echo ( str ( num, key, fs, val, fs ) );
module log_warn(m)
Output warning message to console.
module log_echo(m)
Output message to console.
module log_info(m)
Output information message to console.
empty_str
<string> A string with no characters (the empty string).
empty_lst
<list> A list with no values (the empty list).
function unique(v)
Return a list of the unique elements of an iterable value.
function count(mv, v, s=true, i)
Count all occurrences of a match value in an iterable value.
function not_common(v1, v2)
Return a list of the elements not present in both iterable values.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
function all_equal(v, cv)
Test if all elements of an iterable value equal a comparison value.
function is_empty(v)
Test if an iterable value is empty.
function sort_q2(v, i, d=0, r=false, s=true)
Sort the elements of an iterable value using quick sort and compare.
function sort_q(v, i, r=false)
Sort the elements of an iterable value using quick sort.
function consts(l, v, u=false)
Create a list of constant or incrementing elements.
function strl(v)
Convert a list of values to a concatenated string.
function strl_html(v, b, p, a, f, d=false)
Convert a list of values to a concatenated HTML-formatted string.
function merge_p(v, j=true)
Parallel-merge the iterable elements of a list.
function select_e(v, i, f, l)
Select each element at an index position of a list of iterable values.
function map_equal(m1, m2, keys=true, values=false, sort=true)
Compare the keys and/or values of two maps to test for equality.
function map_update(m, u, ignore=false)
Update existing key-value pairs of a map.
function map_get_value(m, k)
Get the map value associated with a key.
module map_write(m, ks, sort=false, number=false, fs="^", thn="idx", index_tags=empty_lst, key_tags=["b"], value_tags=empty_lst)
Write formatted map entries to the console.
function map_get_keys(m)
Get a list of all map keys.
module map_check(m, verbose=false)
Perform basic format checks on a map and output errors to console.
function map_from_table(t, keys=0, values=1)
Create a map from two selected columns of a data table.
function map_get_index(m, k)
Return the index of a map key.
function map_get_values(m)
Get a list of all map values.
function map_get_firstof2_or(m1, m2, k, d)
Get the the first value associated with an existing key in one of two maps.
module map_dump(m, sort=false, number=true, align=true, p=3)
Dump each map entry to the console.
function map_merge(m1, m2)
Merge the unique key-value pairs of a second map with those of a first.
$map_strict
<boolean> Enforce strict checking for map value references.
function map_exists(m, k)
Test if a key exists.
function map_get_size(m)
Get the number of map entries.
function map_errors(m)
Perform basic format checks on a map and return errors.
function map_to_table(ml, sort=false)
Create a table from a list of maps with common keys.
function is_defined(v)
Test if a value is defined.
function is_number(v)
Test if a value is a number.