map with void fun

cal callumenator at gmail.com
Sat Apr 6 14:56:10 PDT 2013


On Saturday, 6 April 2013 at 21:40:37 UTC, bearophile wrote:
> First, to see the side effects you have also to call front:

Ah thank you, I did not realize a call to front was required.

> But this is wrong still. map() is a higher order function, it's 
> meant to take a function and an iterable and produce a new lazy 
> iterable that contains the ordered results of applying the 
> given function on each item. writeln() returns nothing (void, 
> it's a type with just one value, void itself).

Yes, I understand, the example was just a reduced bit of code.

Thanks again


More information about the Digitalmars-d-learn mailing list