diff([1, 2, 4, 7, 8]) I don't think it gets more beautiful than this :D
Best, Tamas On Sat, Feb 07 2015, Evan Pu <[email protected]> wrote: > say I want to compute a pair-wise diff for all the elements in the array. > input: [1, 2, 4, 7, 8] > output: [1, 2, 3, 1] > > is there some kind of "beautiful" way of doing it? i.e. w/o using a for > loop nor using explicit indecies
