johnnynb
johnnynb

Reputation: 75

GNU APL how do you edit a function

I'm having troubles figuring out how to edit a function in GNU APL.

I have tried ∇func (DEFN ERROR), )edit (BAD COMMAND), )editor (BAD COMMAND) and all give me errors.

Any suggestion on how to edit a simple function would be appreciated.

GNU APL 1.8 on Arch Linux Build Date: 2020-07-07 19:33:16 UTC

Upvotes: 1

Views: 202

Answers (2)

Gilbert
Gilbert

Reputation: 1

if the execution is suspended because a problem occured ( verify with )si ) you can't edit your function with ∇ You must before execute '→'

Example : ∇aaa [1] w← ⍳ [2] ∇ aaa SYNTAX ERROR aaa[1] w←⍳ ^ ^ )si aaa[1]

  ∇aaa

DEFN ERROR+ ∇aaa ^

→ )si

∇aaa [2]

Upvotes: 0

Adám
Adám

Reputation: 7706

You should be able to use the line editor (a.k.a. the editor).

Dyalog's documentation should apply to GNU APL too.

An example session:

⍝ define Foo:
∇r←Foo y
 r←2×y
∇

⍝ apply Foo (result to stdout):
Foo 10

⍝ change Foo's line 1:
∇Foo[1]
 r←3×y
∇

⍝ apply new Foo (result to stdout):
Foo 10

⍝ display Foo's definition (to stderr)
∇foo[⎕]∇

This should print the following to stdout:

20
30

And report Foo's new definition to stderr:

[0]   r←foo y
[1]   r←3×y

Upvotes: 0

Related Questions