From 00abceb4b2b43acd7fbb100aac41f759f643f5e7 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 27 Jul 2021 21:24:34 -0400 Subject: Array diagram --- doc/array.md | 59 +++++++++++++++++++++++++++++++++++++++++ docs/doc/array.html | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) diff --git a/doc/array.md b/doc/array.md index 7d4ccc34..5c50ca08 100644 --- a/doc/array.md +++ b/doc/array.md @@ -10,6 +10,65 @@ BQN's arrays are immutable, meaning that an array is entirely defined by its att An array might also have a [fill element](fill.md) that captures some structural information about its elements and is used by a few operations. The fill, as an inferred property, isn't considered to truly be part of the array but is instead some information about the array that the interpreter keeps track of. So it's out of scope here. + + ## Rectangles A BQN **array** is a multidimensional arrangement of data. The word "array" descends from words meaning "order", and the data in an array is ordered indeed. Below are examples of arrays with zero, one, and two dimensions. diff --git a/docs/doc/array.html b/docs/doc/array.html index 752dcd39..9cf74517 100644 --- a/docs/doc/array.html +++ b/docs/doc/array.html @@ -9,6 +9,82 @@

In BQN, as in APL, arrays are multidimensional, instead of strictly linear. Languages like Python, Javascript, or Haskell offer only one-dimensional arrays with [] syntax, and typically represent multidimensional data with nested arrays. Multidimensional arrays have fundamental differences relative to this model.

BQN's arrays are immutable, meaning that an array is entirely defined by its attributes, and there is no way to modify an existing array, only to produce another array that has changes relative to it. As a result, an array can never contain itself, and arrays form an inductive type. BQN's mutable types are operations and namespaces.

An array might also have a fill element that captures some structural information about its elements and is used by a few operations. The fill, as an inferred property, isn't considered to truly be part of the array but is instead some information about the array that the interpreter keeps track of. So it's out of scope here.

+ + + + Array properties + + + + 4 + 25 + 64 + 121 + 196 + 4 + 25 + 64 + 121 + 196 + 4 + 25 + 64 + 121 + 196 + 4 + 25 + 64 + 121 + 196 + 4 + 25 + 64 + 121 + 196 + 4 + 25 + 64 + 121 + 196 + 4 + 25 + 64 + 121 + 196 + 4 + + Axis 0 + Position 3 + + + Element at 2‿0‿3 + Value 64 + + + + 3 + 2 + 6 + + Shape + + Rank 3 + + + 0 + 1 + 2 + 3 + 4 + 5 + 0 + 1 + 2 + 0 + 1 + + +

Rectangles

A BQN array is a multidimensional arrangement of data. The word "array" descends from words meaning "order", and the data in an array is ordered indeed. Below are examples of arrays with zero, one, and two dimensions.

↗️
    <5
-- 
cgit v1.2.3