Dyalog / pynapl

Dyalog APL ←→ Python interface
MIT License
74 stars 10 forks source link

Using inner product `.` from the Python side behaves as outer product. #9

Open rodrigogiraoserrao opened 2 years ago

rodrigogiraoserrao commented 2 years ago
>>> from pynapl import APL
>>> apl = APL.APL()
>>> dot = apl.op(".")
>>> dot(operator.add)([1, 2, 3], [1, 2, 3])
[[2, 3, 4], [3, 4, 5], [4, 5, 6]]

This should raise some sort of error. Instead, it returns the result of 1 2 3 ∘.+ 1 2 3.

The issue seems to be in the __op inner function of APL.op, that special cases "." in a weird way.