Thanks for all your help understanding the algorithm chaining problem...
Now I have another gotcha.
This code compiles and runs OK if I remove the keyword "pure" or if I remove the ".retro"
As I understand it retro should affect the "pure"ness of the the function.
If I put the keyword in, it fails to instantiate the template...
import std.algorithm;
import std.array;
import std.stdio;
import std.range;
pure auto huh( in uint[] digitArray, in uint value)
{
return find!( (a,b) => (a > b))( digitArray.retro, value);
}
unittest {
auto test = [11u, 1u, 1u, 10u];
auto s = huh( test, 10u);
writeln( s);
}
dmd -unittest -main doesnt_work.d && ./doesnt_work
/usr/include/dmd/phobos/std/algorithm.d(3508): Error: pure function 'doesnt_work.huh' cannot call impure function 'std.range.retro!(const(uint)[]).retro.Result.popFront'
/usr/include/dmd/phobos/std/algorithm.d(3510): Error: pure function 'doesnt_work.huh' cannot call impure function 'std.range.retro!(const(uint)[]).retro.Result.front'
doesnt_work.d(8): Error: template instance doesnt_work.huh.find!(__lambda3, Result, const(uint)) error instantiating
--
John Carter
Phone : (64)(3) 358 6639
Tait Electronics
PO Box 1645 Christchurch
New Zealand