Arc Forumnew | comments | leaders | submitlogin
3 points by sacado 6159 days ago | link | parent

(def rpn args

        (let stack '()

                (each elt args

                        (if (is (type elt) 'fn)

                                (with (second (pop stack) first (pop stack))

                                        (push (elt first second) stack))

                                (push elt stack)))

                (pop stack)))


1 point by sacado 6159 days ago | link

then we've got :

arc> (rpn 2 2 + 9 1 - /)

1/2

-----