aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Gagarin <valentin.gagarin@tweag.io>2023-02-19 23:54:14 +0100
committerGitHub <noreply@github.com>2023-02-19 23:54:14 +0100
commitdda83a59c1cdaaceedc2f2f64606a51dfacdf0bc (patch)
treef6515dbb0da0e4f98d0754ef8e820f49159fa466 /src
parenta88ae62bc0e404b7f87876bfd0a74afbac4d517d (diff)
parentd0f2da214badd4cded6fb00e97af4588da49c0d0 (diff)
Merge pull request #7158 from sternenseemann/foldl-strict-accumulation-value
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index c6f41c4ca..fb7fc3ddb 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -3032,9 +3032,9 @@ static RegisterPrimOp primop_foldlStrict({
.doc = R"(
Reduce a list by applying a binary operator, from left to right,
e.g. `foldl' op nul [x0 x1 x2 ...] = op (op (op nul x0) x1) x2)
- ...`. The operator is applied strictly, i.e., its arguments are
- evaluated first. For example, `foldl' (x: y: x + y) 0 [1 2 3]`
- evaluates to 6.
+ ...`. For example, `foldl' (x: y: x + y) 0 [1 2 3]` evaluates to 6.
+ The return value of each application of `op` is evaluated immediately,
+ even for intermediate values.
)",
.fun = prim_foldlStrict,
});