Explorer

core.compile-function-bodies-range

description
compile-function-bodies over the index range [lo, hi). Splits the range in half so that the recursion depth is O(log n).
type
Fn(
  functions: List<@core.expression>,
  lo: Number,
  hi: Number,
  ctx: Record{
    parts: List<Record{id: String, expression: @core.expression, base: Number}>,
    inlining: List<String>,
    part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
    strings: List<Record{value: String, address: Number}>
  }
) -> List<Number>
expression
fn(functions$0, lo$1, hi$3, ctx$2) =>
  match @core.less-than-or-equal(left: @core.minus(left: $3, right: $1), right: 1) {
    true =>
      match @core.less-than(left: $1, right: $3) {
        true =>
          match @core.list-get(list: $0, index: $1) {
            #none(_) =>
              [],
            #some(item$1005) =>
              @core.list-concat(left: @core.compile-function-body(function: $1005, index: $1, ctx: $2), right: [])
          },
        false =>
          []
      },
    false =>
      let mid$4 = @core.divide(left: @core.plus(left: $1, right: $3), right: 2);
      @core.list-concat(
        left: @core.compile-function-bodies-range(functions: $0, lo: $1, hi: $4, ctx: $2),
        right: @core.compile-function-bodies-range(functions: $0, lo: $4, hi: $3, ctx: $2)
      )
  }
visibility
public
core.compile-function-bodies-range (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: ERP44uDjEAZzC3StUos1RQkfZ6SRT9qj8sWa_lppoNI
content hash: c0dzFGyNpebQ8iFcALCO_yWJshEOwVivdTD1LGgqLZI