t1550.nim 357 B

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