// Code from Hansen and Rischel: Functional Programming using F# 16/12 2012 // Chapter 1: Getting started. let circleArea r = System.Math.PI * r * r;; let daysOfMonth = function | 2 -> 28 // February | 4|6|9|11 -> 30 // April, June, September, November | _ -> 31 // All other months ;; let rec fact = function | 0 -> 1 | n -> n * fact(n-1);; let rec power = function | (x,0) -> 1.0 // (1) | (x,n) -> x * power(x,n-1);; // (2) let rec gcd = function | (0,n) -> n | (m,n) -> gcd(n % m,m);;