Typesetting/Box Drawing Characters
Jump to navigation
Jump to search
Source: http://www.unicode.org/charts/PDF/U2500.pdf
┌┬┐├┼┤└┴┘│─ ┌ ┌ ┌ upper left corner ┬ ┬ ┬ top ┐ ┐ ┐ upper right corner ├ ├ ├ left ┼ ┬ ┬ middle ┤ ┤ ┤ right └ └ └ lower left corner ┴ ┴ ┴ bottom ┘ ┘ ┘ lower right corner │ │ │ north-south ─ ─ ─ east-west
For example:
<"0 i. 3 4 ┌─┬─┬──┬──┐ │0│1│2 │3 │ ├─┼─┼──┼──┤ │4│5│6 │7 │ ├─┼─┼──┼──┤ │8│9│10│11│ └─┴─┴──┴──┘
The box drawing characters are also useful for the tree representation (5!:4). The following example uses verbs from the Matrix Inverse page.
minors =: 1&(|:\.)"2^:2 det =: -/ .* adjoint=: [: |: */~@($&1 _1)@# * det@minors inverse=: adjoint % det treerep=: 1 : '5!:4 <''u.''' inverse f. treerep ┌─ [: ├─ |: │ ┌─ ~ ─── / ──── * │ │ ┌─────┤ ┌─ @ ──┤ ┌─ $ │ │ ┌─ @ ─┤ └─ & ─┴─ 1 _1 │ │ │ └─ # │ │ ├─ * │ └─────┤ ┌─ / ─── - │ │ ┌─ . ──┴─ * ──┤ │ │ ┌─ 1 │ └─ @ ─┤ ┌─ & ──┴─ \. ─── |: │ │ ┌─ " ─┴─ 2 │ └─ ^: ─┴─ 2 ├─ % │ ┌─ / ─── - └─ . ─┴─ *
J maps a range of 11 ASCII control characters to the box-drawing characters:
a.{~ 16 + i. 11 ┌┬┐├┼┤└┴┘│─
Here is a J sentence that returns the equivalent Unicode characters as a utf-8 string:
,(8 u: dfh) every cut '250c 252c 2510 251c 253c 2524 2514 2534 2518 2502 2500' ┌┬┐├┼┤└┴┘│─
See also
Contributed by Roger Hui.