bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Implementing Dyalog Key function


From: Juergen Sauermann
Subject: Re: [Bug-apl] Implementing Dyalog Key function
Date: Mon, 3 Jul 2017 15:36:54 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Elias,

thaks. The explanation is a bit clearer but the problems remain.

Key is a non-standard APL function and we should be careful with the implementation
of non-standard functions.

Every function in GNU APL is an invitation to use it. If the function is obviously useful then it improves
the language. If it merely solves a particular programming case, then it may improve GNU APL a little,
 but at the price of incompatibility. Programs using it become less portable and that undermines the
goal of free software.

So the question in such cases is how useful is a function and is that usefulness worth the incompatibility?

In the case of the key function I would say no.

First of all the key function can only be used if the data it operates on is organized in a specific way: that
the first column is the key. That may be the case but the fact that this is needed is somewhat contrary to
how other APL function work. You could also call that arbitrary.

That goal can easily  achieved by other means. If I have a single KEY then something along the lines of

((DATA[1;]≡KEY)⌿KEY)[1;]

will give me the first row (or all rows if I remove the right [1;]) in an array that has that KEY. I suppose that is
more or less what the key function does (plus applying some function on that _expression_). The _expression_ is
even superior to a function because it can be used at the left side of an assignment.

If that is so then the key function is only one of several APL idioms (see http://aplwiki.com/FinnAplIdiomLibrary
for a rather famous list of more than 700 such idioms). Each of the 700+  idioms is useful and would deserver
its own symbol, but if we would do so (which is technically possible due to Unicode) then we would have turned
GNU APL into an unreadable mess.

Best Regards,
Jürgen Sauermann



On 07/03/2017 05:50 AM, Elias Mårtenson wrote:
The key function is better described in the Dyalog reference manual, on page 153 here: http://docs.dyalog.com/16.0/Dyalog%20APL%20Language%20Reference%20Guide.pdf

Essentially, it's a grouping function. It's used to create groups of similar things, and apply a function on the individual instances. The examples in the section I referenced above should be pretty clear, I think.

Regards,
Elias

On 3 July 2017 at 00:51, Juergen Sauermann <address@hidden> wrote:
Hi Elias,

I am not quite in favour of it and it has problems.

It is not on my keyboard (even though I am using a Dyalog keyboard).
Not to talk about other keyboards.

It does not really look like need-to-have function and I suppose it can be
efficiently performed by a short combination of other APL primitives.

In my opinion adding primitives for every imaginable use case (and
there are certainly use cases for the key function) leads to an overloading
of the APL language in the long run and does not improve the language.

Another problem is that after reading the description several times, I still
can't explain in simple terms what the function is actually doing.  That makes it
a good candidate for a never used function if it should ever be implemented.

Best Regards,
Jürgen Sauermann




On 07/02/2017 06:24 PM, Elias Mårtenson wrote:
How about implementing the key function, ⌸?

It's described in this article on the Dyalog site: https://www.dyalog.com/blog/2015/04/exploring-key/

Jürgen, are you in favour of this function?

Regards,
Elias




reply via email to

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