Nand: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Built-in|Nand|⍲}} is a [[dyadic]] [[scalar function|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 [[wikipedia:Sheffer stroke|Sheffer stroke]] or alternative denial in Boolean logic. Nand is the [[not|boolean negation]] <source lang=apl inline>~</source> of the [[And]] function <source lang=apl inline>∧</source>. The [[glyph]] for Nand is composed from those of [[Not]] (<source lang=apl inline>~</source>) and [[And]] (<source lang=apl inline>∧</source>), but [[fonts]] vary in how they compose them; some overlaying the glyphs (∧&#x334;), and some stacking them (∧&#x303;).
{{Built-in|Nand|⍲}} is a [[dyadic]] [[scalar function|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 [[wikipedia:Sheffer stroke|Sheffer stroke]] or alternative denial in Boolean logic. Nand is the [[not|boolean negation]] <syntaxhighlight lang=apl inline>~</syntaxhighlight> of the [[And]] function <syntaxhighlight lang=apl inline>∧</syntaxhighlight>, and so its [[glyph]] is composed from those. However, [[fonts]] vary in how they compose them; some overlaying the glyphs (∧&#x334;), and some stacking them (∧&#x303;).


{|class=wikitable
{|class=wikitable
!<source lang=apl inline>⍲</source>!!<source lang=apl inline>0</source>!!<source lang=apl inline>1</source>
!<syntaxhighlight lang=apl inline>⍲</syntaxhighlight>!!<syntaxhighlight lang=apl inline>0</syntaxhighlight>!!<syntaxhighlight lang=apl inline>1</syntaxhighlight>
|-
|-
!<source lang=apl inline>0</source>
!<syntaxhighlight lang=apl inline>0</syntaxhighlight>
|<source lang=apl inline>1</source>||<source lang=apl inline>1</source>
|<syntaxhighlight lang=apl inline>1</syntaxhighlight>||<syntaxhighlight lang=apl inline>1</syntaxhighlight>
|-
|-
!<source lang=apl inline>1</source>
!<syntaxhighlight lang=apl inline>1</syntaxhighlight>
|<source lang=apl inline>1</source>||<source lang=apl inline>0</source>
|<syntaxhighlight lang=apl inline>1</syntaxhighlight>||<syntaxhighlight lang=apl inline>0</syntaxhighlight>
|}
|}


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


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


== External links ==
== External links ==
Line 24: Line 24:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/#Language/Primitive%20Functions/Nand.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Nand.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_450.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_450.htm APLX]
* J [https://www.jsoftware.com/help/dictionary/d112.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/starco#dyadic NuVoc]
* J [https://www.jsoftware.com/help/dictionary/d112.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/starco#dyadic NuVoc]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]]

Latest revision as of 22:27, 10 September 2022

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 ~ of the And function , and so its glyph is composed from those. However, fonts vary in how they compose them; some overlaying the glyphs (∧̴), and some stacking them (∧̃).

0 1
0 1 1
1 1 0

Examples

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

      0 0 1 1 ⍲ 0 1 0 1
1 1 1 0

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