aboutsummaryrefslogtreecommitdiff
path: root/python/step2_eval.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/step2_eval.py')
-rw-r--r--python/step2_eval.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/step2_eval.py b/python/step2_eval.py
index e50d231..8af09b1 100644
--- a/python/step2_eval.py
+++ b/python/step2_eval.py
@@ -28,7 +28,7 @@ def eval_ast(ast, env):
return ast # primitive value, return unchanged
def EVAL(ast, env):
- #print("EVAL %s" % ast)
+ #print("EVAL %s" % printer._pr_str(ast))
if not types._list_Q(ast):
return eval_ast(ast, env)
@@ -48,8 +48,9 @@ def REP(str):
repl_env['+'] = lambda a,b: a+b
repl_env['-'] = lambda a,b: a-b
repl_env['*'] = lambda a,b: a*b
-repl_env['/'] = lambda a,b: a/b
+repl_env['/'] = lambda a,b: int(a/b)
+# repl loop
while True:
try:
line = mal_readline.readline("user> ")
@@ -58,4 +59,4 @@ while True:
print(REP(line))
except reader.Blank: continue
except Exception as e:
- print "".join(traceback.format_exception(*sys.exc_info()))
+ print("".join(traceback.format_exception(*sys.exc_info())))