By wrapping them in a .closure iterator.
    
    
    import tables, sugar
    
    type Iterable[T] = iterator: T
    
    proc iterSomething(xs: Iterable[int])=
      for x in xs():
        echo x
    
    template toFirstClassIter(x): untyped =
      iterator it(): auto {.closure.} =
        for y in x: yield y
      it
    
    let dict = toTable {1:2, 3:4}
    iterSomething(toFirstClassIter dict.values)
    
    
    Run

Reply via email to