Membership: Difference between revisions

Jump to navigation Jump to search
45 bytes added ,  21:16, 10 September 2022
m
Text replacement - "</source>" to "</syntaxhighlight>"
(→‎Documentation: BQN link)
m (Text replacement - "</source>" to "</syntaxhighlight>")
Tags: Mobile edit Mobile web edit
Line 14: Line 14:
0 0 1
0 0 1
0 0 1
0 0 1
</source>
</syntaxhighlight>


For [[nested array|nested arrays]], Membership tests for exact [[match]] between the elements.
For [[nested array|nested arrays]], Membership tests for exact [[match]] between the elements.
Line 21: Line 21:
       'CAT' 'DOG' 'MOUSE' ∊ 'CAT' 'FOX' 'DOG' 'LLAMA'
       'CAT' 'DOG' 'MOUSE' ∊ 'CAT' 'FOX' 'DOG' 'LLAMA'
1 1 0
1 1 0
</source>
</syntaxhighlight>


=== Leading axis model ===
=== Leading axis model ===


The behavior of Membership was changed to follow [[leading axis model]] in some implementations such as [[J]] (spelled <source lang=j inline>e.</source>). In this case, if the right argument is a higher-[[rank]] array, the [[cell|cells]] of the left argument with appropriate rank are compared against the [[major cell|major cells]] of the right argument.
The behavior of Membership was changed to follow [[leading axis model]] in some implementations such as [[J]] (spelled <source lang=j inline>e.</syntaxhighlight>). In this case, if the right argument is a higher-[[rank]] array, the [[cell|cells]] of the left argument with appropriate rank are compared against the [[major cell|major cells]] of the right argument.


<source lang=j>
<source lang=j>
Line 42: Line 42:
1 1 1
1 1 1
1 1 1
1 1 1
</source>
</syntaxhighlight>
In other dialects, a leading axis membership function can be defined as:
In other dialects, a leading axis membership function can be defined as:
<source lang=apl>
<source lang=apl>
Line 52: Line 52:
       'able' Membership mat
       'able' Membership mat
1
1
</source>{{Works in|[[Dyalog APL]], [[NARS2000]], [[dzaima/APL]], [[Extended Dyalog APL]], [[GNU APL]]}}
</syntaxhighlight>{{Works in|[[Dyalog APL]], [[NARS2000]], [[dzaima/APL]], [[Extended Dyalog APL]], [[GNU APL]]}}


== See also ==
== See also ==

Navigation menu