@@ -14,31 +14,42 @@ use crate::{Array, ArrayRef};
1414
1515/// Point-wise logical _and_ between two Boolean arrays.
1616///
17- /// This method uses Arrow-style null propagation rather than the Kleene logic semantics.
17+ /// This method uses Arrow-style null propagation rather than the Kleene logic semantics. This
18+ /// semantics is also known as "Bochvar logic" and "weak Kleene logic".
19+ ///
20+ /// See also [BooleanOperator::And]
1821pub fn and ( lhs : & dyn Array , rhs : & dyn Array ) -> VortexResult < ArrayRef > {
1922 boolean ( lhs, rhs, BooleanOperator :: And )
2023}
2124
2225/// Point-wise Kleene logical _and_ between two Boolean arrays.
26+ ///
27+ /// See also [BooleanOperator::AndKleene]
2328pub fn and_kleene ( lhs : & dyn Array , rhs : & dyn Array ) -> VortexResult < ArrayRef > {
2429 boolean ( lhs, rhs, BooleanOperator :: AndKleene )
2530}
2631
2732/// Point-wise logical _or_ between two Boolean arrays.
2833///
29- /// This method uses Arrow-style null propagation rather than the Kleene logic semantics.
34+ /// This method uses Arrow-style null propagation rather than the Kleene logic semantics. This
35+ /// semantics is also known as "Bochvar logic" and "weak Kleene logic".
36+ ///
37+ /// See also [BooleanOperator::Or]
3038pub fn or ( lhs : & dyn Array , rhs : & dyn Array ) -> VortexResult < ArrayRef > {
3139 boolean ( lhs, rhs, BooleanOperator :: Or )
3240}
3341
3442/// Point-wise Kleene logical _or_ between two Boolean arrays.
43+ ///
44+ /// See also [BooleanOperator::OrKleene]
3545pub fn or_kleene ( lhs : & dyn Array , rhs : & dyn Array ) -> VortexResult < ArrayRef > {
3646 boolean ( lhs, rhs, BooleanOperator :: OrKleene )
3747}
3848
3949/// Point-wise logical operator between two Boolean arrays.
4050///
41- /// This method uses Arrow-style null propagation rather than the Kleene logic semantics.
51+ /// This method uses Arrow-style null propagation rather than the Kleene logic semantics. This
52+ /// semantics is also known as "Bochvar logic" and "weak Kleene logic".
4253pub fn boolean ( lhs : & dyn Array , rhs : & dyn Array , op : BooleanOperator ) -> VortexResult < ArrayRef > {
4354 BOOLEAN_FN
4455 . invoke ( & InvocationArgs {
@@ -181,11 +192,46 @@ impl ComputeFnVTable for Boolean {
181192 }
182193}
183194
195+ /// Operations over the nullable Boolean values.
196+ ///
197+ /// All three operators accept and produce values from the set {true, false, and null}.
184198#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
185199pub enum BooleanOperator {
200+ /// Logical and, unless either value is null, in which case the result is null.
201+ ///
202+ /// | A ∧ B | | **B** | | |
203+ /// |:-----:|:-----:|:-----:|:-----:|:-----:|
204+ /// | | | **F** | **U** | **T** |
205+ /// | **A** | **F** | F | U | F |
206+ /// | | **U** | U | U | U |
207+ /// | | **T** | F | U | T |
186208 And ,
209+ /// [Kleene (three-valued) logical and](https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics).
210+ ///
211+ /// | A ∧ B | | **B** | | |
212+ /// |:-----:|:-----:|:-----:|:-----:|:-----:|
213+ /// | | | **F** | **U** | **T** |
214+ /// | **A** | **F** | F | F | F |
215+ /// | | **U** | F | U | U |
216+ /// | | **T** | F | U | T |
187217 AndKleene ,
218+ /// Logical or, unless either value is null, in which case the result is null.
219+ ///
220+ /// | A ∨ B | | **B** | | |
221+ /// |:-----:|:-----:|:-----:|:-----:|:-----:|
222+ /// | | | **F** | **U** | **T** |
223+ /// | **A** | **F** | F | U | T |
224+ /// | | **U** | U | U | U |
225+ /// | | **T** | T | U | T |
188226 Or ,
227+ /// [Kleene (three-valued) logical or](https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics).
228+ ///
229+ /// | A ∨ B | | **B** | | |
230+ /// |:-----:|:-----:|:-----:|:-----:|:-----:|
231+ /// | | | **F** | **U** | **T** |
232+ /// | **A** | **F** | F | U | T |
233+ /// | | **U** | U | U | T |
234+ /// | | **T** | T | T | T |
189235 OrKleene ,
190236 // AndNot,
191237 // AndNotKleene,
0 commit comments