Boolean
From Erights
(Difference between revisions)
(copy in tests from E-on-CL scope-univ.updoc r1044) |
Kevin Reid (Talk | contribs) |
||
Line 1: | Line 1: | ||
- | The '''<code>Boolean</code>''' type has exactly two members, <code>false</code> and <code>true</code>. All three | + | The '''<code>Boolean</code>''' type has exactly two members, <code>false</code> and <code>true</code>. All three names are in the [[universal scope]]. |
- | + | == Protocol == | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | === pick/2 === | |
- | + | pick(<var>t</var>, <var>f</var>) :any | |
- | + | ||
- | + | ||
false.pick(<var>t</var>, <var>f</var>) returns <var>f</var>; true.pick(<var>t</var>, <var>f</var>) returns <var>t</var>. | false.pick(<var>t</var>, <var>f</var>) returns <var>f</var>; true.pick(<var>t</var>, <var>f</var>) returns <var>t</var>. | ||
- | + | === not/0 === | |
- | + | ||
- | + | not() :Boolean | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
Boolean negation. | Boolean negation. | ||
- | + | === or/1 === | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | or(<var>other</var> :Boolean) :Boolean | |
Boolean or. The argument is coerced to a boolean. | Boolean or. The argument is coerced to a boolean. | ||
- | + | === and/1 === | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | and(<var>other</var> :Boolean) :Boolean | |
Boolean and. The argument is coerced to a boolean. | Boolean and. The argument is coerced to a boolean. | ||
- | + | === xor/1 === | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | xor(<var>other</var> :Boolean) :Boolean | |
- | + | ||
- | + | ||
Boolean exclusive or. The argument is coerced to a boolean. | Boolean exclusive or. The argument is coerced to a boolean. | ||
- | + | === op__cmp/1 === | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | |||
Comparison with other Booleans. See [[Message op__cmp]]. | Comparison with other Booleans. See [[Message op__cmp]]. | ||
- | |||
- | |||
- | |||
- |
Revision as of 19:47, 21 April 2007
The Boolean
type has exactly two members, false
and true
. All three names are in the universal scope.
Contents |
Protocol
pick/2
pick(t, f) :any
false.pick(t, f) returns f; true.pick(t, f) returns t.
not/0
not() :Boolean
Boolean negation.
or/1
or(other :Boolean) :Boolean
Boolean or. The argument is coerced to a boolean.
and/1
and(other :Boolean) :Boolean
Boolean and. The argument is coerced to a boolean.
xor/1
xor(other :Boolean) :Boolean
Boolean exclusive or. The argument is coerced to a boolean.
op__cmp/1
Comparison with other Booleans. See Message op__cmp.