Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.41 KB | None | 0 0
  1. open List;;
  2. let wzrost lista =
  3.   let l2 = ref lista
  4.   and wl = ref 0
  5.   and wc = ref []
  6.   and ol = ref 0
  7.   and oc = ref []
  8.   in
  9.   while !l2 <> [] do
  10.     begin
  11.         if !ol = 0 || (hd !l2) > (hd !oc)
  12.           then (oc := (hd !l2)::(!oc); ol := !ol + 1;)
  13.           else (oc := []; ol := 0;);
  14.         if !ol > !wl
  15.           then wl := !ol; wc := !oc;
  16.         l2 := (tl !l2);
  17.       end;
  18.     done;
  19.   in !wc;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement