33 include <../console.scad>;
34 include <datatypes-base.scad>;
70 ) =
first( search( [ri], r, 1, 0 ) );
98 ) =
first( search( [ci], c, 1, 0 ) );
229 : len( r ) * len( c );
303 if (verbose)
log_info(
"begin table check");
308 log_warn (
"table column 0 should be 'id'");
312 if (verbose)
log_info (
"row identifier found at column zero.");
316 if (verbose)
log_info (
"checking row column counts.");
320 if ( col_cnt != len ( r_iter ) )
327 ", id=[",
first(r_iter),
"]",
328 ", has incorrect column count=[", len ( r_iter ),
"]"
335 if (verbose)
log_info (
"checking for repeat column identifiers.");
337 if ( len(
first(search([
first(c_iter)], c, 0, 0))) > 1 )
338 log_warn ( str(
"repeating column identifier [",
first(c_iter),
"]") );
341 if (verbose)
log_info (
"checking for repeat row identifiers.");
343 if ( len(
first(search([
first(r_iter)], r, 0, 0))) > 1 )
344 log_warn ( str(
"repeating row identifier [",
first(r_iter),
"]") );
385 maxr0 = max( [
for (r_iter = r) len(
first(r_iter) )] ) + 1;
386 maxc0 = max( [
for (c_iter = c) len(
first(c_iter) )] ) + 1;
387 maxc1 = max( [
for (c_iter = c) len( c_iter[1] )] ) + 1;
416 "(", c_iter[1],
")", chr(
consts(maxc1-len(c_iter[1]), 32)),
function get_table_ri(r, ri)
Get the table row index that matches a table row identifier.
module log_echo(m)
Output message to console.
function is_empty(v)
Test if an iterable value is empty.
function get_table_ci(c, ci)
Get the table column index that matches a table column identifier.
function table_exists(r, c, ri, ci)
Test the existence of a table row and column identifier.
function sum(v, i1, i2)
Compute the sum of a list of numbers.
module log_warn(m)
Output warning message to console.
module log_info(m)
Output information message to console.
function get_table_v(r, c, ri, ci)
Get the table cell value for a specified row and column identifier.
function get_table_size(r, c)
Get the size of a table.
function not_defined(v)
Test if a value is not defined.
module log_error(m)
Output error message to console.
function is_defined(v)
Test if a value is defined.
function get_table_c(c, ci)
Get the table column that matches a table column identifier.
function get_table_sum(r, c, rl, cl)
Sum select rows and columns of a table.
function first(v)
Return the first element of an iterable value.
function get_table_cidl(c)
Form a list of all table column identifiers.
module table_dump(r, c, rl, cl, number=true)
Dump a table to the console.
function get_table_r(r, ri)
Get the table row that matches a table row identifier.
function consts(l, v, u=false)
Create a sequence of constant or incrementing elements.
function eselect(v, f=true, l=false, i)
Select a specified element from each iterable value of a list.
function get_table_crl(r, c, ci)
Form a list of a select column across all table rows.
module table_check(r, c, verbose=false)
Perform some basic validation/checks on a table.
function get_table_ridl(r)
Form a list of all table row identifiers.
function get_table_copy(r, c, rl, cl)
Create a new matrix from select rows and columns of a table.