コード例 #1
0
def test_chain():
    rl = chain(posdec, posdec)
    assert rl(5) == 3
    assert rl(1) == 0
コード例 #2
0
def bottom_up(rule, fns=basic_fns):
    """ Apply a rule down a tree running it on the bottom nodes first """
    return chain(lambda expr: sall(bottom_up(rule, fns), fns)(expr), rule)
コード例 #3
0
def top_down(rule, fns=basic_fns):
    """ Apply a rule down a tree running it on the top nodes first """
    return chain(rule, lambda expr: sall(top_down(rule, fns), fns)(expr))
コード例 #4
0
ファイル: test_core.py プロジェクト: AdrianPotter/sympy
def test_chain():
    rl = chain(posdec, posdec)
    assert rl(5) == 3
    assert rl(1) == 0