Commits

Dmitry Grebeniuk  committed 250c26e

List: + int_range

  • Participants
  • Parent commits e15bc90

Comments (0)

Files changed (1)

File src/cd_List.ml

     value rev_iter f lst = rev_iter_loop 0 f lst
     ;
 
+    value rec int_range_loop acc ifrom ito =
+      if ifrom <= ito
+      then
+        int_range_loop [ito :: acc] ifrom (ito - 1)
+      else
+        acc
+    ;
+
+    (* [ifrom; .. ; ito] *)
+    value int_range ifrom ito =
+      int_range_loop [] ifrom ito
+    ;
+
+
     (* ** в Cd_List реализовал похожее, потом надо будет слить.
 
     value assoc_count ?(cmp=Pervasives.compare) k t =