<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey everyone,<br class=""><br class="">I would like to implement a few statistics functions in Swift (e.g. variance, standardDeviation, etc) that are computed over a collection.<br class=""><br class="">I am aware of this library:<br class=""><br class=""><a href="https://github.com/evgenyneu/SigmaSwiftStatistics" class="">https://github.com/evgenyneu/SigmaSwiftStatistics</a><br class=""><br class="">My problem is that it only supports Doubles and Arrays. Also the API doesn’t look very ‘swifty' to me.<br class=""><br class="">I am wondering how would someone implement such functionality in a more generic way: to allow usage of multiple collections (even custom, e.g. a RingBuffer) and multiple value types (e.g. Decimal, Double). Extra points for being 'swifty'.<br class=""><br class="">Thanks in advance for any ideas.<br class=""><br class="">-g.</body></html>