# Array Predicates

This clever idea of Bob Bernecky's [1] provides a performance improvement for certain expressions by marking certain arrays with special properties. For example, a permutation vector [2] has the property that it is invariant under various APL primitives such as rotate/reversal (⌽) and grade up/down (⍋ ⍒).

Bernecky has defined several array predicate properties, one of which has been implemented in NARS so far: permutation vectors.

In this case, monadic iota (⍳) produces a permutation vector, as does deal (?) when the left and right arguments are the same, and are marked internally as such. Further use of such arrays maintain that property when operated on by rotate/reversal and grade up/down. Moreover, the grade primitive uses a much faster (linear) algorithm than it would normally use.