Explanation
a,b are cmdline args; s is space; x is empty string (implicit)
Ph:'-Xa<>3JW'+
'-Xa String of hyphens of length a
<>3 grouped into substrings of (maximum) length 3
JW'+ Join on +, also wrapping the result in +
h: Assign that string to h (mnemonic: "header")
P and print it (with newline)
PsX#h-2WR:'|Xb<>2J'+^xh
'|Xb String of pipes of length b
<>2 grouped into substrings of (maximum) length 2
J'+ joined on +
^x and split on empty string (i.e. converted to list of chars)
sX#h-2 String of len(h)-2 spaces
WR: Wrap the spaces with the list of chars
Note 1: WR operates itemwise on lists, so the result is a list,
each item of which consists of the spaces wrapped in an item
from the list of chars
Note 2: the : compute-and-assign meta-operator is here abused
to give WR: lower precedence than J and ^ and avoid parentheses
P Print that list, newline-separated (-n flag)
h Autoprint the header a second time as the footer
Explanation
a,b are cmdline args; s is space; x is empty string (implicit)
Ph:'-Xa<>3JW'+
'-Xa String of hyphens of length a
<>3 grouped into substrings of (maximum) length 3
JW'+ Join on +, also wrapping the result in +
h: Assign that string to h (mnemonic: "header")
P and print it (with newline)
PsX#h-2WR:'|Xb<>2J'+^xh
'|Xb String of pipes of length b
<>2 grouped into substrings of (maximum) length 2
J'+ joined on +
^x and split on empty string (i.e. converted to list of chars)
sX#h-2 String of len(h)-2 spaces
WR: Wrap the spaces with the list of chars
Note 1: WR operates itemwise on lists, so the result is a list,
each item of which consists of the spaces wrapped in an item
from the list of chars
Note 2: the : compute-and-assign meta-operator is here abused
to give WR: lower precedence than J and ^ and avoid parentheses
P Print that list, newline-separated (-n flag)
h Autoprint the header a second time as the footer