Beispiel #1
0
def test_switch2(c, x, y):
    fn = switch(
        c,
        partial(scalar_sub, x),
        partial(scalar_add, x)
    )
    return fn(y)
Beispiel #2
0
def test_array_map_partial(c, xs):
    def square(x):
        return x * x

    def identity(x):
        return x

    if c < 0:
        fn = partial(array_map, square)
    else:
        fn = identity
    return fn(xs)
Beispiel #3
0
 def f(x):
     return partial(P.make_record, Point, x)
Beispiel #4
0
 def f2(x, y):
     return partial(P.make_record, Point, x)(y)
Beispiel #5
0
 def gradbad10(x, y):
     return grad(partial(f, x))(y)
Beispiel #6
0
 def g(x):
     z = x * x
     return partial(f, z)
Beispiel #7
0
def test_partial_polymorphic(x, y):
    def f(a, b):
        return a + b

    return partial(f, x)(x), partial(f, y)(y)
Beispiel #8
0
 def before(x, y):
     return partial(f, x)(y)
Beispiel #9
0
def test_partial_prim(x, y):
    return partial(scalar_add, x)(y)