---Sherlock, Ric wrote:
> In fact I think it would be useful to add a similar optional
> left argument to calendar so that the following is possible.
>
>       0 calendar 2008 1
> +---------------------+
> |         Jan         |
> | Su Mo Tu We Th Fr Sa|
> |        1  2  3  4  5|
> |  6  7  8  9 10 11 12|
...
>       1 calendar 2008 1
> +---------------------+
> |         Jan         |
> | Mo Tu We Th Fr Sa Su|
> |     1  2  3  4  5  6|
...
> 0 should probably be the default left argument for calendar
> to support legacy code?

Something like this would work I think:
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
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to