Get n-th
bearophile
bearophileHUGS at lycos.com
Wed Feb 23 04:34:28 PST 2011
Jonathan M Davis:
> Assuming that it's a forward range rather than an input range:
>
> auto s = range.save;
> s.popFrontN(n - 1);
> writeln(s.front);
This program gives:
test.d(5): Error: no property 'popFrontN' for type 'Recurrence!(fun,int,2u)'
import std.stdio, std.array, std.range;
void main() {
auto fib = recurrence!("a[n-1] + a[n-2]")(1, 1);
auto s = fib.save;
s.popFrontN(10 - 1);
writeln(s.front);
}
Thank you,
bye,
bearophile
More information about the Digitalmars-d-learn
mailing list