Today's programming challenge - How's your Range-Fu ?
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 17 02:09:07 PDT 2015
Challenge level - Moderately easy
Consider the function std.string.wrap:
http://dlang.org/phobos/std_string.html#.wrap
It takes a string as input, and returns a GC allocated string that is
word-wrapped. It needs to be enhanced to:
1. Accept a ForwardRange as input.
2. Return a lazy ForwardRange that delivers the characters of the wrapped result
one by one on demand.
3. Not allocate any memory.
4. The element encoding type of the returned range must be the same as the
element encoding type of the input.
More information about the Digitalmars-d
mailing list