Skip to content

Commit

Permalink
Update data/tutorials/language/1ds_01_arrays.md
Browse files Browse the repository at this point in the history
Co-authored-by: Christine Rose <[email protected]>
  • Loading branch information
gpetiot and christinerose authored Jul 31, 2023
1 parent a07906e commit b58bffe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data/tutorials/language/1ds_01_arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The `Array.map` function creates a new array by applying a given function to eac

### Folding an Array

To combine all the elements of an array into a single result, we can use the `Array.fold_left` and `Array.fold_right` functions. These functions take a binary function, an initial accumulator value, and an array as arguments. The binary function takes two arguments: the current value of the accumulator and the current element of the array and returns a new accumulator value. Both functions traverse the array
To combine all the elements of an array into a single result, we can use the `Array.fold_left` and `Array.fold_right` functions. These functions take a binary function, an initial accumulator value, and an array as arguments. The binary function takes two arguments: the accumulator's current value and the current element of the array, then returns a new accumulator value. Both functions traverse the array
but in opposite directions. This is essentially the same as `List.fold_left` and `List.fold_right`.

Here is the signature of `Array.fold_left`:
Expand Down

0 comments on commit b58bffe

Please sign in to comment.