diff options
Diffstat (limited to 'stdlib/source/lux/time/instant.lux')
-rw-r--r-- | stdlib/source/lux/time/instant.lux | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 31da7dc29..d04b7c845 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -13,7 +13,7 @@ ["E" error] [maybe] (coll [list "L/" Fold<List> Functor<List>] - ["v" vector "v/" Functor<Vector> Fold<Vector>])) + [sequence #+ Sequence sequence "sequence/" Functor<Sequence> Fold<Sequence>])) (type opaque)) (.. [duration "duration/" Order<Duration>] [date])) @@ -102,33 +102,33 @@ )))) (def: normal-months - (v;Vector Nat) - (v;vector +31 +28 +31 + (Sequence Nat) + (sequence +31 +28 +31 +30 +31 +30 +31 +31 +30 +31 +30 +31)) (def: leap-year-months - (v;Vector Nat) - (v;update [+1] n.inc normal-months)) + (Sequence Nat) + (sequence;update [+1] n.inc normal-months)) (def: (find-month months time) - (-> (v;Vector Nat) duration;Duration [Nat duration;Duration]) + (-> (Sequence Nat) duration;Duration [Nat duration;Duration]) (if (duration/>= duration;empty time) - (v/fold (function [month-days [current-month time-left]] - (let [month-duration (duration;scale (nat-to-int month-days) duration;day)] - (if (i.= 0 (duration;query month-duration time-left)) - [current-month time-left] - [(n.inc current-month) (duration;merge (duration;scale -1 month-duration) time-left)]))) - [+0 time] - months) - (v/fold (function [month-days [current-month time-left]] - (let [month-duration (duration;scale (nat-to-int month-days) duration;day)] - (if (i.= 0 (duration;query month-duration time-left)) - [current-month time-left] - [(n.dec current-month) (duration;merge month-duration time-left)]))) - [+11 time] - (v;reverse months)))) + (sequence/fold (function [month-days [current-month time-left]] + (let [month-duration (duration;scale (nat-to-int month-days) duration;day)] + (if (i.= 0 (duration;query month-duration time-left)) + [current-month time-left] + [(n.inc current-month) (duration;merge (duration;scale -1 month-duration) time-left)]))) + [+0 time] + months) + (sequence/fold (function [month-days [current-month time-left]] + (let [month-duration (duration;scale (nat-to-int month-days) duration;day)] + (if (i.= 0 (duration;query month-duration time-left)) + [current-month time-left] + [(n.dec current-month) (duration;merge month-duration time-left)]))) + [+11 time] + (sequence;reverse months)))) (def: (pad value) (-> Int Text) @@ -252,7 +252,7 @@ leap-year-months normal-months) month-days (|> months - (v;nth (int-to-nat (i.dec utc-month))) + (sequence;nth (int-to-nat (i.dec utc-month))) maybe;assume)] _ (l;this "-") utc-day lex-section @@ -282,7 +282,7 @@ year-days-so-far (|> (i.* 365 years-since-epoch) (i.+ previous-leap-days)) month-days-so-far (|> months - v;to-list + sequence;to-list (list;take (int-to-nat (i.dec utc-month))) (L/fold n.+ +0)) total-days (|> year-days-so-far |