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
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
-
@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).lstefano– lstefano11/19/2019 16:01:22Commented 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.Adám– Adám11/19/2019 16:06:06Commented Nov 19, 2019 at 16:06