|
(x>0) - (x<0)
— Kenneth E. Iverson,
A Programming Language, Wiley, 1962-05, §1.4
x← 5 ¯2.7 0 6
|
(x>0)-(x<0)
1 ¯1 0 1
|
|
if x>0
then 1 else if x<0
then ¯1
else 0 |
x × (x>0)-(x<0)
5 2.7 0 6
|
|
if x≥0
then x
else -x |
|
Boolean functions have
value 0
and 1
rather than true
and false .
|
|
Functions apply to entire arrays,
as in, for example, +/x>100
to compute the number of elements of
vector x
greater than 100 .
|
|
A simple function precedence
(“right to left”).
|
|