exo
This commit is contained in:
15
algo/ocaml/liste.ml
Normal file
15
algo/ocaml/liste.ml
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let rec maxprof lst = match lst with
|
||||
[e] -> e
|
||||
|e::l -> let m = maxprof l in if e>m then e else m
|
||||
|[]->failwith "liste vide";;
|
||||
|
||||
let rec max2 a l = match l with
|
||||
[] -> a
|
||||
|e::l -> if a < e then max2 e l else max2 a l;;
|
||||
maxprof [3;2;19;4];;
|
||||
|
||||
Reference in New Issue
Block a user