Equal to: Difference between revisions

Jump to navigation Jump to search
580 bytes added ,  02:22, 28 May 2022
m (4 revisions imported: Migrate from miraheze)
(7 intermediate revisions by 2 users not shown)
Line 28: Line 28:
In a [[Nested array model|nested]] APL, Equal to is pervasive, and compares all [[simple scalar]]s found in a [[nested array]].
In a [[Nested array model|nested]] APL, Equal to is pervasive, and compares all [[simple scalar]]s found in a [[nested array]].
<source lang=apl>
<source lang=apl>
       ⊢n ← ((2 1)0)(1 0 3)(2 2⍴4 0)
       ⎕←n ← ((2 1)0)(1 0 3)(2 2⍴4 0)
┌───────┬─────┬───┐
┌───────┬─────┬───┐
│┌───┬─┐│1 0 3│4 0│
│┌───┬─┐│1 0 3│4 0│
Line 48: Line 48:


== Boolean function ==
== Boolean function ==
 
{{Main|Boolean function}}
When the arguments to Equal to are [[Boolean]], it is the [[wikipedia:Logical biconditional|Logical biconditional]] function, or the [[Not|negation]] of the [[xor]] function (which is [[Not Equal to]] restricted to Boolean arguments). This function is also known as xnor or the Kronecker delta.
When the arguments to Equal to are [[Boolean]], it is the [[wikipedia:Logical biconditional|Logical biconditional]] function, or the [[Not|negation]] of the [[xor]] function (which is [[Not Equal to]] restricted to Boolean arguments):
{|class=wikitable
!<source lang=apl inline>=</source>!!<source lang=apl inline>0</source>!!<source lang=apl inline>1</source>
|-
!<source lang=apl inline>0</source>
|<source lang=apl inline>1</source>||<source lang=apl inline>0</source>
|-
!<source lang=apl inline>1</source>
|<source lang=apl inline>0</source>||<source lang=apl inline>1</source>
|}
In the context of logic, it can be read as ''if and only if''. This function is also known as xnor or the Kronecker delta.


[[Reduction]] with <source lang=apl inline>=</source> is the same as reduction with xor (<source lang=apl inline>≠</source>), but [[Not|inverted]] if the number of reduced elements is even. The left and right [[identity element]] for Boolean <source lang=apl inline>=</source> is 1.
[[Reduction]] with <source lang=apl inline>=</source> is the same as reduction with xor (<source lang=apl inline>≠</source>), but [[Not|inverted]] if the number of reduced elements is even. The left and right [[identity element]] for Boolean <source lang=apl inline>=</source> is 1.
Line 57: Line 67:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Equal.htm Dyalog]
* [https://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Equal.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_310.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_310.htm APLX]
* J [https://www.jsoftware.com/help/dictionary/d000.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/eq#dyadic NuVoc]
* J [https://www.jsoftware.com/help/dictionary/d000.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/eq#dyadic NuVoc]
{{APL built-ins}}
* [https://mlochbaum.github.io/BQN/doc/arithmetic.html#comparisons BQN]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Comparison functions]]

Navigation menu