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)
def simplify(code): """Linearly beta-eta reduce.""" LOG.info('simplify({})'.format(pretty(code))) return _reduce(code, False)
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)