Пример #1
0
def test_list_map_polymorphic_2(c, xs, ys):
    def square(x):
        return x * x

    def double(x):
        return x + x

    if c:
        f = square
    else:
        f = double

    return list_map(f, xs), list_map(f, ys)
Пример #2
0
def test_list_map0():
    def f():
        return 1234

    return list_map(f)
Пример #3
0
def test_list_map2(xs, ys):
    def mulm(x, y):
        return x * -y

    return list_map(mulm, xs, ys)
Пример #4
0
def test_list_map(xs, ys):
    def square(x):
        return x * x

    return list_map(square, xs), list_map(square, ys)
Пример #5
0
def test_list_map_polymorphic(xs, ys):
    def square(x):
        return x * x

    return list_map(square, xs), list_map(square, ys)
Пример #6
0
    def f3(xs):
        def f(pt):
            return pt.x + pt.y

        return list_map(f, xs)