title: Ocaml read list from file
body: <p>I need to take list of list of integers from file and use my func combine to it. See please on my code, where is my mistake?</p>
  
  <pre><code># let f x l = List.filter ((&lt;&gt;) x) l 
    let rec comb = function  
    | [] -&gt; []
    | x::[] -&gt; [[x]]
    | l -&gt; 
      List.fold_left (fun acc x -&gt; acc @ List.map (fun p -&gt; x::p) ( comb ( f x l))) [ ] l  ;;
  
  let file = "example.dat"
    let message = [[1;2];[3;4]] 
    let () =      
      let oc = open_out file in
      fprintf oc "%s\n" message;
      close_out oc;
      let ic = open_in file in
      try 
        let line = input_line ic in    
      print_endline line;
      flush stdout;
      close_in ic
      with e -&gt;
      close_in_noerr ic;
      raise e;; 
  </code></pre>