diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/time/day.lux | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/stdlib/source/lux/time/day.lux b/stdlib/source/lux/time/day.lux index 602c9261f..57c0fae13 100644 --- a/stdlib/source/lux/time/day.lux +++ b/stdlib/source/lux/time/day.lux @@ -10,6 +10,8 @@ ["." exception (#+ exception:)]] [data ["." text]] + [macro + ["." template]] [math [number ["n" nat]]]]) @@ -95,20 +97,24 @@ (def: (encode value) (case value - #Monday "Monday" - #Tuesday "Tuesday" - #Wednesday "Wednesday" - #Thursday "Thursday" - #Friday "Friday" - #Saturday "Saturday" - #Sunday "Sunday")) + (^template [<tag>] + [<tag> (template.text [<tag>])]) + ([#..Monday] + [#..Tuesday] + [#..Wednesday] + [#..Thursday] + [#..Friday] + [#..Saturday] + [#..Sunday]))) (def: (decode value) (case value - "Monday" (#try.Success #..Monday) - "Tuesday" (#try.Success #..Tuesday) - "Wednesday" (#try.Success #..Wednesday) - "Thursday" (#try.Success #..Thursday) - "Friday" (#try.Success #..Friday) - "Saturday" (#try.Success #..Saturday) - "Sunday" (#try.Success #..Sunday) + (^template [<tag>] + [(^ (template.text [<tag>])) (#try.Success <tag>)]) + ([#..Monday] + [#..Tuesday] + [#..Wednesday] + [#..Thursday] + [#..Friday] + [#..Saturday] + [#..Sunday]) _ (exception.throw ..not_a_day_of_the_week [value])))) |