Brought slice() in line with select() indexing, without wrapping. Replaced a lot of select() and slice() calls with last(), list_head(), and list_tail() calls.

This commit is contained in:
Garth Minette
2021-03-30 00:46:59 -07:00
parent cf58ee6f33
commit 0b17bf5930
24 changed files with 250 additions and 186 deletions

View File

@@ -479,7 +479,7 @@ function _tupdate(state, tran, pretran) =
[
concat(state[0],tran),
concat(state[1],pretran),
each select(state,2,-1)
each list_tail(state,2)
];
function _turtle3d_command(command, parm, parm2, state, index) =
@@ -504,8 +504,8 @@ function _turtle3d_command(command, parm, parm2, state, index) =
chnum = (!in_list(command,neednum) || is_num(parm))
&& (!in_list(command,numornothing) || (is_undef(parm) || is_num(parm))),
chtran = !in_list(command,needtran) || is_matrix(parm,4,4),
lastT = select(state[trlist],-1),
lastPre = select(state[prelist],-1),
lastT = last(state[trlist]),
lastPre = last(state[prelist]),
lastpt = apply(lastT,[0,0,0])
)
assert(chvec,str("\"",command,"\" requires a 3d vector parameter at index ",index))