Some F# fun

I’m making my way through the The book of F# and been playing with implementing the RPN calculator

RPN Calculator

personally I found it quite interesting to see my choices during this small exercise, especially the use of Option types to handle error cases comes quite naturally. Another interesting thing I found was that, similar to how I would write the same thing in Lisp, it is very obvious to define functions inside other functions to hide implementation details I would like to give a name to but don’t want to share with the rest of the program.

2 thoughts on “Some F# fun

    1. Mh sadly not, because that would cause a stack with `x :: y :: []` to return `x` even so it should be `None` meaning that `1 2 3` would evaluate to `3` instead of `None`. At least this is my understanding of RPN meaning only a 1 element stack at the end constitues a valid result, I might be wrong so.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.