Or: Difference between revisions
Jump to navigation
Jump to search
(→Documentation: BQN) |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 2: | Line 2: | ||
{|class=wikitable | {|class=wikitable | ||
!<source lang=apl inline>∨</ | !<source lang=apl inline>∨</syntaxhighlight>!!<source lang=apl inline>0</syntaxhighlight>!!<source lang=apl inline>1</syntaxhighlight> | ||
|- | |- | ||
!<source lang=apl inline>0</ | !<source lang=apl inline>0</syntaxhighlight> | ||
|<source lang=apl inline>0</ | |<source lang=apl inline>0</syntaxhighlight>||<source lang=apl inline>1</syntaxhighlight> | ||
|- | |- | ||
!<source lang=apl inline>1</ | !<source lang=apl inline>1</syntaxhighlight> | ||
|<source lang=apl inline>1</ | |<source lang=apl inline>1</syntaxhighlight>||<source lang=apl inline>1</syntaxhighlight> | ||
|} | |} | ||
Line 18: | Line 18: | ||
0 0 1 1 ∨ 0 1 0 1 | 0 0 1 1 ∨ 0 1 0 1 | ||
0 1 1 1 | 0 1 1 1 | ||
</ | </syntaxhighlight> | ||
When combined with [[Reduce]], Or can be used to test if some value in a Boolean vector is true. | When combined with [[Reduce]], Or can be used to test if some value in a Boolean vector is true. | ||
Line 27: | Line 27: | ||
∨/ 0 0 0 0 0 | ∨/ 0 0 0 0 0 | ||
0 | 0 | ||
</ | </syntaxhighlight> | ||
== See also == | == See also == |
Revision as of 22:09, 10 September 2022
∨
|
Or (∨
) is a dyadic scalar boolean function which tests if at least one of the two arguments is true: it returns 1 if at least one side is 1 and 0 if both are 0. It represents the logical disjunction in Boolean logic. In many APLs, Or is a special case of the GCD 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>1</syntaxhighlight> |
<source lang=apl inline>1</syntaxhighlight> | <source lang=apl inline>1</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 1 1 1 </syntaxhighlight>
When combined with Reduce, Or can be used to test if some value in a Boolean vector is true.
<source lang=apl>
∨/ 0 0 1 0 1
1
∨/ 0 0 0 0 0
0 </syntaxhighlight>
See also
External links
Documentation
- Dyalog
- APLX
- J Dictionary, NuVoc
- BQN