4 ms·
Hands down, it's D's shorthand array operations. int[] a = [1, 2, 3]; int[] b = a[] * 3; assert(b == [3, 6, 9]); a[] += 2; assert(a == [3,
by EvenThisAcronym 8y ago
Hands down, it's D's shorthand array operations.
int[] a = [1, 2, 3];
int[] b = a[] * 3;
assert(b == [3, 6, 9]);
a[] += 2;
assert(a == [3, 4, 5]);
int[] c = a[] + b[];
assert(c == [6, 10, 14]);
This of course works with D's slicing syntax so you can do stuff like a[0..1] *= 3.