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.




  ( multiplicationTable
  =     high i j row row2 matrix padFnc tmp
      , celPad leftCelPad padFnc celDashes leftDashes
    .   !arg:?high
      & ( padFnc
        =   L i w d
          .   @(!arg:? [?L)
            & 1+(!L:?i):?L
            & " ":?w
            & "-":?d
            &   whl
              ' ( !i+-1:~<0:?i
                & " " !w:?w
                & "-" !d:?d
                )
            & str$!w:?w
            & (   
                ' ( 
                  .   @(str$(rev$!arg ()$w):?arg [($L) ?)
                    & rev$!arg
                  )
              . str$!d
              )
        )
      & padFnc$(!high^2):((=?celPad).?celDashes)
      & @(!high:?tmp [-2 ?)
      & padFnc$!tmp:((=?leftCelPad).?leftDashes)
      & 0:?i
      & :?row:?row2
      &   whl
        ' ( 1+!i:~>!high:?i
          & !row celPad$!i:?row
          & !celDashes !row2:?row2
          )
      &   str$(leftCelPad$X "|" !row \n !leftDashes "+" !row2 \n)
        : ?matrix
      & 0:?j
      &   whl
        ' ( 1+!j:~>!high:?j
          & 0:?i
          & :?row
          &   whl
            ' ( 1+!i:<!j:?i
              & celPad$() !row:?row
              )
          & leftCelPad$!j "|" !row:?row
          &   whl
            ' ( 1+!i:~>!high:?i
              & !row celPad$(!i*!j):?row
              )
          & !matrix str$(!row \n):?matrix
          )
      & str$!matrix
  )
& out$(multiplicationTable$12)
& done;