Error Messages/43895

< Error Messages
Revision as of 20:11, 10 October 2016 by Lchrisman (Talk | contribs) (Created page with "== Error Message == :A list on an array with an implicit dimension cannot be passed to a repeated parameter of a function. In...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Error Message

A list on an array with an implicit dimension cannot be passed to a repeated parameter of a function. In the call to Fu1, «v» is a repeated parameter. The first argument passed to that parameter is a list, or has an implicit dimension.

Description

A function, whether it is a built-in function or a User-Defined Function, has parameters, allowing you to pass information to the function for processing. Some function parameters allow you to pass a variable number of values, as if each value is passed as a separate parameter, and these are called Repeated parameters.

For example, consider the following User-Defined Function accepts one or more numbers:

Function LeastCommonMultiple( x : ... number )

This function has one parameter named «x», but when you call it you may pass any number of values to it, for example:

LeastCommonMultiple( 5, 7, 10, 14, 18 )

The values passed to the function are sometimes referred to a arguments. In this example, the function has one parameter, but the call to the function has 5 arguments. This use of the word argument has no relationship to the other meaning of argument which refers to a disagreement.

Analytica imposes a limitation that no argument passed to a repeated parameter may have an implicit dimension. A implicit dimension is an array dimension that does not correspond to any named index. Arrays are allowed to have at most one implicit dimension. The reason for this restriction is that inside the function Definition, the parameter will hold the list of values passed as a list, and hence, will itself have an implicit dimension. If one of the arguments were to be passed in, the parameter value would contain two implicit dimensions and thus violate the rule that there can be at most one implicit dimension.

The error message helps you identify which argument is at fault. For example, the error would occur if you called:

LeastCommonMultiple( 5, 7, 10..14, 18 )

and here it would state that the "third argument passed to «x»" has an implicit dimension. If you have more that one parameter, as it:

Function Fu1( u ; v : ... )

with the call:

Fu1( 1..2, 3..4 )

The error would say "the first argument passed to «v»" -- which is the 3..4 argument, the second argument to the function.

Remedies

If the logic of what you wish to do is sound, the remedy to this problem is to use an explicit index. For example, there is no problem with:

Index v := 10..14 Do LeastCommonMultiple( 5, 7, v, 18 )

See Also

Comments


You are not allowed to post comments.