Reverse Polish Ruby

J

jjthrash

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top