Skip to content
Andrei Kurosh edited this page Aug 16, 2026 · 1 revision

A function in LENS can be an iterator returning a possibly infinite IEnumerable<T> instance:

fun loop<T>:T~ (items:T~ count:int) ->
    for i in 0..count do
        for item in items do
            yield item

The same could also be written more conscisely using the yield from syntax, that yields all results from a sub-sequence:

fun loop<T>:T~ (items:T~ count:int) ->
    for i in 0..count do
        yield from items

Clone this wiki locally