Rowan home > Reference > Where

Where Operator:

Module: Main
Syntax: dfn ⌶
Errors: R.ContextException, System.InvalidCastException, R.LengthException
Keystrokes: AltGr+Shift+T

Modifies dfn so that instead of returning a boolean vector when applied to vector arguments, it returns the integer indices where there would have been True values. The function (at the time it is passed) must be an elementwise (level -1) dyad which returns a boolean scalar for each pair of elements; common operands will be the comparison functions.

The derived function x (dfn ⌶) y has level -2 on both sides, returning as the result of processing two vectors the integer indices where x dfn y is true.

For example:

   x←?10⍴100
(4 94 54 35 9 56 61 72 88 92)
   x>⌶60
(2 7 8 9 10)
   x<⌶60
(1 3 4 5 6)

The ContextException is thrown if dfn is not dyadic or does not have rank -1 on both sides.