Box the compass: Difference between revisions

Content added Content deleted
m (J: format numbers more regularly)
(J: add another example)
Line 31: Line 31:
indice=: 32 | 0.5 <.@+ %&11.25
indice=: 32 | 0.5 <.@+ %&11.25
deg2pnt=: points {~ indice</lang>
deg2pnt=: points {~ indice</lang>

Example use:

<lang j> i.10
0 1 2 3 4 5 6 7 8 9
deg2pnt i.10
┌─────┬─────┬─────┬─────┬─────┬─────┬─────────────┬─────────────┬─────────────┬─────────────┐
│North│North│North│North│North│North│North by east│North by east│North by east│North by east│
└─────┴─────┴─────┴─────┴─────┴─────┴─────────────┴─────────────┴─────────────┴─────────────┘</lang>


As for the required example, sometimes it's simpler to do just a small bit of "extra" work:
As for the required example, sometimes it's simpler to do just a small bit of "extra" work: