J's #:
(base)
can be used to compute the offset of an array element as it would appear in
memory. Why so? x #: y
is +/w*y
, where w
is formed as */\.}.x,1
—w
is precisely the strides of an array with dimensions x
.
C (C++) is used to write performant software, however it is ill-suited to SIMD. In particular, its compilation of stepped reduction with lexical scoping opposes parallel execution.
One motivation for Apple was demonstrating typed array programming. Shape types are rich; we can use types as witnesses as in QuickCheck, generating test cases that are shape-correct.
Apple, being a JIT compiler with shape types, is able to do a number of optimizations based on inferred dimension (and rank). Rank is almost always known in practice, so such optimizations are pertinent.
I implemented the Apple array system with the aim of tidying up some of the shortcomings of J, with which I am familiar.
next