D component programming is a joke (Was: Re: Component programming)

David Nadlinger code at klickverbot.at
Sat Aug 3 06:46:36 PDT 2013


On Saturday, 3 August 2013 at 13:35:56 UTC, Andre Artus wrote:
> import std.stdio;
> import std.algorithm;
> void main()
> {
>   auto values = [ 1, 2, 3, 4, 5 ];
>   writeln(values
>     .map!(a => a * 10)
>     .map!(a => a / 3)
>     .filter!(a => !(a % 2)));
> }
>
> As stated this implies 3 separate traversals of the list (or 
> array to be specific) which is what a naïve implementation 
> would do.

In this example, no, as all involved ranges are evaluated lazily. 
(I see your general point, though.)

David


More information about the Digitalmars-d mailing list