More compact to write:
@views adjsum(a) = a[begin:end-1] + a[begin+1:end]
Using the @views macro you can opt-in to views for slices for a whole function at once.
More compact to write:
@views adjsum(a) = a[begin:end-1] + a[begin+1:end]
Using the @views macro you can opt-in to views for slices for a whole function at once.