What is the 'Result' type even for?

Basile B. b2.temp at gmx.com
Fri Jan 20 03:46:52 UTC 2023


On Friday, 20 January 2023 at 03:11:33 UTC, Ruby The Roobster 
wrote:
> Take this example:
> [...]
> What is the purpose of this 'Result' type?  To serve as a 
> generic range?

Yes this is a lazy input range. Use `.array` to yield directly as 
a concrete value,
then you can append using `~=`.

Note that there are special functions to keep the laziness, e.g 
`chain` to happen an input range to another element-compatible 
input range

```
import std;
void main()
{
     auto c = "a|b|c|d|e".splitter("|").chain(["f"]);
     string[] e = ["a", "b", "c", "d", "e", "f"];
     assert(c.equal(e));
}
```


More information about the Digitalmars-d-learn mailing list