Or

From APL Wiki
Revision as of 22:09, 10 September 2022 by Adám Brudzewsky (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
Jump to navigation Jump to search

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

APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector