{
  "title": "About Method Plugin",
  "story": [
    {
      "type": "paragraph",
      "id": "df8885c094fc1710",
      "text": "The Method plugin keeps a running tally of calculations expressed as a series of lines. "
    },
    {
      "type": "method",
      "id": "682d22af9d46f3a5",
      "text": "2\n3\nSUM"
    },
    {
      "type": "paragraph",
      "id": "cd9bdca1991d8090",
      "text": "See [[Bottles of Beer Methods]] for examples."
    },
    {
      "type": "paragraph",
      "id": "942ad9155083e706",
      "text": "See [https://github.com/WardCunningham/Smallest-Federated-Wiki/tree/master/client/plugins/method GitHub] for plugin source."
    },
    {
      "type": "paragraph",
      "id": "c6c02f7fae9f4f03",
      "text": "<h3>Lines"
    },
    {
      "type": "paragraph",
      "id": "c5af6f487a7b9907",
      "text": "The first few characters determine how a line of a method is interpreted."
    },
    {
      "type": "paragraph",
      "id": "bbcc1f9548618bb4",
      "text": "A line starting with <b>digits</b> defines a value and contributes that value to the contribution."
    },
    {
      "type": "paragraph",
      "id": "aec640909082f3b3",
      "text": "A line starting with <b>words</b> retrieves that value from nearby datasets and contributes it to the computation."
    },
    {
      "type": "paragraph",
      "id": "f982813c60a78119",
      "text": "A line starting with <b>all-caps</b> calls out a computation to be applied to previous contributions."
    },
    {
      "type": "paragraph",
      "id": "9b5e3d7a7cc65329",
      "text": "Defined values and computation results are available to subsequent methods by the name that follows on the remainder of the line."
    },
    {
      "type": "paragraph",
      "id": "69084bb462636274",
      "text": "<h3>Computations"
    },
    {
      "type": "paragraph",
      "id": "f3532c800d9b42ba",
      "text": "All computations are defined in the <i>apply</i> function inside the method plugin. This limits the things you can say to compute."
    },
    {
      "type": "paragraph",
      "id": "0c61adb097e329f2",
      "text": "Say <b>SUM</b> to sum the previous contributions."
    },
    {
      "type": "paragraph",
      "id": "641952825d9a9aae",
      "text": "Say <b>PRODUCT</b> to multiply the previous contributions."
    },
    {
      "type": "paragraph",
      "id": "5072042a5e1ddf59",
      "text": "Say <b>AVERAGE</b> to average the previous contributions."
    },
    {
      "type": "paragraph",
      "id": "760060c9bbaee23f",
      "text": "Say <b>MINIUM</b> or <b>MAXIUM</b> to find extremes."
    },
    {
      "type": "paragraph",
      "id": "38d211f128c7e310",
      "text": "Say AVG, MIN or MAX as an acceptable abbreviation."
    },
    {
      "type": "paragraph",
      "id": "56356deed9dd765e",
      "text": "<h3> Programming"
    },
    {
      "type": "paragraph",
      "id": "bb9c2304a9526427",
      "text": "Additional computations may be added as needed by programmers for use on a specific site."
    },
    {
      "type": "paragraph",
      "id": "c723cceb207630d0",
      "text": "The plugin's <i>apply</i> function recognizes computations by name and performs the appropriate computation."
    },
    {
      "type": "code",
      "id": "d17103da4b9a4d55",
      "text": "apply = (name, list, label) ->\n  switch name\n    when 'SUM' then sum list\n    when 'AVG', 'AVERAGE' then avg list\n    when 'MIN', 'MINIMUM' then _.min list\n    when 'MAX', 'MAXIMUM' then _.max list\n    when 'FIRST' then list[0]\n    when 'PRODUCT' then _.reduce list, (p,n)->p*=n\n    when 'LOOKUP' then lookup list\n    when 'POLYNOMIAL' then polynomial list[0], label\n    else throw new Error \"don't know how to #{name}\""
    }
  ],
  "journal": [
    {
      "type": "create",
      "id": "4e4c68f08db85513",
      "item": {
        "title": "About Method Plugin"
      },
      "date": 1342299574825
    },
    {
      "item": {
        "type": "factory",
        "id": "df8885c094fc1710"
      },
      "id": "df8885c094fc1710",
      "type": "add",
      "date": 1342299623556
    },
    {
      "type": "edit",
      "id": "df8885c094fc1710",
      "item": {
        "type": "paragraph",
        "id": "df8885c094fc1710",
        "text": "The Method plugin keeps a running tally of calculations expressed as a series of lines. "
      },
      "date": 1342299755963
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "c5af6f487a7b9907",
        "text": "The first few characters determine how a line of a method is interpreted."
      },
      "after": "df8885c094fc1710",
      "id": "c5af6f487a7b9907",
      "date": 1342299808946
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "bbcc1f9548618bb4",
        "text": "A line starting with <b>digits</b> defines a value and contributes that value to the contribution."
      },
      "after": "c5af6f487a7b9907",
      "id": "bbcc1f9548618bb4",
      "date": 1342299813219
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "aec640909082f3b3",
        "text": "A line starting with <b>words</b> retrieves that value from nearby datasets and contributes it to the computation."
      },
      "after": "bbcc1f9548618bb4",
      "id": "aec640909082f3b3",
      "date": 1342299816951
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "f982813c60a78119",
        "text": "A line starting with <b>all-caps</b> calls out a computation to be applied to previous contributions."
      },
      "after": "aec640909082f3b3",
      "id": "f982813c60a78119",
      "date": 1342299820710
    },
    {
      "item": {
        "type": "factory",
        "id": "69084bb462636274"
      },
      "id": "69084bb462636274",
      "type": "add",
      "after": "f982813c60a78119",
      "date": 1342299854521
    },
    {
      "type": "edit",
      "id": "69084bb462636274",
      "item": {
        "type": "paragraph",
        "id": "69084bb462636274",
        "text": "<h3>Functions"
      },
      "date": 1342299862952
    },
    {
      "item": {
        "type": "paragraph",
        "id": "c503148a4552be44",
        "text": ""
      },
      "id": "c503148a4552be44",
      "type": "add",
      "after": "69084bb462636274",
      "date": 1342299863458
    },
    {
      "type": "remove",
      "id": "c503148a4552be44",
      "date": 1342299872239
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "f3532c800d9b42ba",
        "text": "All computations are defined in the <i>apply</i> function inside the method plugin. This limits the things you can say to compute."
      },
      "after": "69084bb462636274",
      "id": "f3532c800d9b42ba",
      "date": 1342299877382
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "0c61adb097e329f2",
        "text": "Say <b>SUM</b> to sum the previous contributions."
      },
      "after": "f3532c800d9b42ba",
      "id": "0c61adb097e329f2",
      "date": 1342299880545
    },
    {
      "type": "add",
      "item": {
        "type": "paragraph",
        "id": "5072042a5e1ddf59",
        "text": "Say <b>AVG</b> to average the previous contributions."
      },
      "after": "0c61adb097e329f2",
      "id": "5072042a5e1ddf59",
      "date": 1342299884412
    },
    {
      "item": {
        "type": "paragraph",
        "id": "c6c02f7fae9f4f03",
        "text": ""
      },
      "id": "c6c02f7fae9f4f03",
      "type": "add",
      "after": "df8885c094fc1710",
      "date": 1342299906950
    },
    {
      "type": "edit",
      "id": "c6c02f7fae9f4f03",
      "item": {
        "type": "paragraph",
        "id": "c6c02f7fae9f4f03",
        "text": "<h3>Lines"
      },
      "date": 1342299938286
    },
    {
      "type": "add",
      "item": {
        "type": "method",
        "id": "682d22af9d46f3a5",
        "text": "2\n3\nSUM"
      },
      "after": "df8885c094fc1710",
      "id": "682d22af9d46f3a5",
      "date": 1342300170634
    },
    {
      "type": "edit",
      "id": "69084bb462636274",
      "item": {
        "type": "paragraph",
        "id": "69084bb462636274",
        "text": "<h3>Computations"
      },
      "date": 1342300258893
    },
    {
      "item": {
        "type": "paragraph",
        "id": "9b5e3d7a7cc65329",
        "text": ""
      },
      "id": "9b5e3d7a7cc65329",
      "type": "add",
      "after": "f982813c60a78119",
      "date": 1342300265324
    },
    {
      "type": "edit",
      "id": "9b5e3d7a7cc65329",
      "item": {
        "type": "paragraph",
        "id": "9b5e3d7a7cc65329",
        "text": "Defined values and computation results are available to subsequent methods by the name that follow on the remainder of the line."
      },
      "date": 1342300385888
    },
    {
      "type": "edit",
      "id": "9b5e3d7a7cc65329",
      "item": {
        "type": "paragraph",
        "id": "9b5e3d7a7cc65329",
        "text": "Defined values and computation results are available to subsequent methods by the name that follows on the remainder of the line."
      },
      "date": 1342300466198
    },
    {
      "item": {
        "type": "factory",
        "id": "cd9bdca1991d8090"
      },
      "id": "cd9bdca1991d8090",
      "type": "add",
      "after": "5072042a5e1ddf59",
      "date": 1342300499728
    },
    {
      "type": "edit",
      "id": "cd9bdca1991d8090",
      "item": {
        "type": "paragraph",
        "id": "cd9bdca1991d8090",
        "text": "<h3>Examples"
      },
      "date": 1342300511686
    },
    {
      "item": {
        "type": "paragraph",
        "id": "08ff531bbe482a54",
        "text": ""
      },
      "id": "08ff531bbe482a54",
      "type": "add",
      "after": "cd9bdca1991d8090",
      "date": 1342300512190
    },
    {
      "type": "remove",
      "id": "08ff531bbe482a54",
      "date": 1342300531227
    },
    {
      "type": "edit",
      "id": "cd9bdca1991d8090",
      "item": {
        "type": "paragraph",
        "id": "cd9bdca1991d8090",
        "text": "See [[Bottles of Beer Methods]] for examples."
      },
      "date": 1342300620922
    },
    {
      "type": "move",
      "order": [
        "df8885c094fc1710",
        "682d22af9d46f3a5",
        "cd9bdca1991d8090",
        "c6c02f7fae9f4f03",
        "c5af6f487a7b9907",
        "bbcc1f9548618bb4",
        "aec640909082f3b3",
        "f982813c60a78119",
        "9b5e3d7a7cc65329",
        "69084bb462636274",
        "f3532c800d9b42ba",
        "0c61adb097e329f2",
        "5072042a5e1ddf59"
      ],
      "id": "cd9bdca1991d8090",
      "date": 1342300642257
    },
    {
      "type": "edit",
      "id": "cd9bdca1991d8090",
      "item": {
        "type": "paragraph",
        "id": "cd9bdca1991d8090",
        "text": "See [[Bottles of Beer Methods]] for examples, see [https://github.com/WardCunningham/Smallest-Federated-Wiki/tree/master/client/plugins/method GitHub] for plugin source."
      },
      "date": 1342305418293
    },
    {
      "type": "edit",
      "id": "cd9bdca1991d8090",
      "item": {
        "type": "paragraph",
        "id": "cd9bdca1991d8090",
        "text": "See [[Bottles of Beer Methods]] for examples, [https://github.com/WardCunningham/Smallest-Federated-Wiki/tree/master/client/plugins/method GitHub] for plugin source."
      },
      "date": 1342305486675
    },
    {
      "type": "edit",
      "id": "cd9bdca1991d8090",
      "item": {
        "type": "paragraph",
        "id": "cd9bdca1991d8090",
        "text": "See [[Bottles of Beer Methods]] for examples."
      },
      "date": 1342305558939
    },
    {
      "item": {
        "type": "paragraph",
        "id": "942ad9155083e706",
        "text": " [https://github.com/WardCunningham/Smallest-Federated-Wiki/tree/master/client/plugins/method GitHub] for plugin source."
      },
      "id": "942ad9155083e706",
      "type": "add",
      "after": "cd9bdca1991d8090",
      "date": 1342305559445
    },
    {
      "type": "edit",
      "id": "942ad9155083e706",
      "item": {
        "type": "paragraph",
        "id": "942ad9155083e706",
        "text": "See [https://github.com/WardCunningham/Smallest-Federated-Wiki/tree/master/client/plugins/method GitHub] for plugin source."
      },
      "date": 1342305561842
    },
    {
      "item": {
        "type": "paragraph",
        "id": "760060c9bbaee23f",
        "text": ""
      },
      "id": "760060c9bbaee23f",
      "type": "add",
      "after": "5072042a5e1ddf59",
      "date": 1344191930217
    },
    {
      "type": "edit",
      "id": "760060c9bbaee23f",
      "item": {
        "type": "paragraph",
        "id": "760060c9bbaee23f",
        "text": "Say <b>MIN</b> or <b>MAX</b> to find extremes of the previous contributions."
      },
      "date": 1344191979175
    },
    {
      "type": "edit",
      "id": "760060c9bbaee23f",
      "item": {
        "type": "paragraph",
        "id": "760060c9bbaee23f",
        "text": "Say <b>MIN</b> or <b>MAX</b> to find extremes."
      },
      "date": 1344191997087
    },
    {
      "type": "edit",
      "id": "682d22af9d46f3a5",
      "item": {
        "type": "method",
        "id": "682d22af9d46f3a5",
        "text": "12\n3\nSUM"
      },
      "date": 1350073787249
    },
    {
      "item": {
        "type": "paragraph",
        "id": "641952825d9a9aae",
        "text": ""
      },
      "id": "641952825d9a9aae",
      "type": "add",
      "after": "0c61adb097e329f2",
      "date": 1350337439956
    },
    {
      "type": "edit",
      "id": "641952825d9a9aae",
      "item": {
        "type": "paragraph",
        "id": "641952825d9a9aae",
        "text": "Say <b>PRODUCT</b> to multiply the previous contributions."
      },
      "date": 1350337471490
    },
    {
      "type": "edit",
      "id": "5072042a5e1ddf59",
      "item": {
        "type": "paragraph",
        "id": "5072042a5e1ddf59",
        "text": "Say <b>AVERAGE</b> to average the previous contributions."
      },
      "date": 1350337485985
    },
    {
      "type": "edit",
      "id": "760060c9bbaee23f",
      "item": {
        "type": "paragraph",
        "id": "760060c9bbaee23f",
        "text": "Say <b>MINIUM</b> or <b>MAXIUM</b> to find extremes."
      },
      "date": 1350337504065
    },
    {
      "item": {
        "type": "paragraph",
        "id": "38d211f128c7e310",
        "text": ""
      },
      "id": "38d211f128c7e310",
      "type": "add",
      "after": "760060c9bbaee23f",
      "date": 1350337532025
    },
    {
      "type": "edit",
      "id": "38d211f128c7e310",
      "item": {
        "type": "paragraph",
        "id": "38d211f128c7e310",
        "text": "Say AVG, MIN or MAX as an acceptable abbreviation."
      },
      "date": 1350337592822
    },
    {
      "item": {
        "type": "paragraph",
        "id": "bb9c2304a9526427",
        "text": ""
      },
      "id": "bb9c2304a9526427",
      "type": "add",
      "after": "38d211f128c7e310",
      "date": 1350337611046
    },
    {
      "type": "edit",
      "id": "bb9c2304a9526427",
      "item": {
        "type": "paragraph",
        "id": "bb9c2304a9526427",
        "text": "Additional computations may be added as needed by a specific site. See the source code for examples."
      },
      "date": 1350337682020
    },
    {
      "type": "edit",
      "id": "682d22af9d46f3a5",
      "item": {
        "type": "method",
        "id": "682d22af9d46f3a5",
        "text": "2\n3\nSUM"
      },
      "date": 1350337943597
    },
    {
      "type": "add",
      "item": {
        "type": "code",
        "id": "d17103da4b9a4d55",
        "text": "apply = (name, list, label) ->\n  switch name\n    when 'SUM' then sum list\n    when 'AVG', 'AVERAGE' then avg list\n    when 'MIN', 'MINIMUM' then _.min list\n    when 'MAX', 'MAXIMUM' then _.max list\n    when 'FIRST' then list[0]\n    when 'PRODUCT' then _.reduce list, (p,n)->p*=n\n    when 'LOOKUP' then lookup list\n    when 'POLYNOMIAL' then polynomial list[0], label\n    else throw new Error \"don't know how to #{name}\""
      },
      "after": "bb9c2304a9526427",
      "id": "d17103da4b9a4d55",
      "date": 1350338381303
    },
    {
      "type": "edit",
      "id": "bb9c2304a9526427",
      "item": {
        "type": "paragraph",
        "id": "bb9c2304a9526427",
        "text": "Additional computations may be added as needed by a specific site. See the source code above. The function <i>apply</i> recognizes computations by name and performs the appropriate computation."
      },
      "date": 1350338593882
    },
    {
      "type": "edit",
      "id": "bb9c2304a9526427",
      "item": {
        "type": "paragraph",
        "id": "bb9c2304a9526427",
        "text": "Additional computations may be added as needed by a specific site. See the source code above."
      },
      "date": 1350426326153
    },
    {
      "item": {
        "type": "paragraph",
        "id": "c723cceb207630d0",
        "text": "The function <i>apply</i> recognizes computations by name and performs the appropriate computation."
      },
      "id": "c723cceb207630d0",
      "type": "add",
      "after": "bb9c2304a9526427",
      "date": 1350426326660
    },
    {
      "type": "edit",
      "id": "c723cceb207630d0",
      "item": {
        "type": "paragraph",
        "id": "c723cceb207630d0",
        "text": "The plugin's <i>apply</i> function recognizes computations by name and performs the appropriate computation."
      },
      "date": 1350426422717
    },
    {
      "item": {
        "type": "paragraph",
        "id": "56356deed9dd765e",
        "text": ""
      },
      "id": "56356deed9dd765e",
      "type": "add",
      "after": "38d211f128c7e310",
      "date": 1350426445884
    },
    {
      "type": "edit",
      "id": "56356deed9dd765e",
      "item": {
        "type": "paragraph",
        "id": "56356deed9dd765e",
        "text": "<h3> Programming"
      },
      "date": 1350426577448
    },
    {
      "type": "edit",
      "id": "bb9c2304a9526427",
      "item": {
        "type": "paragraph",
        "id": "bb9c2304a9526427",
        "text": "Additional computations may be added as needed by programmers for use on a specific site. See the source code above."
      },
      "date": 1350426622751
    },
    {
      "type": "edit",
      "id": "bb9c2304a9526427",
      "item": {
        "type": "paragraph",
        "id": "bb9c2304a9526427",
        "text": "Additional computations may be added as needed by programmers for use on a specific site."
      },
      "date": 1350426636293
    }
  ]
}