Range of n lines from stdin
Ali Çehreli
acehreli at yahoo.com
Fri Dec 27 09:57:14 PST 2013
On 12/27/2013 06:26 AM, Ivan Kazmenko wrote:
> n.iota.map!(_ => readln)
> to get the next n lines from stdin.
> So, what I ask for is some non-caching repeat for functions with side
> effects. More idiomatic than (1).
This request comes up once in a while.
> Is there something like that in Phobos?
As far as I know, no. Although, bearophile may have a bug report to
track the issue. :)
> Is it an OK style to have an impure function in an UFCS chain?
I don't think any different than side effects in other parts of the
language. In other words, side effects are a part of D. :)
Ali
More information about the Digitalmars-d-learn
mailing list