Explorer

core.compile-assign-part-bases

description
The parts with the index of their first function (base): base, then each part's base plus the number of functions in it. Counts the functions of each part once (with the halves of core.compile-assign-part-bases-range, the parts of the left half were counted again at every level). index is not used (the callers pass 0)
type
Fn(parts: List<Record{id: String, expression: @core.expression}>, index: Number, base: Number) -> List<Record{id: String, expression: @core.expression, base: Number}>
expression
fn(parts$0, index$1, base$2) =>
  let assigned$3 = @core.list-fold(
      T: Record{id: String, expression: @core.expression},
      A: Record{base: Number, parts: List<Record{id: String, expression: @core.expression, base: Number}>},
      reducer: fn(acc$4, item$5) =>
        {
          base: @core.plus(left: $4.base, right: @core.count-functions(expr: $5.expression)),
          parts: @core.list-append(list: $4.parts, item: {id: $5.id, expression: $5.expression, base: $4.base})
        },
      init: {base: $2, parts: []},
      xs: $0
    );
  $3.parts
visibility
public
core.compile-assign-part-bases (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: lGB6F4qhR2DtZpCDx7DRDhB3RAsZWh3r6fLZqMV4UvQ
content hash: amN4wz58cVC-n_BgqbhiLRPObgfBKJ8EAep4-2ZN8pQ