I don't know how to do this, but I am sure Patrick or Jonathan can do this quickly...
In the code above, there is still repetition: all entries in %op_dispatch_table are nearly identical, differing only depending on the arity. We could replace that with something generic which is passed a sub, it pops as many elements as the arity of the passed sub and pushes back the value of applying the sub to the reverse of this list.
I was unable to do this myself because I could not get from the name of the sub to the callable object (I tried &($name), but got a message that it is unimplemented).
Read More