POSITION:028,114
COLOUR:STANDARD
TEXT:00,You've probably noticed, in all of the "if" statement examples we
TEXT:16,have shown, we used expressions that involved atom variables and values.
TEXT:16,The reason for this is because "if" statements cannot handle direct
TEXT:16,comparisons using sequence data objects. However, there is a library
TEXT:16,routine that can help you get around this problem:
COLOUR:EUPHORIA
TEXT:32,   = compare(  ,   )
COLOUR:POINTS
TEXT:00,ri           o1  o2
COLOUR:STANDARD
TEXT:32,compare() takes two data objects,    and   , and compares them, returning
COLOUR:POINTS
TEXT:00,                                  o1     o2
COLOUR:STANDARD
TEXT:16,an integer value that represents the result of the comparison. If    is
COLOUR:POINTS
TEXT:00,                                                                  o1
COLOUR:STANDARD
TEXT:16:equal to   , 0 is returned. If    is smaller than   , -1 is returned. If
COLOUR:POINTS
TEXT:00,         o2                    o1                 o2
COLOUR:STANDARD
TEXT:16,   is larger than   , 1 is returned. compare() can compare two atoms,
COLOUR:POINTS
TEXT:00,o1                o2
COLOUR:STANDARD
TEXT:16,two sequences, or a sequence and an atom. Atoms are always assumed to be
TEXT:16,smaller than sequences in value. Where sequence comparison is concerned,
TEXT:16,it's an element by element comparison until a difference is found, either
TEXT:16,in the length of the sequences or a different element value.

