import std.array : array; assertEqual( [1,1,1,1].uniquer.array, [1] ); assertEqual( [1].uniquer.array, [1] ); assertEqual( "".uniquer.array, [] ); assertEqual( [1,2,1,3].uniquer.array, [1,2,3] ); assertEqual( [1,2,1,3,1,2].uniquer.array, [1,2,3] ); assertEqual( [1,2,3].uniquer.array, [1,2,3] ); assertEqual( ["a","b","a","c","a","c"].uniquer.array, ["a","b","c"] ); import std.typecons : tuple; assertEqual( [tuple(1,"a"),tuple(1,"b"),tuple(2,"b"),tuple(1,"b")] .uniquer.array, [tuple(1,"a"),tuple(1,"b"),tuple(2,"b")] );
Lazily iterate over range and returning only uniques