@active Split(xs) begin
n = length(xs)
n%2==0 ?
(xs[begin:Int(n/2)], xs[Int(n/2+1):end]) :
(xs[begin:Int(floor(n/2))], xs[Int(ceil(n/2))], xs[Int(floor(n/2+1)):end])
end
@match [-2,-1,0,1,2] begin
Split(left, right) => [left, empty(left), right]
Split(left, mid, right) => [left, [mid], right]
end
Is this good style?
Is it possible to use [left..., mid, right...]
instead of Split(left, mid, right)
?