sourcelibs/Dates/demos/calendar.xtl
1⍝!/usr/bin/env xetal
2⍝# A year's dates as arrays: this month's calendar, every Friday the
3⍝# 13th of 2026 at once, and how many days lie between two dates.
4⍝# Run with "just demo Dates calendar".
5
6ᵈ⁼u̲se< "Dates"
72026 ᵈm̲onth 10
8
9⍝ The 13th of every month of 2026, as day numbers: a 3 by 12 matrix of
10⍝ dates, one per column, converted all at once.
11thirteenths ← ᵈd̲ays 3 12 r̲eshape (12 r̲eshape 2026) c̲at (r̲ange 12) c̲at 12 r̲eshape 13
12ᵈi̲so (5 = ᵈw̲eekday thirteenths) r̲eplicate thirteenths
13
14⍝ Days from the first moon landing to the start of 2026, and the weekday it fell on.
15landing ← ᵈd̲ays 1969 7 20
16(ᵈd̲ays 2026 1 1) − landing
17ᵈw̲eekday landing ⍝ 7: a Sunday