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: Elias Mårtenson
Subject: Re: [Bug-apl] Monadic form of ↓
Date: Mon, 9 Oct 2017 17:06:32 +0800

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]