More accurate wording about when Invalid_argument is raised for list functions.

(Patch by Jeremy Yallop)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15074 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Gabriel Scherer 2014-08-08 16:15:13 +00:00
parent c6d67e2bf9
commit c8940948e0
2 changed files with 24 additions and 24 deletions

View File

@ -112,14 +112,14 @@ val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
(** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn (** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn
[f a1 b1; ...; f an bn]. [f a1 b1; ...; f an bn].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
(** [List.map2 f [a1; ...; an] [b1; ...; bn]] is (** [List.map2 f [a1; ...; an] [b1; ...; bn]] is
[[f a1 b1; ...; f an bn]]. [[f a1 b1; ...; f an bn]].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. Not tail-recursive. *) to have different lengths. Not tail-recursive. *)
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
(** [List.rev_map2 f l1 l2] gives the same result as (** [List.rev_map2 f l1 l2] gives the same result as
@ -129,14 +129,14 @@ val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
(** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is (** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is
[f (... (f (f a b1 c1) b2 c2) ...) bn cn]. [f (... (f (f a b1 c1) b2 c2) ...) bn cn].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
(** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is (** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is
[f a1 b1 (f a2 b2 (... (f an bn c) ...))]. [f a1 b1 (f a2 b2 (... (f an bn c) ...))].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. Not tail-recursive. *) to have different lengths. Not tail-recursive. *)
(** {6 List scanning} *) (** {6 List scanning} *)
@ -154,13 +154,13 @@ val exists : ('a -> bool) -> 'a list -> bool
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
(** Same as {!List.for_all}, but for a two-argument predicate. (** Same as {!List.for_all}, but for a two-argument predicate.
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
(** Same as {!List.exists}, but for a two-argument predicate. (** Same as {!List.exists}, but for a two-argument predicate.
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val mem : 'a -> 'a list -> bool val mem : 'a -> 'a list -> bool
(** [mem a l] is true if and only if [a] is equal (** [mem a l] is true if and only if [a] is equal

View File

@ -112,14 +112,14 @@ val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
(** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn (** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn
[f a1 b1; ...; f an bn]. [f a1 b1; ...; f an bn].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
(** [List.map2 f [a1; ...; an] [b1; ...; bn]] is (** [List.map2 f [a1; ...; an] [b1; ...; bn]] is
[[f a1 b1; ...; f an bn]]. [[f a1 b1; ...; f an bn]].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. Not tail-recursive. *) to have different lengths. Not tail-recursive. *)
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
(** [List.rev_map2 f l1 l2] gives the same result as (** [List.rev_map2 f l1 l2] gives the same result as
@ -130,15 +130,15 @@ val fold_left2 :
f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
(** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is (** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is
[f (... (f (f a b1 c1) b2 c2) ...) bn cn]. [f (... (f (f a b1 c1) b2 c2) ...) bn cn].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val fold_right2 : val fold_right2 :
f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
(** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is (** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is
[f a1 b1 (f a2 b2 (... (f an bn c) ...))]. [f a1 b1 (f a2 b2 (... (f an bn c) ...))].
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. Not tail-recursive. *) to have different lengths. Not tail-recursive. *)
(** {6 List scanning} *) (** {6 List scanning} *)
@ -156,13 +156,13 @@ val exists : f:('a -> bool) -> 'a list -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
(** Same as {!ListLabels.for_all}, but for a two-argument predicate. (** Same as {!ListLabels.for_all}, but for a two-argument predicate.
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
(** Same as {!ListLabels.exists}, but for a two-argument predicate. (** Same as {!ListLabels.exists}, but for a two-argument predicate.
Raise [Invalid_argument] if the two lists have Raise [Invalid_argument] if the two lists are determined
different lengths. *) to have different lengths. *)
val mem : 'a -> set:'a list -> bool val mem : 'a -> set:'a list -> bool
(** [mem a l] is true if and only if [a] is equal (** [mem a l] is true if and only if [a] is equal