Impressum/Kontaktparent nodes: implemented functions

≡ Depth

testAplDepth
| a |
"http://www.microapl.co.uk/apl_help/ch_020_020_350.htm"

"data aplDepth"

"Depth is used to indicate the level of nesting. For a simple scalar, depth is 0. For other arrays, the depth of the array is 1+ the depth of the item of maximum depth in the array."

"Depth of a scalar is 0"
self assert: 4 asApl aplDepth = 0 asApl.

"Depth of a vector is 1"
self assert: 4 aplInterval aplDepth = 1 asApl.

"Depth of a matrix is 1"
self assert: (6 aplInterval aplReshape:#(2 2)) aplDepth = 1 asApl .

"(Maximum depth is 1+ depth of a vector"
a :=( Array with: 'ABC' with: 1 with:2 with: 3 with:#(23 55) asApl) asApl.
self assert: a aplDepth = 2 asApl.

"Maximum depth object within the array is 2 - a matrix"
"Overall depth is thus 3"
a := (Array with: 'ABC' with: (#('ABC' 2 3 'K') asApl aplReshape:#(2 4))) asApl.
self assert: a aplDepth = 3 asApl.