projections in D

2014-11-24 Thread Ramon via Digitalmars-d-learn
what range/algorithm allows me to make projections from one sequence to another? that is, in C#, this is the Select method (http://msdn.microsoft.com/en-us/library/vstudio/bb548891%28v=vs.100%29.aspx) example in C#: class ProjectionWanted { public int field1 { get; set; } public int

Re: projections in D

2014-11-24 Thread bearophile via Digitalmars-d-learn
Ramon: example in C#: class ProjectionWanted { public int field1 { get; set; } public int field2 { get; set; } public int field3 { get; set; } } void Foo(ListProjectionWanted list) { var list_projected = list.Select(l = new { l.field1, l.field2 }); // list_projected elements now

Re: projections in D

2014-11-24 Thread Ramon via Digitalmars-d-learn
What is the difference between lazy and eager ranges? (I guess, the lazy one has not yet queried the elements)

Re: projections in D

2014-11-24 Thread bearophile via Digitalmars-d-learn
On Monday, 24 November 2014 at 15:44:02 UTC, Ramon wrote: What is the difference between lazy and eager ranges? (I guess, the lazy one has not yet queried the elements) The lazy returns a range that once iterated gives the results one at a time (so the function allocates no heap memory).