Explorer

definy.closure-candidate-index

description
The hash index of the candidates by part id, for definy.closure-find-all. Made from the candidates in reverse order, so the first candidate of the same id wins
type
Fn(candidates: List<@definy.closure-candidate>) -> List<List<Record{id: String, candidate: @definy.closure-candidate}>>
expression
fn(candidates$0) =>
  let keyed$1 = @core.list-map(
      T: @definy.closure-candidate,
      U: Record{id: String, candidate: @definy.closure-candidate},
      f: fn(item$2) =>
        {id: $2.part.id, candidate: $2},
      xs: $0
    );
  @core.list-hash-index(
    list: @core.list-reverse(
      T: Record{id: String, candidate: @definy.closure-candidate},
      list: $1,
      start: 0,
      end: @core.list-length(value: $1)
    ),
    field: "id"
  )
visibility
public
definy.closure-candidate-index (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: w_5BB92ZBTbZmQXNzOD1IGaX9-sI8ZFxeOdB7h9RyYw
content hash: bH36aRYe9EGT5cNL-nH2qHlYYOphvmnkdezOQkkTtWg