t1550.nim 392 B

123456789101112131415161718192021222324
  1. discard """
  2. targets: "c js"
  3. """
  4. type
  5. A[T] = iterator(x: T): T {.gcsafe, closure.}
  6. iterator aimp[T](x: T): T {.gcsafe, closure.} =
  7. var total = 0
  8. while (total < 100):
  9. yield total
  10. total += x
  11. iterator bimp(y: A[int], z:int): int {.gcsafe, closure.} =
  12. for i in y(z):
  13. yield i
  14. for x in aimp[int](3):
  15. discard x
  16. var y = aimp[int]
  17. var z = bimp
  18. for x in z(y, 1):
  19. discard x