Function: mode_identity (<arg_1>, <arg_2>) A special form used with
macros to declare, e.g., a list of lists of flonums, or other compound data object. The first argument to
mode_identity is a primitive value mode name as given to
mode_declare (i.e., one of
any), and the second argument is an expression which is evaluated and returned as the value of
mode_identity. However, if the return value is not allowed by the mode declared in the first argument, an error or warning is signalled. The important thing is that the mode of the expression as determined by the Maxima to Lisp translator, will be that given as the first argument, independent of anything that goes on in the second argument. E.g.,
x: 3.3; mode_identity (fixnum, x); yields an error.
mode_identity (flonum, x) returns 3.3 . This has a number of uses, e.g., if you knew that
first (l) returned a number then you might write
mode_identity (number, first (l)). However, a more efficient way to do it would be to define a new primitive,
firstnumb (x) ::= buildq ([x], mode_identity (number, x));
firstnumb every time you take the first of a list of numbers.
(%o1) true (%i2)