Retaining context in Evaluator expressions

Is there a way to keep some information across Evaluator calls in given context? This would enable reusing results of some costly operations.

If not, maybe add some kind of predefined loop (gasp!) and make only a single call to the expression, like:

<set up context here>
for value in values {
       <calculations using value and whatever is set up>
        yield result  # here there is return value
}
<clean up context here>

"for" would support only iterables predefined in a given context, so you would remain in control of the loop.

The evaluator can access function variables, so you could use (depending on the context) a tab/lister or global scoped variable and it should persist between calls.

Evaluator Variables [Directory Opus Manual] explains how to get/set them.

So if I understand it correctly, there is no specific context for Evaluator expression run (ie. a particular set of executions, fe. to determine values for a displayed column)? Like, it cannot be determined if given expression is executed for the first/last time in given context?

No, there's nothing like that currently, although if it would be useful we could certainly look at adding it.