예제 #1
0
def sample(code, budget=0):
    """Beta-eta sample code, ignoring budget."""
    assert isinstance(budget, int) and budget >= 0, budget
    LOG.info('sample({})'.format(pretty(code)))
    head = code
    context = EMPTY_CONTEXT
    for continuation in _sample_nonlinear(head, context):
        yield _close(continuation, nonlinear=True)
예제 #2
0
def simplify(code):
    """Linearly beta-eta reduce."""
    LOG.info('simplify({})'.format(pretty(code)))
    return _reduce(code, False)
예제 #3
0
def reduce(code, budget=0):
    """Beta-eta reduce code, ignoring budget."""
    assert isinstance(budget, int) and budget >= 0, budget
    LOG.info('reduce({})'.format(pretty(code)))
    return _reduce(code, True)