bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Power Operator


From: Elias Mårtenson
Subject: Re: [Bug-apl] Power Operator
Date: Thu, 14 Aug 2014 00:07:04 +0800

I agree about the inverse functions. That rabbit hole is dark and deep. However, power is quite useful even without it. :-)

That said, would it make sense to add a )MORE message when the inverse function can't be computed? For example, when you try to apply the power operator on a negative argument and the function is a lambda?

Right now I'm getting a plain DOMAIN ERROR, but it would be nice if there was a + on it, and )MORE could tell me that, for example, "Can't compute inverse of lambda function". Such errors are definitely helpful, especially when one is not an APL expert.

Regards,
ELias


On 13 August 2014 18:23, Juergen Sauermann <address@hidden> wrote:
Hi Blake,

thanks. Negative powers build on  the concept of an "inverse function".

In GNU APL some of the primitives have inverse functions (+/- ×/÷, ⋆/⍟ and ○).

But these inverse functions have rather strange effects, for example:

      2 (+ ⍣ 40) 5
85
      2 (- ⍣ ¯40) 5
85
      2 (+ ⍣ ¯40) 5
5
      2 (- ⍣ ¯40) 5
85

In the context of APL operators (+\ in the Dyalog example), the determination of the
inverse function can get very complicated and is undefined in most cases. Given
that I will no go down too far on the road to inverse functions.

When I read about the power operator for the first time (around GNU APL 1.2 or so),
it was the concept of inverse functions that made me think of ⍣ as a broken operator.

/// Jürgen



On 08/13/2014 01:53 AM, Blake McBride wrote:
Trying some of the examples in the Dyalog book I found the following:

Dialog book:
      (+\ ⍣  ̄¯1) 3 4 9 15 19
3 1 5 6 4


GNU APL:
      (+\ ⍣ ¯1) 3 4 9 15 19
DOMAIN ERROR
      (+\⍣¯1)3 4 9 15 19
      ^     ^


Blake McBride

www.arahant.com
Cell:    615-394-6760
Office:  615-376-5500
Fax:     615-377-6006




On Tue, Aug 12, 2014 at 12:32 PM, Juergen Sauermann <address@hidden> wrote:
Hi,

I have implemented the first shot at the power operator ⍣. SVN 434.

/// Jürgen





reply via email to

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