M HYPE SPLASH
// news

Empty List is Sorted?

By John Peck
$\begingroup$

Is an empty list considered to be sorted?

Let's say I have a math function sort that sorts a list of numbers.

sort :: (Eq a) => [a] -> [a]

The above function definition (written in Haskell) means that the function's input is a list of any type 'a', and then its output is a list of that same input type.

(Eq a) means that we can must be able to compare the list's elements.

Example: a could be a number since numbers can be compared for equality.

From a math point of view, is an empty List considered to be sorted?

$\endgroup$ 8 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy