Cashew updated, Sep 2007

Bill Baxter dnewsgroup at billbaxter.com
Tue Sep 4 20:51:28 PDT 2007


Chris Nicholson-Sauls wrote:
> Chris Nicholson-Sauls wrote:
>> Bill Baxter wrote:
>>>
>>> I sent you some binary search routines for array a while back.  Since 
>>> you didn't put 'em in  I'll just post 'em here for anyone who needs 
>>> to do binary searching:
>>>
>>
>> I do still have those, just hadn't merged them in yet.  (Didn't work 
>> on Cashew at all for a good long while.)  They'll be in their own 
>> module (cashew.utils.Binary) in the next update.
>>
>> -- Chris Nicholson-Sauls
> 
> And now they are there.
> 
> cashew.utils.Binary : 0.1.0
>  -- Care of Bill Baxter
> 
> 
> 
> Sorry about that.  :)  I did make small modifications, but only to add a 
> public import of cashew.utils.Array:NOT_FOUND since you use it, and to 
> add cashew.utils.UTest wrappers to your unittests.  (Which, of course, 
> all passed flawlessly.)
> 
> -- Chris Nicholson-Sauls

Great!  Now next time I need them I won't have to go digging through my 
source code trying to remember where I put them. :-).

I just remembered one thing I changed in a different copy of this stuff 
I have in another folder somewhere:  the preconditions should be changed 
to only check that the specified lo..hi range is sorted.  So something like

in { assert(is_sorted(A[lo..(hi==size_t.max)?$:hi])); }

I've attached a patch that does that plus adds a few more unittests that 
would have failed under the old code.

--bb

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cashew-binary.patch
Url: http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20070905/d0c4daec/attachment.txt 


More information about the Digitalmars-d-announce mailing list