to div :x :y output int quotient :x :y end to dec31_weekday :year output remainder (sum :year div :year 4 div :year -100 div :year 400) 7 end to iso_long_year? :year output or 4 = dec31_weekday :year 3 = dec31_weekday difference :year 1 end for [y 1995 2045 1] [if iso_long_year? :y [print :y]]