FUNCTION function_applicability
(func : maths_function_select, arguments : LIST [1:?] OF maths_value) : BOOLEAN;
LOCAL domain : tuple_space := convert_to_maths_function(func).domain; domain_types : SET OF STRING := TYPEOF (domain); narg : positive_integer := SIZEOF (arguments); arg : generic_expression; END_LOCAL; IF (schema_prefix + 'PRODUCT_SPACE') IN domain_types THEN IF space_dimension (domain) <> narg THEN RETURN (FALSE); END_IF; ELSE IF (schema_prefix + 'EXTENDED_TUPLE_SPACE') IN domain_types THEN IF space_dimension (domain) > narg THEN RETURN (FALSE); END_IF; ELSE RETURN (FALSE); -- Should be unreachable END_IF; END_IF; REPEAT i := 1 TO narg; arg := convert_to_operand (arguments[i]); IF NOT has_values_space (arg) THEN RETURN (FALSE); END_IF; IF NOT compatible_spaces (factor_space (domain, i), values_space_of (arg)) THEN RETURN (FALSE); END_IF; END_REPEAT; RETURN (TRUE); END_FUNCTION; -- function_applicability
|