Function
flatten(_:)
Flattens a nested collection structure.
func flatten(_ collection: any EcoreValue) throws -> [any EcoreValue]
Parameters
collection-
The nested collection to flatten
Return Value
A new flattened array
Discussion
The flatten operation takes a collection of collections and returns a single flat collection containing all elements from the nested collections.
Examples
let nested = [[1, 2], [3, 4], [5]] as [[EInt]]
let flat = try flatten(nested) // Result: [1, 2, 3, 4, 5]