Day of the week: Difference between revisions

Content added Content deleted
(→‎{{header|Elixir}}: add Emacs Lisp)
Line 1,568: Line 1,568:
25 December 2118 is sunday
25 December 2118 is sunday
</pre>
</pre>

=={{header|Emacs Lisp}}==
<lang lisp>(require 'calendar)

(defun sunday-p (y)
"Is Dec 25th a Sunday in this year?"
(if (= (calendar-day-of-week (list 12 25 y)) 0) y nil))

(defun xmas-sunday (a b)
"In which years in the range a, b is Dec 25th a Sunday?"
(seq-filter (lambda (x) (numberp x))
(mapcar #'sunday-p (number-sequence a b))))

(print (xmas-sunday 2008 2121))</lang>
{{output}}
<pre>(2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118)</pre>


=={{header|Erlang}}==
=={{header|Erlang}}==