May 17, 2008 pipe! | ||||
|---|---|---|---|---|
| ||||
I can do what I wanted with the new compiler.
string filename = "data.txt";
auto nums = pipe!(readText, split, map!(to!(uint)))(filename);
Like I write in my previous post. I think, Andrei has read it ^_^. It is even nicer than compose some times because order of application is left to right. This works to:
string filename = "data.txt";
auto nums = compose!(map!(to!(uint)), split, readText)(filename);
But is a bit hard to read because you read order right to left. It is good to have both functions.
There is a question. This does not work
auto nums = pipe!(readText, split, map!(to!(uint)))("data.txt");
with odd Error: slice a[] is not mutable.
What could happen? The file name should not change. Thank you, Dee Girl
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply