sl: use the RETURN_IF_COMPARED macro

... in order to eliminate duplicated code
sl/id_mapper: implement pretty print for debugging
sl/cont_shape: eliminated duplicates in appendImpliedShapes()