This seems to work for me: template toClosure*(i): auto = iterator j: type(i) {.closure.} = for x in i: yield x j iterator countUp(i, j: int): int = for g in i..<j: yield g proc takeInCountUp(iter: iterator) = for j in iter(): echo j takeInCountUp(toClosure(countUp(0, 100))) Run
So it's likely there is something else going on.