A rapid pace of growth of IT is often likened to a "dog year". And now, more rapid pace comes! It calls "firefox year".
http://mozilla.jp/firefox/preview/faq/#q-rapid-3
- Firefox 5 was released at 2011-06-21.
- Firefox 6 will be released at 8 weeks after Firefox 5's one.
- Firefox n + 1 will be released at 6 weeks after Firefox n's one.
So I again try to calculate the year when the version equals release year and when the version passes release year, in F#.
In F#
let firefoxReleaseDate version =
let rec nextFirefoxReleaseDate (nextVersion) (currentDate:System.DateTime) =
match nextVersion with
| nextVersion when nextVersion <= 6 -> currentDate.AddDays(7.0 * 8.0)
| _ -> nextFirefoxReleaseDate (nextVersion - 1) (currentDate.AddDays(7.0 * 6.0))
nextFirefoxReleaseDate version (new System.DateTime(2011, 6, 21))
let calculateFirefoxYear =
let rec incrementFirefoxYear (n:int) =
let date = firefoxReleaseDate(n)
if n < date.Year
then incrementFirefoxYear (n+1)
else (n, date)
incrementFirefoxYear(5)
let result = calculateFirefoxYear
let firefoxYearVersion = fst result
let firefoxYearDate = snd result
System.Console.WriteLine("The version equals release year ({0}) ({1:d})", firefoxYearVersion, firefoxYearDate)
System.Console.WriteLine("The version passes release year ({0}) ({1:d})", firefoxYearVersion+1, firefoxReleaseDate(firefoxYearVersion+1))
The version equals release year (2272) (2272/03/12) The version passes release year (2273) (2272/04/23)
No comments:
Post a Comment