36 include <primitives.scad>;
76 i =
first(search([key], map, 1, 0 ))
174 if (verbose)
log_info(
"begin map check");
176 if (verbose)
log_info (
"checking map format and keys.");
185 if ( 2 != len(entry) )
192 ", has incorrect count=[", len(entry),
"]"
205 ", key=[", key,
"] is not a string."
211 if ( len(
first(search([key], map, 0, 0))) > 1 )
216 ", key=[", key,
"] not unique."
255 maxl = max( [
for (i = keys) len(i)] ) + 1;
257 for (key = sort ?
qsort(keys) : keys)
266 chr(
consts(maxl-len(key), 32)),
"'", key,
"' = ",
module map_check(map, verbose=false)
Perform some basic validation/checks on a map.
module log_error(m)
Output error message to console.
function qsort(v, r=false)
Sort the numeric or string elements of a vector using quick sort.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
module log_info(m)
Output information message to console.
module log_echo(m)
Output message to console.
function map_get(map, key)
Get the value associated with a map key.
function map_exists(map, key)
Test if a key exists in a map.
function map_get_values(map)
Get a vector of the map entry values.
function eselect(v, f=true, l=false, i)
Select an element from each iterable value.
function map_get_idx(map, key)
Return the index for the storage location of a map key-value pair.
module log_warn(m)
Output warning message to console.
empty_v
A vector with no content (the empty vector).
function is_string(v)
Test if a value is a string.
empty_str
A string with no content (the empty string).
function map_get_keys(map)
Get a vector of the map entry identifier keys.
function consts(l, v)
Create a vector of constant elements.
module map_dump(map, sort=true, number=true, p=3)
Dump each map key-value pair to the console.
function map_size(map)
Get the number of key-value pairs stored in a map.