1

How do I get the length of my array in APL? It doesn't seem that this question was answered already- correct me if I'm wrong. Thanks!

1 Answer 1

4

APL arrays can have multiple dimensions. The list of lengths along each dimension is given by the monadic (single-argument, prefix) function Shape (documentation):

      ⍴'abcdef'
6
      ⍴2 3⍴'abcdef'
2 3
      ⍴42

      ⍴⍬
0

Some APL dialects support the monadic function Tally (documentation) to give you the number of "major cells", which is the same as the first element of the above, except for scalars (0-dimensional arrays) for which it returns 1:

      ≢'abcdef'
6
      ≢2 3⍴'abcdef'
2
      ≢42
1
      ≢⍬
0
2
  • @user9791370: please notice that notwithstanding the years elapsed since it was first reported, Chromium based browsers (which soon will be the vast majority) still render wrongly the glyph for tally. I wonder why they are so reluctant to fix it at Google, given that it's just fine in FireFox and the old Edge (but unfortunately not the new Edge). Commented Nov 19, 2019 at 16:01
  • 3
    @lstefano They can't "fix" it. It is a matter of priority: What is more important, the harmony between glyphs, or the rendering of glyphs? Both Gecko (Firefox's rendering engine) and Blink (Chromium's rendering engine) use HarfBuzz as their font renderer. However, they use different strategies if the selected font is missing a glyph. Gecko first looks if an alternate font has the glyph, and only if no other font has it, it tries to compose two glyphs from the original font. Blink first tries to compose, and only if one or both "half-glyphs" are missing, does it go looking for a different font. Commented Nov 19, 2019 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.