from pyramda.function.curry import curry
from . import filter


@curry
def reject(p, xs):
    """
    Acts as a complement  of `filter`

    :param p: predicate
    :param xs: Iterable. A sequence, a container which supports iteration or an iterator
    :return: list
    """
    return list(set(xs) - set(filter(p, xs)))

from pyramda.function.curry import curry
from pyramda.logic import complement
from . import filter


@curry
def reject(p, xs):
    """
    Acts as a complement  of `filter`

    :param p: predicate
    :param xs: Iterable. A sequence, a container which supports iteration or an iterator
    :return: list
    """
    return filter(complement(p), xs)

Refactor to use pyramdas complement function. The initial set implementaion did not respect the order of elements and removed duplicates
Refactor to use pyramdas complement function. The initial set implementaion did not respect the order of elements and removed duplicates

  from pyramda.function.curry import curry
+ from pyramda.logic import complement
  from . import filter
  
  
  @curry
  def reject(p, xs):
      """
      Acts as a complement  of `filter`
  
      :param p: predicate
      :param xs: Iterable. A sequence, a container which supports iteration or an iterator
      :return: list
      """
-     return list(set(xs) - set(filter(p, xs)))
+     return filter(complement(p), xs)
  
Refactor to use pyramdas complement function. The initial set implementaion did not respect the order of elements and removed duplicates
## Code Before:
from pyramda.function.curry import curry
from . import filter


@curry
def reject(p, xs):
    """
    Acts as a complement  of `filter`

    :param p: predicate
    :param xs: Iterable. A sequence, a container which supports iteration or an iterator
    :return: list
    """
    return list(set(xs) - set(filter(p, xs)))

## Instruction:
Refactor to use pyramdas complement function. The initial set implementaion did not respect the order of elements and removed duplicates
## Code After:
from pyramda.function.curry import curry
from pyramda.logic import complement
from . import filter


@curry
def reject(p, xs):
    """
    Acts as a complement  of `filter`

    :param p: predicate
    :param xs: Iterable. A sequence, a container which supports iteration or an iterator
    :return: list
    """
    return filter(complement(p), xs)
