Documentation Language: Swift

Function

excluding(_:_:)

Returns a new collection with all occurrences of an element removed.

func excluding(_ collection: any EcoreValue, _ element: any EcoreValue) throws -> [any EcoreValue]

Parameters

collection

The original collection

element

The element to remove

Return Value

A new array with the element removed

Discussion

The excluding operation creates a new collection containing all elements from the original collection except those equal to the specified element.

Examples

let numbers = [1, 2, 2, 3] as [EInt]
let withoutTwos = try excluding(numbers, 2 as EInt)  // Result: [1, 3]