Commits

camlspotter committed 1a24891

added utils

  • Participants
  • Parent commits 579b23f

Comments (0)

Files changed (3)

 clean:
   rm -f $(filter-proper-targets $(ls R, .))
 
-MyOCamlPackedLibrary(opycaml, apitype autoapi api, auto_stubs api_ml, -lpython2.6 -L$(PREFIX)/lib/ocaml -lcamlidl)
+MyOCamlPackedLibrary(opycaml, utils apitype autoapi api, auto_stubs api_ml, -lpython2.6 -L$(PREFIX)/lib/ocaml -lcamlidl)
 
 .DEFAULT: opycaml.cma opycaml.cmxa
 
 module Tuple = struct
   include Tuple
 
-(*
   let from_list lst =
-    let len = List.length lst in
-    let tpl = new_ len in
-    let rec fill n= function
-      | 0 -> ()
-      | n -> 
-*)
+    let tpl = new_ (List.length lst) in
+    Utils.List.iteri (setItem tpl) lst;
+    tpl
+
 end
+module List = struct
+  let iteri f list =
+    let rec iteri f n = function
+      | [] -> ()
+      | x::xs -> f n x; iteri f (n+1) xs
+    in
+    iteri f 0 list
+end