summary refs log tree commit diff stats
path: root/tests/run
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-06-22 08:30:55 +0200
committerAraq <rumpf_a@web.de>2012-06-22 08:30:55 +0200
commit0b509127d21b3aba735b363d6b8dfeb9b37d1f4d (patch)
tree9c90de9254e72c8dc9ff4d55141328b44aa8ac0a /tests/run
parent05c981ea9b906292063c0b24dd6d387d4e666e8a (diff)
downloadNim-0b509127d21b3aba735b363d6b8dfeb9b37d1f4d.tar.gz
documentation improvements; added system.gorge (for Araq's fun)
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/tfilter.nim15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/run/tfilter.nim b/tests/run/tfilter.nim
index e82d05742..5846d0efb 100644
--- a/tests/run/tfilter.nim
+++ b/tests/run/tfilter.nim
@@ -1,5 +1,5 @@
 discard """
-  output: "02468101214161820"
+  output: "02468101214161820\n15"
 """
 
 proc filter[T](list: seq[T], f: proc (item: T): bool {.closure.}): seq[T] =
@@ -24,5 +24,18 @@ proc outer =
                )
 
   for n in nums2: stdout.write(n)
+  stdout.write("\n")
 
 outer()
+
+import math
+proc compose[T](f1, f2: proc (x: T): T {.closure.}): proc (x: T): T {.closure.} =
+  result = (proc (x: T): T =
+             result = f1(f2(x)))
+
+
+proc add5(x: int): int = result = x + 5
+
+var test = compose(add5, add5)
+echo test(5)
+