--- Comment #3 from Philippe Sigaud <philippe.sig...@gmail.com> 2010-08-20
00:46:32 CEST ---
(In reply to comment #1)
> Doesn't std.algorithm.until pretty much do what you want?
I see until() is templated on the predicate. I guess most of the time, I can
rewrite my predicates to use until.
auto t = takeWhile!"a*a>10"(someValues);
auto u = until!"a*a>b"(10, someValues); // hey, b is 10, a will be elements
from someValues. Is that clear?
I personally find takeWhile to be more readable. Maybe I'm biased due to my
using it in other languages?
Also, it's cumbersome for no-arg functions:
// takes lines as long as they are not empty
auto t = takeWhile!"!a.empty"(file.byLine);
auto u = until!"!a.empty"(dummy, file.byLine);
auto t = takeWile!externalUnaryPredicate(someValues);
auto u = until!externalUnaryPredicate(??, someValues); // How do I do that?
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------