Qurak

ConfirmMatch

可用

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|>]

主題

相關

全部 6300 個函式 · 從 MCP 用戶端使用這個