I have not been able to construct any examples which illustrate the execution order ambiguity which you alluded to

a=: 0
f=. {{ a=: 1 }}
g=. {{ a }}
h=. {{ a=: 2 }}
(f g h) ''

If h is executed before f, the result will be 1. If f is executed before h, the result will be 2. I assume an operational model under which such assignments can be ordered.

I am unable to find the original reference for (f y) g (h y)'s removal from the dictionary, but Roger Hui alludes to it in exercise 30 at https://www.jsoftware.com/papers/APLDesignExercises1.htm#30

A related issue: (f y) g (h y) evaluates y multiple times.


As for the rank issue, that was described (albeit in a formal fashion) in the dictionary. https://www.jsoftware.com/help/dictionary/dict3.htm gives an overview, and rank is described in further detail in various parts of the dictionary.

That is true, but it does not change the fact that the dictionary claims that 'x u&v y ↔ (v x) u (v y)', and that that is not correct.


Language standards are indeed formal statements, but they cannot be entirely independent of the machine implementation(s).

I disagree. Standards may be _informed_ by implementations (or, more to the point, implementation concerns), but they exist independently of them. Case in point: the dictionary does not give an evaluation order for fork, but JE does.


Here, some relevant abstractions include:
(1) functional vs. machine state semantics
(2) parallel vs. serial implementation

I do not see the significance of these. The machine is not 'special'; it is simply another set of semantics. We express one set of semantics in terms of another; that is what compilation means.


(3) current vs. future versions

A future implementation version may implement a different language. Which must be specified differently, but there is no problem with that.

 -E

On Sat, Jan 22, 2022 at 4:16 AM Elijah Stone <[email protected]> wrote:

There are formal definitions of substitutability.  These do not apply to
real-world concepts (such as feet) but absolutely apply to formal
languages.

Language semantics are distinct from implementation details.  APL has
traditionally resisted standardization and, well, APL2 was a collossal
failure.  It is a shame, IMO.

It is a completely different thing to say 'JE 9.03 executes "y" before "x"
in "x f y"' and 'in the language implemented by JE 9.03, "y" must be
executed before "x" in "x f y"'.  I find the latter much more interesting
than the former, because it is a statement of _intent_: which of x and y
_should_ JE execute first?  I am not JE; how should _I_ interpret a
sentence such as 'x f y'?

  -E

On Sat, 22 Jan 2022, Raul Miller wrote:

> Hmm...
>
> First a tiny bit of philosophy, then a bit of my perspective:
>
> Equivalencies, generally speaking, carry assumptions about relevant
> abstractions.
>
> For example, when we are counting, we are counting things which are
> the "same", but for them to be counted we require them to be different
> in some fashion.. 1 foot is not equivalent to 1 foot if they have
> different locations. That sort of thing.
>
> Philosophy aside, details matter, and these sorts of specifics are
> worth documenting somewhere. In most contexts these kinds of details
> are noise. And, this kind of thing tends to be version specific.
> Still, it might be worth constructing some experiments and documenting
> the results of those experiments?
>
> Thanks,
>
> --
> Raul
>
> On Sat, Jan 22, 2022 at 3:00 AM Elijah Stone <[email protected]> wrote:
>>
>> It has been pointed out (f g h) y is not strictly equivalent to (f y) g (h y)
>> because it is not guaranteed that the right and left tines of a fork will
>> be applied in sequence.  See also the recent thread 'can i trust `:0 to
>> always execute left to right?'
>>
>> Does the same caveat apply to & and &: (and &. and &.:)?
>>
>> The dictionary incorrectly claims that x u&v y ←→ (v x) u (v y).  NuVoc
>> mentions this, but only points out the rank discrepancy (and NuVoc takes
>> pedagogic liberties anyway).  Other NuVoc pages (including those for &.
>> and &.:) are silent regarding evaluation order.  The dictionary says of &.
>> the same incorrect thing it says of &.
>>
>> It would be good to have documentation somewhere making explicit which
>> guarantees are provided regarding evaluation order (and which are not).
>> '(f g h) y ←→ (f y) g (h y)' was quietly scrubbed from early editions of
>> the dictionary (so I hear), but the motivation for preferring the
>> diagrammatic definitions was not included.  And `:'s NuVoc page still does
>> not mention that evaluation order for `:0 is not guaranteed, even though
>> this _has_ caused confusion (e.g. forum thread referenced earlier).
>>
>>   -E
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to