replaceFirst, findPieces, and takeExactly

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jan 22 14:33:15 PST 2011


On 1/22/11 4:16 PM, bearophile wrote:
> Andrei:
>
>> Back then people said that STL's find() is better than D's find()
>> because the former returns
>> an iterator that can be combined with either the first iterator to get
>> the portion before the match, or with the last iterator to get the
>> portion starting at the match. D's find() only gives you the portion
>> after the match.
>
> There's a HUGE problem here. This equivalence is sometimes true, but surely not always true:
> "more powerful" != "better"
>
>
>> That function allows you to pick a determined number of elements from a
>> range, assuming the range is never shorter than that. That sounds a bit
>> obscure, but plays a pivotal role in findParts() (which is the name I
>> settled on for the equivalent of Python's partition()):
>
> "trisect" is way better than "findParts" :-) And it's a single word with no uppercase letters in the middle.

There is still time until the next release. Votes for trisect?

Andrei


More information about the Digitalmars-d mailing list