Documentation

Lean.Compiler.LCNF.ExtractClosed

@[reducible, inline]
Instances For
    Instances For
      Instances For
        @[reducible, inline]
        Instances For

          Check if let decl; k forms an Array, ByteArray, or FloatArray literal. They consist of some initial allocation (Array.mkEmpty or Array.emptyWithCapacity) followed by a sequence of Array.push and for the scalar variants finally ByteArray.mk or FloatArray.mk.

          We identify these literals by matching this pattern and ensuring that only the last push/mk from the sequence is used in the final continuation. If that is the case, we can pull out the entire literal as one closed declaration. This avoids the quadratic overhead of repeated Array.push calls on persistent Array objects during initialization.

          Instances For