[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Rank operator and function assignment

From: Kacper Gutowski
Subject: Re: [Bug-apl] Rank operator and function assignment
Date: Tue, 4 Mar 2014 22:52:00 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On 2014-03-04 18:53:29, Juergen Sauermann wrote:
> They say that f ⍤y is a function which is then called with arguments B and
> possibly A.
> Thus Z is a value and not a function; the function is created internally.

I guess the problem is that GNU APL doesn't really have what most people
understand under lambdas even though it supports dfns syntax.  Functions
are not a first-class values.

> The problem with ⍤ is its ambiguity regarding y.
> y is expected to be a vector with 1, 2, or 3 elements.

Perhaps as a result of the earlier, you can not even disambiguate rank
arguments with parentheses this way (this works in other systems):

      (+⍤1) 2 3 4 5
      (+⍤1)2 3 4 5
       ^  ^

By the way, while Elias's example was correctly parsed and interpreted,
I think that parsing is not correct:

      +⍤1 +2 3 4 5
      +⍤1+2 3 4 5

It is expected to be parsed as +⍤1(+2 3 4 5) and it's not ambiguous at all.
I can't find it in the spec right now, but cf. ∘.=⍨ which is (∘.=)⍨ not ∘.(=⍨).
Correct me if I'm wrong, but afaiu, operators, unlike functions, should be
left associative.

Additionally, in A+, but also in Dyalog and NARS as I just checked, there
is a monadic ⊢, i.e. an identity function.  It is useful exactly for
this purpose, as it allows writing: +⍤1⊢2 3 4 5.  Monadic ⊢ could also be
used to display shy result regardless of type as in ⊢X←anything.
It's overall pretty nice consistent extension that I'd be happy to see
in GNU APL too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]