Next: Structures, Previous: Lists, Up: Data Types and Structures [Contents][Index]

### 5.5 Arrays

Maxima supports 3 array-like constructs:

- If one tries to write to an indexed variable without creating a list first an undeclared array (also named hashed array) is created that grows dynamically and allows numbers, symbols and strings as indices:

      (%i1) a["feww"]:1;
      (%o1)                           1

      (%i2) a[qqwdqwd]:3;
      (%o2)                           3

      (%i3) a[5]:99;
      (%o3)                          99

      (%i4) a[qqwdqwd];
      (%o4)                           3

      (%i5) a[5];
      (%o5)                          99

      (%i6) a["feww"];
      (%o6)                           1

  Since lisp handles hashed arrays and `memoizing functions` similar to arrays many of the functions that can be applied to arrays can be applied to them, as well.

- Lists (see `makelist` allow for fast addition and removal of elements, can be created without knowing their final size.
- Declared arrays that allow fast access to random elements at the cost that their size needs to be known at construction time. (See Performance considerations for Lists.)

Next: Structures, Previous: Lists, Up: Data Types and Structures [Contents][Index]