on 492ae2f help sign in
39 lines 647 B history raw
1### `++dawn`
3Weekday of Jan 1
5Computes which day of the week January 1st falls on for a year `yer`,
6producing an atom. Weeks are zero-indexed beginning on Sunday.
8Accepts
9-------
11`yer` is an unsigned decimal, [`@ud`]().
13Produces
14--------
16An atom.
18Source
19------
21 ++ dawn :: weekday of jan 1
22 |= yer=@ud
23 =+ yet=(sub yer 1)
24 %- mod :_ 7
25 :(add 1 (mul 5 (mod yet 4)) (mul 4 (mod yet 100)) (mul 6 (mod yet 400)))
26 ::
28Examples
29--------
31 ~zod/try=> (dawn 2.015)
32 4
33 ~zod/try=> (dawn 1)
34 1
35 ~zod/try=> (dawn 0)
36 ! subtract-underflow
37 ! exit