Removing polytypes; some pylint hints.
This commit is contained in:
parent
7607ca7650
commit
8ad4ab791b
|
|
@ -155,6 +155,7 @@ def yin_functions():
|
||||||
can be defined completely by their stack effects. This means they
|
can be defined completely by their stack effects. This means they
|
||||||
can be auto-compiled.
|
can be auto-compiled.
|
||||||
'''
|
'''
|
||||||
|
# pylint: disable=unused-variable
|
||||||
cons = ef(a1, s0)((a1, s0))
|
cons = ef(a1, s0)((a1, s0))
|
||||||
ccons = compose(cons, cons)
|
ccons = compose(cons, cons)
|
||||||
dup = ef(a1)(a1, a1)
|
dup = ef(a1)(a1, a1)
|
||||||
|
|
@ -341,7 +342,7 @@ class DefinitionWrapper(object):
|
||||||
|
|
||||||
def __call__(self, stack, expression, dictionary):
|
def __call__(self, stack, expression, dictionary):
|
||||||
if self._compiled:
|
if self._compiled:
|
||||||
return self._compiled(stack, expression, dictionary)
|
return self._compiled(stack, expression, dictionary) # pylint: disable=E1102
|
||||||
expression = list_to_stack(self._body, expression)
|
expression = list_to_stack(self._body, expression)
|
||||||
return stack, expression, dictionary
|
return stack, expression, dictionary
|
||||||
|
|
||||||
|
|
@ -1088,11 +1089,13 @@ def map_(S, expression, dictionary):
|
||||||
|
|
||||||
|
|
||||||
def branch_true(stack, expression, dictionary):
|
def branch_true(stack, expression, dictionary):
|
||||||
|
# pylint: disable=unused-variable
|
||||||
(then, (else_, (flag, stack))) = stack
|
(then, (else_, (flag, stack))) = stack
|
||||||
return stack, concat(then, expression), dictionary
|
return stack, concat(then, expression), dictionary
|
||||||
|
|
||||||
|
|
||||||
def branch_false(stack, expression, dictionary):
|
def branch_false(stack, expression, dictionary):
|
||||||
|
# pylint: disable=unused-variable
|
||||||
(then, (else_, (flag, stack))) = stack
|
(then, (else_, (flag, stack))) = stack
|
||||||
return stack, concat(else_, expression), dictionary
|
return stack, concat(else_, expression), dictionary
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
# -*- coding: utf_8
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pop = FUNCTIONS['pop']
|
|
||||||
|
|
||||||
def loop_true(stack, expression, dictionary):
|
|
||||||
quote, (flag, stack) = stack
|
|
||||||
return stack, CONCAT(quote, (pop, expression)), dictionary
|
|
||||||
|
|
||||||
def loop_two_true(stack, expression, dictionary):
|
|
||||||
quote, (flag, stack) = stack
|
|
||||||
return stack, CONCAT(quote, (pop, CONCAT(quote, (pop, expression)))), dictionary
|
|
||||||
|
|
||||||
def loop_false(stack, expression, dictionary):
|
|
||||||
quote, (flag, stack) = stack
|
|
||||||
return stack, expression, dictionary
|
|
||||||
|
|
||||||
FUNCTIONS['loop'] = CombinatorJoyType('loop', [loop_two_true, loop_true, loop_false], 101)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# joy.library.add_aliases(FUNCTIONS, joy.library.ALIASES)
|
|
||||||
|
|
||||||
|
|
||||||
# def set_expectations_of_definition(cjt):
|
|
||||||
# if len(cjt.stack_effects) != 1:
|
|
||||||
# raise ValueError
|
|
||||||
# defi = cjt.stack_effects[0]
|
|
||||||
# if not isinstance(defi, joy.library.DefinitionWrapper):
|
|
||||||
# raise ValueError
|
|
||||||
# F = infer_expression(defi.body)
|
|
||||||
# assert len(F) == 1, repr(F)
|
|
||||||
# fi, fo = F[0]
|
|
||||||
# cjt.expect = fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
average =
|
|
||||||
loop.expect = s6, (b1, s5)
|
|
||||||
disenstacken.expect = (As[1], s1), s0
|
|
||||||
joy.library._dictionary['disenstacken'],
|
|
||||||
|
|
||||||
|
|
||||||
# scope = globals().copy()
|
|
||||||
# scope.update(FUNCTIONS)
|
|
||||||
# eval(set_expectations.func_code, scope)
|
|
||||||
# del scope
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue