Task

Produce a formatted   12×12   multiplication table of the kind memorized by rote when in primary (or elementary) school.



Only print the top half triangle of products.




fun format n l
  let n tostr n
  while len n < l; let n (" " + n); endwhile
  return n
endfun
 
print   "   |"
for let i 1; i <= 12; i++; print format i 4; endfor
print "\n --+"
for let i 1; i <= 12; i++; print "----"; endfor
println ""
for let i 1; i <= 12; i++
  print format i 3 + "|"
  for let j 1; j <= 12; j++
    if j < i; print "    "
    else print format (i * j) 4; endif
  endfor
  println ""
endfor