Intersection

From APL Wiki
Revision as of 01:51, 11 June 2020 by Bubbler (talk | contribs) (Created page with "{{Built-in|Intersection|∩}} is a dyadic set function which computes the set intersection of the two vector argument|arg...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Intersection () is a dyadic set function which computes the set intersection of the two vector arguments.

Examples

Both arguments of Intersection is usually restricted to vectors. Unlike sets in the mathematical sense, duplicate elements are allowed in both sides, and Intersection is usually implemented as "left argument filtered by its existence in the right argument" (X∊Y)/X, which preserves the order and multiplicity in the left argument. Both arguments can be nested arrays.

      'ABRA'∩'CAR'
ARA
       A←'THIS' 'AND' 'THAT'                                                  
       A∩'T'
                              ⍝ (No match for the single character T)
       A∩'AND'
                              ⍝ (No match for any of the three characters A N D)
       A∩⊂'AND'
┌───┐
│AND│
└───┘

External Links

Documentation


APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
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 axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector