On Tue, 10 Jul 2012 16:15:09 +0200, Jacob Carlborg <d...@me.com> wrote:
On 2012-07-10 14:53, Dmitry Olshansky wrote:
Too bad, as there is no need to make an array when you map something.
How do you store your ranges in a struct or class? Most of them are
voldemort types.
Well, there is std.range.inputRangeObject, but as the name indicates, it's
only an input range.
"
Iterates unique consecutive elements of the given range (functionality
akin to the uniq system utility). Equivalence of elements is assessed by
using the predicate pred, by default "a == b". If the given range is
bidirectional, uniq also yields a bidirectional range.
"
Though it doesn't explicitly mentions it, the example is:
Yes, exactly.
int[] arr = [ 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 ];
assert(equal(uniq(arr), [ 1, 2, 3, 4, 5 ][]));
How should I know that from the example?
You shouldn't. The description however, says 'unique consecutive elements',
which *does* explain it.
--
Simen