Université Paris 6 Licence d'informatique | Module de Programmation Année 2000-2001 |
---|
string_of_int 34;; let x = 1;; let f = function x -> 3*x+1;; f 2;; let g = function (x, y) -> x*y+1;; g (f 1, 2);;
let a = 3; let g = function x -> a*x+1;; g 1;; let a = true;; g 1;; let f2 = function x -> let a = 3 in a*x+1;; f2 1;; let f3 = let a = 3 in function x -> a*x+1;; f3 1;;
let a = 1;; let k = function y -> y - a;; let h = function u -> u + k(u);; let f = function v -> h(v) + v;;Évaluez le résultat de
f 25;;
(1) let code = 1900;; (2) let g = let code = 10 in function y -> y + code;; (3) g 25;; (4) code;; (5) let k = function (f,x) -> f (g (x-1)) + 2;; (6) k (function z -> z + code, 3) ;;
let double_applic = function (f,x) -> f(f (x+1));; double_applic (succ,25);;
Ce document a été traduit de LATEX par HEVEA.