• Would such an optimisation be useful for a general purpose language?

    C# LINQ is designed to allow it, though the optimization is done by the LINQ provider not the compiler. And LINQ by and large boils down to a declarative sublanguage somewhere between list comprehensions and SQL.

    I imagine that this kind of optimization would be more generally useful in an array language or languages that make heavy use of dataframes.


    score 4 · canonical