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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started