I was prototyping:

julia> a=[1,2,3,1,2]

julia> b=[a[i]<a[i+1] for i in 1:length(a)-1]
4-element Array{Bool,1}:

In the beginning when trying stuff out I used:

for i in a[1:end-1]


for i in a[2:end]

and it got me thinking, end-1 works for any kind of array, but 1 as the 
start (or 2) is not correct in general. For e.g. general (e.g. zero-based 
arrays now allowed), what do you do? [If I need all: for i in a just works]

In the beginning, because of error, there seemed to be no bounds checking, 
but since it's there, is there a way do disable?

julia> b=[@inbounds a[i]<a[i+1] for i in 1:length(a)-1]
4-element Array{Void,1}:

julia> b=[(@inbounds (a[i]<a[i+1]) for i in 1:length(a)-1)]
1-element Array{Base.Generator{UnitRange{Int64},##59#60},1}:

Eventually I want something different, the points where, increasing turn to 
decreasing (or vice versa), at most n/2 points. Array comprehension is 
probably not the right way, as I need to know how many point.

I'll change to a loop (that will be itself in a loop), that uses a 
preallocated array for result, I want to reuse that in each iteration of 
the outer loop; I assume that isn't possible with an array comprehension.

Reply via email to