How to use filter!() for array type in julia?

845 Views Asked by At

If there is the F array in Julia as following

julia> F
5-element Array{Any,1}:
  6
 28
 30
 34
 49

and I want to reach this

F
1-element Array{Any,1}:
 Any[6, 28, 30, 34, 49]

this code is used

F[1]=vcat(F[1],F[2:end])

while true
    k=2;

    if length(F)==1
        break;
    end

    filter!(x->x≠F[k],F)

end

It works. would you please help me? Is it possible to don't use while? thanks very much

0

There are 0 best solutions below