monoid-average

An implementation of the average monoid

Monoid Average

Fantasy Land Compliant!

An implementation of the average monoid in javascript

var Average = require("monoid-average");
 
var list = [
    new Average(52),
    new Average(72),
    new Average(42),
    new Average(63),
    new Average(65),
    new Average(93)
];
 
var result = list.reduce(function(ab) { return a.concat(b); });
 
console.log(result.value());
//prints 64.5