On 28 September 2017 at 01:21, Roger Hui <[email protected]> wrote:
> If you are making a calendar you may find the following of interest:
> http://www.jsoftware.com/papers/eem/qq101.htm .  It's APL but the ideas
> translate pretty readily into J.

Thanks.
Actually, I am not making a calendar :), I just wanted to see
how difficult it would be to 'rotate' one.
The thing is that on Plan9 (which is an OS) the calendar is only output
with Sunday as the 1st day of a week, like this:

; cal 10
   October 2017
 S  M Tu  W Th  F  S
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

and I just tried to get it to the form starting with Monday.
(Sure, there are many a strategy to do so). So I just wrote

draw =. 0 : 0
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
)
d =. > ". each cutopen draw
]r =. (}."1 ,. 1&|.@:({."1)) 0,d

and thus one gets the form I asked my question about:

 0  0  0  0  0  0  1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31  0  0  0  0  0

which seems ok, but I could not figure out how to print
it without the zeros...


Ruda
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to