Question: Write an emacs/lisp program (Provide proof it works) A function called sorted that takes one parameter that is a list and returns true (t) or
Write an emacs/lisp program (Provide proof it works)
A function called sorted that takes one parameter that is a list and returns true (t) or false (nil) based on whether the list is sorted in ascending order or not. Note that an empty list or a list with a single element are sorted by default. Implementation suggestion: using dolist where you store the previous element in a variable as you go along, or recursion.
What the results should look like: (sorted '()) ; t (sorted '(10)) ; t (sorted '(5 5 5)) ; t (sorted '(4 3 2 1)) ; nil (sorted '(2 5 9 12 14)) ; t
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
