Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Braces in GNU APL

Tags:

function

apl

I am using GNU APL 1.1 (svn 4460) on Linux 2.6.32 and I have some problems with function definitions.

This snippet works as expected:

∇R←ODD N
R←2|N
∇

(ODD L)/L←⍳10

But when I try this

{2|⍵} 5

or this

ODD←{2|⍵}

I get a syntax error. The same snippets run fine here.

I am a complete beginner to APL. Could anyone explain me what causes this syntax error?

like image 257
Hyperboreus Avatar asked Nov 22 '25 11:11

Hyperboreus


1 Answers

You first example uses conventional APL "del" notation to define a function. The second two examples use direct definition (commonly known as dfns - pronounced dee-funs) which is an extension by Dyalog APL, and obviously does not run in the interpreter you are using. The ease of defining functions this way is a great advantage.

like image 157
Paul Mansour Avatar answered Nov 24 '25 21:11

Paul Mansour



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!