Impressum/Kontaktparent nodes: implemented functions
× Sign of
testAplSignOf
| a r |
"http://www.microapl.co.uk/apl_help/ch_020_020_050.htm"
"data aplSignOf"
"Shows the sign of the number(s) in the data argument. Each positive number is represented by a 1, each negative number by a -1 and each zero by a 0."
a := #(33 98 0 -5) asApl.
r := #(1 1 0 -1) asApl.
self assert: r = a aplSignOf.
a := {#(-33.1 0 27). 55. 4 aplInterval + -2 aplReshape: #(2 2).} asApl.
r := {#(-1 0 1). 1. #(-1 0 1 1) aplReshape: #(2 2).} asApl.
self assert: r = a aplSignOf.
" some more:"
self assert: (-1 asApl) = (-22 asApl aplSignOf).
self assert: (0 asApl) = (0 asApl aplSignOf).
self assert: (1 asApl) = (222 asApl aplSignOf).