Discussion on: Everything You Need to Know About Array#reduce

worsnupd profile image
Daniel Worsnup Author

Just read about it. Ranges look really useful!

jessekphillips profile image
Jesse Phillips

It is funny because Ranges a close to c# LINQ or Java stream. D got to really build its algorithms around it (well technically many types of ranges).

Though coding with lazy evaluation can have its surprises when you're not always aware of the implications.

For example several grouping functions, like chunkBy, require the range to be sorted by the grouping. Sorting is eager, but grouping doesn't need to be. And you can group an unsorted range which could have value... Maybe.