diff options
-rw-r--r-- | res/builtins.lisp | 5 | ||||
-rw-r--r-- | src/Builtins.kt | 5 | ||||
-rw-r--r-- | src/CoreBindings.kt | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/res/builtins.lisp b/res/builtins.lisp index 7bab9b4..4348e52 100644 --- a/res/builtins.lisp +++ b/res/builtins.lisp @@ -14,3 +14,8 @@ (defun noop () (return nil)) (export noop) +(comment "boolean atoms") +(def true :true) +(def false :false) +(export true false) + diff --git a/src/Builtins.kt b/src/Builtins.kt index 484ea3a..6ca60e9 100644 --- a/src/Builtins.kt +++ b/src/Builtins.kt @@ -9,8 +9,9 @@ object Builtins { ) { val stackFrame = lispExecutionContext.genBindings() stackFrame.setValueLocal("export", LispData.externalRawCall { context, callsite, stackFrame, args -> - val (name) = args - consumer((name as LispAst.Reference).label, context.resolveValue(stackFrame, name)) + args.forEach { name -> + consumer((name as LispAst.Reference).label, context.resolveValue(stackFrame, name)) + } return@externalRawCall LispData.LispNil }) lispExecutionContext.executeProgram(stackFrame, builtinProgram) diff --git a/src/CoreBindings.kt b/src/CoreBindings.kt index cf4fc50..f139e2e 100644 --- a/src/CoreBindings.kt +++ b/src/CoreBindings.kt @@ -1,7 +1,6 @@ package moe.nea.lisp object CoreBindings { - val nil = LispData.LispNil val def = LispData.externalRawCall { context, callsite, stackFrame, args -> if (args.size != 2) { return@externalRawCall context.reportError("Function define expects exactly two arguments", callsite) @@ -182,10 +181,8 @@ object CoreBindings { } fun offerAllTo(bindings: StackFrame) { - bindings.setValueLocal("true", trueValue) - bindings.setValueLocal("false", falseValue) bindings.setValueLocal("if", ifFun) - bindings.setValueLocal("nil", nil) + bindings.setValueLocal("nil", LispData.LispNil) bindings.setValueLocal("def", def) bindings.setValueLocal("pure", pure) bindings.setValueLocal("lambda", lambda) |