Alternatively, you could define a generic consecutive function
function consecutive(f, A::AbstractVector)
[ f(A[i+1], A[i]) for i = 1:length(A)-1 ]
end
a = [ 2 , 4 , 8 , 16 , 32 ]
consecutive(-, a) # diff
consecutive(+, a)
consecutive(max, a)
consecutive((x,y)->(x+y)/2, a) #average
Note that the impetus for having such a function “built-in” in Julia is pretty low because writing an explicit comprehension or loop is easy and fast, and the impulse to use a consecutive(+, a) largely arises in Matlab-style vectorized code that is unnecessary (and usually awkward and suboptimal) in Julia.
Another generalization of this concept would be a convolution of a long sequence with a short sequence (in this case convolving A with [1,1], while diff corresponds to convolving with [1,-1]). This is nontrivial to implement extremely efficient code for in the general case of a length-m filter, so a mature library is helpful. Packages for this sort of thing include LocalFilters.jl and ImageFiltering.jl.