Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. (*3*)
  2. type product = {nazwa : string; cena: float; ilosc: int};;
  3.  
  4. let prod_list = [{nazwa = "apple"; cena = 90.0; ilosc = 0};{nazwa = "plum"; cena = 1.4; ilosc = 3};{nazwa = "cherry"; cena = 15.5; ilosc = 7}];;
  5.  
  6. exception My_exception;;
  7.  
  8. let findprod li =
  9. try (List.find (fun x -> x.cena>100. && x.ilosc = 0) li )
  10. with Not_found -> raise(My_exception);;
  11.  
  12. findprod prod_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement