Isn't using find with retro awkward?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Feb 16 15:05:15 PST 2011
On 2/16/11, jam <gr0v3er+d at gmail.com> wrote:
>
> import std.stdio,std.algorithm,std.range,std.container;
>
> void main()
> {
> auto a = [5,1,2,3,4,5,1];
> auto index = countUntil(retro(a),5);
> auto R = retro(take(retro(a),index+1));
> writeln(R);
> R[0] = 6;
> writeln(a);
> }
>
> but this is just getting nutty.
>
>
Nutty, but it's great how much lines you can save when composing
ranges. retro and take are both lazy afaik, so this can't be that bad?
More information about the Digitalmars-d-learn
mailing list