Share via


I started playing with F#...

I decided to do some Project Euler problems using F#. 

So here is my first one, Problem # 31.  Nothing in this solution really shows off anything special about F# but you have to start somewhere ;)

 

    1: #light
    2:  
    3: let rec combos amt (denoms:int list) = 
    4:     if amt = 0 then 1
    5:     elif denoms.IsEmpty || amt < 0 then 0
    6:     else 
    7:         combos (amt - denoms.Head) denoms + 
    8:         combos amt denoms.Tail
    9:     
   10:     
   11: printf "\n\nThe Anwer is: %i \n" (combos 200 [200;100;50;20;10;5;2;1])
   12: