Qurak

ConfirmMatch

Beschikbaar

Confirms that an expression matches a pattern otherwise throwing to the enclosing Enclose

ConfirmMatch[expr, form]
ConfirmMatch[expr, form, info]
ConfirmMatch[expr, form, info, tag]
Enclose[f[1, ConfirmMatch[2, _Integer], 3]] → f[1, 2, 3]Enclose[f[1, ConfirmMatch["foo", _Integer], 3]] → Failure[ConfirmationFailed, <|MessageTemplate -> `` does not match ``., MessageParameters -> {foo, _Integer}, ConfirmationType -> ConfirmMatch, Expression -> foo, Information -> Null, Pattern -> _Integer|>]Enclose[Echo[1];ConfirmMatch[{1, 2, 3}, _String];Echo[2]] → Failure[ConfirmationFailed, <|MessageTemplate -> `` does not match ``., MessageParameters -> {{1, 2, 3}, _String}, ConfirmationType -> ConfirmMatch, Expression -> {1, 2, 3}, Information -> Null, Pattern -> _String|>]

Onderwerpen

Gerelateerd

Alle 6300 functies · Gebruik dit vanuit een MCP-client