next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > The Macaulay2 language > what a class is > class

class -- class of an object

Synopsis

Description

Every object in Macaulay2 has a class, see what a class is for more details.
i1 : class {1,2,3}

o1 = List

o1 : Type
i2 : R = QQ[a..d]

o2 = R

o2 : PolynomialRing
i3 : class R

o3 = PolynomialRing

o3 : Type
Use strict equality === to test the exact class of an object.
i4 : class R === PolynomialRing

o4 = true
i5 : class R === Ring

o5 = false
However, each PolynomialRing is a Ring, by inheritance, so a more useful test uses instance.
i6 : instance(R,Ring)

o6 = true

See also