Not: Difference between revisions

Jump to navigation Jump to search
86 bytes added ,  06:58, 9 July 2020
Miraheze>Adám Brudzewsky
No edit summary
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Built-in|Not|~}} is a [[Primitive function|primitive]] [[monadic]] [[scalar function]] that returns the [[wikipedia:Negation|logical negation]] of a [[Boolean]] argument—that is, 0 if the argument is 1 and 1 if it is 0. In some languages, such as [[J]], it is extended so that Not <source lang=apl inline>x</source> is equivalent to <source lang=apl inline>1-x</source> while in others, such as [[K]], it is extended so that Not <source lang=apl inline>x</source> is equivalent to <source lang=apl inline>0=x</source>.
{{Built-in|Not|~}} is a [[monadic]] [[scalar function]] that returns the [[wikipedia:Negation|logical negation]] of a [[Boolean]] argument—that is, 0 if the argument is 1 and 1 if it is 0. In some languages, such as [[J]], it is extended so that Not <source lang=apl inline>x</source> is equivalent to <source lang=apl inline>1-x</source> while in others, such as [[K]], it is extended so that Not <source lang=apl inline>x</source> is equivalent to <source lang=apl inline>0=x</source>.


== Examples ==
== Examples ==
Line 21: Line 21:
== History ==
== History ==


[[A Programming Language]] negates arrays using an overbar symbol like <math>\overline{p}</math>, matching a convention sometimes used in mathematics. In [[APL\360]] the current symbol <source lang=apl inline>~</source> was chosen, also due to its use in mathematics. Mathematical usage has arguably diverged from APL in this respect, as the negation of a variable <math>p</math> is now more often written <math>\neg p</math>, using the symbol <math>¬</math>, when a prefix operator is desired.
[[A Programming Language]] negates arrays using an overbar symbol like <math>\overline{p}</math>, matching a convention sometimes used in mathematics. In [[APL\360]] the current symbol <source lang=apl inline>~</source> was chosen, also due to its use in mathematics. Mathematical usage has arguably diverged from APL in this respect, as the negation of a variable <math>p</math> is now more often written <math>\neg p</math> when a prefix operator is desired.


The arithmetic extension <source lang=apl inline>~x</source> {{←→}} <source lang=apl inline>1-x</source> was introduced to the array langauge family by [[J]]. For arguments in the interval <math>[0,1]</math> this extension may be seen as a probabilistic interpretation of negation.
The arithmetic extension <source lang=apl inline>~x</source> {{←→}} <source lang=apl inline>1-x</source> was introduced to the array langauge family by [[J]]. For arguments in the interval <math>[0,1]</math> this extension may be seen as a probabilistic interpretation of negation.
Line 36: Line 36:
| <source lang=apl inline>0≠⍵</source> || [[K]]
| <source lang=apl inline>0≠⍵</source> || [[K]]
|}
|}
== See also ==
* [[Negate]]
* [[Nor]]
* [[Nand]]
* [[Not Equal to]]
* [[Not Match]]


== External links ==
== External links ==
Line 49: Line 56:
* J [https://www.jsoftware.com/help/dictionary/d121.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/minusdot NuVoc]
* J [https://www.jsoftware.com/help/dictionary/d121.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/minusdot NuVoc]


{{APL built-ins}}
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar monadic functions]]

Navigation menu