F# - Playing Hangman

by Gregor Uhlenheuer on October 18, 2011

Today I made some effort to implement a very simple version of the game “Hangman” in F#. Even though I am already familiar with the general syntax of F# and do understand some basic functional programming styles I have to admit that it’s not that easy to get rid of usual iterative programming behaviors I am so used to.

Without further ado, this is what I came up with so far:

I am pretty sure that there are much more elegant ways to implement this in F#. So if you have got any remarks or suggestions on how to improve this, I am very much interested in your opinion. So feel free to email me.

By the way, I did program on my linux machine at home using MonoDevelop with the great F# bindings 1 mainly written by Tomas Petricek. Go check that out if you are running linux or MacOS - it does work very well especially regarding that it’s completely open-source.

  1. see http://functional-variations.net

This post is tagged with f#, .net and programming