Day of the week: Difference between revisions

Content added Content deleted
(→‎{{header|C}}: Change from strptime() to a manual calculation. Last Fridays of year#C had similar change.)
Line 1,290: Line 1,290:
let list_make_seq first last =
let list_make_seq first last =
let rec aux i acc =
let rec aux i acc =
if i > last then acc
if i < first then acc
else aux (succ i) (i::acc)
else aux (pred i) (i::acc)
in
in
aux first []
aux last []
let print_date (year, month, day) =
let print_date (year, month, day) =
Line 1,303: Line 1,303:
Date.day_of_week (Date.make year 12 25) = Date.Sun) years in
Date.day_of_week (Date.make year 12 25) = Date.Sun) years in
print_endline "December 25 is a Sunday in:";
print_endline "December 25 is a Sunday in:";
List.iter (Printf.printf "%d\n") (List.rev years)</lang>
List.iter (Printf.printf "%d\n") years</lang>


Output:
Output: