Impressum/Kontaktparent nodes: implemented functions

⍳ Index list

testAplInterval
| result price selection |
"http://www.microapl.co.uk/apl_help/ch_020_020_150.htm"

"length aplInterval"

"aplInterval generates a series of integers which start at 1 and whose length must be 0 or a positive integer scalar. length must be a simple numeric scalar or one-element vector."

"To generate the series from 1 to 10:"
result := #(1 2 3 4 5 6 7 8 9 10) asApl.
self assert: result = 10 aplInterval.
self assert: result = 10 asApl aplInterval.

"To generate the series 1 to 5 to be used in selecting the first five elements from a vector (see separate entry for aplIndex: ):"
price := #(29 4 61 5 88 2 18 90 3 201 12 53 27 80) asApl.
selection := price aplIndex: (Array with: 5 aplInterval aplContents).
self assert: #(29 4 61 5 88) asApl = selection.

"To generate a vector of five elements containing the series 1, 1 2, and so on, use the aplEach: "
result := #( #(1) #(1 2) #(1 2 3) #(1 2 3 4) #(1 2 3 4 5))asApl.
self assert: result = ( 5 aplInterval aplEach:#aplInterval).

"A common mechanism to generate an empty vector is:"
result := 1 asApl aplShape.
self assert: result = (0 aplInterval).