This is what might happen: 
    
    
    for thing in
      iterator res: string {.inline.} =
        for r1 in iter1():
          yield r1
        for r2 in iter2():
          yield r2
    

This is what you actually need: 
    
    
    template chain(iter1, iter2: typed, body: untyped) =
      block:
        for str {.inject.} in iter1():
          body
        for str {.inject.} in iter2():
          body
    
    iterator thing1: string =
      yield "A"
      yield "B"
      yield "C"
      yield "D"
    
    iterator thing2: string =
      yield "E"
      yield "F"
      yield "cookiemonster"
    
    chain(thing1,thing2):
      echo(str)
    

[Run it](https://glot.io/snippets/eo08vv36nz)

Reply via email to