fn(frontier$0, found$1, index$2) =>
let step$3 = @core.list-fold(
T: String,
A: Record{found: List<String>, next: List<String>},
reducer: fn(acc$4, item$5) =>
match @core.list-contains-string(list: $4.found, target: $5, index: 0) {
true =>
$4,
false =>
{
found: @core.list-append(list: $4.found, item: $5),
next: match @core.list-hash-index-find(index: $2, field: "id", value: $5) {
#some(part$6) =>
@core.compile-part-references(expr: $6.expression, ids: $4.next),
#none(_) =>
$4.next
}
}
},
init: {found: $1, next: []},
xs: $0
);
match @core.equal(left: @core.list-length(value: $3.next), right: 0) {
true =>
$3.found,
false =>
@core.compile-reachable-ids-from(frontier: $3.next, found: $3.found, index: $2)
}