summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-08-10 02:05:19 +0200
committernea <nea@nea.moe>2023-08-10 02:05:19 +0200
commite4661bf1fecf5a214a020a56b9658dc49565e162 (patch)
tree524d4a5b3774e31c88dbdfa8259f2522457f1696 /src
parent74371302593ee2ee365e697911c364246f460b63 (diff)
downloadnealisp-e4661bf1fecf5a214a020a56b9658dc49565e162.tar.gz
nealisp-e4661bf1fecf5a214a020a56b9658dc49565e162.tar.bz2
nealisp-e4661bf1fecf5a214a020a56b9658dc49565e162.zip
Add more true/false builtins
Diffstat (limited to 'src')
-rw-r--r--src/Builtins.kt5
-rw-r--r--src/CoreBindings.kt5
2 files changed, 4 insertions, 6 deletions
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)