Nand

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

Nand () is a dyadic scalar boolean function which tests if either argument is not true: it returns 0 if both are 1 and 1 if at least one is 0. It represents the Sheffer stroke or alternative denial in Boolean logic. Nand is the boolean negation <syntaxhighlight lang=apl inline>~</source> of the And function <syntaxhighlight lang=apl inline>∧</source>, and so its glyph is composed from those. However, fonts vary in how they compose them; some overlaying the glyphs (∧̴), and some stacking them (∧̃).

<syntaxhighlight lang=apl inline>⍲</source> <syntaxhighlight lang=apl inline>0</source> <syntaxhighlight lang=apl inline>1</source>
<syntaxhighlight lang=apl inline>0</source> <syntaxhighlight lang=apl inline>1</source> <syntaxhighlight lang=apl inline>1</source>
<syntaxhighlight lang=apl inline>1</source> <syntaxhighlight lang=apl inline>1</source> <syntaxhighlight lang=apl inline>0</source>

Examples

The following shows all possible combinations of inputs as a Boolean function.

<syntaxhighlight lang=apl>

     0 0 1 1 ⍲ 0 1 0 1

1 1 1 0 </source>

External links

Documentation

APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
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 axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)
Quad names Index originComparison toleranceMigration levelAtomic vector