digitalmars.D.learn - findSplit
- Gecko (13/13) Jul 25 2014 Hello,
- Jakob Ovrum (4/6) Jul 25 2014 Not at the moment. I've been working on a patch that makes the
Hello,
is there a pretty way to split a range into 3 pieces, like
findSplit, just with a predicate instead of comparing it with an
element.
Like this :
void main() {
import std.algorithm, std.stdio;
auto list = [1,2,3,4,5,6,7];
writeln(findSplit!(x => x == 3 )(list));
//should print Tuple!(....) ([1,2], [3], [4,5,6,7])
}
findSplit accepts a predicate but it doesnt compile for me if i
use an other function than ((a,b) => a == b).
Jul 25 2014
On Friday, 25 July 2014 at 18:56:44 UTC, Gecko wrote:findSplit accepts a predicate but it doesnt compile for me if i use an other function than ((a,b) => a == b).Not at the moment. I've been working on a patch that makes the `findSplit*` family of algorithms as powerful as `find`, including support for your use case.
Jul 25 2014








"Jakob Ovrum" <jakobovrum gmail.com>