practronix512
practronix512

Reputation: 46

Writing APL formulas without parens

I am an APL beginner, How to convert,

https://i.sstatic.net/YtD2Z.png

without using parens?

Upvotes: 1

Views: 188

Answers (2)

RosLuP
RosLuP

Reputation: 163

Here use parentesis () and {} but not in the formula for calc result, only in the function for construction of function {} and for to get the number in variables in ().

  f←{(x y r)←⍵⋄∣-/r×÷x y}
  f 1 2 3
1.5

Upvotes: 0

MBaas
MBaas

Reputation: 7530

If I interpreted your TeX correctly, you want to know if it's possible to remove parens from

      (1÷2)*.5
0.7071067812

That is doable using the commute-operator ⍨:

      .5*⍨1÷2
0.7071067812

If f is a dyadic function, then instead of writing X f Y, you can also write Y f⍨ X which can increase readability and help to avoid parentheses. Try it out here.

Upvotes: 1

Related Questions