bug-apl
[Top][All Lists]
Advanced

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

Re: Support for 'where' primitive '⍸' ?


From: Dr . Jürgen Sauermann
Subject: Re: Support for 'where' primitive '⍸' ?
Date: Mon, 30 Nov 2020 12:53:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi,

after investigating ⍸ I have added it to my TODO list.

Although its monadic form could be easily emulated with standard APL primitives, the dyadic form seems to be useful (find the interval into which a value falls) and,
more importantly, not so easy to implement in APL.

Still wondering if monadic ⍸ B with non-boolean B has a real-life use case?

Best Regards,
Jürgen


On 11/27/20 9:34 PM, Dr. Jürgen Sauermann wrote:
Hi Jay,

thanks a lot for the pointers.

Best Regards,
Jürgen


On 11/27/20 2:48 PM, Jay Foad wrote:
Dyalog's documentation for Where (monadic ⍸) is here:
http://help.dyalog.com/18.0/#Language/Primitive%20Functions/Where.htm
It was implemented long after Mastering Dyalog APL was written.

Re: monadic ⍳ with vector arguments, I believe Dyalog got this from
the original NARS: see https://aplwiki.com/wiki/NARS: "Additionally,
Index Generator was extended to allow a vector argument".

Jay.

On Fri, 27 Nov 2020 at 13:42, Dr. Jürgen Sauermann
<mail@jürgen-sauermann.de> wrote:
Hi Russ,

welcome to APL. And welcome to bug-apl@gnu.org. The latter is a moderated list, so please subscribe to it because otherwise each of your emails will require (manual) approval by myself.

Back to your question, ⍸ is definitely not a standard APL primitive. My only source of information about Dyalog APL, the book with the title Mastering Dyalog APL - A Complete Introduction to Dyalog APL, seems not to mention it
either.

I am somewhat reluctant when it comes to introducing non-standard APL functions into GNU APL. In my opinion, which is certainly arguable, non-standard extensions of APL may lure APL programmers into writing non-standard APL programs, which in turen undermines and even contradicts the principles of
free software.

For a non-standard extension to make it into APL, the extension has to smoothly integrate into APL. One of the rare examples where this was the case was monadic ⍳ with vector arguments adopted from Dyalog APL. That extension was sort of filling a rather arbitrary gap in standard APL, making APL
more consistent than it was before.

Some other extension in Dyalog did not make it into GNU APL because IMHO the additional benefit that they provided was not worth the incompatibility that every non-standard extension unavoidably creates.

I cannot judge to which kind of extensions ⍸ belongs since I do not know what it actually does. I will consider
any opinions posted on bug-apl@gnu.org, though.

Best Regards,
Jürgen



On 11/26/20 11:15 PM, Russtopia wrote:

Hi, newbie to APL so my sincere apologies in advance if this is incorrect, an FAQ, or by design (intentionally not implemented).

Dyalog APL appears to support monadic ⍸ (underscore-iota) primitive as a 'where' function, eg.

     b ← 0 0 1 1 0
     ⍸b
3 4

..whereas GNU APL considers the ⍸ as an invalid symbol (SYNTAX ERROR)

Equivalent seems to be
     b / ⍳⍴ b
3 4

.. just wondering if this is a Dyalog non-standard and if GNU APL plans to implement it.

Thanks,
-Russ








reply via email to

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