diff --git a/desktop/sources/scripts/lisp.js b/desktop/sources/scripts/lisp.js index 56eec45..4132d41 100644 --- a/desktop/sources/scripts/lisp.js +++ b/desktop/sources/scripts/lisp.js @@ -35,7 +35,7 @@ function Lisp (input, lib) { return interpret(input[2], letContext) }, def: function (input, context) { - context.scope[input[1].value] = input[2].value + context.scope[input[1].value] = interpret(input[2], context) return input[2] }, lambda: function (input, context) { diff --git a/examples/benchmark.lisp b/examples/benchmark.lisp index 5b6abcc..75f3d77 100644 --- a/examples/benchmark.lisp +++ b/examples/benchmark.lisp @@ -41,5 +41,7 @@ ; Scope (def aaa 123) - (test "def" aaa 123) + (def addOne (lambda (a) (add a 1))) + (test "def - value" aaa 123) + (test "def - func" (addOne 4) 5) ) \ No newline at end of file diff --git a/examples/include.lisp b/examples/include.lisp index ae2231f..f063b40 100644 --- a/examples/include.lisp +++ b/examples/include.lisp @@ -1,3 +1,4 @@ ( (def value 12) + (def addOne (lambda (a) (add a 1))) ) \ No newline at end of file diff --git a/examples/run.lisp b/examples/run.lisp index 84dc6ee..1d01a28 100644 --- a/examples/run.lisp +++ b/examples/run.lisp @@ -1 +1,7 @@ -(run "./include.lisp") \ No newline at end of file +( + (run "./include.lisp") + + (echo value) + + (echo (addOne value)) +) \ No newline at end of file