Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In APL, the fact that the truth values are also numbers is exploited by eliminating the need to create a new notation for various kinds of masked array operations, like those implemented in GPUs and in Intel/AMD AVX-512 for providing parallel conditional operations.

In APL and similar languages, applying a relational operator to a combination of vectors, matrices or other kinds of arrays will produce an array of "0" or "1" values, which can then be used in various kinds of array multiplications to select a part of the elements of an array for some kind of operation, e.g. a reduction operation.

This is just a reuse of the notation for arithmetic operations, useful to minimize the number of distinct operator symbols, because a good compiler will not do multiplications by "1" or "0", but it will use SIMD masked operations or blend instructions or conditional move instructions in order to get the same result.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: