2 ms·
That syntax is important. It's specifying that the the collection `Elements` contains values which are the same type as `Element`. Sure, those are probably ba
by favorited 5y ago
That syntax is important. It's specifying that the the collection `Elements` contains values which are the same type as `Element`. Sure, those are probably bad names for the generic types (though better than `T` and `U`). But you need some way to express that the `Element` type is the same as the contents of the `Elements` collection.
The SQL analogy is a good one– what the function signature is doing is specifying a constraint between 2 otherwise unrelated values. Otherwise you could call the function with an array of `String`s an ask it for the index of an `Int`.