Friday the 13ths
For some reason, when the 13th day of the month is a Friday, we consider that unlucky. Because it's such a popular superstition (and even those who don't believe in it enjoy the fun), we're making a website for it. Our job is to write some backed routines that the frontend team will add to pages.
Write the following:
- A function that tells you the next upcoming Friday the 13th.
- A function that tells you all the Friday the 13ths in a given year.
- A predicate that tells you if a given year + month had a Friday the 13th.
- A predicate to know if a given date (year, month, day) is a Friday the 13th.
- A function that when the next upcoming Friday the 13th falls in a given month.
If you're working in JVM Clojure, use the Java 8 java.time
package.
Thanks to this site for the problem idea, where it is rated Hard in Ruby. The problem has been modified.
Please submit your solutions as comments on this gist.
To subscribe: https://purelyfunctional.tv/newsletter/