Range of n lines from stdin

Marco Leise Marco.Leise at gmx.de
Fri Dec 27 19:24:29 PST 2013


Am Fri, 27 Dec 2013 20:34:02 +0000
schrieb "Ivan Kazmenko" <gassa at mail.ru>:

> Maybe the imperative should be "repeat is a function, and 
> arguments of functions should be evaluated only once"?  It does 
> make sense from a language point of view, but somewhat breaks the 
> abstraction for me.

The documentation is clear about it:

"Repeats one value forever."

It has nothing to do with purity, whether the input range is
lazy or the element is fetched eagerly. If it was meant to do
what you expected it would read:

"Constructs a range from lazily evaluating the expression
passed to it over and over."

This is not a limitation of the language either I think, since
arguments to functions can be declared "lazy".

-- 
Marco



More information about the Digitalmars-d-learn mailing list