Explorer

html-ui.local-closure

description
(en) The parts (of a branch) that can be reached from the ids of frontier, following the references with the ones in quote (core.expression-part-references). acc is what was already found. For /run-parts, to send only the parts the program may use
type
Fn(
  frontier: List<String>,
  parts: List<Record{id: String, expression: @core.expression}>,
  acc: List<Record{id: String, expression: @core.expression}>
) -> List<Record{id: String, expression: @core.expression}>
expression
fn(frontier$0, parts$1, acc$2) =>
  let found_ids$3 = @core.list-map(
      T: Record{id: String, expression: @core.expression},
      U: String,
      f: fn(item$4) =>
        $4.id,
      xs: $2
    );
  let picked$5 = @core.list-fold(
      T: Record{id: String, expression: @core.expression},
      A: List<Record{id: String, expression: @core.expression}>,
      reducer: fn(acc$6, item$7) =>
        match @core.list-contains-string(list: $0, target: $7.id, index: 0) {
          true =>
            match @core.list-contains-string(list: $3, target: $7.id, index: 0) {
              true =>
                $6,
              false =>
                @core.list-append(list: $6, item: $7)
            },
          false =>
            $6
        },
      init: [],
      xs: $1
    );
  match @core.equal(left: @core.list-length(value: $5), right: 0) {
    true =>
      $2,
    false =>
      @html-ui.local-closure(
        frontier: @core.list-fold(
          T: Record{id: String, expression: @core.expression},
          A: List<String>,
          reducer: fn(acc$8, item$9) =>
            @core.expression-part-references(expr: $9.expression, ids: $8),
          init: [],
          xs: $5
        ),
        parts: $1,
        acc: @core.list-concat(left: $2, right: $5)
      )
  }
visibility
public
html-ui.local-closure (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: IRNjwSsdTlafabKTl3YNfKU6nro0leQdoV7Z5bJTVZE
content hash: 8k5ELl4Nm2zCs20I7cLuBLwQGH7qy8AyfvqoaMItsDw