And
Revision as of 21:05, 10 September 2022 by Adám Brudzewsky (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
And (∧
) is a dyadic scalar boolean function which tests if both arguments are true: it returns 1 if both are 1 and 0 if one or both are 0. It represents the logical conjunction in Boolean logic. In many APLs, And is a special case of the LCM function.
<source lang=apl inline>∧</syntaxhighlight> | <source lang=apl inline>0</syntaxhighlight> | <source lang=apl inline>1</syntaxhighlight> |
---|---|---|
<source lang=apl inline>0</syntaxhighlight> | <source lang=apl inline>0</syntaxhighlight> | <source lang=apl inline>0</syntaxhighlight> |
<source lang=apl inline>1</syntaxhighlight> | <source lang=apl inline>0</syntaxhighlight> | <source lang=apl inline>1</syntaxhighlight> |
Examples
The following shows all possible combinations of inputs as a Boolean function.
<source lang=apl>
0 0 1 1 ∧ 0 1 0 1
0 0 0 1 </syntaxhighlight>
When combined with Reduce, And can be used to test if every value in a Boolean vector is true.
<source lang=apl>
∧/ 1 1 1 1 1
1
∧/ 1 0 0 1 1
0 </syntaxhighlight>
See also
External links
Documentation
- Dyalog
- APLX
- J Dictionary, NuVoc
- BQN