I take it you want to write this in LISP yourself since this is the lisp forum, you are not looking for a ready made solution like the one built into AutoCAD?
With lines, I guess all you need to do is get the start and end point, erase the line, then make a new line in the reverse order. Arcs only go CCW anyway. With polylines, it's essentially the same as lines, but there are probably dozens of things to complicate the matter, including arcs, tangents, widths, whether it's a LWpoly or 3Dpoly, whether it's closed, etc.