table.md

@include "au"
@include "list"
@include "Num"
@include "Sym"
@include "csv"

function Header(i) {
  isa(Object(i))
  has(i,"cols")
  has(i,"less") ; has(i,"more")
  has(i,"indep"); has(i,"dep")
  has(i,"nums") ; has(i,"syms") 
  has(i,"all")
  i.class=""
}
function HeaderAdd(i,c,cell,     what,w) {
  what = "Num"
  w    = 1
  if (cell  ~ /!/)       i.class = c
  if (cell  ~ />/)       push(i.more, c)
  if (cell  ~ /</)      {push(i.less, c); w=-1}
  if (cell  ~ /[<>\$]/)  push(i.nums, c)
  if (cell !~ /[<>\$]/) {push(i.syms, c); what="Sym"}
  if (cell  ~ /[<>!]/)   push(i.dep,  c)
  if (cell !~ /[<>!]/)   push(i.indep,c)
  has3(i.all, c, what, c, cell,w)
}
function Row(i) {
  isa(Object(i))
  has(i,"cells")
}
function Table(i) {
  isa(Object(i))
  has(i,"has","Header")
  has(i,"rows")
  has(i,"use")
}
function TableFromFile(i,file) {
  csv(i,file,"TableRow","TableHeader")
}
function TableHeader(i,r,cells,  c0,c1,cell) {
  for(c0 in cells) {
    cell  = cells[c0]
    if (cell !~ /\?/) {
      i.use[++c1] = c0 
      HeaderAdd(i.has,c1,cell)
}}}     
function TableRow(i,r,cells,    c0,c1,cell) {
  has(i.rows,r,"Row")
  for(c1 in i.use)  {
    c0 = i.use[c1]
    i.rows[r].cells[c1] = @Add(i.has.all[c1], cells[c0])
}}