Function to clear a list.