Ultra-pure map()?

Ali Çehreli acehreli at yahoo.com
Sun Dec 29 14:15:28 PST 2013


On 12/29/2013 02:11 PM, David Held wrote:> On 12/28/2013 5:13 AM, Timon 
Gehr wrote:
 >> [...]
 >> I wouldn't call this an 'eager map'. It's a shallow wrapper around a
 >> foreach loop.
 >
 > The point being that foreach loops aren't composable.

Agreed. However, if they were composable they would have to be at the 
end of the chain because when they don't produce a range, no other 
function can be added after them.

If we imagine a foreach that produces a range, then it becomes map.

 >
 > Dave
 >

Ali



More information about the Digitalmars-d-learn mailing list