Question: Write an emacs/lisp program (Provide proof it works) A function called const that takes one parameter that we can assume to be a list, and
Write an emacs/lisp program (Provide proof it works)
A function called const that takes one parameter that we can assume to be a list, and returns t if all the elements of the list are identical to each other (or what we could call, a constant list) and nil otherwise. Note that both an empty list and one that has only one element can be considered constant. Use the function equal to test for equality. Implementation suggestion: with the dolist loop.
What the results should look like: (const '()) ; t (const '(a)) ; t (const '(1 2 3)) ; nil (const '(2 2 2 2)) ; t
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
