Précédent Suivant Index



Types enregistrements


#type étudiant = {nom : string; âge : int};;
Le type étudiant est défini.
#let lambda = {nom = "LA"; âge = 20};;
lambda : étudiant = {nom = "LA"; âge = 
20}
#let anniv1 = function x -> 
   {nom = x.nom; âge = x.âge+1};;
anniv1 : étudiant -> étudiant = <fun>
#let anniv2 x = match x with
 | {nom = n; âge = a} -> 
   {nom = n; âge = a+1};;
anniv2 : étudiant -> étudiant = <fun>
#anniv1 lambda, lambda;;
- : étudiant * étudiant = {nom = "LA"; âge 
= 21}, {nom = "LA"; âge = 20}

Précédent Suivant Index