Membership: Difference between revisions

Jump to navigation Jump to search
366 bytes added ,  07:58, 29 June 2020
No edit summary
(One intermediate revision by the same user not shown)
Line 25: Line 25:
=== Leading axis model ===
=== Leading axis model ===


The behavior of Membership was changed to follow [[leading axis model]] in some implementations such as [[J]]. 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.</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.


<source lang=j>
<source lang=j>
Line 43: Line 43:
1 1 1
1 1 1
</source>
</source>
In other dialects, a leading axis membership function can be defined as:
<source lang=apl>
      Membership←{(≢⍵)≥⍵⍳⍺}
      ⎕←mat←3 4⍴'ableacreidle'
able
acre
idle
      'able' Membership mat
1
</source>{{Works in|[[Dyalog APL]], [[NARS2000]], [[dzaima/APL]], [[Extended Dyalog APL]], [[GNU APL]]}}


== External links ==
== External links ==

Navigation menu