isSorted -package:tensort

Check if the keys of a Map are already sorted
isSorted (sort m) = True
>>> isSorted (fromList [("B",1),("A",2)])  -- Sortedness is based only on keys
False

>>> isSorted (fromList [("A",2),("B",1)])
True
>>> isSorted (fromList [2, 1])
False

>>> isSorted (fromList [1, 2])
True
The isSorted predicate returns True if the elements of a list occur in non-descending order, equivalent to isSortedBy (<=).
Check whether a sorted list is sorted. Of course, this function should always return True. It's used mostly for testing.
The isSortedBy function returns True iff the predicate returns true for all adjacent pairs of elements in the list.