And: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Built-in|And|∧}} is a dyadic 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 wi...") |
(Move LCM to its own page; see Talk:Or) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Built-in|And|∧}} is a [[dyadic]] [[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 [[wikipedia:logical conjunction|logical conjunction]] in Boolean logic. | {{Built-in|And|∧}} is a [[dyadic]] [[scalar function|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 [[wikipedia:logical conjunction|logical conjunction]] in Boolean logic. In many APLs, And is a special case of the [[LCM]] function. | ||
{|class=wikitable | {|class=wikitable | ||
!<source lang=apl inline> | !<source lang=apl inline>∧</source>!!<source lang=apl inline>0</source>!!<source lang=apl inline>1</source> | ||
|- | |- | ||
!<source lang=apl inline>0</source> | !<source lang=apl inline>0</source> | ||
Line 20: | Line 20: | ||
</source> | </source> | ||
When combined with [[Reduce]], And can be used to test if every value in a Boolean vector is true. | |||
<source lang=apl> | <source lang=apl> | ||
∧/ 1 1 1 1 1 | |||
1 | |||
∧/ 1 0 0 1 1 | |||
0 | 0 | ||
0 | </source> | ||
</source> | |||
== External links == | == External links == | ||
Line 53: | Line 34: | ||
* [http://help.dyalog.com/17.1/#Language/Primitive%20Functions/And%20Lowest%20Common%20Multiple.htm Dyalog] | * [http://help.dyalog.com/17.1/#Language/Primitive%20Functions/And%20Lowest%20Common%20Multiple.htm Dyalog] | ||
* [http://microapl.com/apl_help/ch_020_020_430.htm APLX] | |||
* J [https://www.jsoftware.com/help/dictionary/d111.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/stardot#dyadic NuVoc] | * J [https://www.jsoftware.com/help/dictionary/d111.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/stardot#dyadic NuVoc] | ||
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]] | {{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]] |
Revision as of 15:09, 1 June 2020
∧
|
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.
∧ |
0 |
1
|
---|---|---|
0
|
0 |
0
|
1
|
0 |
1
|
Examples
The following shows all possible combinations of inputs as a Boolean function.
0 0 1 1 ∧ 0 1 0 1 0 0 0 1
When combined with Reduce, And can be used to test if every value in a Boolean vector is true.
∧/ 1 1 1 1 1 1 ∧/ 1 0 0 1 1 0