has_cvar
has_cvar — queries for the existence of a class variable.
has_cvar (instance|class, variable)
instance|classAn instance of a class; or a class.
variableAn class variable name, as a symbol.
This function checks for the existence of class variables for a class or instance of a class. It searches all parent (base) classes.
![]() | |
This example is based on the class and method developed in |
Gamma>RegPolygon;#0=(defclass RegPolygon nil [(linethickness . 2) (perimeter . (defun RegPolygon.perimeter (self) (* (@ self sides) (@ self length))))] [length sides])Gamma>polyD;{RegPolygon (length) (sides)}Gamma>Square;(defclass Square RegPolygon [(area . (defun Square.area (self) (sqr (@ self length))))] [length (sides . 4)])Gamma>sqB;{Square (length) (sides . 4)}Gamma>has_cvar(RegPolygon, #linethickness);tGamma>has_cvar(polyD, #linethickness);tGamma>has_cvar(Square, #linethickness);tGamma>has_cvar(sqB, #linethickness);tGamma>