From e4661bf1fecf5a214a020a56b9658dc49565e162 Mon Sep 17 00:00:00 2001 From: nea Date: Thu, 10 Aug 2023 02:05:19 +0200 Subject: Add more true/false builtins --- src/Builtins.kt | 5 +++-- src/CoreBindings.kt | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') 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) -- cgit