Function
intersection(_:_:)
Returns the intersection of two collections.
func intersection(_ left: any EcoreValue, _ right: any EcoreValue) throws -> [any EcoreValue]
Parameters
left-
The first collection
right-
The second collection
Return Value
A new array containing elements present in both collections
Discussion
The intersection operation returns elements that appear in both collections, with duplicates removed.
Examples
let set1 = [1, 2, 3] as [EInt]
let set2 = [2, 3, 4] as [EInt]
let common = try intersection(set1, set2) // Result: [2, 3]