User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ex-l3-sol [2014/10/13 15:14]
ex-l3-sol [2015/10/08 15:20] (current)
Line 27: Line 27:
 then square (exp' (n/2) x )  then square (exp' (n/2) x ) 
 else x*square (exp' (n/2) x);;  </​code>​ else x*square (exp' (n/2) x);;  </​code>​
 +  - Fibonacci:<​code ocaml>​let fib n = let rec fib' n a b = if n=0 then a else fib' (n-1) b (a+b)
 +  in fib' n 0 1;;</​code>​
ex-l3-sol.txt ยท Last modified: 2015/10/08 15:20 (external edit)