titer11.nim 445 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. file: "titer11.nim"
  3. output: '''[
  4. 1
  5. 2
  6. 3
  7. ]
  8. '''
  9. """
  10. proc represent(i: int): iterator(): string =
  11. result = iterator(): string =
  12. yield $i
  13. proc represent(s: seq[int]): iterator(): string =
  14. result = iterator(): string =
  15. yield "["
  16. for i in s:
  17. var events = represent(i)
  18. for event in events():
  19. yield event
  20. yield "]"
  21. let s = @[1, 2, 3]
  22. var output = represent(s)
  23. for item in output():
  24. echo item