Qurak

ConfirmBy

Beschikbaar

Confirms that a function returns True on an expression otherwise throwing to the enclosing Enclose

ConfirmBy[expr, f]
ConfirmBy[expr, f, info]
ConfirmBy[expr, f, info, tag]
Enclose[f[1, ConfirmBy[2, NumberQ], 3]] → f[1, 2, 3]Enclose[f[1, ConfirmBy["foo", NumberQ], 3]] → Failure[ConfirmationFailed, <|MessageTemplate -> ``[``] did not return True., MessageParameters -> {NumberQ, foo}, ConfirmationType -> ConfirmBy, Expression -> foo, Information -> Null, Function -> NumberQ|>]Enclose[Echo[1];ConfirmBy[10, LessThan[5]];Echo[2]] → Failure[ConfirmationFailed, <|MessageTemplate -> ``[``] did not return True., MessageParameters -> {#1 < 5 & , 10}, ConfirmationType -> ConfirmBy, Expression -> 10, Information -> Null, Function -> #1 < 5 & |>]

Onderwerpen

Gerelateerd

Alle 6300 functies · Gebruik dit vanuit een MCP-client