On 10/12/2014 08:04 AM, yawniek wrote:
i found two snippets from the functional docs that do not work (anymore?)
http://dlang.org/phobos/std_functional.html


assert(compose!(map!(to!(int)), split)("1 2 3") == [1, 2, 3]);
and
int[] a = pipe!(readText, split, map!(to!(int)))("file.txt");

throwing a std.array.array into the mix works fine.

did this use to work? is there any other way of doing it?

The proper way is to call std.algorithm.equal, which compares ranges element-by-element:

    assert(compose!(map!(to!(int)), split)("1 2 3").equal([1, 2, 3]));

Ali

Reply via email to