Explorer

core.compile-slot-env-range

description
compile-slot-env over the index range [lo, hi). Splits the range in half so that the recursion depth is O(log n).
type
Fn(variables: List<Number>, lo: Number, hi: Number, first_local: Number) -> List<Record{variable_id: Number, local: Number}>
expression
fn(variables$0, lo$1, hi$3, first_local$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: [{variable_id: $1005, local: @core.plus(left: $2, right: $1)}], right: [])
          },
        false =>
          []
      },
    false =>
      let mid$4 = @core.divide(left: @core.plus(left: $1, right: $3), right: 2);
      @core.list-concat(
        left: @core.compile-slot-env-range(variables: $0, lo: $1, hi: $4, first_local: $2),
        right: @core.compile-slot-env-range(variables: $0, lo: $4, hi: $3, first_local: $2)
      )
  }
visibility
public
core.compile-slot-env-range (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: CnS3b2tnxnnC7x-wQdksSJdgNxHfG0eA_Z2ojdBWR8M
content hash: m00XkXqS-lwh9PStgg2mLPsj8oEXPtKZwzMdD16wD9M