replaceFirst, findPieces, and takeExactly

spir denis.spir at gmail.com
Sat Jan 22 20:16:33 PST 2011


On 01/22/2011 10:27 PM, Andrei Alexandrescu wrote:
> The first abstraction is the takeExactly() function:
>
> http://d-programming-language.org/cutting-edge/phobos/std_range.html#takeExactly
>
>
> 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()):

What is reasoning behind having length set on takeExactly's result 
(while if succeeds, you know it, or don't you?), and not on take's 
result (which can return a smaller number of elements)? I would expect 
the opposite, or both, but maybe it's only me?

Denis
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list