Skip to main content

•signal — Signal

•signal kind raises an error of the kind that kind names, and message •signal kind gives it a message. Without one, the message is “explicitly signalled”. An error guard catches the error in the same way as an error from a primitive.

positive←{ω≤0?"must be positive" •signal "DOMAIN";ω}
safe←{"DOMAIN"::0 ◇ positive ω}
safe¯3    ⍝ 0
safe4     ⍝ 4

kind is the name of one of BPL’s kinds, which the error guard page lists, or any other one-word name, which defines a new kind. Kind names ignore case. kind can also be a caught error, such as $e, and •signal raises its kind and message again at the •signal call.

Errors: DOMAIN for a number, or a name that isn’t one word of letters, digits and underscores.