Problem with UFCS

Michael pongad at gmail.com
Tue Oct 16 09:12:05 PDT 2012


Hello!
   I have been using D for a while, but only recently paid 
attention to UFCS. For some reason, I can't convince my code to 
compile properly:

void main() {
	import std.range, std.stdio;
	
	auto sqrs = sequence!((a,n) => n*n)(0);
	auto fibs = recurrence!((a,n) => a[n-1]+a[n-2])(1, 1);
	foreach (v; zip(sqrs, fibs).take(10)) writeln(v);
}

The compiler complains about "undefined identifier 'take'". If I 
rewrite the last line to "take(zip(sqrts, fibs), 10)", the 
problem compiles just fine. Is this a compiler bug, or am I 
missing something obvious? I'm using dmd 2.060 on Windows 7.

Thanks,
Michael


More information about the Digitalmars-d-learn mailing list