== Quote from bearophile ([email protected])'s article
> Since many years and many versions of Python the pythonic way to write that
> is to use a lazy iterable:
> def sumOfSquares (sequence):
> return sum(item * item for item in sequence)
> I have suggested few times a list/lazy comp syntax for D too, and I have
> tried to explain why it's a
good thing (it helps "chunking" in the mind of the programmer).
Out of curiosity, what syntax did you propose? I definitely agree that lazy
range comprehensions would
be a Good Thing (tm).
That said, the current D way of writing it isn't all that different from Python:
return reduce!("a+b")(map!("a*a")(sequence), 0);