TRUE when x is a value of an R8 enum whose variant is variant, a
variant that the enum declares. A rule tests a field's variant with the
rule dialect's is_variant(kernel, "Rbf") (rule()).
Details
The name is checked against the enum's declaration, so a misspelled name is an error; for a value whose type is not registered in the session, the names are compared only.
See also
r8variant(), the variant's name.
Examples
op <- options(r8.namespace = "demo")
Shape <- new_enum("Shape", variants = list(Circle = variant(), Square = variant()))
r8is_variant(Shape@Circle, "Circle")#> [1] TRUEtry(r8is_variant(Shape@Circle, "Circel"))#> Error : `Circel` is not a variant of `demo::Shape`; the nearest variant is `Circle`. Variants: Circle, Square.options(op)