Функциональное программирование

map, filter, group, reduce, sort, uniq, join, zip, chunks

import std.algorithm;
import std.string;
import std.typecons;
import std.array;
import std.range;


[1, 2, 3].map!(a => a + 1);

[3, 2, 1].reduce!min;

["hello", "world"].filter!(a => a.indexOf("wo") >= 0).count;

[1, 3, 2].sort!"a > b";

"1 3 2".splitter().map!(to!int);

[1, 3, 2, 2, 3].sort().uniq.count;

[1, 2, 3, 4].chunks(2).map!(sum);

"ABCA".array.sort().group.array;

auto arr = "AGCGA".array;
auto result = arr.zip(arr.save.dropOne)
                 .map!"a.expand.only"
                 .map!(to!string)
                 .join(",");


[3, 4, 5].enumerate.filter!(a => a[0] != 1).map!"a[1]";

results for ""

    No results matching ""