Dyalog / pynapl

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

Could py.PyFn support lambdas? #2

Closed jayfoad closed 5 years ago

jayfoad commented 5 years ago

I think it would be handy if py.PyFn supported Python lambdas, so from APL I could do this:

      f←(py.PyFn'lambda a:a+10').Call
      f 3
13

Currently I get:

      f←(py.PyFn'lambda a:a+10').Call
      f 3
<function <lambda> at 0x7f9ddd1bda60>
jayfoad commented 5 years ago

Ah, I see it works if I add some parentheses:

      f←(py.PyFn'(lambda a:a+10)').Call
      f 3
13

But it still seems like something odd went wrong when I tried without parentheses.