robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

value: binary iota is incorrect #54

Closed robpike closed 4 years ago

robpike commented 6 years ago

Given

scalar binop vector

the scalar will be promoted to vector; that's how ivy works. But it's not how APL works. It usually doesn't matter, but for binary iota (index) it does. 3 iota 3 should yield 3, not 1. It yields 1 because the LHS becomes 3 3 3.

robpike commented 6 years ago

It's not that simple. The operator technically doesn't accept a scalar on the left.

Needs to be tested and verified better.

robpike commented 4 years ago

The analysis in this issue is incorrect. 3 iota 1 2 3 works fine, honoring the documentation even if tryapl.org says it's a rank error. So closing.