Reverse Polish Notation (math package)
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user