CheckArgs - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


CheckArgs

validate a list of Maple expressions

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

CheckArgs(exprs, tests)

Parameters

exprs

-

list of expressions to validate

tests

-

list of tests to apply

Description

• 

The CheckArgs routine returns true if all tests pass, and returns false otherwise.

• 

CheckArgs is intended to be used inside an ASSERT() call to perform simple validation of the arguments to a procedure:

ASSERT( CheckArgs( [args], [tests] ), `CheckArgs/Msg` );

  

The global variable `CheckArgs/Msg` is set to a diagnostic message indicating the first argument whose test failed. The message appears only if assertions are enabled and some test fails.

  

The tests argument consists of a list of tests, which can be either types or predicates, that is, one-argument functions that return true or false. If the procedure does not return false, then the test passes, otherwise it fails. CheckArgs applies the nth test (that is, the nth element of tests) to the nth element of exprs. Thus, CheckArgs cannot be used for tests involving more than one argument at a time.

Examples

CheckArgshello,1,string,posint

true

(1)

See Also

assert

procedure

type