I want to make a list comprehension for 1 <= i < j <= 4. It can be done 
with a for loop like this:

l = []
for i in 1:4, j in i+1:4
    push!(l, (i,j))
end

In python a list comprehension can be made like this

l = [(i, j) for i in range(1, 5) for j in range(i+1, 5)]

But this Julia code gives an error, saying i is not defined:

l = [(i,j) for i in 1:4, j in i+1:4]

Is there another approach? I feel like 4 lines to do this is excessive

Reply via email to