Mathics/is a

From Wikiversity
Jump to navigation Jump to search

The is_a operator can be viewed as a w:binary operator which takes an Mathics/object x and a Mathics/function f and returns the value f(x). In other words

x is_a f = f(x).

If f happens to return a Boolean value, then x is_a f has a semantics which is related to the statement “x is an f”. In particular if the object x happens to be an algebra and the function “class_algebra” is a Boolean function that operates on algebras and returns the value true if and only if x happens to be a class algebra, then the function

x is_a class_algebra = class_algebra(x)

returns the value true if and only if x happens to be a class algebra. It is important to keep in mind that the is_a operator has a broader meaning that whatever the English meaning of the word is is since the function f does not need to return a Boolean value in order for the expression x is_a f to be meaningful. The expression x is_a f, by definition, takes on the value f(x) whenever f(x) is meaningful.