Well this is fairly easy to make. However, doing it in a FPL is another ball game if you're used to 'simple' imperative programming like me (like c, php, java, ...)