diff --git a/.github/demo.png b/.github/demo.png new file mode 100644 index 0000000..e5b6eb9 Binary files /dev/null and b/.github/demo.png differ diff --git a/README.md b/README.md index aeb7ae7..dfa2c4c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ +![./demo](.github/demo.png) + # Install 1. `opam install . --deps-only` diff --git a/lib/eval/eval.ml b/lib/eval/eval.ml index c19e3d5..a6f306a 100644 --- a/lib/eval/eval.ml +++ b/lib/eval/eval.ml @@ -80,7 +80,9 @@ let rec eval_expr expr env = and eval_apply fn_expr args env = match fn_expr with | Object.Primitive (_, fn) -> fn args - | Object.Closure (_, names, expr, clenv) -> + | Object.Closure (fn_name, names, expr, clenv) -> + (* Check if the closure exists *) + Object.lookup (fn_name, env) |> ignore; eval_closure names expr args clenv env | fn_expr -> raise (Errors.Parse_error_exn (Apply_error (Object.string_object fn_expr))) diff --git a/test/end_normal_test.mlisp b/test/end_normal_test.mlisp index d57f27f..1bb24dc 100644 --- a/test/end_normal_test.mlisp +++ b/test/end_normal_test.mlisp @@ -76,4 +76,4 @@ (letrec ((f (lambda (x) (g (+ x 1)))) (g (lambda (x) (+ x 3)))) - (f 0)) + (f 0)) \ No newline at end of file