On Thursday, 14 August 2014 at 07:30:59 UTC, Nordlöw wrote:
On Thursday, 14 August 2014 at 00:56:47 UTC, Jonathan M Davis wrote:
You forgot the !, making the predicate a function argument. It

Great!

My solution:

Depending on your exact needs, don't forget too about "findSkip" (same as find, but skips found element), as well as filter.

In particular, r.filter!pred.take(N) would give you a (lazy) range consisting of the first 10 elements in r that verify pred. In some cases, "until" could also suit your needs.

Long story short, D range and algorithms are little building blocks. There aren't that many "basic" functions that can't simply be expressed as a combination of already existing blocks.

Reply via email to