💾 Archived View for jb55.com › ward.asia.wiki.org › about-method-plugin captured on 2021-12-05 at 23:47:19. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-04)
-=-=-=-=-=-=-
The Method plugin keeps a running tally of calculations expressed as a series of lines.
See Bottles of Beer Methods for examples.
See GitHub for plugin source.
<h3>Lines</h3>
The first few characters determine how a line of a method is interpreted.
A line starting with <b>digits</b> defines a value and contributes that value to the contribution.
A line starting with <b>words</b> retrieves that value from nearby datasets and contributes it to the computation.
A line starting with <b>all-caps</b> calls out a computation to be applied to previous contributions.
Defined values and computation results are available to subsequent methods by the name that follows on the remainder of the line.
<h3>Units</h3>
When the name of a defined value includes parenthesized words, these words are interpreted as units.
Some unit conversions can be applied automatically.
See Method Unit Conversions for more examples.
<h3>Computations</h3>
All computations are defined in the <i>apply</i> function inside the method plugin. This limits the things you can say to compute.
Say <b>SUM</b> to sum the previous contributions.
Say <b>PRODUCT</b> to multiply the previous contributions.
Say <b>AVERAGE</b> to average the previous contributions.
Say <b>MINIUM</b> or <b>MAXIUM</b> to find extremes.
Say <b>RATIO</b> to find the ratio of two numbers.
Say <b>ACCUMULATE</b> to add to a running sum.
Say AVG, MIN or MAX as an acceptable abbreviation.
See Method Expressions for concise formulas.
Say <b>SHOW</b> to display specific results in large digits while hiding other calculatons. (SHOW is otherwise like SUM)
<h3>Application</h3>
The Method plugin exposes its computations such that they can be applied to new values by other plugins.
See About Rollup Plugin to see how calculations contributing to a dataset can be broken down into Methods on pages and then rolled back up to make a revised dataset.
See About Reduce Plugin to see how calculation on a specified sequence of pages can be treated as a whole and evaluated repeatedly as such.
<h3>Programming</h3>
Additional computations may be added as needed by programmers for use on a specific site.
The plugin's <i>apply</i> function recognizes computations by name and performs the appropriate computation.