Frame and cell

From J Wiki
< Help(Redirected from Help/Primer/Frame and cell)
Jump to navigation Jump to search


<=   =>

So far nouns have been considered in their entirety. However, it is useful to think of an array as consisting of cells, parts of the array (subarrays) that when placed in a frame, make up the entire array.

   a =. 2 3 $ 'abcdef'
   a
abc
def


The array a can be thought of as having 6 cells, where each cell is an atom. The frame would be the shape 2 3 that structures the 6 individual cells into the array a. Visually (cell is atom and frame of 2 3):

	a       cell 0
	b       cell 1
	...
	f       cell 5


The array a can also be thought of as having 2 cells, where each cell is a list. The frame would be the shape 2 that structures the cells into the array a. Visually (cell is list and frame of 2):

	abc   cell 0
	def   cell 1


Finally, the array a can be thought of as having 1 cell, where the cell is a table. The frame would be the shape empty that structures the cells into the array a. Visually (cell is table and frame is empty) :

	abc   cell 0
	def


A table with shape 2 3 can be thought of as:

  • a 2 3 frame of cells that are atoms

  • a 2 frame of cells that are lists of shape 3

  • an empty frame of a cell that is a table of shape 2 3

Similarly, an array with shape 4 3 2 can be thought of as:


  • a 4 3 2 frame of cells that are atoms

  • a 4 3 frame of cells that are lists of shape 2

  • a 4 frame of cells that are tables of shape 3 2

  • an empty frame of a cell that is a rank 3 array of shape 4 3 2

The frame is a prefix of the shape of the array. It can be the entire shape (a prefix of all), in which case the cells are atoms. It can be empty (a prefix of none) in which case there is a single cell which is the array. Or anything in between.


The cell shape is the array shape with the frame prefix removed. The length of the cell shape is the cell rank.

The cells of an array are the subarrays that, when assembled into the corresponding frame, create the entire array.

<=   =>

Primer Index               Hover to reveal titles   -   Click to access   -   Current page is highlighted
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
45 46 47 48
50 51 52 53 54 55 56 57
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
97 98 99 100 101 102 103 104 105 106