Macaulay2 » Documentation
Packages » Macaulay2Doc > The Macaulay2 language > operators > ?
next | previous | forward | backward | up | index | toc

? -- comparison operator

Synopsis

Description

Many types of objects may be compared. Numbers are handled as one would expect, and strings, lists and sequences are generally compared lexicographically.
i1 : 3 ? 4

o1 = <

o1 : Keyword
i2 : "book" ? "boolean"

o2 = <

o2 : Keyword
i3 : 3 ? 3.

o3 = ==

o3 : Keyword
i4 : {1,2,3} ? {4,5}

o4 = <

o4 : Keyword

Polynomials from the same ring may also be compared. The order depends on the monomial order in the ring.
i5 : R = ZZ[a,b,c]

o5 = R

o5 : PolynomialRing
i6 : a*c ? b^2

o6 = <

o6 : Keyword
A set is smaller than another if it is a subset; for tallies, corresponding counts should all be smaller.
i7 : set {1,2} ? set {2,3}

o7 = incomparable

o7 : Symbol
i8 : set {1,2} ? set {1,2,3}

o8 = <

o8 : Keyword
i9 : tally {1,1,2} ? tally {1,2,3}

o9 = incomparable

o9 : Symbol
i10 : tally {1,1,2} ? tally {1,1,2,3}

o10 = <

o10 : Keyword

See also

Ways to use symbol ? :

For the programmer

The object ? is a keyword.

This operator may be used as a binary operator in an expression like x?y. The user may install binary methods for handling such expressions with code such as

         X ? Y := (x,y) -> ...

where X is the class of x and Y is the class of y.

This operator may be used as a prefix unary operator in an expression like ?y. The user may install a method for handling such expressions with code such as

           ? Y := (y) -> ...

where Y is the class of y.