예제 #1
0
from ramda.curry import curry
"""This functions takes two list and applies given function to it"""
zip_with = curry(lambda f, xs1, xs2: [f(x, y) for x, y in zip(xs1, xs2)])
예제 #2
0
from ramda.curry import curry
"""This functions takes cross product of two list"""

xprod = curry(lambda xs1, xs2: [[x, y] for y in xs2 for x in xs1])
예제 #3
0
from ramda.curry import curry
"""This functions applies function at given index"""
update = curry(
    lambda i, v, xs: [v if i == ind else x for ind, x in enumerate(xs)])
예제 #4
0
from ramda.curry import curry

equals = curry(lambda x, y: x == y)
예제 #5
0
from ramda.curry import curry

"""This functions takes two list and creates a dictionary with it"""
zip_obj = curry(lambda key, val: dict(zip(key, val)))
예제 #6
0
파일: map.py 프로젝트: slavaGanzin/pyramda
from ramda.curry import curry

map = curry(lambda f, xs: [f(x) for x in xs])
예제 #7
0
from ramda.curry import curry
import builtins

isinstance = curry(lambda type, v: builtins.isinstance(v, type))
예제 #8
0
from ramda.curry import curry

"""Returns a new list without values in the first argument"""

a = [1, 2]
b = [1, 2, 1, 3, 4]

without = curry(lambda xs1, xs2: [x for x in xs2 if x not in xs1])
예제 #9
0
from ramda.curry import curry
import re

replace = curry(re.sub)
예제 #10
0
from ramda.curry import curry

getitem = curry(lambda key, collection: collection[key])
예제 #11
0
from ramda.curry import curry


filter = curry(lambda p, xs: [x for x in xs if p(x)])