adds def
This commit is contained in:
parent
88bf708ed2
commit
530bd1a2d9
@ -34,6 +34,10 @@ function Lisp (input, lib) {
|
||||
|
||||
return interpret(input[2], letContext)
|
||||
},
|
||||
def: function (input, context) {
|
||||
context.scope[input[1].value] = input[2].value
|
||||
return input[2]
|
||||
},
|
||||
lambda: function (input, context) {
|
||||
return function () {
|
||||
const lambdaArguments = arguments
|
||||
|
@ -37,4 +37,9 @@
|
||||
(test "range simple" (range 0 4) (0 1 2 3 4))
|
||||
(test "range with step" (range 0 4 2) (0 2 4))
|
||||
(test "range with negative step" (range 0 -4 -1) (0 -1 -2 -3 -4))
|
||||
|
||||
; Scope
|
||||
|
||||
(def aaa 123)
|
||||
(test "def" aaa 123)
|
||||
)
|
3
examples/include.lisp
Normal file
3
examples/include.lisp
Normal file
@ -0,0 +1,3 @@
|
||||
(
|
||||
(def value 12)
|
||||
)
|
1
examples/run.lisp
Normal file
1
examples/run.lisp
Normal file
@ -0,0 +1 @@
|
||||
(run "./include.lisp")
|
Loading…
x
Reference in New Issue
Block a user