You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the APL Farm matrix/discord, it was suggested that
Arrays in Dyalog APL are always collections of scalars, regardless of rank. However, we can create arbitrarily complex scalars by a process known as enclosing. This means putting something in a “box”.
A scalar like the numbers we've used above is a single value with rank 0. APL also lets you create rank 0 arrays with something inside, which also act as one unit.
In APL, everything is an array. But what about numbers? They might not look or feel like arrays, but they are. But unlike vectors, which have rank 1, or matrices, which have rank 2, etc, they have rank 0. As such, the shape of a number is ⍬. What does that entail? Do numbers contain elements..? If so, how many? What are they? Well, we can ask APL [after previously having mentioned ×/⍴x to be the number of elements]: ×/⍬ → 1. (what's that element then? Well, it's the number itself, which leads to funky recrsion, but let's not get into that). Numbers (or characters) aren't the only possible rank 0 arrays, though - you can also make your own with ⊂x - this creates a rank 0 array containing x (comparing to x y, ⊂x has one element instead of two, rank 0 instead of 1, and the previously discussed shape ⍬ instead of ,2 [ugh APL lacking a way to not properly make a 1-item list is annoying here])
The text was updated successfully, but these errors were encountered:
"Arrays in Dyalog APL are always collections of scalars" is (imo) a helpful view for understanding the construction of nested vectors - (1 2 3)(4 5 6) is (⊂1 2 3),(⊂4 5 6) - but this is better relegated to a section on stranding.
It isn't useful for simple vectors, matrices, etc - as the 0-cells and elements of simple scalars are identical.
I would adopt Marshall's suggestion and also dive into the operational behaviour of stranding in another section.
If other topics (axes, prototypes, singletons) aren't covered a more specific and less opaque version of https://aplwiki.com/wiki/Array_model could be appropriate
On the APL Farm matrix/discord, it was suggested that
is unhelpful/confusing in the long run.
@marshall suggested
@marshall
@dzaima:
The text was updated successfully, but these errors were encountered: