Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array model wording #25

Open
xpqz opened this issue Jun 21, 2022 · 1 comment
Open

Array model wording #25

xpqz opened this issue Jun 21, 2022 · 1 comment

Comments

@xpqz
Copy link
Owner

xpqz commented Jun 21, 2022

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”.

is unhelpful/confusing in the long run.

@marshall suggested

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.

@marshall

Cells (0-cells) are just one way to cut up an array. Non fundamental..

@dzaima:

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])

@ghost
Copy link

ghost commented Aug 30, 2022

"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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant