summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-09-16 20:58:50 +0800
committerGitHub <noreply@github.com>2020-09-16 14:58:50 +0200
commitde7f2372be770ca97f3f63dcc9447bdd2827f9d0 (patch)
treea9e101d43681e0dafd293b3c9c94c08206da1aac
parentfd31e8ff6f96527cc52125d01311d022ff82fead (diff)
downloadNim-de7f2372be770ca97f3f63dcc9447bdd2827f9d0.tar.gz
docs minor and #15335 (#15337)
-rw-r--r--lib/pure/collections/sequtils.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim
index 51d8ade85..d8ea3ad1f 100644
--- a/lib/pure/collections/sequtils.nim
+++ b/lib/pure/collections/sequtils.nim
@@ -809,10 +809,17 @@ template foldl*(sequence, operation: untyped): untyped =
       multiplication = foldl(numbers, a * b)
       words = @["nim", "is", "cool"]
       concatenation = foldl(words, a & b)
+      procs = @["proc", "Is", "Also", "Fine"]
+
+
+    proc foo(acc, cur: string): string =
+      result = acc & cur
+
     assert addition == 25, "Addition is (((5)+9)+11)"
     assert subtraction == -15, "Subtraction is (((5)-9)-11)"
     assert multiplication == 495, "Multiplication is (((5)*9)*11)"
     assert concatenation == "nimiscool"
+    assert foldl(procs, foo(a, b)) == "procIsAlsoFine"
 
   let s = sequence
   assert s.len > 0, "Can't fold empty sequences"