Actually I'm rather using the followig function allowing to remove several
lines.
function removeLines(poly::Poly, indices::BitArray{1})
for op = (:a, :b, :x1, :y1, :x2, :y2, :typ)
@eval $poly.$op = ($poly.$op)[!$indices]
end
end
function removeLines2(poly::Poly, indices::BitArray{1})
for op = (:a, :b, :x1, :y1, :x2, :y2, :typ)
poly.(op) = (poly.(op))[!indices]
end
end
Le jeudi 8 mai 2014 21:04:52 UTC+2, Stéphane Laurent a écrit :
>
> Cool, thank you Jameson.
>
> So what is the best choice between these two possibilities :
>
> function removeLine(poly::Poly, index::Int)
>
> for op = (:a, :b, :x1, :y1, :x2, :y2, :typ)
>
> @eval splice!($poly.$op, $index)
>
> end
>
> end
>
>
> function removeLine2(poly::Poly, index::Int)
>
> for op = (:a, :b, :x1, :y1, :x2, :y2, :typ)
>
> splice!(getfield(poly, op), index)
>
> end
>
> end
>
>