Last active
August 29, 2015 14:16
-
-
Save DmitriyVlasov/c7697a65a2a4471db2a2 to your computer and use it in GitHub Desktop.
The next ten Fridays 13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ``Next N Friday 13`` n = | |
Seq.initInfinite (fun i -> i |> float |> System.DateTime.Now.AddDays) | |
|> Seq.filter (fun date -> date.Day = 13 && date.DayOfWeek = System.DayOfWeek.Friday) | |
|> Seq.map (fun date -> date.ToShortDateString()) | |
|> Seq.take n | |
|> Seq.toList | |
// Output: | |
// val ( Next N Friday 13 ) : n:int -> string list | |
// val it : string list = | |
// ["13.02.2015"; "13.03.2015"; "13.11.2015"; "13.05.2016"; "13.01.2017"; | |
// "13.10.2017"; "13.04.2018"; "13.07.2018"; "13.09.2019"; "13.12.2019"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment