From 9f1e1d6ad96f7cdcaec1ff9ac0f60f8ed9f615e7 Mon Sep 17 00:00:00 2001 From: zongor Date: Sat, 7 Dec 2024 23:22:05 -0500 Subject: [PATCH] fix SPLIT ordering --- examples/list.vqe | 2 +- varaq/interpreter.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/list.vqe b/examples/list.vqe index 82dbdcc..98ca803 100755 --- a/examples/list.vqe +++ b/examples/list.vqe @@ -1 +1 @@ -("test this" (*test*) ) pi cons 2 cons 1 cons 4 { split exch disp newline } repeat +("test this" (*test*) ) pi cons 2 cons 1 cons 4 { split disp newline } repeat diff --git a/varaq/interpreter.go b/varaq/interpreter.go index e0a0749..d75e59c 100644 --- a/varaq/interpreter.go +++ b/varaq/interpreter.go @@ -345,9 +345,10 @@ func Interpret(code Expr, argv []string, w io.Writer) error { } if list.Tok == LIST { n := len(list.Exprs) - 1 - push(list.Exprs[n]) + e := list.Exprs[n] list.Exprs = list.Exprs[:n] push(list) + push(e) } else { return fmt.Errorf("cannot `split` not a list @%v", idx) }