next up previous contents
suivant: Programmation Orientée Objet monter: Types de programmation précédent: Programmation impérative   Table des matières

Programmation Fonctionnelle

Exemples: Lisp, Caml.
En Caml:
#let rec  f(x) =
   if x>100 then x-10 else f(f(x+11));;
f : int -> int = <fun>
#f(6);;
- : int = 91
#let rec append=
    function [] ,l2 -> l2
       |(x::l1), l2 -> x::(append(l1,l2));;
append : 'a list * 'a list -> 'a list = <fun>
#append([1;2;3],[4;5]);;
- : int list = [1; 2; 3; 4; 5]


Hugues FAUCONNIER 2003-01-09