Array Predicates

From NARS2000
Revision as of 16:57, 17 August 2008 by Sudleyplace (talk | contribs) (New page: This clever idea of Bob Bernecky's [http://www.snakeisland.com/predicat.pdf] provides a performance improvement for certain expressions by marking certain arrays with special properties. ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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.