fix SPLIT ordering

This commit is contained in:
zongor 2024-12-07 23:22:05 -05:00
parent 8edcea969e
commit 9f1e1d6ad9
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -345,9 +345,10 @@ func Interpret(code Expr, argv []string, w io.Writer) error {
} }
if list.Tok == LIST { if list.Tok == LIST {
n := len(list.Exprs) - 1 n := len(list.Exprs) - 1
push(list.Exprs[n]) e := list.Exprs[n]
list.Exprs = list.Exprs[:n] list.Exprs = list.Exprs[:n]
push(list) push(list)
push(e)
} else { } else {
return fmt.Errorf("cannot `split` not a list @%v", idx) return fmt.Errorf("cannot `split` not a list @%v", idx)
} }