From 015d9cd399100427b3e82fb183c81d034f00cd8c Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 4 Sep 2020 21:33:13 -0400 Subject: Use atom for non-array throughout docs --- docs/doc/depth.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/doc/depth.html') diff --git a/docs/doc/depth.html b/docs/doc/depth.html index 409e3799..7ae6b2fd 100644 --- a/docs/doc/depth.html +++ b/docs/doc/depth.html @@ -5,7 +5,7 @@

Depth

-

The depth of an array is the greatest level of array nesting it attains, or, put another way, the greatest number of times you can pick an element starting from the original array before reaching a non-array. The monadic function Depth () returns the depth of its argument, while the 2-modifier Depth () can control the way its left operand is applied based on the depth of its arguments. Several primitive functions also use the depth of the left argument to decide whether it applies to a single axis of the right argument or to several axes.

+

The depth of an array is the greatest level of array nesting it attains, or, put another way, the greatest number of times you can pick an element starting from the original array before reaching an atom. The monadic function Depth () returns the depth of its argument, while the 2-modifier Depth () can control the way its left operand is applied based on the depth of its arguments. Several primitive functions also use the depth of the left argument to decide whether it applies to a single axis of the right argument or to several axes.

The Depth function

To find the depth of an array, use Depth (). For example, the depth of a list of numbers or characters is 1:

↗️
     234
@@ -27,7 +27,7 @@
      2,<3,4,<<<5
 4
 
-

As the above expressions suggest, the depth of an array is the maximum of its elements' depths, plus one. The base case, a non-array (including a function or modifier), has depth 0.

+

As the above expressions suggest, the depth of an array is the maximum of its elements' depths, plus one. The base case, an atom (including a function or modifier), has depth 0.

↗️
    'c'
 0
     F+f
@@ -79,7 +79,7 @@
   ⟨ 2 1 ⟩ ⟨ 2 4 ⟩ ⟨ 2 1 ⟩  
                           ┘
 
-

This means the left argument is homogeneous of depth 2. What should an argument of depth 1, or an argument that contains non-arrays, do? One option is to continue to require the left argument to be a list, and convert any non-array argument into an array by enclosing it:

+

This means the left argument is homogeneous of depth 2. What should an argument of depth 1, that is, an array of atoms, do? One option is to continue to require the left argument to be a list, and convert any atom argument into an array by enclosing it:

↗️
    32,1 <(0=≡)¨ 67
 ⟨ ⟨ 3 1 ⟩ ⟨ 2 1 ⟩ ⟩
 
@@ -129,7 +129,7 @@ ⟨ ⟨ 37 36 ⟩ ⟨ 39 38 ⟩ ⟩ ⟨ ⟨ 41 40 ⟩ ⟨ 43 42 ⟩ ⟩ ⟨ ⟨ 45 44 ⟩ ⟨ 47 46 ⟩ ⟩ ┘ -

While a negative depth tells how many levels to go down, a non-negative depth gives the maximum depth of the argument before applying the left operand. On a depth-3 array like above, depth 2 is equivalent to ¯1 and depth 1 is equivalent to ¯2. A depth of 0 means to loop until non-arrays are reached, that is, apply pervasively, like a scalar function.

+

While a negative depth tells how many levels to go down, a non-negative depth gives the maximum depth of the argument before applying the left operand. On a depth-3 array like above, depth 2 is equivalent to ¯1 and depth 1 is equivalent to ¯2. A depth of 0 means to descend all the way to the level of atoms, that is, apply pervasively, like a scalar function.

↗️
    'a',"bc" 0 23,4
 ┌─                                                 
 · ⟨ ⟨ 'a' 2 ⟩ ⟨ 'a' 3 ⟩ ⟩ ⟨ ⟨ 'b' 4 ⟩ ⟨ 'c' 4 ⟩ ⟩  
-- 
cgit v1.2.3