Skip to content
This repository
tag: v1853
Fetching contributors…

Cannot retrieve contributors at this time

file 84 lines (73 sloc) 2.358 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)

(**
Loop module
*)

module For :
sig

  (**
[range a b acc fct]
Bounds:
start bound is included, end bound is Excluded.
{[
For.range 0 10 acc (
fun i acc ->
(* do something with i and acc, return an acc *)
)
]}

The accumulator is returned without changes if a >= b
*)
  val range : int -> int -> 'a -> (int -> 'a -> 'a) -> 'a

  (*
if needed
*)
  (* val down_range *)

end

module InitAcc :
  sig
 (** init the list with [ fst( f i _) : i C {0..n-1} ] and return the folded accumulator *)
  val list : int * 'a -> (int -> 'a -> 'b * 'a) -> 'b list * 'a end
module FilterMap :
  sig
    val array :
      'a array -> (int -> 'a -> bool) -> (int -> 'a -> 'b) -> 'b array
  end
module Map :
  sig
    val list : 'a list -> ('a -> 'b) -> 'b list
    val array : 'a array -> (int -> 'a -> 'b) -> 'b array
    val option : 'a option -> ('a -> 'b) -> 'b option
  end
module FoldMap :
  sig
    val list : 'a list * 'b -> ('a -> 'b -> 'c * 'b) -> 'c list * 'b
    val array :
      'a array * 'b -> (int -> 'a -> 'b -> 'c * 'b) -> 'c array * 'b
  end
module Iter :
  sig
    val list : 'a list -> ('a -> unit) -> unit
    val array : 'a array -> (int -> 'a -> unit) -> unit
  end
module Deprecated :
  sig
    val l_fold : 'a list * 'b -> ('a -> 'b -> 'b) -> 'b
    val l_map : 'a list -> ('a -> 'b) -> 'b list
    val l_filter : 'a list -> ('a -> bool) -> 'a list
    val l_filter_map : 'a list -> ('a -> 'b option) -> 'b list
    val l_for_all : 'a list -> ('a -> bool) -> bool
    val l_map_flat : 'a list -> ('a -> 'b list) -> 'b list
    val l_map_sort : 'a list -> ('a -> 'b) -> 'b list
    val l_iter : 'a list -> ('a -> unit) -> unit
  end
Something went wrong with that request. Please try again.