on 492ae2f help sign in
57 lines 1.3 kB history raw
1### `++yall`
3Time since beginning of time
5Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
6day from a number of days from the beginning of time.
8Accepts
9-------
11`day` is a [`@ud`]()
13Produces
14--------
17Source
18------
20 ++ yall :: day / to day of year
21 |= day/@ud
22 ^- {y/@ud m/@ud d/@ud}
23 =+ [era=0 cet=0 lep=*?]
24 => .(era (div day era:yo), day (mod day era:yo))
25 => ^+ .
26 ?: (lth day +(cet:yo))
27 .(lep &, cet 0)
28 => .(lep |, cet 1, day (sub day +(cet:yo)))
29 .(cet (add cet (div day cet:yo)), day (mod day cet:yo))
30 =+ yer=(add (mul 400 era) (mul 100 cet))
31 |- ^- {y/@ud m/@ud d/@ud}
32 =+ dis=?:(lep 366 365)
33 ?. (lth day dis)
34 =+ ner=+(yer)
35 $(yer ner, day (sub day dis), lep =(0 (end 0 2 ner)))
36 |- ^- {y/@ud m/@ud d/@ud}
37 =+ [mot=0 cah=?:(lep moy:yo moh:yo)]
38 |- ^- {y/@ud m/@ud d/@ud}
39 =+ zis=(snag mot cah)
40 ?: (lth day zis)
41 [yer +(mot) +(day)]
42 $(mot +(mot), day (sub day zis))
43 ::
45Examples
46--------
48 ~zod/try=> (yall 198)
49 [y=0 m=7 d=17]
50 ~zod/try=> (yall 90.398)
51 [y=247 m=7 d=3]
52 ~zod/try=> (yall 0)
53 [y=0 m=1 d=1]
57***