aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/builtins.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/builtins.c b/src/builtins.c
index a189060..a659171 100644
--- a/src/builtins.c
+++ b/src/builtins.c
@@ -556,6 +556,7 @@ void dip(value_t *v) {
array_append(STACK, v1);
}
+/* 3 4 4 [ + ] keep */
void keep(value_t *v) {
value_t *v2 = array_pop(STACK);
if (v2 == NULL) {
@@ -569,17 +570,16 @@ void keep(value_t *v) {
return;
}
- array_append(STACK, value_copy(v1));
- if (v1->type == VQUOTE) {
- array_append(EVAL_STACK, v1);
- for (int i = 0; i < v1->quote->size; i++) {
- eval(value_copy(v1->quote->items[i]));
+ if (v2->type == VQUOTE) {
+ array_append(EVAL_STACK, v2);
+ for (int i = 0; i < v2->quote->size; i++) {
+ eval(value_copy(v2->quote->items[i]));
}
value_free(array_pop(EVAL_STACK));
} else {
- eval(v1);
+ eval(v2);
}
- array_append(STACK, v2);
+ array_append(STACK, v1);
}
void del(value_t *v) {