Process data lazily with D ranges and UFCS
8 steps · about 2 h 10 min · Intermediate
- Learn the input range interface (tutorial, DLang Tour, 12 min)
empty, front and popFront are all a type needs to be a range.
- Chain calls left to right with UFCS (tutorial, DLang Tour, 10 min)
Lets free functions read like methods in a pipeline.
- Combine map, filter and take in one pipeline (tutorial, DLang Tour, 15 min)
Runnable examples of lazy algorithms from Phobos.
- Write your own range type (tutorial, Programming in D (Ali Cehreli), 35 min)
Builds ranges step by step and explains forward, bidirectional and random-access kinds.
- Check range kinds with isInputRange and friends (reference, dlang.org, 10 min)
The traits you use to constrain templates that accept ranges.
- Stream a file with File.byLine (reference, dlang.org, 10 min)
Reads lines lazily so large files never sit in memory.
- Collect a range into an array only when needed (reference, dlang.org, 8 min)
array and appender end a lazy pipeline with real storage.
- Read a full component-programming walk-through (article, D Wiki, 30 min)
Shows a calendar printer built entirely from composed ranges.