diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/time/date.lux | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 5b124a669..36719b45f 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -73,10 +73,10 @@ [(def: (<name> reference sample) (<comp> (month-to-nat reference) (month-to-nat sample)))] - [< n.<] - [<= n.<=] - [> n.>] - [>= n.>=] + [< n/<] + [<= n/<=] + [> n/>] + [>= n/>=] )) (struct: #export _ (Enum Month) @@ -153,10 +153,10 @@ [(def: (<name> reference sample) (<comp> (day-to-nat reference) (day-to-nat sample)))] - [< n.<] - [<= n.<=] - [> n.>] - [>= n.>=] + [< n/<] + [<= n/<=] + [> n/>] + [>= n/>=] )) (struct: #export _ (Enum Day) @@ -187,22 +187,22 @@ (struct: #export _ (Eq Date) (def: (= reference sample) - (and (i.= (get@ #year reference) + (and (i/= (get@ #year reference) (get@ #year sample)) (:: Eq<Month> = (get@ #month reference) (get@ #month sample)) - (n.= (get@ #day reference) + (n/= (get@ #day reference) (get@ #day sample))))) (def: (date.< reference sample) (-> Date Date Bool) - (or (i.< (get@ #year reference) + (or (i/< (get@ #year reference) (get@ #year sample)) (:: Order<Month> < (get@ #month reference) (get@ #month sample)) - (n.< (get@ #day reference) + (n/< (get@ #day reference) (get@ #day sample)))) (struct: #export _ (Order Date) @@ -220,7 +220,7 @@ ## Based on this: https://stackoverflow.com/a/42936293/6823464 (def: (pad value) (-> Int Text) - (if (i.< 10 value) + (if (i/< 10 value) (text/compose "0" (int/encode value)) (int/encode value))) @@ -228,7 +228,7 @@ (-> Date Text) ($_ text/compose (int/encode year) "-" - (pad (|> month month-to-nat n.inc nat-to-int)) "-" + (pad (|> month month-to-nat n/inc nat-to-int)) "-" (pad (|> day nat-to-int)))) (def: lex-year @@ -239,7 +239,7 @@ #let [signum (case sign? #;None 1 (#;Some _) -1)]] - (wrap (i.* signum raw-year)))) + (wrap (i/* signum raw-year)))) (def: lex-section (l;Lexer Int) @@ -247,9 +247,9 @@ (def: (leap-years year) (-> Int Int) - (|> (i./ 4 year) - (i.- (i./ 100 year)) - (i.+ (i./ 400 year)))) + (|> (i// 4 year) + (i/- (i// 100 year)) + (i/+ (i// 400 year)))) (def: normal-months (Sequence Nat) @@ -260,11 +260,11 @@ (def: leap-year-months (Sequence Nat) - (sequence;update [+1] n.inc normal-months)) + (sequence;update [+1] n/inc normal-months)) (def: (divisible? factor input) (-> Int Int Bool) - (|> input (i.% factor) (i.= 0))) + (|> input (i/% factor) (i/= 0))) (def: (leap-year? year) (-> Int Bool) @@ -280,19 +280,19 @@ _ (l;this "-") utc-month lex-section _ (p;assert "Invalid month." - (and (i.>= 1 utc-month) - (i.<= 12 utc-month))) + (and (i/>= 1 utc-month) + (i/<= 12 utc-month))) #let [months (if (leap-year? utc-year) leap-year-months normal-months) month-days (|> months - (sequence;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 _ (p;assert "Invalid day." - (and (i.>= 1 utc-day) - (i.<= (nat-to-int month-days) utc-day)))] + (and (i/>= 1 utc-day) + (i/<= (nat-to-int month-days) utc-day)))] (wrap {#year utc-year #month (case utc-month 1 #January |