Index Generator: Difference between revisions

Jump to navigation Jump to search
m
→‎Scalar-vector discrepancy in nested APLs: Kap also treats singleton vectors as vectors
(→‎Outside of APL: Reformat to better conform to WP MoS)
m (→‎Scalar-vector discrepancy in nested APLs: Kap also treats singleton vectors as vectors)
 
Line 77: Line 77:
== Scalar-vector discrepancy in nested APLs ==
== Scalar-vector discrepancy in nested APLs ==


In [[NARS]] and later [[Nested array theory|nested]] APLs which share its definition, the result of Iota is [[simple]] when the argument is a [[singleton]] and [[nested]] otherwise. This is because, when the argument is a singleton, each [[index]] in the result is represented as a [[scalar]] rather than a 1-[[element]] [[vector]]. [[dzaima/APL]] breaks from this definition by using vector indices whenever the argument is a vector, and scalar indices if the argument is a scalar, so that the result is only simple if the argument was scalar. This definition has the property that the [[shape]] of each index matches the shape of the argument.
In [[NARS]] and later [[Nested array theory|nested]] APLs which share its definition, the result of Iota is [[simple]] when the argument is a [[singleton]] and [[nested]] otherwise. This is because, when the argument is a singleton, each [[index]] in the result is represented as a [[scalar]] rather than a 1-[[element]] [[vector]]. [[dzaima/APL]] and [[Kap]] break from this definition by using vector indices whenever the argument is a vector, and scalar indices if the argument is a scalar, so that the result is only simple if the argument was scalar. This definition has the property that the [[shape]] of each index matches the shape of the argument.


Such an extension breaks compatibility with earlier non-nested APLs: although these APLs required the argument of Iota to be a [[singleton]], they always allowed a [[scalar]] or [[vector]], and sometimes any [[singleton]]. This is because a shape to be passed to Iota would often naturally be a vector: for example, [[Shape]] always returns a vector, and a function such as [[Tally]] to return a scalar length did not exist.
Such an extension breaks compatibility with earlier non-nested APLs: although these APLs required the argument of Iota to be a [[singleton]], they always allowed a [[scalar]] or [[vector]], and sometimes any [[singleton]]. This is because a shape to be passed to Iota would often naturally be a vector: for example, [[Shape]] always returns a vector, and a function such as [[Tally]] to return a scalar length did not exist.

Navigation menu