Raw Weights to Percents
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug reads the raw weights held in the socket's weights map across a set of slots, sums them, and overwrites each slot with its share of that total as a percentage rounded down. It asks the caller for count, the number of weight slots to iterate over in both passes. It fires whenever a caller runs it with that count supplied at execution time. Computing these percent shares by hand or against a stale sum would write incorrect proportions back into storage.

Actions · 17

  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Read map value
    Read map value of in in
    Reads a value from a keyed map in the socket's persistent storage.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Read map value
    Read map value of in in
    Reads a value from a keyed map in the socket's persistent storage.
  • Multiply then divide
    Calculate times divided by rounded
    Multiplies two values and divides by a third in one step, rounding up or down.
  • Set map value
    Set map value of in in to
    Writes a value into a keyed map in the socket's persistent storage.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.

Related plugs · 8