|
From: | Juergen Sauermann |
Subject: | Re: [Bug-apl] Rank operator and function assignment |
Date: | Tue, 04 Mar 2014 18:53:29 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 |
Hi Elias,
I assume by spec you mean ISO/IEC 13751. They give the following syntax: Z ← f ⍤y B (deriving monadically) and Z ← A f ⍤y B (deriving dyadically). 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. The problem with ⍤ is its ambiguity regarding y. y is expected to be a vector with 1, 2, or 3 elements. Now look at: +⍤1 2 3 4 5 AXIS ERROR +⍤1 2 3 4 5 ^^ The problem is that this could mean several things: +⍤1 (2 3 4 5) 2 3 4 5 +⍤1 2 (3 4 5) 3 4 5 +⍤1 2 3 (4 5) 4 5 In your example, {'foo',⍵}⍤1 4 5⍴⍳10 first 1 4 5⍴⍳10 is computed and then {'foo',⍵}⍤y B with an empty y and B the result of 1 4 5⍴⍳10. The empty y then causes the axis error. What you probably intended to do is: {'foo',⍵}⍤1 (4 5⍴⍳10) foo 1 2 3 4 5 foo 6 7 8 9 10 foo 1 2 3 4 5 foo 6 7 8 9 10 In GNU APL you can put the y in axis brackets to resolve the ambiguity. I personally believe ⍤[y] B is a clearer syntax than ⍤y B. {'foo',⍵}⍤[1] 4 5⍴⍳10 foo 1 2 3 4 5 foo 6 7 8 9 10 foo 1 2 3 4 5 foo 6 7 8 9 10 /// Jürgen n 03/04/2014 05:28 PM, Elias Mårtenson wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |