Skip to content

Commit

Permalink
Fix argument order and type var in Seq.fold_lefti documentation
Browse files Browse the repository at this point in the history
`f` has type `int -> 'b -> 'a -> 'b`, therefore the index is the first
argument, and the accumulator is of type `'b`.
  • Loading branch information
thierry-martinez committed Feb 8, 2022
1 parent e228907 commit 7eb63ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stdlib/seq.mli
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ val iteri : (int -> 'a -> unit) -> 'a t -> unit
@since 4.14 *)

val fold_lefti : (int -> 'b -> 'a -> 'b) -> 'b -> 'a t -> 'b
(** [fold_lefti f _ xs] invokes [f _ i x] successively
(** [fold_lefti f _ xs] invokes [f i _ x] successively
for every element [x] located at index [i] of the sequence [xs].
An accumulator of type ['a] is threaded through the calls to [f].
An accumulator of type ['b] is threaded through the calls to [f].
It terminates only if the sequence [xs] is finite.
[fold_lefti f accu xs] is equivalent to
[fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs)].
[fold_left (fun accu (i, x) -> f i accu x) accu (zip (ints 0) xs)].
@since 4.14 *)

Expand Down

0 comments on commit 7eb63ab

Please sign in to comment.