On 07/11/2016 11:31 AM, Ali Çehreli wrote:
     // Another one that combines multiple range algorithms
     import std.range : iota;
     import std.algorithm : map;
     assert(7.iota.map!(i => i % 2 ? '=' : '-').equal("-=-=-=-"));

An alternative without those scary modulo and ternary operators, just because I think it's cute:

import std.range: repeat, roundRobin, take;
import std.algorithm: equal;
assert(roundRobin(repeat('-'), repeat('=')).take(7).equal("-=-=-=-"));

Reply via email to