Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #353 Test if list is sorted

Set the boolean b to true if the list items has all its elements in increasing order, false otherwise.

The order is not strict: the ordered list may contain duplicate elements.

import "slices"
b := slices.IsSorted(items)

New implementation...
< >
programming-idioms.org