⍝ Easter Sunday in year ⍵:

    easter ⍉4 10⍴2000 to 2039               ⍝ Easter tables for four decades.
20000423 20100404 20200412 20300421
20010415 20110424 20210404 20310413
20020331 20120408 20220417 20320328
20030420 20130331 20230409 20330417
20040411 20140420 20240331 20340409
20050327 20150405 20250420 20350325
20060416 20160327 20260405 20360413
20070408 20170416 20270328 20370405
20080323 20180401 20280416 20380425
20090412 20190421 20290401 20390410

    easter(1800 1900)(2000 2100)            ⍝ nested array of years.
┌─────────────────┬─────────────────┐
│18000413 19000415│20000423 21000328│
└─────────────────┴─────────────────┘

      ⍝ We can make an ISO-Date formatter for such (nested) arrays of dates:

      fmt←{{↑,∘('-'∘,)/¯4 ¯2 ¯2↑¨'0',∘⍕¨0 100 100⊤⍵}¨saw ⍵}

      fmt easter ,∘⊂/1900+⍳4                ⍝ corresponding Easter Days.
┌─────────────────────────────────────────────────────┐
│┌────────────┬──────────────────────────────────────┐│
││┌──────────┐│┌────────────┬───────────────────────┐││
│││1901-04-07│││┌──────────┐│┌──────────┬──────────┐│││
││└──────────┘│││1902-03-30│││1903-04-12│1904-04-03││││
││            ││└──────────┘│└──────────┴──────────┘│││
││            │└────────────┴───────────────────────┘││
│└────────────┴──────────────────────────────────────┘│
└─────────────────────────────────────────────────────┘

    evec← easter 1752+⍳1e4              ⍝ 10,000 Easters.

    0∧.=7|days⍉0 100 100⊤evec           ⍝ every one a Sunday!
1
    +/1000|evec                         ⍝ checksum.
3923556

Back to: code

Back to: Workspaces