D dropped in favour of C# for PSP emulator

Ary Manzana ary at esperanto.org.ar
Fri May 11 20:38:59 PDT 2012


On 5/12/12 1:18 AM, Andrei Alexandrescu wrote:
> On 5/11/12 1:10 PM, Mehrdad wrote:
>> On Friday, 11 May 2012 at 18:05:58 UTC, Mehrdad wrote:
>>> and the solution indeed was NOT something I would've found by myself
>>> without spending hours on it.
>>
>>
>> Just a note: I believe I *had* seen SortedRange in the docs, but I'd
>> never realized there's something called assumeSorted() that I was
>> supposed to call... so I was searching up and down for how to search an
>> *arbitrary* container, not how to search something which was already
>> pre-sorted for me.
>> (In retrospect, I probably should've just coded binary search myself...)
>> It's very counterintuitive to have to make a new object (or struct) just
>> to do binary search on an array...
>
> At the same time it clarifies, documents, and statistically verifies
> that you pass a sorted range. Also, D's binary search works with
> non-array ranges, but C#'s works only with arrays (which it assumes
> sorted only by convention).
>
> I think we copiously made the right call there.
>
>
> Andrei

Add a binarySearch(range, object) method that does all of that?

I mean, I don't want to write more than a single line of code to do a 
binarySearch...


More information about the Digitalmars-d mailing list