Seasons
Well, it's Hurricane Season here in the Gulf South. But that's not the kind of seasons I'm talking about now.
Your job is to take a month (keyword) day (number) and a hemisphere (:north
or :south
) and determine which season it is (return a keyword), according to this handy table.
Start End North South
March 1 May 31 Spring Autumn
June 1 August 31 Summer Winter
September 1 November 30 Autumn Spring
December 1 February 29 Winter Summer
Example:
(which-season :north :march 5) ;=> :spring
(which-season :south :december 25) ;=> :summer
Thanks to this site for the challenge idea where it is considered Hard level in JavaScript.
Please submit your solutions as comments to this gist. Discussion is welcome.
This solution parses the text and also takes care of the days at the beginning of the year, which are tricky: