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.
Are we limited to Clojure? I stayed on the simple path with F#. I thought about trying to condense it, but straight up listing it works well enough. If we had to consider the day (e.g. each season usually starts on the 20th or so), it would probably be clearer to break it up a bit.