i see, maybe my example is too special.
What i meant is I have an array of elements and I have a binary operator 
which I want to apply to every adjacent elements.

On Saturday, February 7, 2015 at 7:26:55 AM UTC-5, Tamas Papp wrote:
>
> 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] <javascript:>> 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 
>

Reply via email to