What is the 'Result' type even for?

H. S. Teoh hsteoh at qfbox.info
Fri Jan 20 03:39:48 UTC 2023


On Fri, Jan 20, 2023 at 03:34:43AM +0000, Ruby The Roobster via Digitalmars-d-learn wrote:
> On Friday, 20 January 2023 at 03:30:56 UTC, Steven Schveighoffer wrote:
> > On 1/19/23 10:11 PM, Ruby The Roobster wrote:
> > ...
> > 
> > The point is to be a range over the original input, evaluated
> > lazily. Using this building block, you can create an array, or use
> > some other algorithm, or whatever you want. All without allocating
> > more space to hold an array.
[...]
> I get the point that it is supposed to be lazy.  But why are these
> basic cases not implemented?  I shouldn't have to go write a wrapper
> for something as simple as casting this type to the original type.
> This is one of the things that one expects the standard library to do
> for you.

There's no need to write any wrappers.  Just tack `.array` to the end of
your pipeline, and you're good to go.


T

-- 
My father told me I wasn't at all afraid of hard work. I could lie down right next to it and go to sleep. -- Walter Bright


More information about the Digitalmars-d-learn mailing list