[Top][All Lists]

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

Issues with drop of a scalar argument

From: Kacper Gutowski
Subject: Issues with drop of a scalar argument
Date: Sat, 25 Apr 2020 00:03:05 +0200

1° With left argument longer than one, the scalar is properly extended to a higher rank one-element array, but then it's not dropped correctly unless all axes are non-zero.

      ⊢X← 1 0↓2
1 1

The X here should be an empty array (0 1⍴0) but is (1 1⍴2).

2° When left argument has one non-zero element and right is a non-zero scalar, the returned result is a weird value that looks like the correct one (0⍴0), but is distinct, and isn't transferable.

      8⎕CR Y← 1↓1
      ⍬≡Y ⍝ should be true
      (11⎕CR⍬)≡(11⎕CR Y)
      Y ≡ 12⎕CR 11⎕CR Y

3° This might not be an error, but I find it surprising:

      3 ≡ ''↓3  ⍝ this is correct
      ''↓⍳3  ⍝ this is an extension (length error by ISO)
2 3
      ''↓⍳3 3
      ''↓⍳3 3
      ^  ^

By my reading of ISO, when left argument is empty, the right must be a scalar (or it will be a length error) which is returned unchanged. In Dyalog it's extended such that any value is returned unchanged, in GNU APL ⍬↓X ←→ 1↓X for non-scalar X. Is this intended and correct? (Is that what APL2 does?)


reply via email to

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