I am doing some kind of recursion, where I calculate left and right sides of array. I have working code, but wonder if this could be written more concisely. Here is code:
left = calculate(x[0])
right = calculate(x[1])
a = Array.new(0)
a << left
a << right
self(a)
Try this
If x has only two elements, you can omit
[0..1].