bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Monadic form of ↓


From: Juergen Sauermann
Subject: Re: [Bug-apl] Monadic form of ↓
Date: Tue, 10 Oct 2017 18:46:51 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Hi Elias,

I believe ↓ for 1↓ is too trivial to be useful.

Unoccupied variants of APL primitives (like monadic ↓ or monadic =) are
a very scarce resource that we should not use for trivial things.

/// Jürgen


On 10/09/2017 11:06 AM, Elias Mårtenson wrote:
I was thinking about the usefulness of a monadic ↓ in terms of the new regexp feature. In the current version, when using subexpressions, the return value is always 1+the number of subexpressions, where the first one is always the full matched string. Monadic ↓ would be a neat way of dropping that part.

In any case, my point is that monadic ↓ should do something useful. I guess split is one such useful thing.

In GNU APL, I'd use ⊂⍤1 to achieve Split. Is that the most efficient way?

Regards,
Elias

On 9 October 2017 at 16:58, Jay Foad <address@hidden> wrote:
On 9 October 2017 at 04:56, Elias Mårtenson <address@hidden> wrote:
Currently, monadic ↑ acts as if it was called dyadically with 1 as its left argument,

That's not quite true:

      ⍴⍴1↑'ABC'
1
      ⍴⍴↑'ABC'
0

while monadic ↓ raises a VALENCE ERROR. In almost every single case where I have used ↓, it has been in the form 1↓X. Is there a reason why the monadic form is not allowed?

FYI in Dyalog APL monadic ↓ is Split:

      ↓3 3⍴⎕A
┌───┬───┬───┐
│ABC│DEF│GHI│
└───┴───┴───┘

I believe this came from STSC's NARS.

Jay.



reply via email to

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