Explorer

core.free-variables-in-arms-range

description
free-variables-in-arms over the index range [lo, hi). Splits the range in half so that the recursion depth is O(log n).
type
Fn(arms: List<@core.match-arm>, lo: Number, hi: Number, bound: List<Number>) -> List<Number>
expression
fn(arms$0, lo$1, hi$4, bound$2) =>
  match @core.less-than-or-equal(left: @core.minus(left: $4, right: $1), right: 1) {
    true =>
      match @core.less-than(left: $1, right: $4) {
        true =>
          match @core.list-get(list: $0, index: $1) {
            #none(_) =>
              [],
            #some(item$1006) =>
              let arm$3 = $1006;
              @core.list-concat(
                left: @core.free-variables(
                  expr: $3.body,
                  bound: @core.list-concat(left: @core.pattern-bound-variables(pattern: $3.pattern), right: $2)
                ),
                right: []
              )
          },
        false =>
          []
      },
    false =>
      let mid$5 = @core.divide(left: @core.plus(left: $1, right: $4), right: 2);
      @core.list-concat(
        left: @core.free-variables-in-arms-range(arms: $0, lo: $1, hi: $5, bound: $2),
        right: @core.free-variables-in-arms-range(arms: $0, lo: $5, hi: $4, bound: $2)
      )
  }
visibility
public
core.free-variables-in-arms-range (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: h4nq1zSSgtAP3boBa7PA7qHC2u7_WgZtT4rB_St-X7k
content hash: pXU2QmxWcXQDm9gzN8WsEU4k91Ei6sYX1h6W00Zg9JI