exprfail should be a function which takes 1 param, e.g.@[show;id;{-2 "error - ", x}]your example will evaluate the params before calling @, hence your observation./b.yogaOn Sep 14, 2008, at 5:07 PM, Alexandr Batalshikov wrote:> Sample:> q) id: 5> q) @[show; id; `error] / ok.> 5> q) @[show; id; id:0] / strange!> 0> q) id> 0>> Why?>> Citation from QforMortals books> ( https://code.kx.com/trac/wiki/QforMortals/ > execution_control#Protected-Evaluation ):>> @[fmon;a;exprfail]> .[fmul;Largs;exprfail]>> Here fmon is a monadic function, a is single argument, fmul is a > multivalent function, Largs is a list of arguments, and exprfail is > any expression. In both forms, the function is applied to its > argument(s). Provided there is no error in evaluating the function, > any return value is returned from the protected evaluation. Should > an error arise, exprfail is evaluated.>>> –> Alexandr Batalshikov.>>> >–Apple-Mail-3877-432334118Content-Type: text/html
exprfail should be a function which takes 1 param, e.g.
@[show;id;{-2 "error - ", x}]
your example will evaluate the params before calling @, hence your observation.
/b.yoga
On Sep 14, 2008, at 5:07 PM, Alexandr Batalshikov wrote:
Sample:
q) id: 5
q) @[show; id; `error] / ok.
5
q) @[show; id; id:0] / strange!
0
q) id
0
Why?
Citation from QforMortals books
( https://code.kx.com/trac/wiki/QforMortals/execution_control#Protected-Evaluation ):
@[fmon;a;exprfail]
.[fmul;Largs;exprfail]
Here fmon is a monadic function, a is single argument, fmul is a multivalent function, Largs is a list of arguments, and exprfail is any expression. In both forms, the function is applied to its argument(s). Provided there is no error in evaluating the function, any return value is returned from the protected evaluation. Should an error arise, exprfail is evaluated.
–
Alexandr Batalshikov.
–Apple-Mail-3877-432334118–