exprseq - Maple Help

verify/exprseq

verify expression sequences in a mutable structure

Description

 • The special verifications %NULL, seq, and &, can be used to verify an expression sequence in a mutable structure, that is, in an Array, Matrix, Vector, table, or record verification.
 – %NULL verifies empty expression sequences.
 – seq(ver) verifies expression sequences of ver verifications.
 – (ver1 &, ver2 &, ver3 ... ) verifies expression sequences using ver1 for the first element, and so on.
 • When used in a verification for a mutable structure, these verifications expand to a form that matches the entries wrapped in lists.
 • When used outside a verification for a mutable structure, these verifications return FAIL.

Examples

Create two records, each with a c field assigned the NULL value.

 > $r≔\mathrm{Record}\left('a'={x}^{2}-1,'b'=3,'c'=\mathrm{NULL}\right):$
 > $s≔\mathrm{Record}\left('a'=\left(x-1\right)\left(x+1\right),'b'=3,'c'=\mathrm{NULL}\right):$

Because the c field is NULL, the verification record(expand), which is needed to compare the a fields, returns false.

 > $\mathrm{verify}\left(r,s,'\mathrm{record}\left(\mathrm{expand}\right)'\right)$
 ${\mathrm{false}}$ (1)

Use the verification Or(expand,%NULL) to verify the records.

 > $\mathrm{verify}\left(r,s,'\mathrm{record}\left(\mathrm{Or}\left(\mathrm{expand},\mathrm{%NULL}\right)\right)'\right)$
 ${\mathrm{true}}$ (2)

The seq verifier may also be used for this, because a NULL value matches an empty sequence.

 > $\mathrm{verify}\left(r,s,'\mathrm{record}\left(\mathrm{seq}\left(\mathrm{expand}\right)\right)'\right)$
 ${\mathrm{true}}$ (3)

Use the &, operator to verify an expression sequence assigned to a record.

 > $r≔\mathrm{Record}\left('a'=\left(42,{x}^{2}-1,1\right),'b'=3\right):$
 > $s≔\mathrm{Record}\left('a'=\left(42,\left(x-1\right)\left(x+1\right),2\right),'b'=3\right):$
 > $\mathrm{verify}\left(r,s,'\mathrm{record}\left(\mathrm{Or}\left(\mathrm{truefalse},\left(\mathrm{truefalse}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&,\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{expand}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&,\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{less_than}\right)\right)'\right)$
 ${\mathrm{true}}$ (4)

Using any of the special verifications outside a mutable structure verifier returns FAIL.

 > $\mathrm{verify}\left(\left[\right],\left[\right],'\mathrm{%NULL}'\right)$
 ${\mathrm{FAIL}}$ (5)

Compatibility

 • The verify/exprseq command was introduced in Maple 2015.