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)
)
}