diff options
author | Araq <rumpf_a@web.de> | 2014-02-25 01:06:35 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-02-25 01:06:35 +0100 |
commit | 10768904eb65da1899d0d48cc1a2f3547af3bef0 (patch) | |
tree | 79676143be1663cacdbb5a8790451fde4e7366bc /tests/generics/tgenericlambda.nim | |
parent | ab72377ce64cf2b563ea90204925b793082971cb (diff) | |
parent | e6b0b7ecc9bb81d94eec19fbc4fc62e104f59253 (diff) | |
download | Nim-10768904eb65da1899d0d48cc1a2f3547af3bef0.tar.gz |
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Conflicts: lib/system/jssys.nim
Diffstat (limited to 'tests/generics/tgenericlambda.nim')
-rw-r--r-- | tests/generics/tgenericlambda.nim | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/generics/tgenericlambda.nim b/tests/generics/tgenericlambda.nim index a71c592c5..f7aafe1d9 100644 --- a/tests/generics/tgenericlambda.nim +++ b/tests/generics/tgenericlambda.nim @@ -1,5 +1,5 @@ discard """ - output: "10\n10" + output: "10\n10\n1\n2\n3" """ proc test(x: proc (a, b: int): int) = @@ -8,3 +8,11 @@ proc test(x: proc (a, b: int): int) = test(proc (a, b): auto = a + b) test do (a, b) -> auto: a + b + +proc foreach[T](s: seq[T], body: proc(x: T)) = + for e in s: + body(e) + +foreach(@[1,2,3]) do (x): + echo x + |