Arc Forumnew | comments | leaders | submitlogin
6 points by almkglor 6128 days ago | link | parent

Reverse polish notation? Why not just model the stack directly? How is pattern-matching involved in this?

  (def rpn-eval (lst)
    (let stack nil
       (each c lst
         (if (isa c 'fn)
           (withs (snd (pop stack) fst (pop stack))
             (push (c fst snd) stack))
           (push c stack) ))
       (pop stack)))