Box the compass: Difference between revisions

J: add another example
m (J: format numbers more regularly)
(J: add another example)
Line 31:
indice=: 32 | 0.5 <.@+ %&11.25
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:
6,962

edits