Reverse Polish Notation (math package)

This commit is contained in:
2025-09-19 19:37:43 +10:00
parent 5f65c1b42b
commit 340fb67e98
5 changed files with 180 additions and 47 deletions

View File

@@ -10,11 +10,31 @@ fun -string !ltos -list &inlist
add $ans $store &ans
add $idx 1 &idx
equal $idx $listlen &store
if $store %trueend
if $store %end
add $ans ", " &ans
jump %stdoutloop
@trueend
@end
add $ans "]" &ans
return $ans
endfun
fun -list !listremove -list &input
set &idx 0
getlistsize *input &endidx
subtract $endidx 1 &endidx
setlist *ans
@loop
equal $idx $endidx &store
if $store %return
getlistat *input $idx &store
listappend *ans $store
add $idx 1 &idx
jump %loop
@return
return *ans
endfun