def removeDuplicates(A): p = if_duplicate() next(p) return list_inplace_remove(A, p.send)
def removeElement(A, elem): return list_inplace_remove(A, lambda x: x == elem)