|
|
|
|
|
by mjh2539
26 days ago
|
|
> An example of a programming language with true Boolean logic is APL, where the logical truth values are the numbers "1" and "0" (which is very handy in expressing conditional operations on arrays), while all the programming languages that use "true" and "false" do not use Boolean logic, despite claiming to do so. So Bash could be considered the red-headed, left-handed sibling to APL? |
|
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.