def test_programs(self):
    '\n        Checks the evaluation of programs\n        '
    p1 = BasicPrimitive('MAP')
    p2 = BasicPrimitive('MAP', type_=PolymorphicType(name='test'))
    self.assertTrue((repr(p1) == repr(p2)))
    self.assertTrue(p1.typeless_eq(p2))
    self.assertFalse(p1.__eq__(p2))
    self.assertFalse((id(p1) == id(p2)))
    t0 = PolymorphicType('t0')
    t1 = PolymorphicType('t1')
    semantics = {'+1': (lambda x: (x + 1)), 'MAP': (lambda f: (lambda l: list(map(f, l))))}
    primitive_types = {'+1': Arrow(INT, INT), 'MAP': Arrow(Arrow(t0, t1), Arrow(List(t0), List(t1)))}
    toy_DSL = DSL(semantics, primitive_types)
    p0 = Function(BasicPrimitive('+1'), [Variable(0)])
    env = (2, None)
    self.assertTrue((p0.eval(toy_DSL, env, 0) == 3))
    p1 = Function(BasicPrimitive('MAP'), [BasicPrimitive('+1'), Variable(0)])
    env = ([2, 4], None)
    self.assertTrue((p1.eval(toy_DSL, env, 0) == [3, 5]))
Checks the evaluation of programs
def test_programs(self):
    '\n        \n        '
    p1 = BasicPrimitive('MAP')
    p2 = BasicPrimitive('MAP', type_=PolymorphicType(name='test'))
    self.assertTrue((repr(p1) == repr(p2)))
    self.assertTrue(p1.typeless_eq(p2))
    self.assertFalse(p1.__eq__(p2))
    self.assertFalse((id(p1) == id(p2)))
    t0 = PolymorphicType('t0')
    t1 = PolymorphicType('t1')
    semantics = {'+1': (lambda x: (x + 1)), 'MAP': (lambda f: (lambda l: list(map(f, l))))}
    primitive_types = {'+1': Arrow(INT, INT), 'MAP': Arrow(Arrow(t0, t1), Arrow(List(t0), List(t1)))}
    toy_DSL = DSL(semantics, primitive_types)
    p0 = Function(BasicPrimitive('+1'), [Variable(0)])
    env = (2, None)
    self.assertTrue((p0.eval(toy_DSL, env, 0) == 3))
    p1 = Function(BasicPrimitive('MAP'), [BasicPrimitive('+1'), Variable(0)])
    env = ([2, 4], None)
    self.assertTrue((p1.eval(toy_DSL, env, 0) == [3, 5]))