A solution to Guy Royse's vending machine kata