diff options
author | Preston Pan <preston@nullring.xyz> | 2024-01-12 19:12:05 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2024-01-12 19:12:05 -0800 |
commit | f5f261968de27ecdd2eacedc6255da115e7b43cb (patch) | |
tree | 7f94f63d821c714bbe295a0c85ff136f59bea9c8 | |
parent | 9573dffae70e9d674dec84082ddc162f7f7eb418 (diff) |
fix keep for real, can I keep on doing this forever?
-rw-r--r-- | src/builtins.c | 14 |
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) { |