### evaluation

#### Evaluation of APL direct functions

Here is a snippet I was testing recently. It takes two diameters (⍺,⍵) and computes the circumference of a circle: 10{(○1×⍺){⍺ ⍵}○1×⍵}10 ⍝ note the brackets around ⍺ 31.4159 31.4159 10{○1×⍺{⍺ ⍵}○1×⍵}10 31.4159 98.696 I would like to understand how evaluation of this expression works - why is the first one evaluating correctly and the second one isn't? I am using Dyalog APL.

You have nested functions. In both cases, the inner function simply returns its right and left argument. In the first case, the left argument to the inner function is the expression (○ 1×⍺), in the second case the left argument to the inner function is simply ⍺, or the unaltered left argument of the outer function -- then entire result of the inner function is multiplied by ○ and by 1. Note that the argument to the circle function is everything to its right so the 1 x is totally redundant. In APL, expressions are evaluated right to left. We can say that function applies to everything to its right unless modified by parens. Therefore we could say that in the first expression ○ takes 1 multiplied by everything to its right which is only ⍺ due to the parentheses. But in the second expression ○ takes 1 multiplied by everything to its right which is the result of the inner function. Furthermore, note that due to scalar extension, you can compute the two numbers with no braces at all: ○10 10 31.415926535898 31.415926535898 More interesting with a different diameters: ○10 15 20 31.415926535898 47.123889803847 62.831853071796

### Related Links

Math notation understanding

What criterias do you look for in a WAF (web application firewall)?

Predictionio evaluation fails with Text Classification template

Evaluation of APL direct functions

Modelica Evaluation Order

how compilers evaluate mathematical expressions? [closed]

What does “top-level evaluation” mean?

Boolean expression evaluation with a given context

Is relying on short-circuit evaluation good design? [closed]

Objectively evaluating new GUI toolkits

what are evaluation techniques for HCI projects (without involving users, or psychologist)?

Evaluating developers [closed]

Options to Common Criteria

What are some useful criteria for deciding on which software package to go for?

Having to set objectives for developers, even though objectives don't work [closed]

How would you go about evaluating a programmer? [closed]