One should post a new answer if both answers can stand independently and both answers contribute distinct ideas (i.e. it is valuable to have both). One should use editing to improve an answer without changing its basic content - including to build upon an idea, to rewrite things more clearly, to simplify arguments, and other similar tasks.
On the main site, this tends to play out as saying that if you find simplifications (or errors) in a proof in an answer or you find a way to build upon a proof, you should probably edit those in even if the result is that not many of the words of the original answer survive. In the opposite direction, if you post an answer using Fourier analysis and later discover a way to do it via a combinatorial argument, you should create a new answer - even if you feel that the new answer is superior to the old one.
Mostly, I suggest this because it often is the case that having both answers is better than having just one. The system of sorting answers via up/downvoting also tends to assume that answers don't change too fundamentally.
In the given case, I think your old answer contributed something valuable: it showed how to use the
array environment in a simple way to accomplish the given effect - and this is something I believe would be useful to maintain, especially since people may be more likely to use
array than to search meta for some specific macro definitions. Your new answer builds upon this original, showing how to encapsulate this basic idea with macros. In my opinion, the best choice in the given situation is to keep most of the original answer and then additionally include the refinement - my inclination here would be to just take the old answer and include it at the start or the end of the new one (possibly separated by a horizontal line), although there are surely more elegant ways to ensure that no value is lost in the edit (e.g. one could write it more as "here's the basic idea and here's a more advanced extension" or "here's a working system and here's how it works" - but such solutions can take some work to write and aren't strictly necessary).