Facebook
From Reliable Water Vole, 6 Years ago, written in OCaml (Objective Caml).
Embed
Download Paste or View Raw
Hits: 227
  1. let lpodziel list =
  2.         let rec lpodziel = function
  3.                 | LCons(v, f), i -> let (list1, list2) = lpodziel(f(), i+1) in
  4.                         if i mod 2 = 0 then
  5.                                 LCons(v, fun() -> list1), list2
  6.                         else
  7.                                 list1, LCons(v, fun() -> list2)
  8.                 | LEmpty, _ -> LEmpty, LEmpty
  9.         in lpodziel(list, 0);;