diff options
Diffstat (limited to 'stdlib/source/library/lux/time/date.lux')
-rw-r--r-- | stdlib/source/library/lux/time/date.lux | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index 3419b07ea..96f855fee 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -102,43 +102,43 @@ [day_of_month Nat #day] ) - (implementation: .public equivalence + (def: .public equivalence (Equivalence Date) - - (def: (= reference sample) - (let [reference (representation reference) - sample (representation sample)] - (and (at //year.equivalence = + (implementation + (def: (= reference sample) + (let [reference (representation reference) + sample (representation sample)] + (and (at //year.equivalence = + (the #year reference) + (the #year sample)) + (at //month.equivalence = + (the #month reference) + (the #month sample)) + (n.= (the #day reference) + (the #day sample))))))) + + (def: .public order + (Order Date) + (implementation + (def: equivalence ..equivalence) + + (def: (< reference sample) + (let [reference (representation reference) + sample (representation sample)] + (or (at //year.order < (the #year reference) (the #year sample)) - (at //month.equivalence = - (the #month reference) - (the #month sample)) - (n.= (the #day reference) - (the #day sample)))))) - - (implementation: .public order - (Order Date) - - (def: equivalence ..equivalence) - - (def: (< reference sample) - (let [reference (representation reference) - sample (representation sample)] - (or (at //year.order < - (the #year reference) - (the #year sample)) - (and (at //year.equivalence = - (the #year reference) - (the #year sample)) - (or (at //month.order < - (the #month reference) - (the #month sample)) - (and (at //month.order = - (the #month reference) - (the #month sample)) - (n.< (the #day reference) - (the #day sample))))))))) + (and (at //year.equivalence = + (the #year reference) + (the #year sample)) + (or (at //month.order < + (the #month reference) + (the #month sample)) + (and (at //month.order = + (the #month reference) + (the #month sample)) + (n.< (the #day reference) + (the #day sample)))))))))) ) (def: section_parser @@ -189,11 +189,11 @@ ..separator (..padded (|> value ..month //month.number)) ..separator (..padded (..day_of_month value)))) -(implementation: .public codec +(def: .public codec (Codec Text Date) - - (def: encoded ..format) - (def: decoded (<text>.result ..parser))) + (implementation + (def: encoded ..format) + (def: decoded (<text>.result ..parser)))) (def: days_per_leap (|> //year.days @@ -340,13 +340,13 @@ (maybe.trusted (dictionary.value month ..month_by_number)) day)))) -(implementation: .public enum +(def: .public enum (Enum Date) + (implementation + (def: order ..order) - (def: order ..order) - - (def: succ - (|>> ..days ++ ..of_days)) + (def: succ + (|>> ..days ++ ..of_days)) - (def: pred - (|>> ..days -- ..of_days))) + (def: pred + (|>> ..days -- ..of_days)))) |