about summary refs log tree commit diff
path: root/doc/manual/expressions/builtins.xml
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-23T15·03+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-23T15·03+0200
commit61af14a9219bff090b238f15c9def5453087aa5d (patch)
tree1ea17f961d74fb236d0b31c524d19fdfe9678a5c /doc/manual/expressions/builtins.xml
parent887bb5fa5a5a7b8b91d371de1a5c8280f9505744 (diff)
Add foldl' primop
Diffstat (limited to 'doc/manual/expressions/builtins.xml')
-rw-r--r--doc/manual/expressions/builtins.xml13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml
index 6bdfdd55c4b6..0b11e2f5a5c6 100644
--- a/doc/manual/expressions/builtins.xml
+++ b/doc/manual/expressions/builtins.xml
@@ -313,6 +313,19 @@ stdenv.mkDerivation {
   </varlistentry>
 
 
+  <varlistentry><term><function>builtins.foldl’</function> 
+    <replaceable>op</replaceable> <replaceable>nul</replaceable> <replaceable>list</replaceable></term>
+
+    <listitem><para>Reduce a list by applying a binary operator, from
+    left to right, e.g. <literal>foldl’ op nul [x0 x1 x2 ...] = op (op
+    (op nul x0) x1) x2) ...</literal>. The operator is applied
+    strictly, i.e., its arguments are evaluated first. For example,
+    <literal>foldl’ (x: y: x + y) 0 [1 2 3]</literal> evaluates to
+    6.</para></listitem>
+
+  </varlistentry>
+
+
   <varlistentry><term><function>builtins.fromJSON</function> <replaceable>e</replaceable></term>
 
     <listitem><para>Convert a JSON string to a Nix