- Many ideas around how the language should work are up in the air.
- Many bugs exist in the implementation.
Statistics library for jth.
Note that by convention, functions that operate on the stack (by taking and returning an array) are suffixed with "$".
Dependencies: node/npm
Install with command:
npm install jth-stats
Returns the number of items in the current stack.
import { count$ } from "jth-stats";
1 2 3 count$!! @!!; /*prints "3"*/
import { randomize$ } from "jth-stats";
1 2 3 randomize$!! @!!; /*prints "1 2 3" or "3 1 2" or... it's random*/
Sorts stack ascending
import { sort$ } from "jth-stats";
2 1 3 sort$!! @!!; /*prints "1 2 3"*/
Sorts stack descending
import { sortD$ } from "jth-stats";
2 1 3 sortD$!! @!!; /*prints "3 2 1"*/
Returns sum of numbers on stack
import { sum$ } from "jth-stats";
1 2 3 4 sum$!! @!!; /*prints "10"*/
Returns product of numbers on stack
import { product$ } from "jth-stats";
1 2 3 4 product$!! @!!; /*prints "24"*/
Returns mean of numbers on stack
import { mean$ } from "jth-stats";
1 2 3 4 mean$!! @!!; /*prints "2.5"*/
Returns median of numbers on stack
import { median$ } from "jth-stats";
1 2 3 4 5 median$!! @!!; /*prints "3"*/
### mode$
Returns mode of numbers on stack
```javascript
import { mode$ } from "jth-stats";
1 1 2 3 4 mode$!! @!!; /*prints "1"*/
Returns all modes on stack
import { modes$ } from "jth-stats";
1 1 2 2 3 4 modes$!! @!!; /*prints "1 2"*/