Merging one Array with Another

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 3 08:29:01 PDT 2015


On 05/03/2015 07:56 AM, "Per =?UTF-8?B?Tm9yZGzDtnci?= 
<per.nordlow at gmail.com>" wrote:
> On Saturday, 2 May 2015 at 04:08:04 UTC, Ali Çehreli wrote:
>> Interesting idea. I have defined a simple algorithm below to see how
>> it could work (my skipped() function instead of uniq()).
>
> That's a bit above my current D experience to decide.
>
> What about just tweaking uniq() for now to propagate SortedRange and
> leave the rest for later?

The implementation seems trivial to me. If others don't object, I 
suggest you open an enhancement request.

 > Or will this break existing uses of uniq?

Other than the fact that uniq may return SortedRange, I don't see any 
issue. If an existing piece of code was explicitly checking whether a 
certain range object was  UniqResult, no code should be affected.

Another possibility is to return UniqResult in both cases but expose the 
special SortedRange member functions on it if the input were 
SortedRange. (Again, trivial.)

Ali



More information about the Digitalmars-d-learn mailing list