Document base case of List.for_all and List.exists (#9325)

* Document the base case (`[ ]`) of List.for_all and List.exists
master
Glenn Slotte 2020-02-26 09:51:01 +01:00 committed by GitHub
parent bb15443a23
commit 4823934182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -142,6 +142,9 @@ Working version
- #9255, #9300: reference chapter, split the expression grammar
(Florian Angeletti, report by Harrison Ainsworth, review by Gabriel Scherer)
- #9325: documented base case for `List.for_all` and `List.exists`
(Glenn Slotte, review by Florian Angeletti)
### Compiler user-interface and warnings:
- GPR#1664: make -output-complete-obj link the runtime native c libraries when

View File

@ -202,12 +202,14 @@ val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
val for_all : ('a -> bool) -> 'a list -> bool
(** [for_all p [a1; ...; an]] checks if all elements of the list
satisfy the predicate [p]. That is, it returns
[(p a1) && (p a2) && ... && (p an)]. *)
[(p a1) && (p a2) && ... && (p an)] for a non-empty list and
[true] if the list is empty. *)
val exists : ('a -> bool) -> 'a list -> bool
(** [exists p [a1; ...; an]] checks if at least one element of
the list satisfies the predicate [p]. That is, it returns
[(p a1) || (p a2) || ... || (p an)]. *)
[(p a1) || (p a2) || ... || (p an)] for a non-empty list and
[false] if the list is empty. *)
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
(** Same as {!List.for_all}, but for a two-argument predicate.