User Tools

Site Tools


ex-l2-plus-sol

Differences

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-l2-plus-sol [2014/10/08 12:31]
giovanni.casu
ex-l2-plus-sol [2015/10/08 15:20] (current)
Line 12: Line 12:
     - Esponenziale:<​code ocaml>​let exp x n = let rec exp' x n acc = if (n=0) then 1      - Esponenziale:<​code ocaml>​let exp x n = let rec exp' x n acc = if (n=0) then 1 
 else exp' x (n-1) x*acc in exp' x n x;;</​code>​ else exp' x (n-1) x*acc in exp' x n x;;</​code>​
-    - Fibonacci:<​code ocaml>​let fib n = let rec fib' n a acc = if(n=0) then acc +    - Fibonacci:<​code ocaml>​let fib n = let rec fib' n a acc = if(n=0) then 
 else fib' (n-1) acc (a+acc) in fib' n 0 1;;</​code>​ else fib' (n-1) acc (a+acc) in fib' n 0 1;;</​code>​
     - Real:<​code ocaml>​let real n = let rec real' n acc = if(n=0) then acc      - Real:<​code ocaml>​let real n = let rec real' n acc = if(n=0) then acc 
ex-l2-plus-sol.txt ยท Last modified: 2015/10/08 15:20 (external edit)