Explorer

core.collect-functions-in-list-range

description
collect-functions-in-list over the index range [lo, hi). Splits the range in half so that the recursion depth is O(log n).
type
Fn(items: List<@core.expression>, lo: Number, hi: Number) -> List<@core.expression>
expression
fn(items$0, lo$1, hi$2) =>
  match @core.less-than-or-equal(left: @core.minus(left: $2, right: $1), right: 1) {
    true =>
      match @core.less-than(left: $1, right: $2) {
        true =>
          match @core.list-get(list: $0, index: $1) {
            #none(_) =>
              [],
            #some(item$1004) =>
              @core.list-concat(left: @core.collect-functions(expr: $1004), right: [])
          },
        false =>
          []
      },
    false =>
      let mid$3 = @core.divide(left: @core.plus(left: $1, right: $2), right: 2);
      @core.list-concat(
        left: @core.collect-functions-in-list-range(items: $0, lo: $1, hi: $3),
        right: @core.collect-functions-in-list-range(items: $0, lo: $3, hi: $2)
      )
  }
visibility
public
core.collect-functions-in-list-range (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: PKLx0EvVMiEOpvoE8880s5nR7ThoYWoB5db4GaLSDY8
content hash: FtKOTg2vEQXs8Q-IzAGgjppVdyB40Uf-eGqeeJ1LGMg