Day of the week: Difference between revisions

Content added Content deleted
No edit summary
(adding maxima)
Line 1,023: Line 1,023:
2118
2118
</pre>
</pre>

=={{header|Maxima}}==
<lang maxima>weekday(year, month, day) := block([m: month, y: year, k],
if m < 3 then (m: m + 12, y: y - 1),
k: 1 + remainder(day + quotient((m + 1)*26, 10) + y + quotient(y, 4)
+ 6*quotient(y, 100) + quotient(y, 400) + 5, 7),
['monday, 'tuesday, 'wednesday, 'thurdsday, 'friday, 'saturday, 'sunday][k]
)$

sublist(makelist(i, i, 2008, 2121),
lambda([y], weekday(y, 12, 25) = 'sunday));
/* [2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118] */</lang>


=={{header|Modula-3}}==
=={{header|Modula-3}}==