def test_switch2(c, x, y): fn = switch( c, partial(scalar_sub, x), partial(scalar_add, x) ) return fn(y)
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)
def f(x): return partial(P.make_record, Point, x)
def f2(x, y): return partial(P.make_record, Point, x)(y)
def gradbad10(x, y): return grad(partial(f, x))(y)
def g(x): z = x * x return partial(f, z)
def test_partial_polymorphic(x, y): def f(a, b): return a + b return partial(f, x)(x), partial(f, y)(y)
def before(x, y): return partial(f, x)(y)
def test_partial_prim(x, y): return partial(scalar_add, x)(y)