And there is a calendar verb in the standard library that may be able to
produce what you want.
calendar 2017 4
┌─────────────────────┐
│ Apr │
│ Su Mo Tu We Th Fr Sa│
│ 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 │
└─────────────────────┘
2}. {. > calendar 2017 4 1
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
calendar
3 : 0
0 calendar y
:
a=. ((j<100)*(-100&|){.6!:0'')+j=. {.y
b=. (a-x)+-/<.4 100 400%~<:a
r=. 28+3,(~:/0=4 100 400|a),10$5$3 2
r=. (-7|b+0,+/\}:r)|."0 1 r(]&:>:*"1>/)i.42
m=. (<:}.y),i.12*1=#y
h=. 'JanFebMarAprMayJunJulAugSepOctNovDec'
h=. ((x*3)|.' Su Mo Tu We Th Fr Sa'),:"1~_3(_12&{.)\h
<"2 m{h,"2[12 6 21 ($,) r{' ',3":1+i.31 1
)
Cheers, bob
> On Sep 27, 2017, at 4:21 PM, 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.
>
>
>
> On Wed, Sep 27, 2017 at 8:57 AM, Rudolf Sykora <[email protected]>
> wrote:
>
>> Hello,
>>
>> I have an array of integers
>>
>> 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
>>
>> and I want to have it printed (to a string, say) without
>> the zeros. I.e, I want to replace each isolated 0 with a space.
>> How can I do it?
>>
>> Thanks
>> Ruda
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm