[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] Suggestions needed: Editing of named lambdas
From: |
Kacper Gutowski |
Subject: |
Re: [Bug-apl] Suggestions needed: Editing of named lambdas |
Date: |
Thu, 6 Mar 2014 07:10:54 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On 2014-03-06 10:53:12, Elias Mårtenson wrote:
> ∇λ←avg ⍵
> λ←(+/⍵)÷⍴⍵
>
> This will of course fail when the user tries to save the function.
I'm not using Emacs nor your mode, but why should it fail?
This works:
⎕FX 'λ←avg ⍵' 'λ←(+/⍵)÷⍴⍵'
avg
And so does this:
∇avg
[1] [0]λ←avg ⍵
[1] λ←(+/⍵)÷⍴⍵
[2] ∇
User can not start editing a new function writing ∇λ←avg ⍵, but there
is nothing preventing user from changing this header or making more than
one statement inside a function even if it was initially defined with
dfn syntax (so you can not assume that if it starts with λ then it has
only one statement).
This might not have been intended to work, but it does! :)
avg ← {(+/⍵)÷⍴⍵}
∇avg[⎕]
[0] λ←avg ⍵
[1] λ←(+/⍵)÷⍴⍵
[2] [0] λ←avg ⍵;z
[1] z←+/⍵
[2] λ←z÷⍴⍵
[3] ∇
⎕CR'avg'
λ←avg ⍵;z
z←+/⍵
λ←z÷⍴⍵
-k