[HN Gopher] Simple Statistics: Statistical methods in JavaScript...
___________________________________________________________________
Simple Statistics: Statistical methods in JavaScript for browsers
and servers
Author : favourable
Score : 68 points
Date : 2023-06-24 14:49 UTC (8 hours ago)
(HTM) web link (simple-statistics.github.io)
(TXT) w3m dump (simple-statistics.github.io)
| montroser wrote:
| This project is nice enough, but I wonder what is the point of
| some of the simpler functions.
|
| The maxSorted function for example is as trivial as it gets:
| https://github.com/simple-statistics/simple-statistics/blob/...
| It would be actually simpler for everyone without the
| abstraction.
| melling wrote:
| I reimplemented part of this, from the Python version, in Swift a
| couple years ago.
|
| https://github.com/melling/SimpleStatistics
| Tade0 wrote:
| I applaud the effort, but I would suggest a different code style
| if the aim is to make it as friendly and simple as possible.
|
| Specifically, comments every other line quickly add up and take
| up valuable space. Some, like the one above `sumOfSquares` are,
| in my opinion, unnecessary. It's obvious from the variable name
| and that `for` loop what's going on there.
|
| My experience is that the best way to make equations legible is
| to use their matrix form - matrices are easy to explain to anyone
| who can add and multiply.
|
| I'm currently in a project that's built around a few calculations
| and we settled on matrices because it's a language that every
| team member, from the project owners to developers, understands.
| codazoda wrote:
| I'm going to disagree. Even code that makes sense when read is
| easier to read in human language reading through comments.
| Especially if you're looking for an area of code you're not
| very familiar with.
|
| Comments are basically free in most languages. Use them.
| ComputerGuru wrote:
| Matrices explain what a function does "literally" (it's
| basically a mathematical equivalent to the function itself) but
| not the why. Comments are probably still needed.
| bvan wrote:
| Sometimes, this is all you need. I like it.
___________________________________________________________________
(page generated 2023-06-24 23:00 UTC)