Typesetting/Box Drawing Characters

From J Wiki
Jump to: navigation, 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
  ├─ %
  │     ┌─ / ─── -
  └─ . ─┴─ *



See also



Contributed by Roger Hui.