You could use try. and catch. or, if you expect the error to be only at the
selection step, you could replace this with your own version - maybe
something like this:
sel=: (_&[`{) @. ([ < [: # ])
2 sel i.4
2
5 sel i.4
_
On Thu, Sep 8, 2011 at 12:47 PM, Steven Taylor <[email protected]> wrote:
> Hi,
>
> say I've got a verb train, that I like as a verb train... and I don't want
> to break it up. Is there a way to check for an error condition?
>
> 3 (]{~ [ I.~]) i. 4
> 3
>
> 4 (]{~ [ I.~]) i. 4
> |index error
> | 4 (]{~[I.~])i.4
> |[-0]
>
> I could set an initial value like this...
>
> fail=.0 [ret=. 4 { i.4 [ fail=.1
>
> i.e. fail should equal zero if ret=.4 runs correctly.
>
> I was looking at these foreigns briefly.
> errno=:13!:11
> errmsg=:13!:12
> errno''
> errmsg''
>
> these foreigns appear to be geared towards debug sessions though.
>
> thanks,
> -Steven
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm