Implemented clear and compact for array