[swift-evolution] [Proposal] Add Binary Search functions to SequenceType
Lorenzo Racca
lorenzo.racca at live.it
Tue Mar 15 10:48:58 CDT 2016
Thank you Haraviik,
I already knew the impossibility of applying such a predicate as “$0 == 3” and I actually couldn’t quite figure out a solution. Honestly, I’m quite new to Swift :)
Actually at first I thought that no one would use it, as the same result could be achieved using the main binarySearch function.
If the elements to be matched have to be equal it makes no difference whether we retrieve the smallest or greatest, unless the array had multiple entries with same value.
In that case, you are right, my functions do not work properly, but your code seems to be working fine in these situations!
Would you want to cooperate for the proposal?
Lorenzo Racca
+39 345 9294756
lorenzo.racca at live.it
More information about the swift-evolution
mailing list