Is there an elegant way of making a Result eager instead of lazy?

ixid nuaccount at gmail.com
Tue Mar 20 10:36:46 PDT 2012


I understand the point of lazy evaluation but I often want to use 
the lazy algorithm library functions in an eager way. Other than 
looping through them all which feels rather messy is there a good 
way of doing this?

Is there a reason not to allow the following to be automatically 
treated eagerly or is there some kind of cast or conv way of 
doing it?

	int[] test1 = [1,2,3,4];
	int[] test2 = map!("a + a")(test1); //Eager, not allowed

	auto test3 = map!("a + a")(test1); //Lazy


More information about the Digitalmars-d-learn mailing list