Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » lists and sequences » isSorted
next | previous | forward | backward | up | index | toc

# isSorted -- whether a list is sorted

- Usage:
    `isSorted L`
- Inputs:
  - L, a visible list,
- Outputs:
  - a Boolean value, whether the elements of L are in increasing order

## Description

    i1 : isSorted {1,2,2,3}

    o1 = true

    i2 : isSorted {1,2,3,2}

    o2 = false

    i3 : R = ZZ/2[x,y,z, MonomialOrder => Lex];

    i4 : isSorted (z^3, y^2, x)

    o4 = true

    i5 : R = ZZ/2[x,y,z, MonomialOrder => GLex];

    i6 : isSorted (z^3, y^2, x)

    o6 = false

## See also

- sort -- sort a list or columns of a matrix
- ? -- comparison operator
- lists and sequences -- a detailed overview of lists and sequences in Macaulay2

## Ways to use isSorted:

- `isSorted(VisibleList)`

## For the programmer

The object isSorted is a method function with a single argument.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/isSorted-doc.m2:30:0.