Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,28 @@
MODULE Dates;
CONST SUNDAY* = 0;
MONDAY* = 1;
TUESDAY* = 2;
WEDNESDAY* = 3;
THURSDAY* = 4;
FRIDAY* = 5;
SATURDAY* = 6;
(* returns the day of the week of 31st December of year *)
PROCEDURE dayOfYearEnd* ( year : INTEGER ) : INTEGER ;
BEGIN
RETURN ( year + ( year DIV 4 ) - ( year DIV 100 ) + ( year DIV 400 ) ) MOD 7
END dayOfYearEnd ;
(* returns TRUE if year is a long year (i.e., has 53 weeks), FaLSE otherwise *)
PROCEDURE isLongYear* ( year : INTEGER ) : BOOLEAN ;
BEGIN
(* year is a long year if 31st December is a Thursday
* or the first of January is a Thursday (and so the previous
* year had 31st December on a Wednesday)
*)
RETURN ( dayOfYearEnd( year ) = THURSDAY )
OR ( dayOfYearEnd( year - 1 ) = WEDNESDAY )
END isLongYear ;
END Dates.

View file

@ -0,0 +1,12 @@
MODULE LongYear;
IMPORT Dates, Out;
VAR year : INTEGER ;
BEGIN
FOR year := 2000 TO 2099 DO
IF Dates.isLongYear( year ) THEN
Out.Int( year, 5 )
END
END;
Out.Ln
END LongYear.