bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] A couple of bugs, and a question on the power operator


From: Juergen Sauermann
Subject: Re: [Bug-apl] A couple of bugs, and a question on the power operator
Date: Sun, 14 Aug 2016 12:00:02 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi Kacper,

thanks, I see. If I read your examples correctly then Dyalog has a special syntax {A} to mark the left argument A
of a defined function as optional and, as a consequence, to declare a function as ambivalent.

In GNU APL (and I believe also in IBM APL2) every defined dyadic function is automatically ambivalent,
and therefore there is not difference between a defined ambivalent function and a defined dyadic function.

With that difference in mind, treating all lambdas as ambivalent would, for GNU APL, mean to treat
all lambdas as dyadic. This would, in turn, prevent all lambdas from being used as monadic G in the
Dyalog power operator.

That all tells me that a monadic condition function in GNU APL is calling for trouble. And the text
in the SYNTAX error seems to indicate that up to revision 14 of Dyalog APL the condition function
was always treated as dyadic.

/// Jürgen



On 08/13/2016 10:34 PM, Kacper Gutowski wrote:
On 13 August 2016 at 19:28, Juergen Sauermann wrote:
It would also prevent the monadic use of the power operator with lambdas
completely
(which is not as bad as it sounds, though) because the lambdas are always
ambivalent then.
I think treating all lambda functions as ambivalent is actually what
Dyalog does.  I present you the following transcript from Dyalog APL
version 14.0.23392.0 32 Unicode:

      1{⍵}2  ⍝ no error
2
      {1+⍵⊣⎕←'F'⍵}⍣{1=⍵⊣⎕←'G'⍵}1
F 1
G 1
2
      {1+⍵⊣⎕←'F'⍵}⍣{1=⍵⊣⎕←⍺'G'⍵}1
F 1
2 G 1
2
      ⍝ dyadic
      ∇R←A GD B
[1]  A'GD'B
[2]  R←1=B∇
      {1+⍵⊣⎕←'F'⍵}⍣GD 1
F 1
2  GD  1
2
      ⍝ ambivalent
      ∇R←{A} GA B
[1]  A'GA'B
[2]  R←1=B∇
      {1+⍵⊣⎕←'F'⍵}⍣GA 1
F 1
2  GA  1
2
      ⍝ monadic
      ∇R←GM B
[1]  'GM'B
[2]  R←1=B∇
      {1+⍵⊣⎕←'F'⍵}⍣GM 1
F 1
SYNTAX ERROR: The function does not take a left argument
      {1+⍵⊣⎕←'F'⍵}⍣GM 1
     ∧


I don't know if it changed in 15, but in 14 it clearly required right
function to be callable dyadically.


-k



reply via email to

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