As you point out, there are several ways to do this. First, consider the approach of the find()
function, and then consider the approach to understanding a list.
x = [6, 7, 8] y = [1, 1, 0] xsucc = x[find(y .== 1)] xfail = x[find(y .== 0)]
To approach the list comprehension, we can do something like the following.
x = [6, 7, 8] y = [1, 1, 0] xsucc = [w for w in x[y .== 1]] xfail = [w for w in x[y .== 0]]
Of these, I'm not sure what is considered Julia's most idiomatic code (perhaps not).
source share