 ALIAS: first-day-of-lent ash-wednesday
 
 HOLIDAY: fat-tuesday ash-wednesday 1 days time- ;
-
-HOLIDAY: good-friday easter 2 days time- ;
 
 HOLIDAY: tax-day april 15 >>day ;
 


PRIVATE>

M: us-federal holidays
    (holidays) [
        [ clone ] dip execute( timestamp -- timestamp ) adjust-federal-holiday
    ] with map ;

: us-post-office-open? ( timestamp -- ? )
    { [ sunday? not ] [ us-federal holiday? not ] } 1&& ;

HOLIDAY: new-years-day january 1 >>day ;
HOLIDAY-NAME: new-years-day world "New Year's Day"
HOLIDAY-NAME: new-years-day us-federal "New Year's Day"

HOLIDAY: martin-luther-king-day january 2 monday-of-month ;
HOLIDAY-NAME: martin-luther-king-day us-federal "Martin Luther King Day"

HOLIDAY: inauguration-day january 20 >>day [ dup 4 neg rem + ] change-year ;
HOLIDAY-NAME: inauguration-day us "Inauguration Day"

HOLIDAY: washingtons-birthday february 2 monday-of-month ;
HOLIDAY-NAME: washingtons-birthday us-federal "Washington's Birthday"

HOLIDAY: memorial-day may last-monday-of-month ;
HOLIDAY-NAME: memorial-day us-federal "Memorial Day"

HOLIDAY: independence-day july 4 >>day ;
HOLIDAY-NAME: independence-day us-federal "Independence Day"

HOLIDAY: labor-day september 0 monday-of-month ;
HOLIDAY-NAME: labor-day us-federal "Labor Day"

HOLIDAY: columbus-day october 1 monday-of-month ;
HOLIDAY-NAME: columbus-day us-federal "Columbus Day"

combinators.short-circuit kernel math sequences ;
IN: calendar.holidays.us

SINGLETONS: us us-federal us-market ;

HOLIDAY: new-years-day january 1 >>day ;
HOLIDAY-NAME: new-years-day world "New Year's Day"
HOLIDAY-NAME: new-years-day us-federal "New Year's Day"
HOLIDAY-NAME: new-years-day us-market "New Year's Day"

<PRIVATE

: adjust-federal-holiday ( timestamp -- timestamp )
    {
        ! Don't adjust to Dec 31
        { [ dup { [ dup new-years-day same-day? ] [ saturday? ] } 1&& ] [ ] }
        { [ dup saturday? ] [ -1 days (time+) ] }
        { [ dup sunday? ] [ 1 days (time+) ] }
        [ ]
