type Recurrent = class first: T; next: Func; count: integer; constructor (f: T; n: Func; c: integer); begin first := f; next := n; count := c; end; function f(): IEnumerable; begin result := Range(1, count).Select(x -> begin result := first; first := next(first); end) end; end; begin var a := new Recurrent(1, x -> x * 2, 10); writeln(a.f()); end.