tyrion

es3.ml

Oct 28th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.96 KB | None | 0 0
  1. let somma (a,b) (c,d) =
  2.   ((a + c + (b+d)/60) mod 24, (b+d) mod 60)
  3.  
  4. let leggi first fn =
  5.   let rec aux ris =
  6.     match read_line() with
  7.     | "." -> ris
  8.     | str -> aux (fn (str, ris))
  9.   in aux (first())
  10.  
  11.  
  12. (* ((int_of_string str)::lista) *)
  13.  
  14.  
  15. (*
  16. let massimo () = leggi (read_int(), (function (str, max) ->
  17.   let n = int_of_string str in if (n > max) then max else n))
  18. *)
  19.  
  20. let massimo() = leggi read_int (function (str, max) ->
  21.   let n = int_of_string str in if (n > max) then n else max)
  22.  
  23. let maxmin() = leggi (function() -> let n = read_int() in (n, n))
  24.     (function (str, (min, max)) -> let n = (int_of_string str) in
  25.     ((if (n < min) then n else min),
  26.      (if (n > max) then n else min)));;
  27.  
  28.  
  29. let a = function (str, (min, max)) ->
  30.   let n = (int_of_string str) in
  31.     ((if (n < min) then n else min),
  32.      (if (n > max) then n else min))
  33.  
  34. let leggi_lista() = leggi
  35.     (function () -> [])
  36.     (function (str, ris) -> (int_of_string str)::ris)
Advertisement
Add Comment
Please, Sign In to add comment