CheckArgs - Maple Help

CheckArgs

validate a list of Maple expressions

 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

 > $\mathrm{CheckArgs}\left(\left["hello",1\right],\left[\mathrm{string},\mathrm{posint}\right]\right)$
 ${\mathrm{true}}$ (1)