Iverson
The Iverson bracket.
Syntax
-
Iverson(b)
-
b
is a boolean
-
Description
The Iverson bracket maps false
to 0
and true
to 1
.
Notes
Unfortunately, the Iverson bracket is not mapped to the []
circumfix operator. If you use the Iverson bracket frequently, you may want to assign it to I
or some other brief symbol.
Examples
I ≔ Iverson
Iverson
f ≔ x ↦ (1 + x^2)⋅I(x > 2)
custom function