Reverse Polish Ruby

Hey folks,

So… all I wanted was an RPN calculator. So I wrote one. But, I
thought, why should I reimplement +? Or -, sin, etc? So I decided to
pass those requests along to Ruby. After that, my coworker joined in
and we went a little overboard.

The resulting monstrosity is a gruesome combination of object oriented
programming language and Reverse Polish Notation. For example: “2 1 +”
yields 3, right? It’s really doing 2.send(:+, 1).

Feel free to try it out. I kinda like it. But don’t say I didn’t warn
you it was gruesome. At least it’s a usable RPN calculator, and it’s
fun that “1 1 { dup2 + } 10 evaln” gives you the first 12 numbers of
the Fibonacci sequence.

gem install rprb --source http://gems.jimmythrasher.com

Jimmy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs