Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Expressions > Testing Expressions > OrderedQ >
Mathematica > Core Language > Procedural Programming > Conditionals > Testing Expressions > OrderedQ >

OrderedQ

OrderedQ
gives True if the are in canonical order, and False otherwise.
  • By default, OrderedQ uses canonical order as described in the notes for Sort.
  • OrderedQ uses the function p to determine whether each pair of elements in list is in order.
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
OrderedQ works with any expressions:
OrderedQ works with any head, not just List:
Use Greater to test for ordering:
Find tuples that are in order:
Find which tuples are in order:
Sort by default sorts using OrderedQ:
OrderedQ by default works structurally, not by numerical value:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF