plsql: add dockerfile. Lots of cleanup/renaming.
[jackhill/mal.git] / nim / step3_env.nim
index 98438fe..43f8581 100644 (file)
@@ -22,6 +22,7 @@ proc eval_ast(ast: MalType, env: var Env): MalType =
 proc eval(ast: MalType, env: var Env): MalType =
   case ast.kind
   of List:
+    if ast.list.len == 0: return ast
     let
       a0 = ast.list[0]
       a1 = ast.list[1]
@@ -41,7 +42,7 @@ proc eval(ast: MalType, env: var Env): MalType =
       result = a2.eval(letEnv)
     else:
       let el = ast.eval_ast(env)
-      result = el.list[0].fun(el.list[1 .. -1])
+      result = el.list[0].fun(el.list[1 .. ^1])
   else:
     result = ast.eval_ast(env)